polotno-node 2.15.11 → 2.15.12
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-Bk-DJEZM.js +444 -0
- package/dist/assets/{index-9Tuh7mWU.js → index-DJgsd6rb.js} +1 -1
- package/dist/assets/{index.es-6USixNFT.js → index.es-CRhp6G1d.js} +1 -1
- package/dist/assets/{jspdf.es.min-CvVM72Fp.js → jspdf.es.min-C-wxpZSs.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +6 -6
- 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:{}},Ht={};var Vb;function V6(){if(Vb)return Ht;Vb=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 w(L,q,W){this.props=L,this.context=q,this.refs=b,this.updater=W||y}w.prototype.isReactComponent={},w.prototype.setState=function(L,q){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,q,"setState")},w.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function k(){}k.prototype=w.prototype;function S(L,q,W){this.props=L,this.context=q,this.refs=b,this.updater=W||y}var P=S.prototype=new k;P.constructor=S,v(P,w.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,q,W){var J,te={},K=null,ne=null;if(q!=null)for(J in q.ref!==void 0&&(ne=q.ref),q.key!==void 0&&(K=""+q.key),q)E.call(q,J)&&!T.hasOwnProperty(J)&&(te[J]=q[J]);var fe=arguments.length-2;if(fe===1)te.children=W;else if(1<fe){for(var oe=Array(fe),ue=0;ue<fe;ue++)oe[ue]=arguments[ue+2];te.children=oe}if(L&&L.defaultProps)for(J in fe=L.defaultProps,fe)te[J]===void 0&&(te[J]=fe[J]);return{$$typeof:t,type:L,key:K,ref:ne,props:te,_owner:A.current}}function M(L,q){return{$$typeof:t,type:L.type,key:q,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 q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(W){return q[W]})}var F=/\/+/g;function H(L,q){return typeof L=="object"&&L!==null&&L.key!=null?N(""+L.key):q.toString(36)}function $(L,q,W,J,te){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,te=te(ne),L=J===""?"."+H(ne,0):J,_(te)?(W="",L!=null&&(W=L.replace(F,"$&/")+"/"),$(te,q,W,"",function(ue){return ue})):te!=null&&(R(te)&&(te=M(te,W+(!te.key||ne&&ne.key===te.key?"":(""+te.key).replace(F,"$&/")+"/")+L)),q.push(te)),1;if(ne=0,J=J===""?".":J+":",_(L))for(var fe=0;fe<L.length;fe++){K=L[fe];var oe=J+H(K,fe);ne+=$(K,q,W,oe,te)}else if(oe=h(L),typeof oe=="function")for(L=oe.call(L),fe=0;!(K=L.next()).done;)K=K.value,oe=J+H(K,fe++),ne+=$(K,q,W,oe,te);else if(K==="object")throw q=String(L),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return ne}function X(L,q,W){if(L==null)return L;var J=[],te=0;return $(L,J,"","",function(K){return q.call(W,K,te++)}),J}function Z(L){if(L._status===-1){var q=L._result;q=q(),q.then(function(W){(L._status===0||L._status===-1)&&(L._status=1,L._result=W)},function(W){(L._status===0||L._status===-1)&&(L._status=2,L._result=W)}),L._status===-1&&(L._status=0,L._result=q)}if(L._status===1)return L._result.default;throw L._result}var ee={current:null},V={transition:null},Q={ReactCurrentDispatcher:ee,ReactCurrentBatchConfig:V,ReactCurrentOwner:A};function U(){throw Error("act(...) is not supported in production builds of React.")}return Ht.Children={map:X,forEach:function(L,q,W){X(L,function(){q.apply(this,arguments)},W)},count:function(L){var q=0;return X(L,function(){q++}),q},toArray:function(L){return X(L,function(q){return q})||[]},only:function(L){if(!R(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},Ht.Component=w,Ht.Fragment=r,Ht.Profiler=i,Ht.PureComponent=S,Ht.StrictMode=n,Ht.Suspense=u,Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,Ht.act=U,Ht.cloneElement=function(L,q,W){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var J=v({},L.props),te=L.key,K=L.ref,ne=L._owner;if(q!=null){if(q.ref!==void 0&&(K=q.ref,ne=A.current),q.key!==void 0&&(te=""+q.key),L.type&&L.type.defaultProps)var fe=L.type.defaultProps;for(oe in q)E.call(q,oe)&&!T.hasOwnProperty(oe)&&(J[oe]=q[oe]===void 0&&fe!==void 0?fe[oe]:q[oe])}var oe=arguments.length-2;if(oe===1)J.children=W;else if(1<oe){fe=Array(oe);for(var ue=0;ue<oe;ue++)fe[ue]=arguments[ue+2];J.children=fe}return{$$typeof:t,type:L.type,key:te,ref:K,props:J,_owner:ne}},Ht.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},Ht.createElement=I,Ht.createFactory=function(L){var q=I.bind(null,L);return q.type=L,q},Ht.createRef=function(){return{current:null}},Ht.forwardRef=function(L){return{$$typeof:s,render:L}},Ht.isValidElement=R,Ht.lazy=function(L){return{$$typeof:f,_payload:{_status:-1,_result:L},_init:Z}},Ht.memo=function(L,q){return{$$typeof:d,type:L,compare:q===void 0?null:q}},Ht.startTransition=function(L){var q=V.transition;V.transition={};try{L()}finally{V.transition=q}},Ht.unstable_act=U,Ht.useCallback=function(L,q){return ee.current.useCallback(L,q)},Ht.useContext=function(L){return ee.current.useContext(L)},Ht.useDebugValue=function(){},Ht.useDeferredValue=function(L){return ee.current.useDeferredValue(L)},Ht.useEffect=function(L,q){return ee.current.useEffect(L,q)},Ht.useId=function(){return ee.current.useId()},Ht.useImperativeHandle=function(L,q,W){return ee.current.useImperativeHandle(L,q,W)},Ht.useInsertionEffect=function(L,q){return ee.current.useInsertionEffect(L,q)},Ht.useLayoutEffect=function(L,q){return ee.current.useLayoutEffect(L,q)},Ht.useMemo=function(L,q){return ee.current.useMemo(L,q)},Ht.useReducer=function(L,q,W){return ee.current.useReducer(L,q,W)},Ht.useRef=function(L){return ee.current.useRef(L)},Ht.useState=function(L){return ee.current.useState(L)},Ht.useSyncExternalStore=function(L,q,W){return ee.current.useSyncExternalStore(L,q,W)},Ht.useTransition=function(){return ee.current.useTransition()},Ht.version="18.3.1",Ht}var qb;function Mp(){return qb||(qb=1,m1.exports=V6()),m1.exports}var qr=Mp();const G=Oc(qr);var Km={},g1={exports:{}},Ni={},y1={exports:{}},v1={};var Wb;function q6(){return Wb||(Wb=1,(function(t){function e(V,Q){var U=V.length;V.push(Q);e:for(;0<U;){var L=U-1>>>1,q=V[L];if(0<i(q,Q))V[L]=Q,V[U]=q,U=L;else break e}}function r(V){return V.length===0?null:V[0]}function n(V){if(V.length===0)return null;var Q=V[0],U=V.pop();if(U!==Q){V[0]=U;e:for(var L=0,q=V.length,W=q>>>1;L<W;){var J=2*(L+1)-1,te=V[J],K=J+1,ne=V[K];if(0>i(te,U))K<q&&0>i(ne,te)?(V[L]=ne,V[K]=U,L=K):(V[L]=te,V[J]=U,L=J);else if(K<q&&0>i(ne,U))V[L]=ne,V[K]=U,L=K;else break e}}return Q}function i(V,Q){var U=V.sortIndex-Q.sortIndex;return U!==0?U:V.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,w=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(V){for(var Q=r(d);Q!==null;){if(Q.callback===null)n(d);else if(Q.startTime<=V)n(d),Q.sortIndex=Q.expirationTime,e(u,Q);else break;Q=r(d)}}function _(V){if(b=!1,P(V),!v)if(r(u)!==null)v=!0,Z(E);else{var Q=r(d);Q!==null&&ee(_,Q.startTime-V)}}function E(V,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)||V&&!N());){var L=p.callback;if(typeof L=="function"){p.callback=null,h=p.priorityLevel;var q=L(p.expirationTime<=Q);Q=t.unstable_now(),typeof q=="function"?p.callback=q:p===r(u)&&n(u),P(Q)}else n(u);p=r(u)}if(p!==null)var W=!0;else{var J=r(d);J!==null&&ee(_,J.startTime-Q),W=!1}return W}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 F(){if(T!==null){var V=t.unstable_now();R=V;var Q=!0;try{Q=T(!0,V)}finally{Q?H():(A=!1,T=null)}}else A=!1}var H;if(typeof S=="function")H=function(){S(F)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,X=$.port2;$.port1.onmessage=F,H=function(){X.postMessage(null)}}else H=function(){w(F,0)};function Z(V){T=V,A||(A=!0,H())}function ee(V,Q){I=w(function(){V(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(V){V.callback=null},t.unstable_continueExecution=function(){v||y||(v=!0,Z(E))},t.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<V?Math.floor(1e3/V):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return r(u)},t.unstable_next=function(V){switch(h){case 1:case 2:case 3:var Q=3;break;default:Q=h}var U=h;h=Q;try{return V()}finally{h=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(V,Q){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var U=h;h=V;try{return Q()}finally{h=U}},t.unstable_scheduleCallback=function(V,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,V){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=U+q,V={id:f++,callback:Q,priorityLevel:V,startTime:U,expirationTime:q,sortIndex:-1},U>L?(V.sortIndex=U,e(d,V),r(u)===null&&V===r(d)&&(b?(k(I),I=-1):b=!0,ee(_,U-L))):(V.sortIndex=q,e(u,V),v||y||(v=!0,Z(E))),V},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(V){var Q=h;return function(){var U=h;h=Q;try{return V.apply(this,arguments)}finally{h=U}}}})(v1)),v1}var Gb;function p2(){return Gb||(Gb=1,y1.exports=q6()),y1.exports}var Xb;function W6(){if(Xb)return Ni;Xb=1;var t=Mp(),e=p2();function r(l){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+l,x=1;x<arguments.length;x++)c+="&args[]="+encodeURIComponent(arguments[x]);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,x,O){if(x!==null&&x.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return O?!1:x!==null?!x.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,c,x,O){if(c===null||typeof c>"u"||y(l,c,x,O))return!0;if(O)return!1;if(x!==null)switch(x.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,x,O,B,j,re){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=O,this.attributeNamespace=B,this.mustUseProperty=x,this.propertyName=l,this.type=c,this.sanitizeURL=j,this.removeEmptyString=re}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[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];w[c]=new b(c,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new b(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[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){w[l]=new b(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new b(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new b(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new b(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[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);w[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);w[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);w[c]=new b(c,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!0,!0)});function P(l,c,x,O){var B=w.hasOwnProperty(c)?w[c]:null;(B!==null?B.type!==0:O||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,x,B,O)&&(x=null),O||B===null?h(c)&&(x===null?l.removeAttribute(c):l.setAttribute(c,""+x)):B.mustUseProperty?l[B.propertyName]=x===null?B.type===3?!1:"":x:(c=B.attributeName,O=B.attributeNamespace,x===null?l.removeAttribute(c):(B=B.type,x=B===3||B===4&&x===!0?"":""+x,O?l.setAttributeNS(O,c,x):l.setAttribute(c,x))))}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"),F=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),ee=Symbol.for("react.offscreen"),V=Symbol.iterator;function Q(l){return l===null||typeof l!="object"?null:(l=V&&l[V]||l["@@iterator"],typeof l=="function"?l:null)}var U=Object.assign,L;function q(l){if(L===void 0)try{throw Error()}catch(x){var c=x.stack.trim().match(/\n( *(at )?)/);L=c&&c[1]||""}return`
|
|
2
|
+
`+L+l}var W=!1;function J(l,c){if(!l||W)return"";W=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(De){var O=De}Reflect.construct(l,[],c)}else{try{c.call()}catch(De){O=De}l.call(c.prototype)}else{try{throw Error()}catch(De){O=De}l()}}catch(De){if(De&&O&&typeof De.stack=="string"){for(var B=De.stack.split(`
|
|
3
|
+
`),j=O.stack.split(`
|
|
4
|
+
`),re=B.length-1,ce=j.length-1;1<=re&&0<=ce&&B[re]!==j[ce];)ce--;for(;1<=re&&0<=ce;re--,ce--)if(B[re]!==j[ce]){if(re!==1||ce!==1)do if(re--,ce--,0>ce||B[re]!==j[ce]){var ve=`
|
|
5
|
+
`+B[re].replace(" at new "," at ");return l.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",l.displayName)),ve}while(1<=re&&0<=ce);break}}}finally{W=!1,Error.prepareStackTrace=x}return(l=l?l.displayName||l.name:"")?q(l):""}function te(l){switch(l.tag){case 5:return q(l.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return l=J(l.type,!1),l;case 11:return l=J(l.type.render,!1),l;case 1:return l=J(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 F:var c=l.render;return l=l.displayName,l||(l=c.displayName||c.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case X:return c=l.displayName||null,c!==null?c: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 fe(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function oe(l){var c=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function ue(l){var c=oe(l)?"checked":"value",x=Object.getOwnPropertyDescriptor(l.constructor.prototype,c),O=""+l[c];if(!l.hasOwnProperty(c)&&typeof x<"u"&&typeof x.get=="function"&&typeof x.set=="function"){var B=x.get,j=x.set;return Object.defineProperty(l,c,{configurable:!0,get:function(){return B.call(this)},set:function(re){O=""+re,j.call(this,re)}}),Object.defineProperty(l,c,{enumerable:x.enumerable}),{getValue:function(){return O},setValue:function(re){O=""+re},stopTracking:function(){l._valueTracker=null,delete l[c]}}}}function we(l){l._valueTracker||(l._valueTracker=ue(l))}function Re(l){if(!l)return!1;var c=l._valueTracker;if(!c)return!0;var x=c.getValue(),O="";return l&&(O=oe(l)?l.checked?"true":"false":l.value),l=O,l!==x?(c.setValue(l),!0):!1}function Ne(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 He(l,c){var x=c.checked;return U({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:x??l._wrapperState.initialChecked})}function $e(l,c){var x=c.defaultValue==null?"":c.defaultValue,O=c.checked!=null?c.checked:c.defaultChecked;x=fe(c.value!=null?c.value:x),l._wrapperState={initialChecked:O,initialValue:x,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function et(l,c){c=c.checked,c!=null&&P(l,"checked",c,!1)}function xe(l,c){et(l,c);var x=fe(c.value),O=c.type;if(x!=null)O==="number"?(x===0&&l.value===""||l.value!=x)&&(l.value=""+x):l.value!==""+x&&(l.value=""+x);else if(O==="submit"||O==="reset"){l.removeAttribute("value");return}c.hasOwnProperty("value")?se(l,c.type,x):c.hasOwnProperty("defaultValue")&&se(l,c.type,fe(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(l.defaultChecked=!!c.defaultChecked)}function he(l,c,x){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,x||c===l.value||(l.value=c),l.defaultValue=c}x=l.name,x!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,x!==""&&(l.name=x)}function se(l,c,x){(c!=="number"||Ne(l.ownerDocument)!==l)&&(x==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+x&&(l.defaultValue=""+x))}var ge=Array.isArray;function Ce(l,c,x,O){if(l=l.options,c){c={};for(var B=0;B<x.length;B++)c["$"+x[B]]=!0;for(x=0;x<l.length;x++)B=c.hasOwnProperty("$"+l[x].value),l[x].selected!==B&&(l[x].selected=B),B&&O&&(l[x].defaultSelected=!0)}else{for(x=""+fe(x),c=null,B=0;B<l.length;B++){if(l[B].value===x){l[B].selected=!0,O&&(l[B].defaultSelected=!0);return}c!==null||l[B].disabled||(c=l[B])}c!==null&&(c.selected=!0)}}function ae(l,c){if(c.dangerouslySetInnerHTML!=null)throw Error(r(91));return U({},c,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function _e(l,c){var x=c.value;if(x==null){if(x=c.children,c=c.defaultValue,x!=null){if(c!=null)throw Error(r(92));if(ge(x)){if(1<x.length)throw Error(r(93));x=x[0]}c=x}c==null&&(c=""),x=c}l._wrapperState={initialValue:fe(x)}}function Oe(l,c){var x=fe(c.value),O=fe(c.defaultValue);x!=null&&(x=""+x,x!==l.value&&(l.value=x),c.defaultValue==null&&l.defaultValue!==x&&(l.defaultValue=x)),O!=null&&(l.defaultValue=""+O)}function Fe(l){var c=l.textContent;c===l._wrapperState.initialValue&&c!==""&&c!==null&&(l.value=c)}function ot(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 ke(l,c){return l==null||l==="http://www.w3.org/1999/xhtml"?ot(c):l==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var me,Ue=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,x,O,B){MSApp.execUnsafeLocalFunction(function(){return l(c,x,O,B)})}:l})(function(l,c){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=c;else{for(me=me||document.createElement("div"),me.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=me.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;c.firstChild;)l.appendChild(c.firstChild)}});function be(l,c){if(c){var x=l.firstChild;if(x&&x===l.lastChild&&x.nodeType===3){x.nodeValue=c;return}}l.textContent=c}var je={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},at=["Webkit","ms","Moz","O"];Object.keys(je).forEach(function(l){at.forEach(function(c){c=c+l.charAt(0).toUpperCase()+l.substring(1),je[c]=je[l]})});function Et(l,c,x){return c==null||typeof c=="boolean"||c===""?"":x||typeof c!="number"||c===0||je.hasOwnProperty(l)&&je[l]?(""+c).trim():c+"px"}function bt(l,c){l=l.style;for(var x in c)if(c.hasOwnProperty(x)){var O=x.indexOf("--")===0,B=Et(x,c[x],O);x==="float"&&(x="cssFloat"),O?l.setProperty(x,B):l[x]=B}}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 le(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 ye(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 it=null;function pt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var yt=null,ft=null,Nt=null;function Nr(l){if(l=Vu(l)){if(typeof yt!="function")throw Error(r(280));var c=l.stateNode;c&&(c=hn(c),yt(l.stateNode,l.type,c))}}function Gt(l){ft?Nt?Nt.push(l):Nt=[l]:ft=l}function fr(){if(ft){var l=ft,c=Nt;if(Nt=ft=null,Nr(l),c)for(l=0;l<c.length;l++)Nr(c[l])}}function ir(l,c){return l(c)}function er(){}var ar=!1;function En(l,c,x){if(ar)return l(c,x);ar=!0;try{return ir(l,c,x)}finally{ar=!1,(ft!==null||Nt!==null)&&(er(),fr())}}function Hr(l,c){var x=l.stateNode;if(x===null)return null;var O=hn(x);if(O===null)return null;x=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(x&&typeof x!="function")throw Error(r(231,c,typeof x));return x}var Tn=!1;if(s)try{var Xr={};Object.defineProperty(Xr,"passive",{get:function(){Tn=!0}}),window.addEventListener("test",Xr,Xr),window.removeEventListener("test",Xr,Xr)}catch{Tn=!1}function Pi(l,c,x,O,B,j,re,ce,ve){var De=Array.prototype.slice.call(arguments,3);try{c.apply(x,De)}catch(qe){this.onError(qe)}}var Jr=!1,Vi=null,Bn=!1,Ei=null,al={onError:function(l){Jr=!0,Vi=l}};function Ba(l,c,x,O,B,j,re,ce,ve){Jr=!1,Vi=null,Pi.apply(al,arguments)}function ol(l,c,x,O,B,j,re,ce,ve){if(Ba.apply(this,arguments),Jr){if(Jr){var De=Vi;Jr=!1,Vi=null}else throw Error(r(198));Bn||(Bn=!0,Ei=De)}}function Cn(l){var c=l,x=l;if(l.alternate)for(;c.return;)c=c.return;else{l=c;do c=l,(c.flags&4098)!==0&&(x=c.return),l=c.return;while(l)}return c.tag===3?x:null}function ho(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 po(l){if(Cn(l)!==l)throw Error(r(188))}function Jo(l){var c=l.alternate;if(!c){if(c=Cn(l),c===null)throw Error(r(188));return c!==l?null:l}for(var x=l,O=c;;){var B=x.return;if(B===null)break;var j=B.alternate;if(j===null){if(O=B.return,O!==null){x=O;continue}break}if(B.child===j.child){for(j=B.child;j;){if(j===x)return po(B),l;if(j===O)return po(B),c;j=j.sibling}throw Error(r(188))}if(x.return!==O.return)x=B,O=j;else{for(var re=!1,ce=B.child;ce;){if(ce===x){re=!0,x=B,O=j;break}if(ce===O){re=!0,O=B,x=j;break}ce=ce.sibling}if(!re){for(ce=j.child;ce;){if(ce===x){re=!0,x=j,O=B;break}if(ce===O){re=!0,O=j,x=B;break}ce=ce.sibling}if(!re)throw Error(r(189))}}if(x.alternate!==O)throw Error(r(190))}if(x.tag!==3)throw Error(r(188));return x.stateNode.current===x?l:c}function ui(l){return l=Jo(l),l!==null?fa(l):null}function fa(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var c=fa(l);if(c!==null)return c;l=l.sibling}return null}var es=e.unstable_scheduleCallback,ts=e.unstable_cancelCallback,da=e.unstable_shouldYield,jc=e.unstable_requestPaint,Er=e.unstable_now,Tu=e.unstable_getCurrentPriorityLevel,rs=e.unstable_ImmediatePriority,Uc=e.unstable_UserBlockingPriority,sl=e.unstable_NormalPriority,F0=e.unstable_LowPriority,Hc=e.unstable_IdlePriority,za=null,gn=null;function wr(l){if(gn&&typeof gn.onCommitFiberRoot=="function")try{gn.onCommitFiberRoot(za,l,void 0,(l.current.flags&128)===128)}catch{}}var jt=Math.clz32?Math.clz32:Zn,mo=Math.log,On=Math.LN2;function Zn(l){return l>>>=0,l===0?32:31-(mo(l)/On|0)|0}var ha=64,ja=4194304;function cn(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 ns(l,c){var x=l.pendingLanes;if(x===0)return 0;var O=0,B=l.suspendedLanes,j=l.pingedLanes,re=x&268435455;if(re!==0){var ce=re&~B;ce!==0?O=cn(ce):(j&=re,j!==0&&(O=cn(j)))}else re=x&~B,re!==0?O=cn(re):j!==0&&(O=cn(j));if(O===0)return 0;if(c!==0&&c!==O&&(c&B)===0&&(B=O&-O,j=c&-c,B>=j||B===16&&(j&4194240)!==0))return c;if((O&4)!==0&&(O|=x&16),c=l.entangledLanes,c!==0)for(l=l.entanglements,c&=O;0<c;)x=31-jt(c),B=1<<x,O|=l[x],c&=~B;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 x=l.suspendedLanes,O=l.pingedLanes,B=l.expirationTimes,j=l.pendingLanes;0<j;){var re=31-jt(j),ce=1<<re,ve=B[re];ve===-1?((ce&x)===0||(ce&O)!==0)&&(B[re]=Xp(ce,c)):ve<=c&&(l.expiredLanes|=ce),j&=~ce}}function ll(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Fd(){var l=ha;return ha<<=1,(ha&4194240)===0&&(ha=64),l}function ci(l){for(var c=[],x=0;31>x;x++)c.push(l);return c}function Cu(l,c,x){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-jt(c),l[c]=x}function B0(l,c){var x=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<x;){var B=31-jt(x),j=1<<B;c[B]=0,O[B]=-1,l[B]=-1,x&=~j}}function Bd(l,c){var x=l.entangledLanes|=c;for(l=l.entanglements;x;){var O=31-jt(x),B=1<<O;B&c|l[O]&c&&(l[O]|=c),x&=~B}}var Qt=0;function Ou(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var ul,cl,Kp,Qp,$c,Vc=!1,fl=[],Ti=null,go=null,pa=null,Ut=new Map,dl=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":Ti=null;break;case"dragenter":case"dragleave":go=null;break;case"mouseover":case"mouseout":pa=null;break;case"pointerover":case"pointerout":Ut.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":dl.delete(c.pointerId)}}function Au(l,c,x,O,B,j){return l===null||l.nativeEvent!==j?(l={blockedOn:c,domEventName:x,eventSystemFlags:O,nativeEvent:j,targetContainers:[B]},c!==null&&(c=Vu(c),c!==null&&cl(c)),l):(l.eventSystemFlags|=O,c=l.targetContainers,B!==null&&c.indexOf(B)===-1&&c.push(B),l)}function fn(l,c,x,O,B){switch(c){case"focusin":return Ti=Au(Ti,l,c,x,O,B),!0;case"dragenter":return go=Au(go,l,c,x,O,B),!0;case"mouseover":return pa=Au(pa,l,c,x,O,B),!0;case"pointerover":var j=B.pointerId;return Ut.set(j,Au(Ut.get(j)||null,l,c,x,O,B)),!0;case"gotpointercapture":return j=B.pointerId,dl.set(j,Au(dl.get(j)||null,l,c,x,O,B)),!0}return!1}function qc(l){var c=Eo(l.target);if(c!==null){var x=Cn(c);if(x!==null){if(c=x.tag,c===13){if(c=ho(x),c!==null){l.blockedOn=c,$c(l.priority,function(){Kp(x)});return}}else if(c===3&&x.stateNode.current.memoizedState.isDehydrated){l.blockedOn=x.tag===3?x.stateNode.containerInfo:null;return}}}l.blockedOn=null}function Wc(l){if(l.blockedOn!==null)return!1;for(var c=l.targetContainers;0<c.length;){var x=Yc(l.domEventName,l.eventSystemFlags,c[0],l.nativeEvent);if(x===null){x=l.nativeEvent;var O=new x.constructor(x.type,x);it=O,x.target.dispatchEvent(O),it=null}else return c=Vu(x),c!==null&&cl(c),l.blockedOn=x,!1;c.shift()}return!0}function Gc(l,c,x){Wc(l)&&x.delete(c)}function z0(){Vc=!1,Ti!==null&&Wc(Ti)&&(Ti=null),go!==null&&Wc(go)&&(go=null),pa!==null&&Wc(pa)&&(pa=null),Ut.forEach(Gc),dl.forEach(Gc)}function yo(l,c){l.blockedOn===c&&(l.blockedOn=null,Vc||(Vc=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,z0)))}function Jn(l){function c(B){return yo(B,l)}if(0<fl.length){yo(fl[0],l);for(var x=1;x<fl.length;x++){var O=fl[x];O.blockedOn===l&&(O.blockedOn=null)}}for(Ti!==null&&yo(Ti,l),go!==null&&yo(go,l),pa!==null&&yo(pa,l),Ut.forEach(c),dl.forEach(c),x=0;x<ma.length;x++)O=ma[x],O.blockedOn===l&&(O.blockedOn=null);for(;0<ma.length&&(x=ma[0],x.blockedOn===null);)qc(x),x.blockedOn===null&&ma.shift()}var hl=_.ReactCurrentBatchConfig,Xc=!0;function qi(l,c,x,O){var B=Qt,j=hl.transition;hl.transition=null;try{Qt=1,pl(l,c,x,O)}finally{Qt=B,hl.transition=j}}function Ua(l,c,x,O){var B=Qt,j=hl.transition;hl.transition=null;try{Qt=4,pl(l,c,x,O)}finally{Qt=B,hl.transition=j}}function pl(l,c,x,O){if(Xc){var B=Yc(l,c,x,O);if(B===null)df(l,c,O,ml,x),Jp(l,O);else if(fn(B,l,c,x,O))O.stopPropagation();else if(Jp(l,O),c&4&&-1<Zp.indexOf(l)){for(;B!==null;){var j=Vu(B);if(j!==null&&ul(j),j=Yc(l,c,x,O),j===null&&df(l,c,O,ml,x),j===B)break;B=j}B!==null&&O.stopPropagation()}else df(l,c,O,null,x)}}var ml=null;function Yc(l,c,x,O){if(ml=null,l=pt(O),l=Eo(l),l!==null)if(c=Cn(l),c===null)l=null;else if(x=c.tag,x===13){if(l=ho(c),l!==null)return l;l=null}else if(x===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;l=null}else c!==l&&(l=null);return ml=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(Tu()){case rs:return 1;case Uc:return 4;case sl:case F0:return 16;case Hc:return 536870912;default:return 16}default:return 16}}var yn=null,vo=null,Ha=null;function Iu(){if(Ha)return Ha;var l,c=vo,x=c.length,O,B="value"in yn?yn.value:yn.textContent,j=B.length;for(l=0;l<x&&c[l]===B[l];l++);var re=x-l;for(O=1;O<=re&&c[x-O]===B[j-O];O++);return Ha=B.slice(l,1<O?1-O:void 0)}function is(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 fi(){return!1}function en(l){function c(x,O,B,j,re){this._reactName=x,this._targetInst=B,this.type=O,this.nativeEvent=j,this.target=re,this.currentTarget=null;for(var ce in l)l.hasOwnProperty(ce)&&(x=l[ce],this[ce]=x?x(j):j[ce]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?zn:fi,this.isPropagationStopped=fi,this}return U(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var x=this.nativeEvent;x&&(x.preventDefault?x.preventDefault():typeof x.returnValue!="unknown"&&(x.returnValue=!1),this.isDefaultPrevented=zn)},stopPropagation:function(){var x=this.nativeEvent;x&&(x.stopPropagation?x.stopPropagation():typeof x.cancelBubble!="unknown"&&(x.cancelBubble=!0),this.isPropagationStopped=zn)},persist:function(){},isPersistent:zn}),c}var ei={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wi=en(ei),Gi=U({},ei,{view:0,detail:0}),tm=en(Gi),Ru,Mu,vn,jn=U({},Gi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:os,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!==vn&&(vn&&l.type==="mousemove"?(Ru=l.screenX-vn.screenX,Mu=l.screenY-vn.screenY):Mu=Ru=0,vn=l),Ru)},movementY:function(l){return"movementY"in l?l.movementY:Mu}}),xr=en(jn),Du=U({},jn,{dataTransfer:0}),Xi=en(Du),rm=U({},Gi,{relatedTarget:0}),Kc=en(rm),zd=U({},ei,{animationName:0,elapsedTime:0,pseudoElement:0}),jd=en(zd),nm=U({},ei,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),Qc=en(nm),im=U({},ei,{data:0}),as=en(im),Ud={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"},Zc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function U0(l){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(l):(l=Zc[l])?!!c[l]:!1}function os(){return U0}var Jc=U({},Gi,{key:function(l){if(l.key){var c=Ud[l.key]||l.key;if(c!=="Unidentified")return c}return l.type==="keypress"?(l=is(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:os,charCode:function(l){return l.type==="keypress"?is(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?is(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),am=en(Jc),om=U({},jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ss=en(om),sm=U({},Gi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:os}),ef=en(sm),tf=U({},ei,{propertyName:0,elapsedTime:0,pseudoElement:0}),gl=en(tf),Hd=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}),$d=en(Hd),lm=[9,13,27,32],Nu=s&&"CompositionEvent"in window,ls=null;s&&"documentMode"in document&&(ls=document.documentMode);var yl=s&&"TextEvent"in window&&!ls,di=s&&(!Nu||ls&&8<ls&&11>=ls),bo=" ",rf=!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 Yi(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var hi=!1;function qd(l,c){switch(l){case"compositionend":return Yi(c);case"keypress":return c.which!==32?null:(rf=!0,bo);case"textInput":return l=c.data,l===bo&&rf?null:l;default:return null}}function um(l,c){if(hi)return l==="compositionend"||!Nu&&Vd(l,c)?(l=Iu(),Ha=vo=yn=null,hi=!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 di&&c.locale!=="ko"?null:c.data;default:return null}}var $a={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"?!!$a[l.type]:c==="textarea"}function Lu(l,c,x,O){Gt(O),c=hf(c,"onChange"),0<c.length&&(x=new Wi("onChange","change",null,x,O),l.push({event:x,listeners:c}))}var vl=null,wo=null;function cm(l){rh(l,0)}function xo(l){var c=rn(l);if(Re(c))return l}function Ci(l,c){if(l==="change")return c}var bl=!1;if(s){var So;if(s){var Oi="oninput"in document;if(!Oi){var nf=document.createElement("div");nf.setAttribute("oninput","return;"),Oi=typeof nf.oninput=="function"}So=Oi}else So=!1;bl=So&&(!document.documentMode||9<document.documentMode)}function us(){vl&&(vl.detachEvent("onpropertychange",Wd),wo=vl=null)}function Wd(l){if(l.propertyName==="value"&&xo(wo)){var c=[];Lu(c,wo,l,pt(l)),En(cm,c)}}function Gd(l,c,x){l==="focusin"?(us(),vl=c,wo=x,vl.attachEvent("onpropertychange",Wd)):l==="focusout"&&us()}function Lr(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return xo(wo)}function af(l,c){if(l==="click")return xo(c)}function Xd(l,c){if(l==="input"||l==="change")return xo(c)}function Yd(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var ti=typeof Object.is=="function"?Object.is:Yd;function cs(l,c){if(ti(l,c))return!0;if(typeof l!="object"||l===null||typeof c!="object"||c===null)return!1;var x=Object.keys(l),O=Object.keys(c);if(x.length!==O.length)return!1;for(O=0;O<x.length;O++){var B=x[O];if(!u.call(c,B)||!ti(l[B],c[B]))return!1}return!0}function ko(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Tr(l,c){var x=ko(l);l=0;for(var O;x;){if(x.nodeType===3){if(O=l+x.textContent.length,l<=c&&O>=c)return{node:x,offset:c-l};l=O}e:{for(;x;){if(x.nextSibling){x=x.nextSibling;break e}x=x.parentNode}x=void 0}x=ko(x)}}function Yr(l,c){return l&&c?l===c?!0:l&&l.nodeType===3?!1:c&&c.nodeType===3?Yr(l,c.parentNode):"contains"in l?l.contains(c):l.compareDocumentPosition?!!(l.compareDocumentPosition(c)&16):!1:!1}function tn(){for(var l=window,c=Ne();c instanceof l.HTMLIFrameElement;){try{var x=typeof c.contentWindow.location.href=="string"}catch{x=!1}if(x)l=c.contentWindow;else break;c=Ne(l.document)}return c}function wl(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=tn(),x=l.focusedElem,O=l.selectionRange;if(c!==x&&x&&x.ownerDocument&&Yr(x.ownerDocument.documentElement,x)){if(O!==null&&wl(x)){if(c=O.start,l=O.end,l===void 0&&(l=c),"selectionStart"in x)x.selectionStart=c,x.selectionEnd=Math.min(l,x.value.length);else if(l=(c=x.ownerDocument||document)&&c.defaultView||window,l.getSelection){l=l.getSelection();var B=x.textContent.length,j=Math.min(O.start,B);O=O.end===void 0?j:Math.min(O.end,B),!l.extend&&j>O&&(B=O,O=j,j=B),B=Tr(x,j);var re=Tr(x,O);B&&re&&(l.rangeCount!==1||l.anchorNode!==B.node||l.anchorOffset!==B.offset||l.focusNode!==re.node||l.focusOffset!==re.offset)&&(c=c.createRange(),c.setStart(B.node,B.offset),l.removeAllRanges(),j>O?(l.addRange(c),l.extend(re.node,re.offset)):(c.setEnd(re.node,re.offset),l.addRange(c)))}}for(c=[],l=x;l=l.parentNode;)l.nodeType===1&&c.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<c.length;x++)l=c[x],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var Bu=s&&"documentMode"in document&&11>=document.documentMode,xl=null,dn=null,fs=null,zu=!1;function of(l,c,x){var O=x.window===x?x.document:x.nodeType===9?x:x.ownerDocument;zu||xl==null||xl!==Ne(O)||(O=xl,"selectionStart"in O&&wl(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}),fs&&cs(fs,O)||(fs=O,O=hf(dn,"onSelect"),0<O.length&&(c=new Wi("onSelect","select",null,c,x),l.push({event:c,listeners:O}),c.target=xl)))}function pi(l,c){var x={};return x[l.toLowerCase()]=c.toLowerCase(),x["Webkit"+l]="webkit"+c,x["Moz"+l]="moz"+c,x}var bn={animationend:pi("Animation","AnimationEnd"),animationiteration:pi("Animation","AnimationIteration"),animationstart:pi("Animation","AnimationStart"),transitionend:pi("Transition","TransitionEnd")},ds={},sf={};s&&(sf=document.createElement("div").style,"AnimationEvent"in window||(delete bn.animationend.animation,delete bn.animationiteration.animation,delete bn.animationstart.animation),"TransitionEvent"in window||delete bn.transitionend.transition);function Sl(l){if(ds[l])return ds[l];if(!bn[l])return l;var c=bn[l],x;for(x in c)if(c.hasOwnProperty(x)&&x in sf)return ds[l]=c[x];return l}var Kd=Sl("animationend"),Qd=Sl("animationiteration"),Zd=Sl("animationstart"),Jd=Sl("transitionend"),eh=new Map,th="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 qa(l,c){eh.set(l,c),a(c,[l])}for(var lf=0;lf<th.length;lf++){var hs=th[lf],fm=hs.toLowerCase(),uf=hs[0].toUpperCase()+hs.slice(1);qa(fm,"on"+uf)}qa(Kd,"onAnimationEnd"),qa(Qd,"onAnimationIteration"),qa(Zd,"onAnimationStart"),qa("dblclick","onDoubleClick"),qa("focusin","onFocus"),qa("focusout","onBlur"),qa(Jd,"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 _o="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(_o));function cf(l,c,x){var O=l.type||"unknown-event";l.currentTarget=x,ol(O,c,void 0,l),l.currentTarget=null}function rh(l,c){c=(c&4)!==0;for(var x=0;x<l.length;x++){var O=l[x],B=O.event;O=O.listeners;e:{var j=void 0;if(c)for(var re=O.length-1;0<=re;re--){var ce=O[re],ve=ce.instance,De=ce.currentTarget;if(ce=ce.listener,ve!==j&&B.isPropagationStopped())break e;cf(B,ce,De),j=ve}else for(re=0;re<O.length;re++){if(ce=O[re],ve=ce.instance,De=ce.currentTarget,ce=ce.listener,ve!==j&&B.isPropagationStopped())break e;cf(B,ce,De),j=ve}}}if(Bn)throw l=Ei,Bn=!1,Ei=null,l}function gr(l,c){var x=c[mf];x===void 0&&(x=c[mf]=new Set);var O=l+"__bubble";x.has(O)||(nh(c,l,2,!1),x.add(O))}function ff(l,c,x){var O=0;c&&(O|=4),nh(x,l,O,c)}var ju="_reactListening"+Math.random().toString(36).slice(2);function ps(l){if(!l[ju]){l[ju]=!0,n.forEach(function(x){x!=="selectionchange"&&(dm.has(x)||ff(x,!1,l),ff(x,!0,l))});var c=l.nodeType===9?l:l.ownerDocument;c===null||c[ju]||(c[ju]=!0,ff("selectionchange",!1,c))}}function nh(l,c,x,O){switch(em(c)){case 1:var B=qi;break;case 4:B=Ua;break;default:B=pl}x=B.bind(null,c,x,l),B=void 0,!Tn||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(B=!0),O?B!==void 0?l.addEventListener(c,x,{capture:!0,passive:B}):l.addEventListener(c,x,!0):B!==void 0?l.addEventListener(c,x,{passive:B}):l.addEventListener(c,x,!1)}function df(l,c,x,O,B){var j=O;if((c&1)===0&&(c&2)===0&&O!==null)e:for(;;){if(O===null)return;var re=O.tag;if(re===3||re===4){var ce=O.stateNode.containerInfo;if(ce===B||ce.nodeType===8&&ce.parentNode===B)break;if(re===4)for(re=O.return;re!==null;){var ve=re.tag;if((ve===3||ve===4)&&(ve=re.stateNode.containerInfo,ve===B||ve.nodeType===8&&ve.parentNode===B))return;re=re.return}for(;ce!==null;){if(re=Eo(ce),re===null)return;if(ve=re.tag,ve===5||ve===6){O=j=re;continue e}ce=ce.parentNode}}O=O.return}En(function(){var De=j,qe=pt(x),Ge=[];e:{var Ve=eh.get(l);if(Ve!==void 0){var dt=Wi,gt=l;switch(l){case"keypress":if(is(x)===0)break e;case"keydown":case"keyup":dt=am;break;case"focusin":gt="focus",dt=Kc;break;case"focusout":gt="blur",dt=Kc;break;case"beforeblur":case"afterblur":dt=Kc;break;case"click":if(x.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":dt=xr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":dt=Xi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":dt=ef;break;case Kd:case Qd:case Zd:dt=jd;break;case Jd:dt=gl;break;case"scroll":dt=tm;break;case"wheel":dt=$d;break;case"copy":case"cut":case"paste":dt=Qc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":dt=ss}var vt=(c&4)!==0,sn=!vt&&l==="scroll",Ae=vt?Ve!==null?Ve+"Capture":null:Ve;vt=[];for(var Se=De,Ie;Se!==null;){Ie=Se;var Ye=Ie.stateNode;if(Ie.tag===5&&Ye!==null&&(Ie=Ye,Ae!==null&&(Ye=Hr(Se,Ae),Ye!=null&&vt.push(kl(Se,Ye,Ie)))),sn)break;Se=Se.return}0<vt.length&&(Ve=new dt(Ve,gt,null,x,qe),Ge.push({event:Ve,listeners:vt}))}}if((c&7)===0){e:{if(Ve=l==="mouseover"||l==="pointerover",dt=l==="mouseout"||l==="pointerout",Ve&&x!==it&&(gt=x.relatedTarget||x.fromElement)&&(Eo(gt)||gt[ya]))break e;if((dt||Ve)&&(Ve=qe.window===qe?qe:(Ve=qe.ownerDocument)?Ve.defaultView||Ve.parentWindow:window,dt?(gt=x.relatedTarget||x.toElement,dt=De,gt=gt?Eo(gt):null,gt!==null&&(sn=Cn(gt),gt!==sn||gt.tag!==5&>.tag!==6)&&(gt=null)):(dt=null,gt=De),dt!==gt)){if(vt=xr,Ye="onMouseLeave",Ae="onMouseEnter",Se="mouse",(l==="pointerout"||l==="pointerover")&&(vt=ss,Ye="onPointerLeave",Ae="onPointerEnter",Se="pointer"),sn=dt==null?Ve:rn(dt),Ie=gt==null?Ve:rn(gt),Ve=new vt(Ye,Se+"leave",dt,x,qe),Ve.target=sn,Ve.relatedTarget=Ie,Ye=null,Eo(qe)===De&&(vt=new vt(Ae,Se+"enter",gt,x,qe),vt.target=Ie,vt.relatedTarget=sn,Ye=vt),sn=Ye,dt&>)t:{for(vt=dt,Ae=gt,Se=0,Ie=vt;Ie;Ie=ms(Ie))Se++;for(Ie=0,Ye=Ae;Ye;Ye=ms(Ye))Ie++;for(;0<Se-Ie;)vt=ms(vt),Se--;for(;0<Ie-Se;)Ae=ms(Ae),Ie--;for(;Se--;){if(vt===Ae||Ae!==null&&vt===Ae.alternate)break t;vt=ms(vt),Ae=ms(Ae)}vt=null}else vt=null;dt!==null&&hm(Ge,Ve,dt,vt,!1),gt!==null&&sn!==null&&hm(Ge,sn,gt,vt,!0)}}e:{if(Ve=De?rn(De):window,dt=Ve.nodeName&&Ve.nodeName.toLowerCase(),dt==="select"||dt==="input"&&Ve.type==="file")var xt=Ci;else if(Va(Ve))if(bl)xt=Xd;else{xt=Lr;var Tt=Gd}else(dt=Ve.nodeName)&&dt.toLowerCase()==="input"&&(Ve.type==="checkbox"||Ve.type==="radio")&&(xt=af);if(xt&&(xt=xt(l,De))){Lu(Ge,xt,x,qe);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?rn(De):window,l){case"focusin":(Va(Tt)||Tt.contentEditable==="true")&&(xl=Tt,dn=De,fs=null);break;case"focusout":fs=dn=xl=null;break;case"mousedown":zu=!0;break;case"contextmenu":case"mouseup":case"dragend":zu=!1,of(Ge,x,qe);break;case"selectionchange":if(Bu)break;case"keydown":case"keyup":of(Ge,x,qe)}var Ct;if(Nu)e:{switch(l){case"compositionstart":var Rt="onCompositionStart";break e;case"compositionend":Rt="onCompositionEnd";break e;case"compositionupdate":Rt="onCompositionUpdate";break e}Rt=void 0}else hi?Vd(l,x)&&(Rt="onCompositionEnd"):l==="keydown"&&x.keyCode===229&&(Rt="onCompositionStart");Rt&&(di&&x.locale!=="ko"&&(hi||Rt!=="onCompositionStart"?Rt==="onCompositionEnd"&&hi&&(Ct=Iu()):(yn=qe,vo="value"in yn?yn.value:yn.textContent,hi=!0)),Tt=hf(De,Rt),0<Tt.length&&(Rt=new as(Rt,l,null,x,qe),Ge.push({event:Rt,listeners:Tt}),Ct?Rt.data=Ct:(Ct=Yi(x),Ct!==null&&(Rt.data=Ct)))),(Ct=yl?qd(l,x):um(l,x))&&(De=hf(De,"onBeforeInput"),0<De.length&&(qe=new as("onBeforeInput","beforeinput",null,x,qe),Ge.push({event:qe,listeners:De}),qe.data=Ct))}rh(Ge,c)})}function kl(l,c,x){return{instance:l,listener:c,currentTarget:x}}function hf(l,c){for(var x=c+"Capture",O=[];l!==null;){var B=l,j=B.stateNode;B.tag===5&&j!==null&&(B=j,j=Hr(l,x),j!=null&&O.unshift(kl(l,j,B)),j=Hr(l,c),j!=null&&O.push(kl(l,j,B))),l=l.return}return O}function ms(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function hm(l,c,x,O,B){for(var j=c._reactName,re=[];x!==null&&x!==O;){var ce=x,ve=ce.alternate,De=ce.stateNode;if(ve!==null&&ve===O)break;ce.tag===5&&De!==null&&(ce=De,B?(ve=Hr(x,j),ve!=null&&re.unshift(kl(x,ve,ce))):B||(ve=Hr(x,j),ve!=null&&re.push(kl(x,ve,ce)))),x=x.return}re.length!==0&&l.push({event:c,listeners:re})}var H0=/\r\n?/g,pm=/\u0000|\uFFFD/g;function ih(l){return(typeof l=="string"?l:""+l).replace(H0,`
|
|
6
|
+
`).replace(pm,"")}function Uu(l,c,x){if(c=ih(c),ih(l)!==c&&x)throw Error(r(425))}function gs(){}var ah=null,oh=null;function sh(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 mi=typeof setTimeout=="function"?setTimeout:void 0,lh=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)}:mi;function gm(l){setTimeout(function(){throw l})}function pf(l,c){var x=c,O=0;do{var B=x.nextSibling;if(l.removeChild(x),B&&B.nodeType===8)if(x=B.data,x==="/$"){if(O===0){l.removeChild(B),Jn(c);return}O--}else x!=="$"&&x!=="$?"&&x!=="$!"||O++;x=B}while(x);Jn(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 ys(l){l=l.previousSibling;for(var c=0;l;){if(l.nodeType===8){var x=l.data;if(x==="$"||x==="$!"||x==="$?"){if(c===0)return l;c--}else x==="/$"&&c++}l=l.previousSibling}return null}var Po=Math.random().toString(36).slice(2),Ai="__reactFiber$"+Po,$u="__reactProps$"+Po,ya="__reactContainer$"+Po,mf="__reactEvents$"+Po,ym="__reactListeners$"+Po,vm="__reactHandles$"+Po;function Eo(l){var c=l[Ai];if(c)return c;for(var x=l.parentNode;x;){if(c=x[ya]||x[Ai]){if(x=c.alternate,c.child!==null||x!==null&&x.child!==null)for(l=ys(l);l!==null;){if(x=l[Ai])return x;l=ys(l)}return c}l=x,x=l.parentNode}return null}function Vu(l){return l=l[Ai]||l[ya],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function rn(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(r(33))}function hn(l){return l[$u]||null}var gf=[],vs=-1;function Wa(l){return{current:l}}function yr(l){0>vs||(l.current=gf[vs],gf[vs]=null,vs--)}function pr(l,c){vs++,gf[vs]=l.current,l.current=c}var va={},wn=Wa(va),An=Wa(!1),To=va;function bs(l,c){var x=l.type.contextTypes;if(!x)return va;var O=l.stateNode;if(O&&O.__reactInternalMemoizedUnmaskedChildContext===c)return O.__reactInternalMemoizedMaskedChildContext;var B={},j;for(j in x)B[j]=c[j];return O&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=B),B}function In(l){return l=l.childContextTypes,l!=null}function _l(){yr(An),yr(wn)}function uh(l,c,x){if(wn.current!==va)throw Error(r(168));pr(wn,c),pr(An,x)}function yf(l,c,x){var O=l.stateNode;if(c=c.childContextTypes,typeof O.getChildContext!="function")return x;O=O.getChildContext();for(var B in O)if(!(B in c))throw Error(r(108,ne(l)||"Unknown",B));return U({},x,O)}function ws(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||va,To=wn.current,pr(wn,l),pr(An,An.current),!0}function bm(l,c,x){var O=l.stateNode;if(!O)throw Error(r(169));x?(l=yf(l,c,To),O.__reactInternalMemoizedMergedChildContext=l,yr(An),yr(wn),pr(wn,l)):yr(An),pr(An,x)}var ba=null,Pl=!1,vf=!1;function qu(l){ba===null?ba=[l]:ba.push(l)}function Ga(l){Pl=!0,qu(l)}function Co(){if(!vf&&ba!==null){vf=!0;var l=0,c=Qt;try{var x=ba;for(Qt=1;l<x.length;l++){var O=x[l];do O=O(!0);while(O!==null)}ba=null,Pl=!1}catch(B){throw ba!==null&&(ba=ba.slice(l+1)),es(rs,Co),B}finally{Qt=c,vf=!1}}return null}var Un=[],xs=0,Oo=null,Ao=0,Hn=[],$n=0,Io=null,gi=1,Cr="";function Ss(l,c){Un[xs++]=Ao,Un[xs++]=Oo,Oo=l,Ao=c}function wm(l,c,x){Hn[$n++]=gi,Hn[$n++]=Cr,Hn[$n++]=Io,Io=l;var O=gi;l=Cr;var B=32-jt(O)-1;O&=~(1<<B),x+=1;var j=32-jt(c)+B;if(30<j){var re=B-B%5;j=(O&(1<<re)-1).toString(32),O>>=re,B-=re,gi=1<<32-jt(c)+B|x<<B|O,Cr=j+l}else gi=1<<j|x<<B|O,Cr=l}function El(l){l.return!==null&&(Ss(l,1),wm(l,1,0))}function pn(l){for(;l===Oo;)Oo=Un[--xs],Un[xs]=null,Ao=Un[--xs],Un[xs]=null;for(;l===Io;)Io=Hn[--$n],Hn[$n]=null,Cr=Hn[--$n],Hn[$n]=null,gi=Hn[--$n],Hn[$n]=null}var yi=null,tt=null,or=!1,vi=null;function ch(l,c){var x=Ea(5,null,null,0);x.elementType="DELETED",x.stateNode=c,x.return=l,c=l.deletions,c===null?(l.deletions=[x],l.flags|=16):c.push(x)}function xm(l,c){switch(l.tag){case 5:var x=l.type;return c=c.nodeType!==1||x.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(l.stateNode=c,yi=l,tt=ga(c.firstChild),!0):!1;case 6:return c=l.pendingProps===""||c.nodeType!==3?null:c,c!==null?(l.stateNode=c,yi=l,tt=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(x=Io!==null?{id:gi,overflow:Cr}:null,l.memoizedState={dehydrated:c,treeContext:x,retryLane:1073741824},x=Ea(18,null,null,0),x.stateNode=c,x.return=l,l.child=x,yi=l,tt=null,!0):!1;default:return!1}}function ks(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Tl(l){if(or){var c=tt;if(c){var x=c;if(!xm(l,c)){if(ks(l))throw Error(r(418));c=ga(x.nextSibling);var O=yi;c&&xm(l,c)?ch(O,x):(l.flags=l.flags&-4097|2,or=!1,yi=l)}}else{if(ks(l))throw Error(r(418));l.flags=l.flags&-4097|2,or=!1,yi=l}}}function bf(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;yi=l}function Wu(l){if(l!==yi)return!1;if(!or)return bf(l),or=!0,!1;var c;if((c=l.tag!==3)&&!(c=l.tag!==5)&&(c=l.type,c=c!=="head"&&c!=="body"&&!sh(l.type,l.memoizedProps)),c&&(c=tt)){if(ks(l))throw fh(),Error(r(418));for(;c;)ch(l,c),c=ga(c.nextSibling)}if(bf(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 x=l.data;if(x==="/$"){if(c===0){tt=ga(l.nextSibling);break e}c--}else x!=="$"&&x!=="$!"&&x!=="$?"||c++}l=l.nextSibling}tt=null}}else tt=yi?ga(l.stateNode.nextSibling):null;return!0}function fh(){for(var l=tt;l;)l=ga(l.nextSibling)}function _s(){tt=yi=null,or=!1}function Gu(l){vi===null?vi=[l]:vi.push(l)}var dh=_.ReactCurrentBatchConfig;function $r(l,c,x){if(l=x.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(x._owner){if(x=x._owner,x){if(x.tag!==1)throw Error(r(309));var O=x.stateNode}if(!O)throw Error(r(147,l));var B=O,j=""+l;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===j?c.ref:(c=function(re){var ce=B.refs;re===null?delete ce[j]:ce[j]=re},c._stringRef=j,c)}if(typeof l!="string")throw Error(r(284));if(!x._owner)throw Error(r(290,l))}return l}function ri(l,c){throw l=Object.prototype.toString.call(c),Error(r(31,l==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":l))}function Ki(l){var c=l._init;return c(l._payload)}function wf(l){function c(Ae,Se){if(l){var Ie=Ae.deletions;Ie===null?(Ae.deletions=[Se],Ae.flags|=16):Ie.push(Se)}}function x(Ae,Se){if(!l)return null;for(;Se!==null;)c(Ae,Se),Se=Se.sibling;return null}function O(Ae,Se){for(Ae=new Map;Se!==null;)Se.key!==null?Ae.set(Se.key,Se):Ae.set(Se.index,Se),Se=Se.sibling;return Ae}function B(Ae,Se){return Ae=Gl(Ae,Se),Ae.index=0,Ae.sibling=null,Ae}function j(Ae,Se,Ie){return Ae.index=Ie,l?(Ie=Ae.alternate,Ie!==null?(Ie=Ie.index,Ie<Se?(Ae.flags|=2,Se):Ie):(Ae.flags|=2,Se)):(Ae.flags|=1048576,Se)}function re(Ae){return l&&Ae.alternate===null&&(Ae.flags|=2),Ae}function ce(Ae,Se,Ie,Ye){return Se===null||Se.tag!==6?(Se=u1(Ie,Ae.mode,Ye),Se.return=Ae,Se):(Se=B(Se,Ie),Se.return=Ae,Se)}function ve(Ae,Se,Ie,Ye){var xt=Ie.type;return xt===T?qe(Ae,Se,Ie.props.children,Ye,Ie.key):Se!==null&&(Se.elementType===xt||typeof xt=="object"&&xt!==null&&xt.$$typeof===Z&&Ki(xt)===Se.type)?(Ye=B(Se,Ie.props),Ye.ref=$r(Ae,Se,Ie),Ye.return=Ae,Ye):(Ye=Hm(Ie.type,Ie.key,Ie.props,null,Ae.mode,Ye),Ye.ref=$r(Ae,Se,Ie),Ye.return=Ae,Ye)}function De(Ae,Se,Ie,Ye){return Se===null||Se.tag!==4||Se.stateNode.containerInfo!==Ie.containerInfo||Se.stateNode.implementation!==Ie.implementation?(Se=c1(Ie,Ae.mode,Ye),Se.return=Ae,Se):(Se=B(Se,Ie.children||[]),Se.return=Ae,Se)}function qe(Ae,Se,Ie,Ye,xt){return Se===null||Se.tag!==7?(Se=ic(Ie,Ae.mode,Ye,xt),Se.return=Ae,Se):(Se=B(Se,Ie),Se.return=Ae,Se)}function Ge(Ae,Se,Ie){if(typeof Se=="string"&&Se!==""||typeof Se=="number")return Se=u1(""+Se,Ae.mode,Ie),Se.return=Ae,Se;if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case E:return Ie=Hm(Se.type,Se.key,Se.props,null,Ae.mode,Ie),Ie.ref=$r(Ae,null,Se),Ie.return=Ae,Ie;case A:return Se=c1(Se,Ae.mode,Ie),Se.return=Ae,Se;case Z:var Ye=Se._init;return Ge(Ae,Ye(Se._payload),Ie)}if(ge(Se)||Q(Se))return Se=ic(Se,Ae.mode,Ie,null),Se.return=Ae,Se;ri(Ae,Se)}return null}function Ve(Ae,Se,Ie,Ye){var xt=Se!==null?Se.key:null;if(typeof Ie=="string"&&Ie!==""||typeof Ie=="number")return xt!==null?null:ce(Ae,Se,""+Ie,Ye);if(typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case E:return Ie.key===xt?ve(Ae,Se,Ie,Ye):null;case A:return Ie.key===xt?De(Ae,Se,Ie,Ye):null;case Z:return xt=Ie._init,Ve(Ae,Se,xt(Ie._payload),Ye)}if(ge(Ie)||Q(Ie))return xt!==null?null:qe(Ae,Se,Ie,Ye,null);ri(Ae,Ie)}return null}function dt(Ae,Se,Ie,Ye,xt){if(typeof Ye=="string"&&Ye!==""||typeof Ye=="number")return Ae=Ae.get(Ie)||null,ce(Se,Ae,""+Ye,xt);if(typeof Ye=="object"&&Ye!==null){switch(Ye.$$typeof){case E:return Ae=Ae.get(Ye.key===null?Ie:Ye.key)||null,ve(Se,Ae,Ye,xt);case A:return Ae=Ae.get(Ye.key===null?Ie:Ye.key)||null,De(Se,Ae,Ye,xt);case Z:var Tt=Ye._init;return dt(Ae,Se,Ie,Tt(Ye._payload),xt)}if(ge(Ye)||Q(Ye))return Ae=Ae.get(Ie)||null,qe(Se,Ae,Ye,xt,null);ri(Se,Ye)}return null}function gt(Ae,Se,Ie,Ye){for(var xt=null,Tt=null,Ct=Se,Rt=Se=0,Fn=null;Ct!==null&&Rt<Ie.length;Rt++){Ct.index>Rt?(Fn=Ct,Ct=null):Fn=Ct.sibling;var tr=Ve(Ae,Ct,Ie[Rt],Ye);if(tr===null){Ct===null&&(Ct=Fn);break}l&&Ct&&tr.alternate===null&&c(Ae,Ct),Se=j(tr,Se,Rt),Tt===null?xt=tr:Tt.sibling=tr,Tt=tr,Ct=Fn}if(Rt===Ie.length)return x(Ae,Ct),or&&Ss(Ae,Rt),xt;if(Ct===null){for(;Rt<Ie.length;Rt++)Ct=Ge(Ae,Ie[Rt],Ye),Ct!==null&&(Se=j(Ct,Se,Rt),Tt===null?xt=Ct:Tt.sibling=Ct,Tt=Ct);return or&&Ss(Ae,Rt),xt}for(Ct=O(Ae,Ct);Rt<Ie.length;Rt++)Fn=dt(Ct,Ae,Rt,Ie[Rt],Ye),Fn!==null&&(l&&Fn.alternate!==null&&Ct.delete(Fn.key===null?Rt:Fn.key),Se=j(Fn,Se,Rt),Tt===null?xt=Fn:Tt.sibling=Fn,Tt=Fn);return l&&Ct.forEach(function(Xl){return c(Ae,Xl)}),or&&Ss(Ae,Rt),xt}function vt(Ae,Se,Ie,Ye){var xt=Q(Ie);if(typeof xt!="function")throw Error(r(150));if(Ie=xt.call(Ie),Ie==null)throw Error(r(151));for(var Tt=xt=null,Ct=Se,Rt=Se=0,Fn=null,tr=Ie.next();Ct!==null&&!tr.done;Rt++,tr=Ie.next()){Ct.index>Rt?(Fn=Ct,Ct=null):Fn=Ct.sibling;var Xl=Ve(Ae,Ct,tr.value,Ye);if(Xl===null){Ct===null&&(Ct=Fn);break}l&&Ct&&Xl.alternate===null&&c(Ae,Ct),Se=j(Xl,Se,Rt),Tt===null?xt=Xl:Tt.sibling=Xl,Tt=Xl,Ct=Fn}if(tr.done)return x(Ae,Ct),or&&Ss(Ae,Rt),xt;if(Ct===null){for(;!tr.done;Rt++,tr=Ie.next())tr=Ge(Ae,tr.value,Ye),tr!==null&&(Se=j(tr,Se,Rt),Tt===null?xt=tr:Tt.sibling=tr,Tt=tr);return or&&Ss(Ae,Rt),xt}for(Ct=O(Ae,Ct);!tr.done;Rt++,tr=Ie.next())tr=dt(Ct,Ae,Rt,tr.value,Ye),tr!==null&&(l&&tr.alternate!==null&&Ct.delete(tr.key===null?Rt:tr.key),Se=j(tr,Se,Rt),Tt===null?xt=tr:Tt.sibling=tr,Tt=tr);return l&&Ct.forEach(function(j6){return c(Ae,j6)}),or&&Ss(Ae,Rt),xt}function sn(Ae,Se,Ie,Ye){if(typeof Ie=="object"&&Ie!==null&&Ie.type===T&&Ie.key===null&&(Ie=Ie.props.children),typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case E:e:{for(var xt=Ie.key,Tt=Se;Tt!==null;){if(Tt.key===xt){if(xt=Ie.type,xt===T){if(Tt.tag===7){x(Ae,Tt.sibling),Se=B(Tt,Ie.props.children),Se.return=Ae,Ae=Se;break e}}else if(Tt.elementType===xt||typeof xt=="object"&&xt!==null&&xt.$$typeof===Z&&Ki(xt)===Tt.type){x(Ae,Tt.sibling),Se=B(Tt,Ie.props),Se.ref=$r(Ae,Tt,Ie),Se.return=Ae,Ae=Se;break e}x(Ae,Tt);break}else c(Ae,Tt);Tt=Tt.sibling}Ie.type===T?(Se=ic(Ie.props.children,Ae.mode,Ye,Ie.key),Se.return=Ae,Ae=Se):(Ye=Hm(Ie.type,Ie.key,Ie.props,null,Ae.mode,Ye),Ye.ref=$r(Ae,Se,Ie),Ye.return=Ae,Ae=Ye)}return re(Ae);case A:e:{for(Tt=Ie.key;Se!==null;){if(Se.key===Tt)if(Se.tag===4&&Se.stateNode.containerInfo===Ie.containerInfo&&Se.stateNode.implementation===Ie.implementation){x(Ae,Se.sibling),Se=B(Se,Ie.children||[]),Se.return=Ae,Ae=Se;break e}else{x(Ae,Se);break}else c(Ae,Se);Se=Se.sibling}Se=c1(Ie,Ae.mode,Ye),Se.return=Ae,Ae=Se}return re(Ae);case Z:return Tt=Ie._init,sn(Ae,Se,Tt(Ie._payload),Ye)}if(ge(Ie))return gt(Ae,Se,Ie,Ye);if(Q(Ie))return vt(Ae,Se,Ie,Ye);ri(Ae,Ie)}return typeof Ie=="string"&&Ie!==""||typeof Ie=="number"?(Ie=""+Ie,Se!==null&&Se.tag===6?(x(Ae,Se.sibling),Se=B(Se,Ie),Se.return=Ae,Ae=Se):(x(Ae,Se),Se=u1(Ie,Ae.mode,Ye),Se.return=Ae,Ae=Se),re(Ae)):x(Ae,Se)}return sn}var Ps=wf(!0),Ii=wf(!1),Xu=Wa(null),bi=null,Cl=null,xf=null;function Sf(){xf=Cl=bi=null}function kf(l){var c=Xu.current;yr(Xu),l._currentValue=c}function _f(l,c,x){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===x)break;l=l.return}}function Xa(l,c){bi=l,xf=Cl=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&c)!==0&&(Y=!0),l.firstContext=null)}function Vn(l){var c=l._currentValue;if(xf!==l)if(l={context:l,memoizedValue:c,next:null},Cl===null){if(bi===null)throw Error(r(308));Cl=l,bi.dependencies={lanes:0,firstContext:l}}else Cl=Cl.next=l;return c}var wa=null;function Ol(l){wa===null?wa=[l]:wa.push(l)}function Yu(l,c,x,O){var B=c.interleaved;return B===null?(x.next=x,Ol(c)):(x.next=B.next,B.next=x),c.interleaved=x,wi(l,O)}function wi(l,c){l.lanes|=c;var x=l.alternate;for(x!==null&&(x.lanes|=c),x=l,l=l.return;l!==null;)l.childLanes|=c,x=l.alternate,x!==null&&(x.childLanes|=c),x=l,l=l.return;return x.tag===3?x.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 Pf(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,x){var O=l.updateQueue;if(O===null)return null;if(O=O.shared,(Jt&2)!==0){var B=O.pending;return B===null?c.next=c:(c.next=B.next,B.next=c),O.pending=c,wi(l,x)}return B=O.interleaved,B===null?(c.next=c,Ol(O)):(c.next=B.next,B.next=c),O.interleaved=c,wi(l,x)}function Ef(l,c,x){if(c=c.updateQueue,c!==null&&(c=c.shared,(x&4194240)!==0)){var O=c.lanes;O&=l.pendingLanes,x|=O,c.lanes=x,Bd(l,x)}}function Qu(l,c){var x=l.updateQueue,O=l.alternate;if(O!==null&&(O=O.updateQueue,x===O)){var B=null,j=null;if(x=x.firstBaseUpdate,x!==null){do{var re={eventTime:x.eventTime,lane:x.lane,tag:x.tag,payload:x.payload,callback:x.callback,next:null};j===null?B=j=re:j=j.next=re,x=x.next}while(x!==null);j===null?B=j=c:j=j.next=c}else B=j=c;x={baseState:O.baseState,firstBaseUpdate:B,lastBaseUpdate:j,shared:O.shared,effects:O.effects},l.updateQueue=x;return}l=x.lastBaseUpdate,l===null?x.firstBaseUpdate=c:l.next=c,x.lastBaseUpdate=c}function Al(l,c,x,O){var B=l.updateQueue;xa=!1;var j=B.firstBaseUpdate,re=B.lastBaseUpdate,ce=B.shared.pending;if(ce!==null){B.shared.pending=null;var ve=ce,De=ve.next;ve.next=null,re===null?j=De:re.next=De,re=ve;var qe=l.alternate;qe!==null&&(qe=qe.updateQueue,ce=qe.lastBaseUpdate,ce!==re&&(ce===null?qe.firstBaseUpdate=De:ce.next=De,qe.lastBaseUpdate=ve))}if(j!==null){var Ge=B.baseState;re=0,qe=De=ve=null,ce=j;do{var Ve=ce.lane,dt=ce.eventTime;if((O&Ve)===Ve){qe!==null&&(qe=qe.next={eventTime:dt,lane:0,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null});e:{var gt=l,vt=ce;switch(Ve=c,dt=x,vt.tag){case 1:if(gt=vt.payload,typeof gt=="function"){Ge=gt.call(dt,Ge,Ve);break e}Ge=gt;break e;case 3:gt.flags=gt.flags&-65537|128;case 0:if(gt=vt.payload,Ve=typeof gt=="function"?gt.call(dt,Ge,Ve):gt,Ve==null)break e;Ge=U({},Ge,Ve);break e;case 2:xa=!0}}ce.callback!==null&&ce.lane!==0&&(l.flags|=64,Ve=B.effects,Ve===null?B.effects=[ce]:Ve.push(ce))}else dt={eventTime:dt,lane:Ve,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null},qe===null?(De=qe=dt,ve=Ge):qe=qe.next=dt,re|=Ve;if(ce=ce.next,ce===null){if(ce=B.shared.pending,ce===null)break;Ve=ce,ce=Ve.next,Ve.next=null,B.lastBaseUpdate=Ve,B.shared.pending=null}}while(!0);if(qe===null&&(ve=Ge),B.baseState=ve,B.firstBaseUpdate=De,B.lastBaseUpdate=qe,c=B.shared.interleaved,c!==null){B=c;do re|=B.lane,B=B.next;while(B!==c)}else j===null&&(B.shared.lanes=0);ec|=re,l.lanes=re,l.memoizedState=Ge}}function zr(l,c,x){if(l=c.effects,c.effects=null,l!==null)for(c=0;c<l.length;c++){var O=l[c],B=O.callback;if(B!==null){if(O.callback=null,O=x,typeof B!="function")throw Error(r(191,B));B.call(O)}}}var Lt={},mr=Wa(Lt),Or=Wa(Lt),Vr=Wa(Lt);function nn(l){if(l===Lt)throw Error(r(174));return l}function Ro(l,c){switch(pr(Vr,c),pr(Or,l),pr(mr,Lt),l=c.nodeType,l){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:ke(null,"");break;default:l=l===8?c.parentNode:c,c=l.namespaceURI||null,l=l.tagName,c=ke(c,l)}yr(mr),pr(mr,c)}function Ar(){yr(mr),yr(Or),yr(Vr)}function Il(l){nn(Vr.current);var c=nn(mr.current),x=ke(c,l.type);c!==x&&(pr(Or,l),pr(mr,x))}function Ya(l){Or.current===l&&(yr(mr),yr(Or))}var vr=Wa(0);function Rl(l){for(var c=l;c!==null;){if(c.tag===13){var x=c.memoizedState;if(x!==null&&(x=x.dehydrated,x===null||x.data==="$?"||x.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 Es=[];function Rn(){for(var l=0;l<Es.length;l++)Es[l]._workInProgressVersionPrimary=null;Es.length=0}var Ml=_.ReactCurrentDispatcher,Zu=_.ReactCurrentBatchConfig,qn=0,dr=null,jr=null,Kr=null,Qi=!1,Mo=!1,Ri=0,Tf=0;function Qr(){throw Error(r(321))}function Ju(l,c){if(c===null)return!1;for(var x=0;x<c.length&&x<l.length;x++)if(!ti(l[x],c[x]))return!1;return!0}function Dl(l,c,x,O,B,j){if(qn=j,dr=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Ml.current=l===null||l.memoizedState===null?V0:Lo,l=x(O,B),Mo){j=0;do{if(Mo=!1,Ri=0,25<=j)throw Error(r(301));j+=1,Kr=jr=null,c.updateQueue=null,Ml.current=Rf,l=x(O,B)}while(Mo)}if(Ml.current=Bl,c=jr!==null&&jr.next!==null,qn=0,Kr=jr=dr=null,Qi=!1,c)throw Error(r(300));return l}function Nl(){var l=Ri!==0;return Ri=0,l}function Sr(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kr===null?dr.memoizedState=Kr=l:Kr=Kr.next=l,Kr}function an(){if(jr===null){var l=dr.alternate;l=l!==null?l.memoizedState:null}else l=jr.next;var c=Kr===null?dr.memoizedState:Kr.next;if(c!==null)Kr=c,jr=l;else{if(l===null)throw Error(r(310));jr=l,l={memoizedState:jr.memoizedState,baseState:jr.baseState,baseQueue:jr.baseQueue,queue:jr.queue,next:null},Kr===null?dr.memoizedState=Kr=l:Kr=Kr.next=l}return Kr}function Mn(l,c){return typeof c=="function"?c(l):c}function Dn(l){var c=an(),x=c.queue;if(x===null)throw Error(r(311));x.lastRenderedReducer=l;var O=jr,B=O.baseQueue,j=x.pending;if(j!==null){if(B!==null){var re=B.next;B.next=j.next,j.next=re}O.baseQueue=B=j,x.pending=null}if(B!==null){j=B.next,O=O.baseState;var ce=re=null,ve=null,De=j;do{var qe=De.lane;if((qn&qe)===qe)ve!==null&&(ve=ve.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 Ge={lane:qe,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null};ve===null?(ce=ve=Ge,re=O):ve=ve.next=Ge,dr.lanes|=qe,ec|=qe}De=De.next}while(De!==null&&De!==j);ve===null?re=O:ve.next=ce,ti(O,c.memoizedState)||(Y=!0),c.memoizedState=O,c.baseState=re,c.baseQueue=ve,x.lastRenderedState=O}if(l=x.interleaved,l!==null){B=l;do j=B.lane,dr.lanes|=j,ec|=j,B=B.next;while(B!==l)}else B===null&&(x.lanes=0);return[c.memoizedState,x.dispatch]}function Cf(l){var c=an(),x=c.queue;if(x===null)throw Error(r(311));x.lastRenderedReducer=l;var O=x.dispatch,B=x.pending,j=c.memoizedState;if(B!==null){x.pending=null;var re=B=B.next;do j=l(j,re.action),re=re.next;while(re!==B);ti(j,c.memoizedState)||(Y=!0),c.memoizedState=j,c.baseQueue===null&&(c.baseState=j),x.lastRenderedState=j}return[j,O]}function Of(){}function Af(l,c){var x=dr,O=an(),B=c(),j=!ti(O.memoizedState,B);if(j&&(O.memoizedState=B,Y=!0),O=O.queue,gh(hh.bind(null,x,O,l),[l]),O.getSnapshot!==c||j||Kr!==null&&Kr.memoizedState.tag&1){if(x.flags|=2048,Ll(9,Ka.bind(null,x,O,B,c),void 0,null),Ln===null)throw Error(r(349));(qn&30)!==0||Sm(x,c,B)}return B}function Sm(l,c,x){l.flags|=16384,l={getSnapshot:c,value:x},c=dr.updateQueue,c===null?(c={lastEffect:null,stores:null},dr.updateQueue=c,c.stores=[l]):(x=c.stores,x===null?c.stores=[l]:x.push(l))}function Ka(l,c,x,O){c.value=x,c.getSnapshot=O,ph(c)&&If(l)}function hh(l,c,x){return x(function(){ph(c)&&If(l)})}function ph(l){var c=l.getSnapshot;l=l.value;try{var x=c();return!ti(l,x)}catch{return!0}}function If(l){var c=wi(l,1);c!==null&&eo(c,l,1,-1)}function Do(l){var c=Sr();return typeof l=="function"&&(l=l()),c.memoizedState=c.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:l},c.queue=l,l=l.dispatch=Cm.bind(null,dr,l),[c.memoizedState,l]}function Ll(l,c,x,O){return l={tag:l,create:c,destroy:x,deps:O,next:null},c=dr.updateQueue,c===null?(c={lastEffect:null,stores:null},dr.updateQueue=c,c.lastEffect=l.next=l):(x=c.lastEffect,x===null?c.lastEffect=l.next=l:(O=x.next,x.next=l,l.next=O,c.lastEffect=l)),l}function mh(){return an().memoizedState}function Fl(l,c,x,O){var B=Sr();dr.flags|=l,B.memoizedState=Ll(1|c,x,void 0,O===void 0?null:O)}function Ts(l,c,x,O){var B=an();O=O===void 0?null:O;var j=void 0;if(jr!==null){var re=jr.memoizedState;if(j=re.destroy,O!==null&&Ju(O,re.deps)){B.memoizedState=Ll(c,x,j,O);return}}dr.flags|=l,B.memoizedState=Ll(1|c,x,j,O)}function km(l,c){return Fl(8390656,8,l,c)}function gh(l,c){return Ts(2048,8,l,c)}function yh(l,c){return Ts(4,2,l,c)}function vh(l,c){return Ts(4,4,l,c)}function No(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,x){return x=x!=null?x.concat([l]):null,Ts(4,4,No.bind(null,c,l),x)}function Qa(){}function bh(l,c){var x=an();c=c===void 0?null:c;var O=x.memoizedState;return O!==null&&c!==null&&Ju(c,O[1])?O[0]:(x.memoizedState=[l,c],l)}function kr(l,c){var x=an();c=c===void 0?null:c;var O=x.memoizedState;return O!==null&&c!==null&&Ju(c,O[1])?O[0]:(l=l(),x.memoizedState=[l,c],l)}function Pm(l,c,x){return(qn&21)===0?(l.baseState&&(l.baseState=!1,Y=!0),l.memoizedState=x):(ti(x,c)||(x=Fd(),dr.lanes|=x,ec|=x,l.baseState=!0),c)}function Em(l,c){var x=Qt;Qt=x!==0&&4>x?x:4,l(!0);var O=Zu.transition;Zu.transition={};try{l(!1),c()}finally{Qt=x,Zu.transition=O}}function Tm(){return an().memoizedState}function $0(l,c,x){var O=ql(l);if(x={lane:O,action:x,hasEagerState:!1,eagerState:null,next:null},wh(l))Om(c,x);else if(x=Yu(l,c,x,O),x!==null){var B=Si();eo(x,l,O,B),xi(x,c,O)}}function Cm(l,c,x){var O=ql(l),B={lane:O,action:x,hasEagerState:!1,eagerState:null,next:null};if(wh(l))Om(c,B);else{var j=l.alternate;if(l.lanes===0&&(j===null||j.lanes===0)&&(j=c.lastRenderedReducer,j!==null))try{var re=c.lastRenderedState,ce=j(re,x);if(B.hasEagerState=!0,B.eagerState=ce,ti(ce,re)){var ve=c.interleaved;ve===null?(B.next=B,Ol(c)):(B.next=ve.next,ve.next=B),c.interleaved=B;return}}catch{}x=Yu(l,c,B,O),x!==null&&(B=Si(),eo(x,l,O,B),xi(x,c,O))}}function wh(l){var c=l.alternate;return l===dr||c!==null&&c===dr}function Om(l,c){Mo=Qi=!0;var x=l.pending;x===null?c.next=c:(c.next=x.next,x.next=c),l.pending=c}function xi(l,c,x){if((x&4194240)!==0){var O=c.lanes;O&=l.pendingLanes,x|=O,c.lanes=x,Bd(l,x)}}var Bl={readContext:Vn,useCallback:Qr,useContext:Qr,useEffect:Qr,useImperativeHandle:Qr,useInsertionEffect:Qr,useLayoutEffect:Qr,useMemo:Qr,useReducer:Qr,useRef:Qr,useState:Qr,useDebugValue:Qr,useDeferredValue:Qr,useTransition:Qr,useMutableSource:Qr,useSyncExternalStore:Qr,useId:Qr,unstable_isNewReconciler:!1},V0={readContext:Vn,useCallback:function(l,c){return Sr().memoizedState=[l,c===void 0?null:c],l},useContext:Vn,useEffect:km,useImperativeHandle:function(l,c,x){return x=x!=null?x.concat([l]):null,Fl(4194308,4,No.bind(null,c,l),x)},useLayoutEffect:function(l,c){return Fl(4194308,4,l,c)},useInsertionEffect:function(l,c){return Fl(4,2,l,c)},useMemo:function(l,c){var x=Sr();return c=c===void 0?null:c,l=l(),x.memoizedState=[l,c],l},useReducer:function(l,c,x){var O=Sr();return c=x!==void 0?x(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,dr,l),[O.memoizedState,l]},useRef:function(l){var c=Sr();return l={current:l},c.memoizedState=l},useState:Do,useDebugValue:Qa,useDeferredValue:function(l){return Sr().memoizedState=l},useTransition:function(){var l=Do(!1),c=l[0];return l=Em.bind(null,l[1]),Sr().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,x){var O=dr,B=Sr();if(or){if(x===void 0)throw Error(r(407));x=x()}else{if(x=c(),Ln===null)throw Error(r(349));(qn&30)!==0||Sm(O,c,x)}B.memoizedState=x;var j={value:x,getSnapshot:c};return B.queue=j,km(hh.bind(null,O,j,l),[l]),O.flags|=2048,Ll(9,Ka.bind(null,O,j,x,c),void 0,null),x},useId:function(){var l=Sr(),c=Ln.identifierPrefix;if(or){var x=Cr,O=gi;x=(O&~(1<<32-jt(O)-1)).toString(32)+x,c=":"+c+"R"+x,x=Ri++,0<x&&(c+="H"+x.toString(32)),c+=":"}else x=Tf++,c=":"+c+"r"+x.toString(32)+":";return l.memoizedState=c},unstable_isNewReconciler:!1},Lo={readContext:Vn,useCallback:bh,useContext:Vn,useEffect:gh,useImperativeHandle:_m,useInsertionEffect:yh,useLayoutEffect:vh,useMemo:kr,useReducer:Dn,useRef:mh,useState:function(){return Dn(Mn)},useDebugValue:Qa,useDeferredValue:function(l){var c=an();return Pm(c,jr.memoizedState,l)},useTransition:function(){var l=Dn(Mn)[0],c=an().memoizedState;return[l,c]},useMutableSource:Of,useSyncExternalStore:Af,useId:Tm,unstable_isNewReconciler:!1},Rf={readContext:Vn,useCallback:bh,useContext:Vn,useEffect:gh,useImperativeHandle:_m,useInsertionEffect:yh,useLayoutEffect:vh,useMemo:kr,useReducer:Cf,useRef:mh,useState:function(){return Cf(Mn)},useDebugValue:Qa,useDeferredValue:function(l){var c=an();return jr===null?c.memoizedState=l:Pm(c,jr.memoizedState,l)},useTransition:function(){var l=Cf(Mn)[0],c=an().memoizedState;return[l,c]},useMutableSource:Of,useSyncExternalStore:Af,useId:Tm,unstable_isNewReconciler:!1};function xn(l,c){if(l&&l.defaultProps){c=U({},c),l=l.defaultProps;for(var x in l)c[x]===void 0&&(c[x]=l[x]);return c}return c}function zl(l,c,x,O){c=l.memoizedState,x=x(O,c),x=x==null?c:U({},c,x),l.memoizedState=x,l.lanes===0&&(l.updateQueue.baseState=x)}var jl={isMounted:function(l){return(l=l._reactInternals)?Cn(l)===l:!1},enqueueSetState:function(l,c,x){l=l._reactInternals;var O=Si(),B=ql(l),j=Sa(O,B);j.payload=c,x!=null&&(j.callback=x),c=ka(l,j,B),c!==null&&(eo(c,l,B,O),Ef(c,l,B))},enqueueReplaceState:function(l,c,x){l=l._reactInternals;var O=Si(),B=ql(l),j=Sa(O,B);j.tag=1,j.payload=c,x!=null&&(j.callback=x),c=ka(l,j,B),c!==null&&(eo(c,l,B,O),Ef(c,l,B))},enqueueForceUpdate:function(l,c){l=l._reactInternals;var x=Si(),O=ql(l),B=Sa(x,O);B.tag=2,c!=null&&(B.callback=c),c=ka(l,B,O),c!==null&&(eo(c,l,O,x),Ef(c,l,O))}};function Mf(l,c,x,O,B,j,re){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(O,j,re):c.prototype&&c.prototype.isPureReactComponent?!cs(x,O)||!cs(B,j):!0}function Am(l,c,x){var O=!1,B=va,j=c.contextType;return typeof j=="object"&&j!==null?j=Vn(j):(B=In(c)?To:wn.current,O=c.contextTypes,j=(O=O!=null)?bs(l,B):va),c=new c(x,j),l.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=jl,l.stateNode=c,c._reactInternals=l,O&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=B,l.__reactInternalMemoizedMaskedChildContext=j),c}function xh(l,c,x,O){l=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(x,O),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(x,O),c.state!==l&&jl.enqueueReplaceState(c,c.state,null)}function Df(l,c,x,O){var B=l.stateNode;B.props=x,B.state=l.memoizedState,B.refs={},Ku(l);var j=c.contextType;typeof j=="object"&&j!==null?B.context=Vn(j):(j=In(c)?To:wn.current,B.context=bs(l,j)),B.state=l.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(zl(l,c,j,x),B.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof B.getSnapshotBeforeUpdate=="function"||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(c=B.state,typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount(),c!==B.state&&jl.enqueueReplaceState(B,B.state,null),Al(l,x,B,O),B.state=l.memoizedState),typeof B.componentDidMount=="function"&&(l.flags|=4194308)}function Cs(l,c){try{var x="",O=c;do x+=te(O),O=O.return;while(O);var B=x}catch(j){B=`
|
|
7
|
+
Error generating stack: `+j.message+`
|
|
8
|
+
`+j.stack}return{value:l,source:c,stack:B,digest:null}}function Nf(l,c,x){return{value:l,source:null,stack:x??null,digest:c??null}}function Ul(l,c){try{console.error(c.value)}catch(x){setTimeout(function(){throw x})}}var q0=typeof WeakMap=="function"?WeakMap:Map;function Im(l,c,x){x=Sa(-1,x),x.tag=3,x.payload={element:null};var O=c.value;return x.callback=function(){Lm||(Lm=!0,t1=O),Ul(l,c)},x}function m(l,c,x){x=Sa(-1,x),x.tag=3;var O=l.type.getDerivedStateFromError;if(typeof O=="function"){var B=c.value;x.payload=function(){return O(B)},x.callback=function(){Ul(l,c)}}var j=l.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(x.callback=function(){Ul(l,c),typeof O!="function"&&($l===null?$l=new Set([this]):$l.add(this));var re=c.stack;this.componentDidCatch(c.value,{componentStack:re!==null?re:""})}),x}function g(l,c,x){var O=l.pingCache;if(O===null){O=l.pingCache=new q0;var B=new Set;O.set(c,B)}else B=O.get(c),B===void 0&&(B=new Set,O.set(c,B));B.has(x)||(B.add(x),l=O6.bind(null,l,c,x),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,x,O,B){return(l.mode&1)===0?(l===c?l.flags|=65536:(l.flags|=128,x.flags|=131072,x.flags&=-52805,x.tag===1&&(x.alternate===null?x.tag=17:(c=Sa(-1,1),c.tag=2,ka(x,c,1))),x.lanes|=1),l):(l.flags|=65536,l.lanes=B,l)}var z=_.ReactCurrentOwner,Y=!1;function ie(l,c,x,O){c.child=l===null?Ii(c,null,x,O):Ps(c,l.child,x,O)}function Pe(l,c,x,O,B){x=x.render;var j=c.ref;return Xa(c,B),O=Dl(l,c,x,O,j,B),x=Nl(),l!==null&&!Y?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~B,Nn(l,c,B)):(or&&x&&El(c),c.flags|=1,ie(l,c,O,B),c.child)}function Le(l,c,x,O,B){if(l===null){var j=x.type;return typeof j=="function"&&!l1(j)&&j.defaultProps===void 0&&x.compare===null&&x.defaultProps===void 0?(c.tag=15,c.type=j,Xe(l,c,j,O,B)):(l=Hm(x.type,null,O,c,c.mode,B),l.ref=c.ref,l.return=c,c.child=l)}if(j=l.child,(l.lanes&B)===0){var re=j.memoizedProps;if(x=x.compare,x=x!==null?x:cs,x(re,O)&&l.ref===c.ref)return Nn(l,c,B)}return c.flags|=1,l=Gl(j,O),l.ref=c.ref,l.return=c,c.child=l}function Xe(l,c,x,O,B){if(l!==null){var j=l.memoizedProps;if(cs(j,O)&&l.ref===c.ref)if(Y=!1,c.pendingProps=O=j,(l.lanes&B)!==0)(l.flags&131072)!==0&&(Y=!0);else return c.lanes=l.lanes,Nn(l,c,B)}return st(l,c,x,O,B)}function ht(l,c,x){var O=c.pendingProps,B=O.children,j=l!==null?l.memoizedState:null;if(O.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},pr(Ff,Zi),Zi|=x;else{if((x&1073741824)===0)return l=j!==null?j.baseLanes|x:x,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:l,cachePool:null,transitions:null},c.updateQueue=null,pr(Ff,Zi),Zi|=l,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},O=j!==null?j.baseLanes:x,pr(Ff,Zi),Zi|=O}else j!==null?(O=j.baseLanes|x,c.memoizedState=null):O=x,pr(Ff,Zi),Zi|=O;return ie(l,c,B,x),c.child}function Mt(l,c){var x=c.ref;(l===null&&x!==null||l!==null&&l.ref!==x)&&(c.flags|=512,c.flags|=2097152)}function st(l,c,x,O,B){var j=In(x)?To:wn.current;return j=bs(c,j),Xa(c,B),x=Dl(l,c,x,O,j,B),O=Nl(),l!==null&&!Y?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~B,Nn(l,c,B)):(or&&O&&El(c),c.flags|=1,ie(l,c,x,B),c.child)}function br(l,c,x,O,B){if(In(x)){var j=!0;ws(c)}else j=!1;if(Xa(c,B),c.stateNode===null)Vt(l,c),Am(c,x,O),Df(c,x,O,B),O=!0;else if(l===null){var re=c.stateNode,ce=c.memoizedProps;re.props=ce;var ve=re.context,De=x.contextType;typeof De=="object"&&De!==null?De=Vn(De):(De=In(x)?To:wn.current,De=bs(c,De));var qe=x.getDerivedStateFromProps,Ge=typeof qe=="function"||typeof re.getSnapshotBeforeUpdate=="function";Ge||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ce!==O||ve!==De)&&xh(c,re,O,De),xa=!1;var Ve=c.memoizedState;re.state=Ve,Al(c,O,re,B),ve=c.memoizedState,ce!==O||Ve!==ve||An.current||xa?(typeof qe=="function"&&(zl(c,x,qe,O),ve=c.memoizedState),(ce=xa||Mf(c,x,ce,O,Ve,ve,De))?(Ge||typeof re.UNSAFE_componentWillMount!="function"&&typeof re.componentWillMount!="function"||(typeof re.componentWillMount=="function"&&re.componentWillMount(),typeof re.UNSAFE_componentWillMount=="function"&&re.UNSAFE_componentWillMount()),typeof re.componentDidMount=="function"&&(c.flags|=4194308)):(typeof re.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=O,c.memoizedState=ve),re.props=O,re.state=ve,re.context=De,O=ce):(typeof re.componentDidMount=="function"&&(c.flags|=4194308),O=!1)}else{re=c.stateNode,Pf(l,c),ce=c.memoizedProps,De=c.type===c.elementType?ce:xn(c.type,ce),re.props=De,Ge=c.pendingProps,Ve=re.context,ve=x.contextType,typeof ve=="object"&&ve!==null?ve=Vn(ve):(ve=In(x)?To:wn.current,ve=bs(c,ve));var dt=x.getDerivedStateFromProps;(qe=typeof dt=="function"||typeof re.getSnapshotBeforeUpdate=="function")||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ce!==Ge||Ve!==ve)&&xh(c,re,O,ve),xa=!1,Ve=c.memoizedState,re.state=Ve,Al(c,O,re,B);var gt=c.memoizedState;ce!==Ge||Ve!==gt||An.current||xa?(typeof dt=="function"&&(zl(c,x,dt,O),gt=c.memoizedState),(De=xa||Mf(c,x,De,O,Ve,gt,ve)||!1)?(qe||typeof re.UNSAFE_componentWillUpdate!="function"&&typeof re.componentWillUpdate!="function"||(typeof re.componentWillUpdate=="function"&&re.componentWillUpdate(O,gt,ve),typeof re.UNSAFE_componentWillUpdate=="function"&&re.UNSAFE_componentWillUpdate(O,gt,ve)),typeof re.componentDidUpdate=="function"&&(c.flags|=4),typeof re.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof re.componentDidUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=1024),c.memoizedProps=O,c.memoizedState=gt),re.props=O,re.state=gt,re.context=ve,O=De):(typeof re.componentDidUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=1024),O=!1)}return sr(l,c,x,O,j,B)}function sr(l,c,x,O,B,j){Mt(l,c);var re=(c.flags&128)!==0;if(!O&&!re)return B&&bm(c,x,!1),Nn(l,c,j);O=c.stateNode,z.current=c;var ce=re&&typeof x.getDerivedStateFromError!="function"?null:O.render();return c.flags|=1,l!==null&&re?(c.child=Ps(c,l.child,null,j),c.child=Ps(c,null,ce,j)):ie(l,c,ce,j),c.memoizedState=O.state,B&&bm(c,x,!0),c.child}function Wn(l){var c=l.stateNode;c.pendingContext?uh(l,c.pendingContext,c.pendingContext!==c.context):c.context&&uh(l,c.context,!1),Ro(l,c.containerInfo)}function _a(l,c,x,O,B){return _s(),Gu(B),c.flags|=256,ie(l,c,x,O),c.child}var Me={dehydrated:null,treeContext:null,retryLane:0};function Ee(l){return{baseLanes:l,cachePool:null,transitions:null}}function Be(l,c,x){var O=c.pendingProps,B=vr.current,j=!1,re=(c.flags&128)!==0,ce;if((ce=re)||(ce=l!==null&&l.memoizedState===null?!1:(B&2)!==0),ce?(j=!0,c.flags&=-129):(l===null||l.memoizedState!==null)&&(B|=1),pr(vr,B&1),l===null)return Tl(c),l=c.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((c.mode&1)===0?c.lanes=1:l.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(re=O.children,l=O.fallback,j?(O=c.mode,j=c.child,re={mode:"hidden",children:re},(O&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=re):j=$m(re,O,0,null),l=ic(l,O,x,null),j.return=c,l.return=c,j.sibling=l,c.child=j,c.child.memoizedState=Ee(x),c.memoizedState=Me,l):lt(c,re));if(B=l.memoizedState,B!==null&&(ce=B.dehydrated,ce!==null))return Ft(l,c,re,O,ce,B,x);if(j){j=O.fallback,re=c.mode,B=l.child,ce=B.sibling;var ve={mode:"hidden",children:O.children};return(re&1)===0&&c.child!==B?(O=c.child,O.childLanes=0,O.pendingProps=ve,c.deletions=null):(O=Gl(B,ve),O.subtreeFlags=B.subtreeFlags&14680064),ce!==null?j=Gl(ce,j):(j=ic(j,re,x,null),j.flags|=2),j.return=c,O.return=c,O.sibling=j,c.child=O,O=j,j=c.child,re=l.child.memoizedState,re=re===null?Ee(x):{baseLanes:re.baseLanes|x,cachePool:null,transitions:re.transitions},j.memoizedState=re,j.childLanes=l.childLanes&~x,c.memoizedState=Me,O}return j=l.child,l=j.sibling,O=Gl(j,{mode:"visible",children:O.children}),(c.mode&1)===0&&(O.lanes=x),O.return=c,O.sibling=null,l!==null&&(x=c.deletions,x===null?(c.deletions=[l],c.flags|=16):x.push(l)),c.child=O,c.memoizedState=null,O}function lt(l,c){return c=$m({mode:"visible",children:c},l.mode,0,null),c.return=l,l.child=c}function kt(l,c,x,O){return O!==null&&Gu(O),Ps(c,l.child,null,x),l=lt(c,c.pendingProps.children),l.flags|=2,c.memoizedState=null,l}function Ft(l,c,x,O,B,j,re){if(x)return c.flags&256?(c.flags&=-257,O=Nf(Error(r(422))),kt(l,c,re,O)):c.memoizedState!==null?(c.child=l.child,c.flags|=128,null):(j=O.fallback,B=c.mode,O=$m({mode:"visible",children:O.children},B,0,null),j=ic(j,B,re,null),j.flags|=2,O.return=c,j.return=c,O.sibling=j,c.child=O,(c.mode&1)!==0&&Ps(c,l.child,null,re),c.child.memoizedState=Ee(re),c.memoizedState=Me,j);if((c.mode&1)===0)return kt(l,c,re,null);if(B.data==="$!"){if(O=B.nextSibling&&B.nextSibling.dataset,O)var ce=O.dgst;return O=ce,j=Error(r(419)),O=Nf(j,O,void 0),kt(l,c,re,O)}if(ce=(re&l.childLanes)!==0,Y||ce){if(O=Ln,O!==null){switch(re&-re){case 4:B=2;break;case 16:B=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:B=32;break;case 536870912:B=268435456;break;default:B=0}B=(B&(O.suspendedLanes|re))!==0?0:B,B!==0&&B!==j.retryLane&&(j.retryLane=B,wi(l,B),eo(O,l,B,-1))}return s1(),O=Nf(Error(r(421))),kt(l,c,re,O)}return B.data==="$?"?(c.flags|=128,c.child=l.child,c=A6.bind(null,l),B._reactRetry=c,null):(l=j.treeContext,tt=ga(B.nextSibling),yi=c,or=!0,vi=null,l!==null&&(Hn[$n++]=gi,Hn[$n++]=Cr,Hn[$n++]=Io,gi=l.id,Cr=l.overflow,Io=c),c=lt(c,O.children),c.flags|=4096,c)}function Dt(l,c,x){l.lanes|=c;var O=l.alternate;O!==null&&(O.lanes|=c),_f(l.return,c,x)}function Xt(l,c,x,O,B){var j=l.memoizedState;j===null?l.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:O,tail:x,tailMode:B}:(j.isBackwards=c,j.rendering=null,j.renderingStartTime=0,j.last=O,j.tail=x,j.tailMode=B)}function on(l,c,x){var O=c.pendingProps,B=O.revealOrder,j=O.tail;if(ie(l,c,O.children,x),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&&Dt(l,x,c);else if(l.tag===19)Dt(l,x,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(pr(vr,O),(c.mode&1)===0)c.memoizedState=null;else switch(B){case"forwards":for(x=c.child,B=null;x!==null;)l=x.alternate,l!==null&&Rl(l)===null&&(B=x),x=x.sibling;x=B,x===null?(B=c.child,c.child=null):(B=x.sibling,x.sibling=null),Xt(c,!1,B,x,j);break;case"backwards":for(x=null,B=c.child,c.child=null;B!==null;){if(l=B.alternate,l!==null&&Rl(l)===null){c.child=B;break}l=B.sibling,B.sibling=x,x=B,B=l}Xt(c,!0,x,null,j);break;case"together":Xt(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Vt(l,c){(c.mode&1)===0&&l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2)}function Nn(l,c,x){if(l!==null&&(c.dependencies=l.dependencies),ec|=c.lanes,(x&c.childLanes)===0)return null;if(l!==null&&c.child!==l.child)throw Error(r(153));if(c.child!==null){for(l=c.child,x=Gl(l,l.pendingProps),c.child=x,x.return=c;l.sibling!==null;)l=l.sibling,x=x.sibling=Gl(l,l.pendingProps),x.return=c;x.sibling=null}return c.child}function W0(l,c,x){switch(c.tag){case 3:Wn(c),_s();break;case 5:Il(c);break;case 1:In(c.type)&&ws(c);break;case 4:Ro(c,c.stateNode.containerInfo);break;case 10:var O=c.type._context,B=c.memoizedProps.value;pr(Xu,O._currentValue),O._currentValue=B;break;case 13:if(O=c.memoizedState,O!==null)return O.dehydrated!==null?(pr(vr,vr.current&1),c.flags|=128,null):(x&c.child.childLanes)!==0?Be(l,c,x):(pr(vr,vr.current&1),l=Nn(l,c,x),l!==null?l.sibling:null);pr(vr,vr.current&1);break;case 19:if(O=(x&c.childLanes)!==0,(l.flags&128)!==0){if(O)return on(l,c,x);c.flags|=128}if(B=c.memoizedState,B!==null&&(B.rendering=null,B.tail=null,B.lastEffect=null),pr(vr,vr.current),O)break;return null;case 22:case 23:return c.lanes=0,ht(l,c,x)}return Nn(l,c,x)}var pb,G0,mb,gb;pb=function(l,c){for(var x=c.child;x!==null;){if(x.tag===5||x.tag===6)l.appendChild(x.stateNode);else if(x.tag!==4&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===c)break;for(;x.sibling===null;){if(x.return===null||x.return===c)return;x=x.return}x.sibling.return=x.return,x=x.sibling}},G0=function(){},mb=function(l,c,x,O){var B=l.memoizedProps;if(B!==O){l=c.stateNode,nn(mr.current);var j=null;switch(x){case"input":B=He(l,B),O=He(l,O),j=[];break;case"select":B=U({},B,{value:void 0}),O=U({},O,{value:void 0}),j=[];break;case"textarea":B=ae(l,B),O=ae(l,O),j=[];break;default:typeof B.onClick!="function"&&typeof O.onClick=="function"&&(l.onclick=gs)}le(x,O);var re;x=null;for(De in B)if(!O.hasOwnProperty(De)&&B.hasOwnProperty(De)&&B[De]!=null)if(De==="style"){var ce=B[De];for(re in ce)ce.hasOwnProperty(re)&&(x||(x={}),x[re]="")}else De!=="dangerouslySetInnerHTML"&&De!=="children"&&De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&De!=="autoFocus"&&(i.hasOwnProperty(De)?j||(j=[]):(j=j||[]).push(De,null));for(De in O){var ve=O[De];if(ce=B?.[De],O.hasOwnProperty(De)&&ve!==ce&&(ve!=null||ce!=null))if(De==="style")if(ce){for(re in ce)!ce.hasOwnProperty(re)||ve&&ve.hasOwnProperty(re)||(x||(x={}),x[re]="");for(re in ve)ve.hasOwnProperty(re)&&ce[re]!==ve[re]&&(x||(x={}),x[re]=ve[re])}else x||(j||(j=[]),j.push(De,x)),x=ve;else De==="dangerouslySetInnerHTML"?(ve=ve?ve.__html:void 0,ce=ce?ce.__html:void 0,ve!=null&&ce!==ve&&(j=j||[]).push(De,ve)):De==="children"?typeof ve!="string"&&typeof ve!="number"||(j=j||[]).push(De,""+ve):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(i.hasOwnProperty(De)?(ve!=null&&De==="onScroll"&&gr("scroll",l),j||ce===ve||(j=[])):(j=j||[]).push(De,ve))}x&&(j=j||[]).push("style",x);var De=j;(c.updateQueue=De)&&(c.flags|=4)}},gb=function(l,c,x,O){x!==O&&(c.flags|=4)};function Sh(l,c){if(!or)switch(l.tailMode){case"hidden":c=l.tail;for(var x=null;c!==null;)c.alternate!==null&&(x=c),c=c.sibling;x===null?l.tail=null:x.sibling=null;break;case"collapsed":x=l.tail;for(var O=null;x!==null;)x.alternate!==null&&(O=x),x=x.sibling;O===null?c||l.tail===null?l.tail=null:l.tail.sibling=null:O.sibling=null}}function ni(l){var c=l.alternate!==null&&l.alternate.child===l.child,x=0,O=0;if(c)for(var B=l.child;B!==null;)x|=B.lanes|B.childLanes,O|=B.subtreeFlags&14680064,O|=B.flags&14680064,B.return=l,B=B.sibling;else for(B=l.child;B!==null;)x|=B.lanes|B.childLanes,O|=B.subtreeFlags,O|=B.flags,B.return=l,B=B.sibling;return l.subtreeFlags|=O,l.childLanes=x,c}function b6(l,c,x){var O=c.pendingProps;switch(pn(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ni(c),null;case 1:return In(c.type)&&_l(),ni(c),null;case 3:return O=c.stateNode,Ar(),yr(An),yr(wn),Rn(),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,vi!==null&&(i1(vi),vi=null))),G0(l,c),ni(c),null;case 5:Ya(c);var B=nn(Vr.current);if(x=c.type,l!==null&&c.stateNode!=null)mb(l,c,x,O,B),l.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!O){if(c.stateNode===null)throw Error(r(166));return ni(c),null}if(l=nn(mr.current),Wu(c)){O=c.stateNode,x=c.type;var j=c.memoizedProps;switch(O[Ai]=c,O[$u]=j,l=(c.mode&1)!==0,x){case"dialog":gr("cancel",O),gr("close",O);break;case"iframe":case"object":case"embed":gr("load",O);break;case"video":case"audio":for(B=0;B<_o.length;B++)gr(_o[B],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":_e(O,j),gr("invalid",O)}le(x,j),B=null;for(var re in j)if(j.hasOwnProperty(re)){var ce=j[re];re==="children"?typeof ce=="string"?O.textContent!==ce&&(j.suppressHydrationWarning!==!0&&Uu(O.textContent,ce,l),B=["children",ce]):typeof ce=="number"&&O.textContent!==""+ce&&(j.suppressHydrationWarning!==!0&&Uu(O.textContent,ce,l),B=["children",""+ce]):i.hasOwnProperty(re)&&ce!=null&&re==="onScroll"&&gr("scroll",O)}switch(x){case"input":we(O),he(O,j,!0);break;case"textarea":we(O),Fe(O);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(O.onclick=gs)}O=B,c.updateQueue=O,O!==null&&(c.flags|=4)}else{re=B.nodeType===9?B:B.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=ot(x)),l==="http://www.w3.org/1999/xhtml"?x==="script"?(l=re.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof O.is=="string"?l=re.createElement(x,{is:O.is}):(l=re.createElement(x),x==="select"&&(re=l,O.multiple?re.multiple=!0:O.size&&(re.size=O.size))):l=re.createElementNS(l,x),l[Ai]=c,l[$u]=O,pb(l,c,!1,!1),c.stateNode=l;e:{switch(re=ye(x,O),x){case"dialog":gr("cancel",l),gr("close",l),B=O;break;case"iframe":case"object":case"embed":gr("load",l),B=O;break;case"video":case"audio":for(B=0;B<_o.length;B++)gr(_o[B],l);B=O;break;case"source":gr("error",l),B=O;break;case"img":case"image":case"link":gr("error",l),gr("load",l),B=O;break;case"details":gr("toggle",l),B=O;break;case"input":$e(l,O),B=He(l,O),gr("invalid",l);break;case"option":B=O;break;case"select":l._wrapperState={wasMultiple:!!O.multiple},B=U({},O,{value:void 0}),gr("invalid",l);break;case"textarea":_e(l,O),B=ae(l,O),gr("invalid",l);break;default:B=O}le(x,B),ce=B;for(j in ce)if(ce.hasOwnProperty(j)){var ve=ce[j];j==="style"?bt(l,ve):j==="dangerouslySetInnerHTML"?(ve=ve?ve.__html:void 0,ve!=null&&Ue(l,ve)):j==="children"?typeof ve=="string"?(x!=="textarea"||ve!=="")&&be(l,ve):typeof ve=="number"&&be(l,""+ve):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(i.hasOwnProperty(j)?ve!=null&&j==="onScroll"&&gr("scroll",l):ve!=null&&P(l,j,ve,re))}switch(x){case"input":we(l),he(l,O,!1);break;case"textarea":we(l),Fe(l);break;case"option":O.value!=null&&l.setAttribute("value",""+fe(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 B.onClick=="function"&&(l.onclick=gs)}switch(x){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 ni(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(x=nn(Vr.current),nn(mr.current),Wu(c)){if(O=c.stateNode,x=c.memoizedProps,O[Ai]=c,(j=O.nodeValue!==x)&&(l=yi,l!==null))switch(l.tag){case 3:Uu(O.nodeValue,x,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&Uu(O.nodeValue,x,(l.mode&1)!==0)}j&&(c.flags|=4)}else O=(x.nodeType===9?x:x.ownerDocument).createTextNode(O),O[Ai]=c,c.stateNode=O}return ni(c),null;case 13:if(yr(vr),O=c.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(or&&tt!==null&&(c.mode&1)!==0&&(c.flags&128)===0)fh(),_s(),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[Ai]=c}else _s(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;ni(c),j=!1}else vi!==null&&(i1(vi),vi=null),j=!0;if(!j)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=x,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?Sn===0&&(Sn=3):s1())),c.updateQueue!==null&&(c.flags|=4),ni(c),null);case 4:return Ar(),G0(l,c),l===null&&ps(c.stateNode.containerInfo),ni(c),null;case 10:return kf(c.type._context),ni(c),null;case 17:return In(c.type)&&_l(),ni(c),null;case 19:if(yr(vr),j=c.memoizedState,j===null)return ni(c),null;if(O=(c.flags&128)!==0,re=j.rendering,re===null)if(O)Sh(j,!1);else{if(Sn!==0||l!==null&&(l.flags&128)!==0)for(l=c.child;l!==null;){if(re=Rl(l),re!==null){for(c.flags|=128,Sh(j,!1),O=re.updateQueue,O!==null&&(c.updateQueue=O,c.flags|=4),c.subtreeFlags=0,O=x,x=c.child;x!==null;)j=x,l=O,j.flags&=14680066,re=j.alternate,re===null?(j.childLanes=0,j.lanes=l,j.child=null,j.subtreeFlags=0,j.memoizedProps=null,j.memoizedState=null,j.updateQueue=null,j.dependencies=null,j.stateNode=null):(j.childLanes=re.childLanes,j.lanes=re.lanes,j.child=re.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=re.memoizedProps,j.memoizedState=re.memoizedState,j.updateQueue=re.updateQueue,j.type=re.type,l=re.dependencies,j.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),x=x.sibling;return pr(vr,vr.current&1|2),c.child}l=l.sibling}j.tail!==null&&Er()>Bf&&(c.flags|=128,O=!0,Sh(j,!1),c.lanes=4194304)}else{if(!O)if(l=Rl(re),l!==null){if(c.flags|=128,O=!0,x=l.updateQueue,x!==null&&(c.updateQueue=x,c.flags|=4),Sh(j,!0),j.tail===null&&j.tailMode==="hidden"&&!re.alternate&&!or)return ni(c),null}else 2*Er()-j.renderingStartTime>Bf&&x!==1073741824&&(c.flags|=128,O=!0,Sh(j,!1),c.lanes=4194304);j.isBackwards?(re.sibling=c.child,c.child=re):(x=j.last,x!==null?x.sibling=re:c.child=re,j.last=re)}return j.tail!==null?(c=j.tail,j.rendering=c,j.tail=c.sibling,j.renderingStartTime=Er(),c.sibling=null,x=vr.current,pr(vr,O?x&1|2:x&1),c):(ni(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?(Zi&1073741824)!==0&&(ni(c),c.subtreeFlags&6&&(c.flags|=8192)):ni(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function w6(l,c){switch(pn(c),c.tag){case 1:return In(c.type)&&_l(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Ar(),yr(An),yr(wn),Rn(),l=c.flags,(l&65536)!==0&&(l&128)===0?(c.flags=l&-65537|128,c):null;case 5:return Ya(c),null;case 13:if(yr(vr),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(r(340));_s()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return yr(vr),null;case 4:return Ar(),null;case 10:return kf(c.type._context),null;case 22:case 23:return o1(),null;case 24:return null;default:return null}}var Rm=!1,ii=!1,x6=typeof WeakSet=="function"?WeakSet:Set,mt=null;function Lf(l,c){var x=l.ref;if(x!==null)if(typeof x=="function")try{x(null)}catch(O){Zr(l,c,O)}else x.current=null}function X0(l,c,x){try{x()}catch(O){Zr(l,c,O)}}var yb=!1;function S6(l,c){if(ah=Xc,l=tn(),wl(l)){if("selectionStart"in l)var x={start:l.selectionStart,end:l.selectionEnd};else e:{x=(x=l.ownerDocument)&&x.defaultView||window;var O=x.getSelection&&x.getSelection();if(O&&O.rangeCount!==0){x=O.anchorNode;var B=O.anchorOffset,j=O.focusNode;O=O.focusOffset;try{x.nodeType,j.nodeType}catch{x=null;break e}var re=0,ce=-1,ve=-1,De=0,qe=0,Ge=l,Ve=null;t:for(;;){for(var dt;Ge!==x||B!==0&&Ge.nodeType!==3||(ce=re+B),Ge!==j||O!==0&&Ge.nodeType!==3||(ve=re+O),Ge.nodeType===3&&(re+=Ge.nodeValue.length),(dt=Ge.firstChild)!==null;)Ve=Ge,Ge=dt;for(;;){if(Ge===l)break t;if(Ve===x&&++De===B&&(ce=re),Ve===j&&++qe===O&&(ve=re),(dt=Ge.nextSibling)!==null)break;Ge=Ve,Ve=Ge.parentNode}Ge=dt}x=ce===-1||ve===-1?null:{start:ce,end:ve}}else x=null}x=x||{start:0,end:0}}else x=null;for(oh={focusedElem:l,selectionRange:x},Xc=!1,mt=c;mt!==null;)if(c=mt,l=c.child,(c.subtreeFlags&1028)!==0&&l!==null)l.return=c,mt=l;else for(;mt!==null;){c=mt;try{var gt=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(gt!==null){var vt=gt.memoizedProps,sn=gt.memoizedState,Ae=c.stateNode,Se=Ae.getSnapshotBeforeUpdate(c.elementType===c.type?vt:xn(c.type,vt),sn);Ae.__reactInternalSnapshotBeforeUpdate=Se}break;case 3:var Ie=c.stateNode.containerInfo;Ie.nodeType===1?Ie.textContent="":Ie.nodeType===9&&Ie.documentElement&&Ie.removeChild(Ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Ye){Zr(c,c.return,Ye)}if(l=c.sibling,l!==null){l.return=c.return,mt=l;break}mt=c.return}return gt=yb,yb=!1,gt}function kh(l,c,x){var O=c.updateQueue;if(O=O!==null?O.lastEffect:null,O!==null){var B=O=O.next;do{if((B.tag&l)===l){var j=B.destroy;B.destroy=void 0,j!==void 0&&X0(c,x,j)}B=B.next}while(B!==O)}}function Mm(l,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var x=c=c.next;do{if((x.tag&l)===l){var O=x.create;x.destroy=O()}x=x.next}while(x!==c)}}function Y0(l){var c=l.ref;if(c!==null){var x=l.stateNode;l.tag,l=x,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[Ai],delete c[$u],delete c[mf],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,x){var O=l.tag;if(O===5||O===6)l=l.stateNode,c?x.nodeType===8?x.parentNode.insertBefore(l,c):x.insertBefore(l,c):(x.nodeType===8?(c=x.parentNode,c.insertBefore(l,x)):(c=x,c.appendChild(l)),x=x._reactRootContainer,x!=null||c.onclick!==null||(c.onclick=gs));else if(O!==4&&(l=l.child,l!==null))for(K0(l,c,x),l=l.sibling;l!==null;)K0(l,c,x),l=l.sibling}function Q0(l,c,x){var O=l.tag;if(O===5||O===6)l=l.stateNode,c?x.insertBefore(l,c):x.appendChild(l);else if(O!==4&&(l=l.child,l!==null))for(Q0(l,c,x),l=l.sibling;l!==null;)Q0(l,c,x),l=l.sibling}var Gn=null,Za=!1;function Hl(l,c,x){for(x=x.child;x!==null;)xb(l,c,x),x=x.sibling}function xb(l,c,x){if(gn&&typeof gn.onCommitFiberUnmount=="function")try{gn.onCommitFiberUnmount(za,x)}catch{}switch(x.tag){case 5:ii||Lf(x,c);case 6:var O=Gn,B=Za;Gn=null,Hl(l,c,x),Gn=O,Za=B,Gn!==null&&(Za?(l=Gn,x=x.stateNode,l.nodeType===8?l.parentNode.removeChild(x):l.removeChild(x)):Gn.removeChild(x.stateNode));break;case 18:Gn!==null&&(Za?(l=Gn,x=x.stateNode,l.nodeType===8?pf(l.parentNode,x):l.nodeType===1&&pf(l,x),Jn(l)):pf(Gn,x.stateNode));break;case 4:O=Gn,B=Za,Gn=x.stateNode.containerInfo,Za=!0,Hl(l,c,x),Gn=O,Za=B;break;case 0:case 11:case 14:case 15:if(!ii&&(O=x.updateQueue,O!==null&&(O=O.lastEffect,O!==null))){B=O=O.next;do{var j=B,re=j.destroy;j=j.tag,re!==void 0&&((j&2)!==0||(j&4)!==0)&&X0(x,c,re),B=B.next}while(B!==O)}Hl(l,c,x);break;case 1:if(!ii&&(Lf(x,c),O=x.stateNode,typeof O.componentWillUnmount=="function"))try{O.props=x.memoizedProps,O.state=x.memoizedState,O.componentWillUnmount()}catch(ce){Zr(x,c,ce)}Hl(l,c,x);break;case 21:Hl(l,c,x);break;case 22:x.mode&1?(ii=(O=ii)||x.memoizedState!==null,Hl(l,c,x),ii=O):Hl(l,c,x);break;default:Hl(l,c,x)}}function Sb(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var x=l.stateNode;x===null&&(x=l.stateNode=new x6),c.forEach(function(O){var B=I6.bind(null,l,O);x.has(O)||(x.add(O),O.then(B,B))})}}function Ja(l,c){var x=c.deletions;if(x!==null)for(var O=0;O<x.length;O++){var B=x[O];try{var j=l,re=c,ce=re;e:for(;ce!==null;){switch(ce.tag){case 5:Gn=ce.stateNode,Za=!1;break e;case 3:Gn=ce.stateNode.containerInfo,Za=!0;break e;case 4:Gn=ce.stateNode.containerInfo,Za=!0;break e}ce=ce.return}if(Gn===null)throw Error(r(160));xb(j,re,B),Gn=null,Za=!1;var ve=B.alternate;ve!==null&&(ve.return=null),B.return=null}catch(De){Zr(B,c,De)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)kb(c,l),c=c.sibling}function kb(l,c){var x=l.alternate,O=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(Ja(c,l),Fo(l),O&4){try{kh(3,l,l.return),Mm(3,l)}catch(vt){Zr(l,l.return,vt)}try{kh(5,l,l.return)}catch(vt){Zr(l,l.return,vt)}}break;case 1:Ja(c,l),Fo(l),O&512&&x!==null&&Lf(x,x.return);break;case 5:if(Ja(c,l),Fo(l),O&512&&x!==null&&Lf(x,x.return),l.flags&32){var B=l.stateNode;try{be(B,"")}catch(vt){Zr(l,l.return,vt)}}if(O&4&&(B=l.stateNode,B!=null)){var j=l.memoizedProps,re=x!==null?x.memoizedProps:j,ce=l.type,ve=l.updateQueue;if(l.updateQueue=null,ve!==null)try{ce==="input"&&j.type==="radio"&&j.name!=null&&et(B,j),ye(ce,re);var De=ye(ce,j);for(re=0;re<ve.length;re+=2){var qe=ve[re],Ge=ve[re+1];qe==="style"?bt(B,Ge):qe==="dangerouslySetInnerHTML"?Ue(B,Ge):qe==="children"?be(B,Ge):P(B,qe,Ge,De)}switch(ce){case"input":xe(B,j);break;case"textarea":Oe(B,j);break;case"select":var Ve=B._wrapperState.wasMultiple;B._wrapperState.wasMultiple=!!j.multiple;var dt=j.value;dt!=null?Ce(B,!!j.multiple,dt,!1):Ve!==!!j.multiple&&(j.defaultValue!=null?Ce(B,!!j.multiple,j.defaultValue,!0):Ce(B,!!j.multiple,j.multiple?[]:"",!1))}B[$u]=j}catch(vt){Zr(l,l.return,vt)}}break;case 6:if(Ja(c,l),Fo(l),O&4){if(l.stateNode===null)throw Error(r(162));B=l.stateNode,j=l.memoizedProps;try{B.nodeValue=j}catch(vt){Zr(l,l.return,vt)}}break;case 3:if(Ja(c,l),Fo(l),O&4&&x!==null&&x.memoizedState.isDehydrated)try{Jn(c.containerInfo)}catch(vt){Zr(l,l.return,vt)}break;case 4:Ja(c,l),Fo(l);break;case 13:Ja(c,l),Fo(l),B=l.child,B.flags&8192&&(j=B.memoizedState!==null,B.stateNode.isHidden=j,!j||B.alternate!==null&&B.alternate.memoizedState!==null||(e1=Er())),O&4&&Sb(l);break;case 22:if(qe=x!==null&&x.memoizedState!==null,l.mode&1?(ii=(De=ii)||qe,Ja(c,l),ii=De):Ja(c,l),Fo(l),O&8192){if(De=l.memoizedState!==null,(l.stateNode.isHidden=De)&&!qe&&(l.mode&1)!==0)for(mt=l,qe=l.child;qe!==null;){for(Ge=mt=qe;mt!==null;){switch(Ve=mt,dt=Ve.child,Ve.tag){case 0:case 11:case 14:case 15:kh(4,Ve,Ve.return);break;case 1:Lf(Ve,Ve.return);var gt=Ve.stateNode;if(typeof gt.componentWillUnmount=="function"){O=Ve,x=Ve.return;try{c=O,gt.props=c.memoizedProps,gt.state=c.memoizedState,gt.componentWillUnmount()}catch(vt){Zr(O,x,vt)}}break;case 5:Lf(Ve,Ve.return);break;case 22:if(Ve.memoizedState!==null){Eb(Ge);continue}}dt!==null?(dt.return=Ve,mt=dt):Eb(Ge)}qe=qe.sibling}e:for(qe=null,Ge=l;;){if(Ge.tag===5){if(qe===null){qe=Ge;try{B=Ge.stateNode,De?(j=B.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(ce=Ge.stateNode,ve=Ge.memoizedProps.style,re=ve!=null&&ve.hasOwnProperty("display")?ve.display:null,ce.style.display=Et("display",re))}catch(vt){Zr(l,l.return,vt)}}}else if(Ge.tag===6){if(qe===null)try{Ge.stateNode.nodeValue=De?"":Ge.memoizedProps}catch(vt){Zr(l,l.return,vt)}}else if((Ge.tag!==22&&Ge.tag!==23||Ge.memoizedState===null||Ge===l)&&Ge.child!==null){Ge.child.return=Ge,Ge=Ge.child;continue}if(Ge===l)break e;for(;Ge.sibling===null;){if(Ge.return===null||Ge.return===l)break e;qe===Ge&&(qe=null),Ge=Ge.return}qe===Ge&&(qe=null),Ge.sibling.return=Ge.return,Ge=Ge.sibling}}break;case 19:Ja(c,l),Fo(l),O&4&&Sb(l);break;case 21:break;default:Ja(c,l),Fo(l)}}function Fo(l){var c=l.flags;if(c&2){try{e:{for(var x=l.return;x!==null;){if(bb(x)){var O=x;break e}x=x.return}throw Error(r(160))}switch(O.tag){case 5:var B=O.stateNode;O.flags&32&&(be(B,""),O.flags&=-33);var j=wb(l);Q0(l,j,B);break;case 3:case 4:var re=O.stateNode.containerInfo,ce=wb(l);K0(l,ce,re);break;default:throw Error(r(161))}}catch(ve){Zr(l,l.return,ve)}l.flags&=-3}c&4096&&(l.flags&=-4097)}function k6(l,c,x){mt=l,_b(l)}function _b(l,c,x){for(var O=(l.mode&1)!==0;mt!==null;){var B=mt,j=B.child;if(B.tag===22&&O){var re=B.memoizedState!==null||Rm;if(!re){var ce=B.alternate,ve=ce!==null&&ce.memoizedState!==null||ii;ce=Rm;var De=ii;if(Rm=re,(ii=ve)&&!De)for(mt=B;mt!==null;)re=mt,ve=re.child,re.tag===22&&re.memoizedState!==null?Tb(B):ve!==null?(ve.return=re,mt=ve):Tb(B);for(;j!==null;)mt=j,_b(j),j=j.sibling;mt=B,Rm=ce,ii=De}Pb(l)}else(B.subtreeFlags&8772)!==0&&j!==null?(j.return=B,mt=j):Pb(l)}}function Pb(l){for(;mt!==null;){var c=mt;if((c.flags&8772)!==0){var x=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:ii||Mm(5,c);break;case 1:var O=c.stateNode;if(c.flags&4&&!ii)if(x===null)O.componentDidMount();else{var B=c.elementType===c.type?x.memoizedProps:xn(c.type,x.memoizedProps);O.componentDidUpdate(B,x.memoizedState,O.__reactInternalSnapshotBeforeUpdate)}var j=c.updateQueue;j!==null&&zr(c,j,O);break;case 3:var re=c.updateQueue;if(re!==null){if(x=null,c.child!==null)switch(c.child.tag){case 5:x=c.child.stateNode;break;case 1:x=c.child.stateNode}zr(c,re,x)}break;case 5:var ce=c.stateNode;if(x===null&&c.flags&4){x=ce;var ve=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":ve.autoFocus&&x.focus();break;case"img":ve.src&&(x.src=ve.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 qe=De.memoizedState;if(qe!==null){var Ge=qe.dehydrated;Ge!==null&&Jn(Ge)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}ii||c.flags&512&&Y0(c)}catch(Ve){Zr(c,c.return,Ve)}}if(c===l){mt=null;break}if(x=c.sibling,x!==null){x.return=c.return,mt=x;break}mt=c.return}}function Eb(l){for(;mt!==null;){var c=mt;if(c===l){mt=null;break}var x=c.sibling;if(x!==null){x.return=c.return,mt=x;break}mt=c.return}}function Tb(l){for(;mt!==null;){var c=mt;try{switch(c.tag){case 0:case 11:case 15:var x=c.return;try{Mm(4,c)}catch(ve){Zr(c,x,ve)}break;case 1:var O=c.stateNode;if(typeof O.componentDidMount=="function"){var B=c.return;try{O.componentDidMount()}catch(ve){Zr(c,B,ve)}}var j=c.return;try{Y0(c)}catch(ve){Zr(c,j,ve)}break;case 5:var re=c.return;try{Y0(c)}catch(ve){Zr(c,re,ve)}}}catch(ve){Zr(c,c.return,ve)}if(c===l){mt=null;break}var ce=c.sibling;if(ce!==null){ce.return=c.return,mt=ce;break}mt=c.return}}var _6=Math.ceil,Dm=_.ReactCurrentDispatcher,Z0=_.ReactCurrentOwner,Pa=_.ReactCurrentBatchConfig,Jt=0,Ln=null,mn=null,Xn=0,Zi=0,Ff=Wa(0),Sn=0,_h=null,ec=0,Nm=0,J0=0,Ph=null,Mi=null,e1=0,Bf=1/0,Os=null,Lm=!1,t1=null,$l=null,Fm=!1,Vl=null,Bm=0,Eh=0,r1=null,zm=-1,jm=0;function Si(){return(Jt&6)!==0?Er():zm!==-1?zm:zm=Er()}function ql(l){return(l.mode&1)===0?1:(Jt&2)!==0&&Xn!==0?Xn&-Xn:dh.transition!==null?(jm===0&&(jm=Fd()),jm):(l=Qt,l!==0||(l=window.event,l=l===void 0?16:em(l.type)),l)}function eo(l,c,x,O){if(50<Eh)throw Eh=0,r1=null,Error(r(185));Cu(l,x,O),((Jt&2)===0||l!==Ln)&&(l===Ln&&((Jt&2)===0&&(Nm|=x),Sn===4&&Wl(l,Xn)),Di(l,O),x===1&&Jt===0&&(c.mode&1)===0&&(Bf=Er()+500,Pl&&Co()))}function Di(l,c){var x=l.callbackNode;Yp(l,c);var O=ns(l,l===Ln?Xn:0);if(O===0)x!==null&&ts(x),l.callbackNode=null,l.callbackPriority=0;else if(c=O&-O,l.callbackPriority!==c){if(x!=null&&ts(x),c===1)l.tag===0?Ga(Ob.bind(null,l)):qu(Ob.bind(null,l)),mm(function(){(Jt&6)===0&&Co()}),x=null;else{switch(Ou(O)){case 1:x=rs;break;case 4:x=Uc;break;case 16:x=sl;break;case 536870912:x=Hc;break;default:x=sl}x=Fb(x,Cb.bind(null,l))}l.callbackPriority=c,l.callbackNode=x}}function Cb(l,c){if(zm=-1,jm=0,(Jt&6)!==0)throw Error(r(327));var x=l.callbackNode;if(zf()&&l.callbackNode!==x)return null;var O=ns(l,l===Ln?Xn:0);if(O===0)return null;if((O&30)!==0||(O&l.expiredLanes)!==0||c)c=Um(l,O);else{c=O;var B=Jt;Jt|=2;var j=Ib();(Ln!==l||Xn!==c)&&(Os=null,Bf=Er()+500,rc(l,c));do try{T6();break}catch(ce){Ab(l,ce)}while(!0);Sf(),Dm.current=j,Jt=B,mn!==null?c=0:(Ln=null,Xn=0,c=Sn)}if(c!==0){if(c===2&&(B=ll(l),B!==0&&(O=B,c=n1(l,B))),c===1)throw x=_h,rc(l,0),Wl(l,O),Di(l,Er()),x;if(c===6)Wl(l,O);else{if(B=l.current.alternate,(O&30)===0&&!P6(B)&&(c=Um(l,O),c===2&&(j=ll(l),j!==0&&(O=j,c=n1(l,j))),c===1))throw x=_h,rc(l,0),Wl(l,O),Di(l,Er()),x;switch(l.finishedWork=B,l.finishedLanes=O,c){case 0:case 1:throw Error(r(345));case 2:nc(l,Mi,Os);break;case 3:if(Wl(l,O),(O&130023424)===O&&(c=e1+500-Er(),10<c)){if(ns(l,0)!==0)break;if(B=l.suspendedLanes,(B&O)!==O){Si(),l.pingedLanes|=l.suspendedLanes&B;break}l.timeoutHandle=mi(nc.bind(null,l,Mi,Os),c);break}nc(l,Mi,Os);break;case 4:if(Wl(l,O),(O&4194240)===O)break;for(c=l.eventTimes,B=-1;0<O;){var re=31-jt(O);j=1<<re,re=c[re],re>B&&(B=re),O&=~j}if(O=B,O=Er()-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=mi(nc.bind(null,l,Mi,Os),O);break}nc(l,Mi,Os);break;case 5:nc(l,Mi,Os);break;default:throw Error(r(329))}}}return Di(l,Er()),l.callbackNode===x?Cb.bind(null,l):null}function n1(l,c){var x=Ph;return l.current.memoizedState.isDehydrated&&(rc(l,c).flags|=256),l=Um(l,c),l!==2&&(c=Mi,Mi=x,c!==null&&i1(c)),l}function i1(l){Mi===null?Mi=l:Mi.push.apply(Mi,l)}function P6(l){for(var c=l;;){if(c.flags&16384){var x=c.updateQueue;if(x!==null&&(x=x.stores,x!==null))for(var O=0;O<x.length;O++){var B=x[O],j=B.getSnapshot;B=B.value;try{if(!ti(j(),B))return!1}catch{return!1}}}if(x=c.child,c.subtreeFlags&16384&&x!==null)x.return=c,c=x;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 Wl(l,c){for(c&=~J0,c&=~Nm,l.suspendedLanes|=c,l.pingedLanes&=~c,l=l.expirationTimes;0<c;){var x=31-jt(c),O=1<<x;l[x]=-1,c&=~O}}function Ob(l){if((Jt&6)!==0)throw Error(r(327));zf();var c=ns(l,0);if((c&1)===0)return Di(l,Er()),null;var x=Um(l,c);if(l.tag!==0&&x===2){var O=ll(l);O!==0&&(c=O,x=n1(l,O))}if(x===1)throw x=_h,rc(l,0),Wl(l,c),Di(l,Er()),x;if(x===6)throw Error(r(345));return l.finishedWork=l.current.alternate,l.finishedLanes=c,nc(l,Mi,Os),Di(l,Er()),null}function a1(l,c){var x=Jt;Jt|=1;try{return l(c)}finally{Jt=x,Jt===0&&(Bf=Er()+500,Pl&&Co())}}function tc(l){Vl!==null&&Vl.tag===0&&(Jt&6)===0&&zf();var c=Jt;Jt|=1;var x=Pa.transition,O=Qt;try{if(Pa.transition=null,Qt=1,l)return l()}finally{Qt=O,Pa.transition=x,Jt=c,(Jt&6)===0&&Co()}}function o1(){Zi=Ff.current,yr(Ff)}function rc(l,c){l.finishedWork=null,l.finishedLanes=0;var x=l.timeoutHandle;if(x!==-1&&(l.timeoutHandle=-1,lh(x)),mn!==null)for(x=mn.return;x!==null;){var O=x;switch(pn(O),O.tag){case 1:O=O.type.childContextTypes,O!=null&&_l();break;case 3:Ar(),yr(An),yr(wn),Rn();break;case 5:Ya(O);break;case 4:Ar();break;case 13:yr(vr);break;case 19:yr(vr);break;case 10:kf(O.type._context);break;case 22:case 23:o1()}x=x.return}if(Ln=l,mn=l=Gl(l.current,null),Xn=Zi=c,Sn=0,_h=null,J0=Nm=ec=0,Mi=Ph=null,wa!==null){for(c=0;c<wa.length;c++)if(x=wa[c],O=x.interleaved,O!==null){x.interleaved=null;var B=O.next,j=x.pending;if(j!==null){var re=j.next;j.next=B,O.next=re}x.pending=O}wa=null}return l}function Ab(l,c){do{var x=mn;try{if(Sf(),Ml.current=Bl,Qi){for(var O=dr.memoizedState;O!==null;){var B=O.queue;B!==null&&(B.pending=null),O=O.next}Qi=!1}if(qn=0,Kr=jr=dr=null,Mo=!1,Ri=0,Z0.current=null,x===null||x.return===null){Sn=1,_h=c,mn=null;break}e:{var j=l,re=x.return,ce=x,ve=c;if(c=Xn,ce.flags|=32768,ve!==null&&typeof ve=="object"&&typeof ve.then=="function"){var De=ve,qe=ce,Ge=qe.tag;if((qe.mode&1)===0&&(Ge===0||Ge===11||Ge===15)){var Ve=qe.alternate;Ve?(qe.updateQueue=Ve.updateQueue,qe.memoizedState=Ve.memoizedState,qe.lanes=Ve.lanes):(qe.updateQueue=null,qe.memoizedState=null)}var dt=C(re);if(dt!==null){dt.flags&=-257,D(dt,re,ce,j,c),dt.mode&1&&g(j,De,c),c=dt,ve=De;var gt=c.updateQueue;if(gt===null){var vt=new Set;vt.add(ve),c.updateQueue=vt}else gt.add(ve);break e}else{if((c&1)===0){g(j,De,c),s1();break e}ve=Error(r(426))}}else if(or&&ce.mode&1){var sn=C(re);if(sn!==null){(sn.flags&65536)===0&&(sn.flags|=256),D(sn,re,ce,j,c),Gu(Cs(ve,ce));break e}}j=ve=Cs(ve,ce),Sn!==4&&(Sn=2),Ph===null?Ph=[j]:Ph.push(j),j=re;do{switch(j.tag){case 3:j.flags|=65536,c&=-c,j.lanes|=c;var Ae=Im(j,ve,c);Qu(j,Ae);break e;case 1:ce=ve;var Se=j.type,Ie=j.stateNode;if((j.flags&128)===0&&(typeof Se.getDerivedStateFromError=="function"||Ie!==null&&typeof Ie.componentDidCatch=="function"&&($l===null||!$l.has(Ie)))){j.flags|=65536,c&=-c,j.lanes|=c;var Ye=m(j,ce,c);Qu(j,Ye);break e}}j=j.return}while(j!==null)}Mb(x)}catch(xt){c=xt,mn===x&&x!==null&&(mn=x=x.return);continue}break}while(!0)}function Ib(){var l=Dm.current;return Dm.current=Bl,l===null?Bl:l}function s1(){(Sn===0||Sn===3||Sn===2)&&(Sn=4),Ln===null||(ec&268435455)===0&&(Nm&268435455)===0||Wl(Ln,Xn)}function Um(l,c){var x=Jt;Jt|=2;var O=Ib();(Ln!==l||Xn!==c)&&(Os=null,rc(l,c));do try{E6();break}catch(B){Ab(l,B)}while(!0);if(Sf(),Jt=x,Dm.current=O,mn!==null)throw Error(r(261));return Ln=null,Xn=0,Sn}function E6(){for(;mn!==null;)Rb(mn)}function T6(){for(;mn!==null&&!da();)Rb(mn)}function Rb(l){var c=Lb(l.alternate,l,Zi);l.memoizedProps=l.pendingProps,c===null?Mb(l):mn=c,Z0.current=null}function Mb(l){var c=l;do{var x=c.alternate;if(l=c.return,(c.flags&32768)===0){if(x=b6(x,c,Zi),x!==null){mn=x;return}}else{if(x=w6(x,c),x!==null){x.flags&=32767,mn=x;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{Sn=6,mn=null;return}}if(c=c.sibling,c!==null){mn=c;return}mn=c=l}while(c!==null);Sn===0&&(Sn=5)}function nc(l,c,x){var O=Qt,B=Pa.transition;try{Pa.transition=null,Qt=1,C6(l,c,x,O)}finally{Pa.transition=B,Qt=O}return null}function C6(l,c,x,O){do zf();while(Vl!==null);if((Jt&6)!==0)throw Error(r(327));x=l.finishedWork;var B=l.finishedLanes;if(x===null)return null;if(l.finishedWork=null,l.finishedLanes=0,x===l.current)throw Error(r(177));l.callbackNode=null,l.callbackPriority=0;var j=x.lanes|x.childLanes;if(B0(l,j),l===Ln&&(mn=Ln=null,Xn=0),(x.subtreeFlags&2064)===0&&(x.flags&2064)===0||Fm||(Fm=!0,Fb(sl,function(){return zf(),null})),j=(x.flags&15990)!==0,(x.subtreeFlags&15990)!==0||j){j=Pa.transition,Pa.transition=null;var re=Qt;Qt=1;var ce=Jt;Jt|=4,Z0.current=null,S6(l,x),kb(x,l),Fu(oh),Xc=!!ah,oh=ah=null,l.current=x,k6(x),jc(),Jt=ce,Qt=re,Pa.transition=j}else l.current=x;if(Fm&&(Fm=!1,Vl=l,Bm=B),j=l.pendingLanes,j===0&&($l=null),wr(x.stateNode),Di(l,Er()),c!==null)for(O=l.onRecoverableError,x=0;x<c.length;x++)B=c[x],O(B.value,{componentStack:B.stack,digest:B.digest});if(Lm)throw Lm=!1,l=t1,t1=null,l;return(Bm&1)!==0&&l.tag!==0&&zf(),j=l.pendingLanes,(j&1)!==0?l===r1?Eh++:(Eh=0,r1=l):Eh=0,Co(),null}function zf(){if(Vl!==null){var l=Ou(Bm),c=Pa.transition,x=Qt;try{if(Pa.transition=null,Qt=16>l?16:l,Vl===null)var O=!1;else{if(l=Vl,Vl=null,Bm=0,(Jt&6)!==0)throw Error(r(331));var B=Jt;for(Jt|=4,mt=l.current;mt!==null;){var j=mt,re=j.child;if((mt.flags&16)!==0){var ce=j.deletions;if(ce!==null){for(var ve=0;ve<ce.length;ve++){var De=ce[ve];for(mt=De;mt!==null;){var qe=mt;switch(qe.tag){case 0:case 11:case 15:kh(8,qe,j)}var Ge=qe.child;if(Ge!==null)Ge.return=qe,mt=Ge;else for(;mt!==null;){qe=mt;var Ve=qe.sibling,dt=qe.return;if(vb(qe),qe===De){mt=null;break}if(Ve!==null){Ve.return=dt,mt=Ve;break}mt=dt}}}var gt=j.alternate;if(gt!==null){var vt=gt.child;if(vt!==null){gt.child=null;do{var sn=vt.sibling;vt.sibling=null,vt=sn}while(vt!==null)}}mt=j}}if((j.subtreeFlags&2064)!==0&&re!==null)re.return=j,mt=re;else e:for(;mt!==null;){if(j=mt,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:kh(9,j,j.return)}var Ae=j.sibling;if(Ae!==null){Ae.return=j.return,mt=Ae;break e}mt=j.return}}var Se=l.current;for(mt=Se;mt!==null;){re=mt;var Ie=re.child;if((re.subtreeFlags&2064)!==0&&Ie!==null)Ie.return=re,mt=Ie;else e:for(re=Se;mt!==null;){if(ce=mt,(ce.flags&2048)!==0)try{switch(ce.tag){case 0:case 11:case 15:Mm(9,ce)}}catch(xt){Zr(ce,ce.return,xt)}if(ce===re){mt=null;break e}var Ye=ce.sibling;if(Ye!==null){Ye.return=ce.return,mt=Ye;break e}mt=ce.return}}if(Jt=B,Co(),gn&&typeof gn.onPostCommitFiberRoot=="function")try{gn.onPostCommitFiberRoot(za,l)}catch{}O=!0}return O}finally{Qt=x,Pa.transition=c}}return!1}function Db(l,c,x){c=Cs(x,c),c=Im(l,c,1),l=ka(l,c,1),c=Si(),l!==null&&(Cu(l,1,c),Di(l,c))}function Zr(l,c,x){if(l.tag===3)Db(l,l,x);else for(;c!==null;){if(c.tag===3){Db(c,l,x);break}else if(c.tag===1){var O=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof O.componentDidCatch=="function"&&($l===null||!$l.has(O))){l=Cs(x,l),l=m(c,l,1),c=ka(c,l,1),l=Si(),c!==null&&(Cu(c,1,l),Di(c,l));break}}c=c.return}}function O6(l,c,x){var O=l.pingCache;O!==null&&O.delete(c),c=Si(),l.pingedLanes|=l.suspendedLanes&x,Ln===l&&(Xn&x)===x&&(Sn===4||Sn===3&&(Xn&130023424)===Xn&&500>Er()-e1?rc(l,0):J0|=x),Di(l,c)}function Nb(l,c){c===0&&((l.mode&1)===0?c=1:(c=ja,ja<<=1,(ja&130023424)===0&&(ja=4194304)));var x=Si();l=wi(l,c),l!==null&&(Cu(l,c,x),Di(l,x))}function A6(l){var c=l.memoizedState,x=0;c!==null&&(x=c.retryLane),Nb(l,x)}function I6(l,c){var x=0;switch(l.tag){case 13:var O=l.stateNode,B=l.memoizedState;B!==null&&(x=B.retryLane);break;case 19:O=l.stateNode;break;default:throw Error(r(314))}O!==null&&O.delete(c),Nb(l,x)}var Lb;Lb=function(l,c,x){if(l!==null)if(l.memoizedProps!==c.pendingProps||An.current)Y=!0;else{if((l.lanes&x)===0&&(c.flags&128)===0)return Y=!1,W0(l,c,x);Y=(l.flags&131072)!==0}else Y=!1,or&&(c.flags&1048576)!==0&&wm(c,Ao,c.index);switch(c.lanes=0,c.tag){case 2:var O=c.type;Vt(l,c),l=c.pendingProps;var B=bs(c,wn.current);Xa(c,x),B=Dl(null,c,O,l,B,x);var j=Nl();return c.flags|=1,typeof B=="object"&&B!==null&&typeof B.render=="function"&&B.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,In(O)?(j=!0,ws(c)):j=!1,c.memoizedState=B.state!==null&&B.state!==void 0?B.state:null,Ku(c),B.updater=jl,c.stateNode=B,B._reactInternals=c,Df(c,O,l,x),c=sr(null,c,O,!0,j,x)):(c.tag=0,or&&j&&El(c),ie(null,c,B,x),c=c.child),c;case 16:O=c.elementType;e:{switch(Vt(l,c),l=c.pendingProps,B=O._init,O=B(O._payload),c.type=O,B=c.tag=M6(O),l=xn(O,l),B){case 0:c=st(null,c,O,l,x);break e;case 1:c=br(null,c,O,l,x);break e;case 11:c=Pe(null,c,O,l,x);break e;case 14:c=Le(null,c,O,xn(O.type,l),x);break e}throw Error(r(306,O,""))}return c;case 0:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:xn(O,B),st(l,c,O,B,x);case 1:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:xn(O,B),br(l,c,O,B,x);case 3:e:{if(Wn(c),l===null)throw Error(r(387));O=c.pendingProps,j=c.memoizedState,B=j.element,Pf(l,c),Al(c,O,null,x);var re=c.memoizedState;if(O=re.element,j.isDehydrated)if(j={element:O,isDehydrated:!1,cache:re.cache,pendingSuspenseBoundaries:re.pendingSuspenseBoundaries,transitions:re.transitions},c.updateQueue.baseState=j,c.memoizedState=j,c.flags&256){B=Cs(Error(r(423)),c),c=_a(l,c,O,x,B);break e}else if(O!==B){B=Cs(Error(r(424)),c),c=_a(l,c,O,x,B);break e}else for(tt=ga(c.stateNode.containerInfo.firstChild),yi=c,or=!0,vi=null,x=Ii(c,null,O,x),c.child=x;x;)x.flags=x.flags&-3|4096,x=x.sibling;else{if(_s(),O===B){c=Nn(l,c,x);break e}ie(l,c,O,x)}c=c.child}return c;case 5:return Il(c),l===null&&Tl(c),O=c.type,B=c.pendingProps,j=l!==null?l.memoizedProps:null,re=B.children,sh(O,B)?re=null:j!==null&&sh(O,j)&&(c.flags|=32),Mt(l,c),ie(l,c,re,x),c.child;case 6:return l===null&&Tl(c),null;case 13:return Be(l,c,x);case 4:return Ro(c,c.stateNode.containerInfo),O=c.pendingProps,l===null?c.child=Ps(c,null,O,x):ie(l,c,O,x),c.child;case 11:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:xn(O,B),Pe(l,c,O,B,x);case 7:return ie(l,c,c.pendingProps,x),c.child;case 8:return ie(l,c,c.pendingProps.children,x),c.child;case 12:return ie(l,c,c.pendingProps.children,x),c.child;case 10:e:{if(O=c.type._context,B=c.pendingProps,j=c.memoizedProps,re=B.value,pr(Xu,O._currentValue),O._currentValue=re,j!==null)if(ti(j.value,re)){if(j.children===B.children&&!An.current){c=Nn(l,c,x);break e}}else for(j=c.child,j!==null&&(j.return=c);j!==null;){var ce=j.dependencies;if(ce!==null){re=j.child;for(var ve=ce.firstContext;ve!==null;){if(ve.context===O){if(j.tag===1){ve=Sa(-1,x&-x),ve.tag=2;var De=j.updateQueue;if(De!==null){De=De.shared;var qe=De.pending;qe===null?ve.next=ve:(ve.next=qe.next,qe.next=ve),De.pending=ve}}j.lanes|=x,ve=j.alternate,ve!==null&&(ve.lanes|=x),_f(j.return,x,c),ce.lanes|=x;break}ve=ve.next}}else if(j.tag===10)re=j.type===c.type?null:j.child;else if(j.tag===18){if(re=j.return,re===null)throw Error(r(341));re.lanes|=x,ce=re.alternate,ce!==null&&(ce.lanes|=x),_f(re,x,c),re=j.sibling}else re=j.child;if(re!==null)re.return=j;else for(re=j;re!==null;){if(re===c){re=null;break}if(j=re.sibling,j!==null){j.return=re.return,re=j;break}re=re.return}j=re}ie(l,c,B.children,x),c=c.child}return c;case 9:return B=c.type,O=c.pendingProps.children,Xa(c,x),B=Vn(B),O=O(B),c.flags|=1,ie(l,c,O,x),c.child;case 14:return O=c.type,B=xn(O,c.pendingProps),B=xn(O.type,B),Le(l,c,O,B,x);case 15:return Xe(l,c,c.type,c.pendingProps,x);case 17:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:xn(O,B),Vt(l,c),c.tag=1,In(O)?(l=!0,ws(c)):l=!1,Xa(c,x),Am(c,O,B),Df(c,O,B,x),sr(null,c,O,!0,l,x);case 19:return on(l,c,x);case 22:return ht(l,c,x)}throw Error(r(156,c.tag))};function Fb(l,c){return es(l,c)}function R6(l,c,x,O){this.tag=l,this.key=x,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,x,O){return new R6(l,c,x,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===F)return 11;if(l===X)return 14}return 2}function Gl(l,c){var x=l.alternate;return x===null?(x=Ea(l.tag,c,l.key,l.mode),x.elementType=l.elementType,x.type=l.type,x.stateNode=l.stateNode,x.alternate=l,l.alternate=x):(x.pendingProps=c,x.type=l.type,x.flags=0,x.subtreeFlags=0,x.deletions=null),x.flags=l.flags&14680064,x.childLanes=l.childLanes,x.lanes=l.lanes,x.child=l.child,x.memoizedProps=l.memoizedProps,x.memoizedState=l.memoizedState,x.updateQueue=l.updateQueue,c=l.dependencies,x.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},x.sibling=l.sibling,x.index=l.index,x.ref=l.ref,x}function Hm(l,c,x,O,B,j){var re=2;if(O=l,typeof l=="function")l1(l)&&(re=1);else if(typeof l=="string")re=5;else e:switch(l){case T:return ic(x.children,B,j,c);case I:re=8,B|=8;break;case M:return l=Ea(12,x,c,B|2),l.elementType=M,l.lanes=j,l;case H:return l=Ea(13,x,c,B),l.elementType=H,l.lanes=j,l;case $:return l=Ea(19,x,c,B),l.elementType=$,l.lanes=j,l;case ee:return $m(x,B,j,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case R:re=10;break e;case N:re=9;break e;case F:re=11;break e;case X:re=14;break e;case Z:re=16,O=null;break e}throw Error(r(130,l==null?l:typeof l,""))}return c=Ea(re,x,c,B),c.elementType=l,c.type=O,c.lanes=j,c}function ic(l,c,x,O){return l=Ea(7,l,O,c),l.lanes=x,l}function $m(l,c,x,O){return l=Ea(22,l,O,c),l.elementType=ee,l.lanes=x,l.stateNode={isHidden:!1},l}function u1(l,c,x){return l=Ea(6,l,null,c),l.lanes=x,l}function c1(l,c,x){return c=Ea(4,l.children!==null?l.children:[],l.key,c),c.lanes=x,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function D6(l,c,x,O,B){this.tag=c,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ci(0),this.expirationTimes=ci(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ci(0),this.identifierPrefix=O,this.onRecoverableError=B,this.mutableSourceEagerHydrationData=null}function f1(l,c,x,O,B,j,re,ce,ve){return l=new D6(l,c,x,ce,ve),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:x,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ku(j),l}function N6(l,c,x){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:x}}function Bb(l){if(!l)return va;l=l._reactInternals;e:{if(Cn(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(In(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(r(171))}if(l.tag===1){var x=l.type;if(In(x))return yf(l,x,c)}return c}function zb(l,c,x,O,B,j,re,ce,ve){return l=f1(x,O,!0,l,B,j,re,ce,ve),l.context=Bb(null),x=l.current,O=Si(),B=ql(x),j=Sa(O,B),j.callback=c??null,ka(x,j,B),l.current.lanes=B,Cu(l,B,O),Di(l,O),l}function Vm(l,c,x,O){var B=c.current,j=Si(),re=ql(B);return x=Bb(x),c.context===null?c.context=x:c.pendingContext=x,c=Sa(j,re),c.payload={element:l},O=O===void 0?null:O,O!==null&&(c.callback=O),l=ka(B,c,re),l!==null&&(eo(l,B,re,j),Ef(l,B,re)),re}function qm(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 x=l.retryLane;l.retryLane=x!==0&&x<c?x: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));Vm(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(){Vm(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 x=0;x<ma.length&&c!==0&&c<ma[x].priority;x++);ma.splice(x,0,l),x===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,x,O,B){if(B){if(typeof O=="function"){var j=O;O=function(){var De=qm(re);j.call(De)}}var re=zb(c,O,l,0,null,!1,!1,"",Hb);return l._reactRootContainer=re,l[ya]=re.current,ps(l.nodeType===8?l.parentNode:l),tc(),re}for(;B=l.lastChild;)l.removeChild(B);if(typeof O=="function"){var ce=O;O=function(){var De=qm(ve);ce.call(De)}}var ve=f1(l,0,!1,null,null,!1,!1,"",Hb);return l._reactRootContainer=ve,l[ya]=ve.current,ps(l.nodeType===8?l.parentNode:l),tc(function(){Vm(c,ve,x,O)}),ve}function Xm(l,c,x,O,B){var j=x._reactRootContainer;if(j){var re=j;if(typeof B=="function"){var ce=B;B=function(){var ve=qm(re);ce.call(ve)}}Vm(c,re,l,B)}else re=F6(x,c,l,B,O);return qm(re)}ul=function(l){switch(l.tag){case 3:var c=l.stateNode;if(c.current.memoizedState.isDehydrated){var x=cn(c.pendingLanes);x!==0&&(Bd(c,x|1),Di(c,Er()),(Jt&6)===0&&(Bf=Er()+500,Co()))}break;case 13:tc(function(){var O=wi(l,1);if(O!==null){var B=Si();eo(O,l,1,B)}}),d1(l,1)}},cl=function(l){if(l.tag===13){var c=wi(l,134217728);if(c!==null){var x=Si();eo(c,l,134217728,x)}d1(l,134217728)}},Kp=function(l){if(l.tag===13){var c=ql(l),x=wi(l,c);if(x!==null){var O=Si();eo(x,l,c,O)}d1(l,c)}},Qp=function(){return Qt},$c=function(l,c){var x=Qt;try{return Qt=l,c()}finally{Qt=x}},yt=function(l,c,x){switch(c){case"input":if(xe(l,x),c=x.name,x.type==="radio"&&c!=null){for(x=l;x.parentNode;)x=x.parentNode;for(x=x.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<x.length;c++){var O=x[c];if(O!==l&&O.form===l.form){var B=hn(O);if(!B)throw Error(r(90));Re(O),xe(O,B)}}}break;case"textarea":Oe(l,x);break;case"select":c=x.value,c!=null&&Ce(l,!!x.multiple,c,!1)}},ir=a1,er=tc;var B6={usingClientEntryPoint:!1,Events:[Vu,rn,hn,Gt,fr,a1]},Th={findFiberByHostInstance:Eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},z6={bundleType:Th.bundleType,version:Th.version,rendererPackageName:Th.rendererPackageName,rendererConfig:Th.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=ui(l),l===null?null:l.stateNode},findFiberByHostInstance:Th.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{za=Ym.inject(z6),gn=Ym}catch{}}return Ni.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B6,Ni.createPortal=function(l,c){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p1(c))throw Error(r(200));return N6(l,c,null,x)},Ni.createRoot=function(l,c){if(!p1(l))throw Error(r(299));var x=!1,O="",B=Ub;return c!=null&&(c.unstable_strictMode===!0&&(x=!0),c.identifierPrefix!==void 0&&(O=c.identifierPrefix),c.onRecoverableError!==void 0&&(B=c.onRecoverableError)),c=f1(l,1,!1,null,null,x,!1,O,B),l[ya]=c.current,ps(l.nodeType===8?l.parentNode:l),new h1(c)},Ni.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=ui(c),l=l===null?null:l.stateNode,l},Ni.flushSync=function(l){return tc(l)},Ni.hydrate=function(l,c,x){if(!Gm(c))throw Error(r(200));return Xm(null,l,c,!0,x)},Ni.hydrateRoot=function(l,c,x){if(!p1(l))throw Error(r(405));var O=x!=null&&x.hydratedSources||null,B=!1,j="",re=Ub;if(x!=null&&(x.unstable_strictMode===!0&&(B=!0),x.identifierPrefix!==void 0&&(j=x.identifierPrefix),x.onRecoverableError!==void 0&&(re=x.onRecoverableError)),c=zb(c,null,l,1,x??null,B,!1,j,re),l[ya]=c.current,ps(l),O)for(l=0;l<O.length;l++)x=O[l],B=x._getVersion,B=B(x._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[x,B]:c.mutableSourceEagerHydrationData.push(x,B);return new Wm(c)},Ni.render=function(l,c,x){if(!Gm(c))throw Error(r(200));return Xm(null,l,c,!1,x)},Ni.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},Ni.unstable_batchedUpdates=a1,Ni.unstable_renderSubtreeIntoContainer=function(l,c,x,O){if(!Gm(x))throw Error(r(200));if(l==null||l._reactInternals===void 0)throw Error(r(38));return Xm(l,c,x,!1,O)},Ni.version="18.3.1-next-f1338f8080-20240426",Ni}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 zt(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];throw new Error(typeof t=="number"?"[MobX] minified error nr: "+t+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+t)}var 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,Vo=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||zt("Proxy not available")}function iS(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}var ed=function(){};function la(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 du(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){Vo(t,e,{enumerable:!1,writable:!0,configurable:!0,value:r})}function oS(t,e,r){Vo(t,e,{enumerable:!1,writable:!1,configurable:!0,value:r})}function gu(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 Bs(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 ia(t,e){return!!(t&e)}function aa(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 td(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 hu(){return hu=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},hu.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 Uo=Symbol("mobx-stored-annotations");function qo(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,Uo)||c0(t,Uo,hu({},t[Uo])),f_(r)||(t[Uo][e]=r)}function a_(t){return Vs(t,Uo)||c0(t,Uo,hu({},t[Uo])),t[Uo]}function Np(t){return typeof t=="object"&&typeof t.kind=="string"}var Ot=Symbol("mobx administration"),yu=(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_=nr.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(){Fi(),TS(this),Bi()},e.toString=function(){return this.name_},Cd(t,[{key:"isBeingObserved",get:function(){return ia(this.flags_,t.isBeingObservedMask_)},set:function(n){this.flags_=aa(this.flags_,t.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return ia(this.flags_,t.isPendingUnobservationMask_)},set:function(n){this.flags_=aa(this.flags_,t.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return ia(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=aa(this.flags_,t.diffValueMask_,n===1)}}])})();yu.isBeingObservedMask_=1;yu.isPendingUnobservationMask_=2;yu.diffValueMask_=4;var g2=gu("Atom",yu);function Mg(t,e,r){e===void 0&&(e=ed),r===void 0&&(r=ed);var n=new yu(t);return e!==ed&&p9(n,e),r!==ed&&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)?Wt.array(t,{name:r}):du(t)?Wt.object(t,void 0,{name:r}):Td(t)?Wt.map(t,{name:r}):Bs(t)?Wt.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||lo(t)||Qo(t)||Fa(t)||_i(t))return t;if(Array.isArray(t))return Wt.array(t,{name:r,deep:!1});if(du(t))return Wt.object(t,void 0,{name:r,deep:!1});if(Td(t))return Wt.map(t,{name:r,deep:!1});if(Bs(t))return Wt.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 Vo(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 pu((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}zt("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=rt.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:pu((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 Vo(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=rt.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,hu({},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=hu({},r.options_,{get:t,context:this});o.name||(o.name="ObservableObject."+n.toString()),a.values_.set(n,new ao(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 cu(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:pu(e.toString(),r.set);return n===t.target_?t.defineProperty_(e,{configurable:rt.safeDescriptors?t.isPlainObject_:!0,set:o})===null?0:2:(Vo(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?Wt.ref:Wt;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:rt.safeDescriptors?t.isPlainObject_:!0,set:pu(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?Wt.ref:Wt;return s.extend_(t,e,r,n)}function R_(t,e){zt("'"+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=qo(_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:du(t)?Wt.object(t,e,r):Array.isArray(t)?Wt.array(t,e):Td(t)?Wt.map(t,e):Bs(t)?Wt.set(t,e):typeof t=="object"&&t!==null?t:Wt.box(t,e)}rS(gS,mS);var H_={box:function(e,r){var n=Qm(r);return new cu(e,Zm(n),n.name,!0,n.equals)},array:function(e,r){var n=Qm(r);return(rt.useProxies===!1||n.proxy===!1?V9: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(rt.useProxies===!1||n?.proxy===!1?Od({},n):I9({},n),e,r)})},ref:qo(F_),shallow:qo(B_),deep:mS,struct:qo(z_)},Wt=rS(gS,H_),yS="computed",$_="computed.struct",Pv=y2(yS),V_=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(du(e))return qo(y2(yS,e));var n=du(r)?r:{};return n.get=e,n.name||(n.name=e.name||""),new ao(n)};Object.assign(Ac,Pv);Ac.struct=qo(V_);var Zb,Jb,Dg=0,q_=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 pu(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,Vo(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=rt.trackingDerivation,s=!e||!o;Fi();var u=rt.allowStateChanges;s&&(Ic(),u=p0(!0));var d=v2(!0),f={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:u,prevAllowStateReads_:d,notifySpy_:i,startTime_:a,actionId_:q_++,parentActionId_:Dg};return Dg=f.actionId_,f}function X_(t){Dg!==t.actionId_&&zt(30),Dg=t.parentActionId_,t.error_!==void 0&&(rt.suppressReactionErrors=!0),m0(t.prevAllowStateChanges_),ep(t.prevAllowStateReads_),Bi(),t.runAsAction_&&qs(t.prevDerivation_),rt.suppressReactionErrors=!1}function bS(t,e){var r=p0(t);try{return e()}finally{m0(r)}}function p0(t){var e=rt.allowStateChanges;return rt.allowStateChanges=t,e}function m0(t){rt.allowStateChanges=t}var cu=(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!==rt.UNCHANGED&&this.setNewValue_(i)},r.prepareNewValue_=function(i){if(Oa(this)){var a=Aa(this,{object:this,type:Wo,newValue:i});if(!a)return rt.UNCHANGED;i=a.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?rt.UNCHANGED:i},r.setNewValue_=function(i){var a=this.value_;this.value_=i,this.reportChanged(),no(this)&&io(this,{type:Wo,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:Wo,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})(yu),Y_=gu("ObservableValue",cu),ao=(function(){function t(r){this.dependenciesState_=nr.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=nr.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||zt(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=pu("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&&zt(32,this.name_,this.derivation),rt.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Ev(this)&&(this.warnAboutUntrackedRead_(),Fi(),this.value_=this.computeValue_(!1),Bi());else if(ES(this),Ev(this)){var n=rt.trackingContext;this.keepAlive_&&!n&&(rt.trackingContext=this),this.trackAndCompute()&&e9(this),rt.trackingContext=n}var i=this.value_;if(vg(i))throw i.cause;return i},e.set=function(n){if(this.setter_){this.isRunningSetter&&zt(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter=!1}}else zt(34,this.name_)},e.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===nr.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(rt.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 oo(function(){var u=a.get();if(!o||i){var d=Ic();n({observableKind:"computed",debugObjectName:a.name_,type:Wo,object:a,newValue:u,oldValue:s}),qs(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 ia(this.flags_,t.isComputingMask_)},set:function(n){this.flags_=aa(this.flags_,t.isComputingMask_,n)}},{key:"isRunningSetter",get:function(){return ia(this.flags_,t.isRunningSetterMask_)},set:function(n){this.flags_=aa(this.flags_,t.isRunningSetterMask_,n)}},{key:"isBeingObserved",get:function(){return ia(this.flags_,t.isBeingObservedMask_)},set:function(n){this.flags_=aa(this.flags_,t.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return ia(this.flags_,t.isPendingUnobservationMask_)},set:function(n){this.flags_=aa(this.flags_,t.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return ia(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=aa(this.flags_,t.diffValueMask_,n===1)}}])})();ao.isComputingMask_=1;ao.isRunningSetterMask_=2;ao.isBeingObservedMask_=4;ao.isPendingUnobservationMask_=8;ao.diffValueMask_=16;var g0=gu("ComputedValue",ao),nr;(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_"})(nr||(nr={}));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 nr.UP_TO_DATE_:return!1;case nr.NOT_TRACKING_:case nr.STALE_:return!0;case nr.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(rt.disableErrorBoundaries)o.get();else try{o.get()}catch{return qs(r),ep(e),!0}if(t.dependenciesState_===nr.STALE_)return qs(r),ep(e),!0}}return SS(t),qs(r),ep(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_=++rt.runId;var i=rt.trackingDerivation;rt.trackingDerivation=t,rt.inBatch++;var a;if(rt.disableErrorBoundaries===!0)a=e.call(r);else try{a=e.call(r)}catch(o){a=new Lg(o)}return rt.inBatch--,rt.trackingDerivation=i,K_(t),ep(n),a}function K_(t){for(var e=t.observing_,r=t.observing_=t.newObserving_,n=nr.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!==nr.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_=nr.NOT_TRACKING_}function xS(t){var e=Ic();try{return t()}finally{qs(e)}}function Ic(){var t=rt.trackingDerivation;return rt.trackingDerivation=null,t}function qs(t){rt.trackingDerivation=t}function v2(t){var e=rt.allowStateReads;return rt.allowStateReads=t,e}function ep(t){rt.allowStateReads=t}function SS(t){if(t.dependenciesState_!==nr.UP_TO_DATE_){t.dependenciesState_=nr.UP_TO_DATE_;for(var e=t.observing_,r=e.length;r--;)e[r].lowestObserverState_=nr.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,rt=(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||zt(35)},1),new bg)})();function Q_(){if((rt.pendingReactions.length||rt.inBatch||rt.isRunningReactions)&&zt(36),kS=!0,wg){var t=s0();--t.__mobxInstanceCount===0&&(t.__mobxGlobals=void 0),rt=new bg}}function Z_(){return rt}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,rt.pendingUnobservations.push(t))}function Fi(){rt.inBatch++}function Bi(){if(--rt.inBatch===0){CS();for(var t=rt.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 ao&&r.suspend_())}rt.pendingUnobservations=[]}}function ES(t){var e=rt.trackingDerivation;return e!==null?(e.runId_!==t.lastAccessedBy_&&(t.lastAccessedBy_=e.runId_,e.newObserving_[e.unboundDepsCount_++]=t,!t.isBeingObserved&&rt.trackingContext&&(t.isBeingObserved=!0,t.onBO())),t.isBeingObserved):(t.observers_.size===0&&rt.inBatch>0&&PS(t),!1)}function TS(t){t.lowestObserverState_!==nr.STALE_&&(t.lowestObserverState_=nr.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===nr.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=nr.STALE_}))}function e9(t){t.lowestObserverState_!==nr.STALE_&&(t.lowestObserverState_=nr.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===nr.POSSIBLY_STALE_?e.dependenciesState_=nr.STALE_:e.dependenciesState_===nr.UP_TO_DATE_&&(t.lowestObserverState_=nr.UP_TO_DATE_)}))}function t9(t){t.lowestObserverState_===nr.UP_TO_DATE_&&(t.lowestObserverState_=nr.POSSIBLY_STALE_,t.observers_.forEach(function(e){e.dependenciesState_===nr.UP_TO_DATE_&&(e.dependenciesState_=nr.POSSIBLY_STALE_,e.onBecomeStale_())}))}var Go=(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_=nr.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,rt.pendingReactions.push(this),CS())},e.runReaction_=function(){if(!this.isDisposed){Fi(),this.isScheduled=!1;var n=rt.trackingContext;if(rt.trackingContext=this,Ev(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(i){this.reportExceptionInDerivation_(i)}}rt.trackingContext=n,Bi()}},e.track=function(n){if(!this.isDisposed){Fi(),this.isRunning=!0;var i=rt.trackingContext;rt.trackingContext=this;var a=wS(this,n,void 0);rt.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Tv(this),vg(a)&&this.reportExceptionInDerivation_(a.cause),Bi()}},e.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(rt.disableErrorBoundaries)throw n;var a="[mobx] uncaught error in '"+this+"'";rt.suppressReactionErrors||console.error(a,n),rt.globalReactionErrorHandlers.forEach(function(o){return o(n,i)})},e.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Fi(),Tv(this),Bi()))},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 ia(this.flags_,t.isDisposedMask_)},set:function(n){this.flags_=aa(this.flags_,t.isDisposedMask_,n)}},{key:"isScheduled",get:function(){return ia(this.flags_,t.isScheduledMask_)},set:function(n){this.flags_=aa(this.flags_,t.isScheduledMask_,n)}},{key:"isTrackPending",get:function(){return ia(this.flags_,t.isTrackPendingMask_)},set:function(n){this.flags_=aa(this.flags_,t.isTrackPendingMask_,n)}},{key:"isRunning",get:function(){return ia(this.flags_,t.isRunningMask_)},set:function(n){this.flags_=aa(this.flags_,t.isRunningMask_,n)}},{key:"diffValue",get:function(){return ia(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=aa(this.flags_,t.diffValueMask_,n===1)}}])})();Go.isDisposedMask_=1;Go.isScheduledMask_=2;Go.isTrackPendingMask_=4;Go.isRunningMask_=8;Go.diffValueMask_=16;var r9=100,Cv=function(e){return e()};function CS(){rt.inBatch>0||rt.isRunningReactions||Cv(n9)}function n9(){rt.isRunningReactions=!0;for(var t=rt.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_()}rt.isRunningReactions=!1}var Fg=gu("Reaction",Go);function i9(t){var e=Cv;Cv=function(n){return t(function(){return e(n)})}}function tp(){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(la(n))return pu(n.name||IS,n,t);if(la(i))return pu(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 qo(Lp(t?AS:OS,{name:n,autoAction:t}))};return e}var Bt=RS(!1);Object.assign(Bt,Ov);var gp=RS(!0);Object.assign(gp,Av);Bt.bound=qo(l9);gp.bound=qo(u9);function Ca(t){return vS(t.name||IS,!1,t,this,void 0)}function bd(t){return la(t)&&t.isMobxAction===!0}function oo(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 Go(o,function(){this.track(p)},e.onError,e.requiresObservable);else{var d=MS(e),f=!1;u=new Go(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=Bt(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 Go(o,function(){f||u?b():p||(p=!0,d(b))},r.onError,r.requiresObservable);function b(){if(p=!1,!v.isDisposed){var w=!1,k=h;v.track(function(){var S=bS(!1,function(){return t(v)});w=f||!y(h,S),h=S}),(f&&r.fireImmediately||!f&&w)&&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=la(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&&(rt.useProxies=e===Jm?!0:e===m9?!1:typeof Proxy<"u"),e==="ifavailable"&&(rt.verifyProxies=!0),r!==void 0){var n=r===Jm?Jm:r===g9;rt.enforceActions=n,rt.allowStateChanges=!(n===!0||n===Jm)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in t&&(rt[i]=!!t[i])}),rt.allowStateReads=!rt.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=Bt(i+" - runid: "+d+" - init",n).apply(s,u),p,h=void 0,y=new Promise(function(v,b){var w=0;p=b;function k(_){h=void 0;var E;try{E=Bt(i+" - runid: "+d+" - yield "+w++,f.next).call(f,_)}catch(A){return b(A)}P(E)}function S(_){h=void 0;var E;try{E=Bt(i+" - runid: "+d+" - yield "+w++,f.throw).call(f,_)}catch(A){return b(A)}P(E)}function P(_){if(la(_?.then)){_.then(P,b);return}return _.done?v(_.value):(h=Promise.resolve(_.value),h.then(k,S))}k(void 0)});return y.cancel=Bt(i+" - runid: "+d+" - cancel",function(){try{h&&tw(h);var v=f.return(void 0),b=Promise.resolve(v.value);b.then(ed,ed),tw(b),p(new BS)}catch(w){p(w)}}),y};return a.isMobXFlow=!0,a},b1);wd.bound=qo(S9);function tw(t){la(t.cancel)&&t.cancel()}function yp(t){return t?.isMobXFlow===!0}function zS(t,e,r){var n;return Fa(t)||Qo(t)||Y_(t)?n=Xo(t):lo(t)&&(n=Xo(t,e)),n.dehancer=typeof e=="function"?e:r,function(){n.dehancer=void 0}}function b2(t,e,r){return la(r)?_9(t,e,r):k9(t,e)}function k9(t,e){return Xo(t).intercept_(e)}function _9(t,e,r){return Xo(t,e).intercept_(r)}function P9(t,e){return t?lo(t)||!!t[Ot]||g2(t)||Fg(t)||g0(t):!1}function jS(t){return P9(t)}function Bg(t){if(lo(t))return t[Ot].keys_();if(Fa(t)||_i(t))return Array.from(t.keys());if(Qo(t))return t.map(function(e,r){return r});zt(5)}function US(t){if(lo(t))return Bg(t).map(function(e){return t[e]});if(Fa(t))return Bg(t).map(function(e){return t.get(e)});if(_i(t))return Array.from(t.values());if(Qo(t))return t.slice();zt(6)}function E9(t){if(lo(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(_i(t))return Array.from(t.entries());if(Qo(t))return t.map(function(e,r){return[r,e]});zt(7)}function HS(t,e,r){if(arguments.length===2&&!_i(t)){Fi();var n=e;try{for(var i in n)HS(t,i,n[i])}finally{Bi()}return}lo(t)?t[Ot].set_(e,r):Fa(t)?t.set(e,r):_i(t)?t.add(e):Qo(t)?(typeof e!="number"&&(e=parseInt(e,10)),e<0&&zt("Invalid index: '"+e+"'"),Fi(),e>=t.length&&(t.length=e+1),t[e]=r,Bi()):zt(8)}function $S(t,e,r){if(lo(t))return t[Ot].defineProperty_(e,r);zt(39)}function w2(t,e,r,n){return la(r)?C9(t,e,r,n):T9(t,e,r)}function T9(t,e,r){return Xo(t).observe_(e,r)}function C9(t,e,r,n){return Xo(t,e).observe_(r,n)}function zs(t,e){e===void 0&&(e=void 0),Fi();try{return t.apply(e)}finally{Bi()}}function rw(t,e,r){return arguments.length===1||e&&typeof e=="object"?O9(t,e):VS(t,e,{})}function VS(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=pu("When-effect",e),o=oo(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=VS(t,o,hu({},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 jf(t){return t[Ot]}var A9={has:function(e,r){return jf(e).has_(r)},get:function(e,r){return jf(e).get_(r)},set:function(e,r,n){var i;return _c(r)?(i=jf(e).set_(r,n,!0))!=null?i:!0:!1},deleteProperty:function(e,r){var n;return _c(r)?(n=jf(e).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(e,r,n){var i;return(i=jf(e).defineProperty_(r,n))!=null?i:!0},ownKeys:function(e){return jf(e).ownKeys_()},preventExtensions:function(e){zt(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&&zt(14),!!e);i++);return e}finally{qs(r)}}function no(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 io(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);qs(r)}}function qS(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",Wo="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(){zt(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 yu(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)&&zt("Out of range: "+n);var i=this.values_.length;if(n!==i)if(n>i){for(var a=new Array(n-i),o=0;o<n-i;o++)a[o]=void 0;this.spliceWithArray_(i,0,a)}else this.spliceWithArray_(n,i-n)},e.updateArrayLength_=function(n,i){n!==this.lastKnownLength_&&zt(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&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_&&tp(),s=no(this),u=s||o?{observableKind:"array",object:this.proxy_,type:Wo,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:a}:null;this.atom_.reportChanged(),s&&io(this,u)},e.notifyArraySplice_=function(n,i,a){var o=!this.owned_&&tp(),s=no(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&&io(this,u)},e.get_=function(n){if(this.legacyMode_&&n>=this.values_.length){console.warn("[mobx] Out of bounds read: "+n);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[n])},e.set_=function(n,i){var a=this.values_;if(this.legacyMode_&&n>a.length&&zt(17,n,a.length),n<a.length){this.atom_;var o=a[n];if(Oa(this)){var s=Aa(this,{type:Wo,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 rt.trackingDerivation&&zt(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){rt.trackingDerivation&&zt(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}};Mr("at",ca);Mr("concat",ca);Mr("flat",ca);Mr("includes",ca);Mr("indexOf",ca);Mr("join",ca);Mr("lastIndexOf",ca);Mr("slice",ca);Mr("toString",ca);Mr("toLocaleString",ca);Mr("toSorted",ca);Mr("toSpliced",ca);Mr("with",ca);Mr("every",so);Mr("filter",so);Mr("find",so);Mr("findIndex",so);Mr("findLast",so);Mr("findLastIndex",so);Mr("flatMap",so);Mr("forEach",so);Mr("map",so);Mr("some",so);Mr("toReversed",so);Mr("reduce",WS);Mr("reduceRight",WS);function Mr(t,e){typeof Array.prototype[t]=="function"&&(zg[t]=e(t))}function ca(t){return function(){var e=this[Ot];e.atom_.reportObserved();var r=e.dehanceValues_(e.values_);return r[t].apply(r,arguments)}}function so(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=gu("ObservableArrayAdministration",x2);function Qo(t){return u0(t)&&N9(t[Ot])}var L9={},nu="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,la(Map)||zt(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(!rt.trackingDerivation)return this.has_(n);var a=this.hasMap_.get(n);if(!a){var o=a=new cu(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?Wo:nu,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=tp(),s=no(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:jg,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return zs(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&&io(this,u),!0}return!1},e.updateValue_=function(n,i){var a=this.data_.get(n);if(i=a.prepareNewValue_(i),i!==rt.UNCHANGED){var o=tp(),s=no(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:Wo,object:this,oldValue:a.value_,name:n,newValue:i}:null;a.setNewValue_(i),s&&io(this,u)}},e.addValue_=function(n,i){var a=this;this.keysAtom_,zs(function(){var d,f=new cu(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=tp(),s=no(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:nu,object:this,name:n,newValue:i}:null;s&&io(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=td(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)),zs(function(){du(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)||zt(19,n),n.forEach(function(a,o){return i.set(o,a)})):n!=null&&zt(20,n)}),this},e.clear=function(){var n=this;zs(function(){xS(function(){for(var i=td(n.keys()),a;!(a=i()).done;){var o=a.value;n.delete(o)}})})},e.replace=function(n){var i=this;return zs(function(){for(var a=F9(n),o=new Map,s=!1,u=td(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=td(a.entries()),v;!(v=y()).done;){var b=v.value,w=b[0],k=b[1],S=i.data_.has(w);if(i.set(w,k),i.data_.has(w)){var P=i.data_.get(w);o.set(w,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=gu("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(du(t)){var e=new Map;for(var r in t)e.set(r,t[r]);return e}else return zt(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,la(Set)||zt(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;zs(function(){xS(function(){for(var i=td(n.data_.values()),a;!(a=i()).done;){var o=a.value;n.delete(o)}})})},e.forEach=function(n,i){for(var a=td(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:nu,object:this,newValue:n});if(!a)return this;n=a.newValue}if(!this.has(n)){zs(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var o=!1,s=no(this),u=s||o?{observableKind:"set",debugObjectName:this.name_,type:nu,object:this,newValue:n}:null;s&&io(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=no(this),u=s||o?{observableKind:"set",debugObjectName:this.name_,type:jg,object:this,oldValue:n}:null;return zs(function(){i.atom_.reportChanged(),i.data_.delete(n)}),s&&io(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(Bs(n)&&!_i(n))return n.intersection(this);var i=new Set(this);return i.intersection(n)},e.union=function(n){if(Bs(n)&&!_i(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(Bs(n)&&!_i(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(Bs(n)&&!_i(n))return n.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(n)},e.replace=function(n){var i=this;return _i(n)&&(n=new Set(n)),zs(function(){Array.isArray(n)?(i.clear(),n.forEach(function(a){return i.add(a)})):Bs(n)?(i.clear(),n.forEach(function(a){return i.add(a)})):n!=null&&zt("Cannot initialize set from "+n)}),this},e.observe_=function(n,i){return 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"}}])})(),_i=gu("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 yu("ObservableObject.keys"),this.isPlainObject_=du(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 ao)return a.set(i),!0;if(Oa(this)){var o=Aa(this,{type:Wo,object:this.proxy_||this.target_,name:n,newValue:i});if(!o)return null;i=o.newValue}if(i=a.prepareNewValue_(i),i!==rt.UNCHANGED){var s=no(this),u=!1,d=s||u?{type:Wo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:a.value_,name:n,newValue:i}:null;a.setNewValue_(i),s&&io(this,d)}return!0},e.get_=function(n){return rt.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(!rt.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new cu(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_[Uo])!=null&&a[n])return;zt(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{Fi();var o=this.delete_(n);if(!o)return o;if(Oa(this)){var s=Aa(this,{object:this.proxy_||this.target_,name:n,type:nu,newValue:i.value});if(!s)return null;var u=s.newValue;i.value!==u&&(i=hu({},i,{value:u}))}if(a){if(!Reflect.defineProperty(this.target_,n,i))return!1}else Vo(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{Bi()}return!0},e.defineObservableProperty_=function(n,i,a,o){o===void 0&&(o=!1),this.keysAtom_;try{Fi();var s=this.delete_(n);if(!s)return s;if(Oa(this)){var u=Aa(this,{object:this.proxy_||this.target_,name:n,type:nu,newValue:i});if(!u)return null;i=u.newValue}var d=lw(n),f={configurable:rt.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:d.get,set:d.set};if(o){if(!Reflect.defineProperty(this.target_,n,f))return!1}else Vo(this.target_,n,f);var p=new cu(i,a,"ObservableObject.key",!1);this.values_.set(n,p),this.notifyPropertyAddition_(n,p.value_)}finally{Bi()}return!0},e.defineComputedProperty_=function(n,i,a){a===void 0&&(a=!1),this.keysAtom_;try{Fi();var o=this.delete_(n);if(!o)return o;if(Oa(this)){var s=Aa(this,{object:this.proxy_||this.target_,name:n,type:nu,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:rt.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,n,d))return!1}else Vo(this.target_,n,d);this.values_.set(n,new ao(i)),this.notifyPropertyAddition_(n,void 0)}finally{Bi()}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;Fi();var s=no(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 cu&&(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&&io(this,h)}}finally{Bi()}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=no(this),s=!1;if(o||s){var u=o||s?{type:nu,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;o&&io(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=gu("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 lo(t){return u0(t)?z9(t[Ot]):!1}function uw(t,e,r){var n;(n=t.target_[Uo])==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 Qo(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){Vo(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 V9(t,e,r){return new k2(t,e,r)}function xd(t,e){if(typeof t=="object"&&t!==null){if(Qo(t))return e!==void 0&&zt(23),t[Ot].atom_;if(_i(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||zt(25,e,Iv(t)),r}if(lo(t)){if(!e)return zt(26);var n=t[Ot].values_.get(e);return n||zt(27,e,Iv(t)),n}if(g2(t)||g0(t)||Fg(t))return t}else if(la(t)&&Fg(t[Ot]))return t[Ot];zt(28)}function Xo(t,e){if(t||zt(29),e!==void 0)return Xo(xd(t,e));if(g2(t)||g0(t)||Fg(t)||Fa(t)||_i(t))return t;if(t[Ot])return t[Ot];zt(24,t)}function Iv(t,e){var r;if(e!==void 0)r=xd(t,e);else{if(bd(t))return t.name;lo(t)||Fa(t)||_i(t)?r=Xo(t):r=xd(t)}return r.name_}function Rc(t){var e=Ic(),r=p0(!0);Fi();try{return t()}finally{Bi(),m0(r),qs(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&&!(la(u)&&u instanceof u&&la(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 Qo(t)?t.slice():Td(t)||Fa(t)||Bs(t)||_i(t)?Array.from(t.entries()):t}var dw,q9=((dw=s0().Iterator)==null?void 0:dw.prototype)||{};function _2(t){return t[Symbol.iterator]=W9,Object.assign(Object.create(q9),t)}function W9(){return this}["Symbol","Map","Set"].forEach(function(t){var e=s0();typeof e[t]>"u"&&zt("MobX requires global '"+t+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:a9,extras:{getDebugName:Iv},$mobx:Ot});if(!qr.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!qS)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,w=v[1];return a(function(){b.value=y,b.getSnapshot=h,u(b)&&w({inst:b})},[p,y,h]),i(function(){return u(b)&&w({inst:b}),p(function(){u(b)&&w({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 Go("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=G.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)),G.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 qr.forwardRef=="function"&&qr.forwardRef(function(t){return null}).$$typeof,yw=e5?Symbol.for("react.memo"):typeof qr.memo=="function"&&qr.memo(function(t){return null}).$$typeof;function _r(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=qr.forwardRef(o)),o=qr.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 qr.useState(function(){return Wt(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:{},Ze={_global:mc,version:"10.2.0",isBrowser:uP(),isUnminified:/param/.test((function(t){}).toString()),dblClickWindow:400,getAngle(t){return Ze.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 Ze.DD.isDragging},isTransforming(){var t,e;return(e=(t=Ze.Transformer)===null||t===void 0?void 0:t.isTransforming())!==null&&e!==void 0?e:!1},isDragReady(){return!!Ze.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}},Gr=t=>{Ze[t.prototype.getClassName()]=t};Ze._injectGlobal(Ze);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 oa{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 oa(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,Ch="#",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=[],Oh=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(Ch,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 Ch+t},isCanvasFarblingActive(){if(Oh!==null)return Oh;if(typeof document>"u")return Oh=!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 Oh=n,this.releaseCanvas(t),Oh},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),Ch+this._rgbToHex(t,e,r)},getSnappedHexColor(t){const e=this._hexToRgb(t);return Ch+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]===Ch?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 Ze.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){Ze.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){Ze.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},w={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+w.x*y,y:s.y+w.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,Ze.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=Ze._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||Ze.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,Ze._mouseListenClick=!1,Ze._touchListenClick=!1,Ze._pointerListenClick=!1,r.dragStatus="stopped");const o=r.node.getLayer()||r.node instanceof Ze.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)})}};Ze.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 vu(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 Ke(){if(Ze.isUnminified)return function(t,e){return Te._isNumber(t)||Te.warn(vu(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function v0(t){if(Ze.isUnminified)return function(e,r){let n=Te._isNumber(e),i=Te._isArray(e)&&e.length==t;return!n&&!i&&Te.warn(vu(e)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function T2(){if(Ze.isUnminified)return function(t,e){return Te._isNumber(t)||t==="auto"||Te.warn(vu(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function Mc(){if(Ze.isUnminified)return function(t,e){return Te._isString(t)||Te.warn(vu(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function r5(){if(Ze.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(vu(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function LP(){if(Ze.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(vu(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function uo(){if(Ze.isUnminified)return function(t,e){return t===!0||t===!1||Te.warn(vu(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function FP(t){if(Ze.isUnminified)return function(e,r){return e==null||Te.isObject(e)||Te.warn(vu(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+t),e}}const Ah="get",Ih="set",de={addGetterSetter(t,e,r,n,i){de.addGetter(t,e,r),de.addSetter(t,e,n,i),de.addOverloadedGetterSetter(t,e)},addGetter(t,e,r){const n=Ah+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=Ih+Te._capitalize(e);t.prototype[i]||de.overWriteSetter(t,e,r,n)},overWriteSetter(t,e,r,n){const i=Ih+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=Ah+o(e),u=Ih+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},de.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){const r=Te._capitalize(e),n=Ih+r,i=Ah+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=Ah+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},de.addSetter(t,e,n,function(){Te.error(a)}),de.addOverloadedGetterSetter(t,e)},backCompat(t,e){Te.each(e,function(r,n){const i=t.prototype[n],a=Ah+Te._capitalize(r),o=Ih+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=Ze.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=Ze.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=Ze.Filters;u&&u.Contrast&&u.Contrast.call(this,o)}}case"grayscale":return function(a){const o=Ze.Filters;o&&o.Grayscale&&o.Grayscale.call(this,a)};case"sepia":return function(a){const o=Ze.Filters;o&&o.Sepia&&o.Sepia.call(this,a)};case"invert":return function(a){const o=Ze.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",Rs="absoluteTransform",_w="absoluteScale",ac="canvas",zP="Change",jP="children",UP="konva",Dv="listening",HP="mouseenter",$P="mouseleave",VP="pointerenter",qP="pointerleave",WP="touchenter",GP="touchleave",Pw="set",Ew="Shape",Sg=" ",Tw="stage",Ql="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,Qe=class Hh{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===Ql||e===Rs)&&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===Ql||e===Rs)&&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===Rs&&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}),w=new E2({pixelRatio:p,width:i,height:a}),k=v.getContext(),S=w.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 w.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(w,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:w,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(Rs),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&&!Ze.hitOnDragEnabled&&(i||Ze.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(Ql),this._clearSelfAndDescendantCache(Rs)),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 oa,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(Ql);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(Ql),this._clearSelfAndDescendantCache(Rs),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(Rs,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let r;if(e)return r=new oa,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(Rs)||new oa,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(Ql,this._getTransform)}_getTransform(){var e,r;const n=this._cache.get(Ql)||new oa;n.reset();const i=this.x(),a=this.y(),o=Ze.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():Ze.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(Ze.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,VP,qP,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=Hh.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,Hh.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)||Ze.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=Hh.prototype.getClassName.call(e),i=e.children,a,o,s;r&&(e.attrs.container=r),Ze[n]||(Te.warn('Can not find a node with class name "'+n+'". Fallback to "Shape".'),n="Shape");const u=Ze[n];if(a=new u(e.attrs),i)for(o=i.length,s=0;s<o;s++)a.add(Hh._createNode(i[s]));return a}};Qe.protoListenerMap=new Map;Qe.prototype.nodeType="Node";Qe.prototype._attrsAffectingSize=[];Qe.prototype.eventListeners={};Qe.prototype.on.call(Qe.prototype,YP,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Ql),this._clearSelfAndDescendantCache(Rs)});Qe.prototype.on.call(Qe.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Nv)});Qe.prototype.on.call(Qe.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Dv)});Qe.prototype.on.call(Qe.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(xg)});const Pr=de.addGetterSetter;Pr(Qe,"zIndex");Pr(Qe,"absolutePosition");Pr(Qe,"position");Pr(Qe,"x",0,Ke());Pr(Qe,"y",0,Ke());Pr(Qe,"globalCompositeOperation","source-over",Mc());Pr(Qe,"opacity",1,Ke());Pr(Qe,"name","",Mc());Pr(Qe,"id","",Mc());Pr(Qe,"rotation",0,Ke());de.addComponentsGetterSetter(Qe,"scale",["x","y"]);Pr(Qe,"scaleX",1,Ke());Pr(Qe,"scaleY",1,Ke());de.addComponentsGetterSetter(Qe,"skew",["x","y"]);Pr(Qe,"skewX",0,Ke());Pr(Qe,"skewY",0,Ke());de.addComponentsGetterSetter(Qe,"offset",["x","y"]);Pr(Qe,"offsetX",0,Ke());Pr(Qe,"offsetY",0,Ke());Pr(Qe,"dragDistance",void 0,Ke());Pr(Qe,"width",0,Ke());Pr(Qe,"height",0,Ke());Pr(Qe,"listening",!0,uo());Pr(Qe,"preventDefault",!0,uo());Pr(Qe,"filters",void 0,function(t){return this._filterUpToDate=!1,t});Pr(Qe,"visible",!0,uo());Pr(Qe,"transformsEnabled","all",Mc());Pr(Qe,"size");Pr(Qe,"dragBoundFunc");Pr(Qe,"draggable",!1,uo());de.backCompat(Qe,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class sa extends Qe{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=Qe.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=Qe.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 w=this.clipX(),k=this.clipY();o.rect(w||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)}}de.addComponentsGetterSetter(sa,"clip",["x","y","width","height"]);de.addGetterSetter(sa,"clipX",void 0,Ke());de.addGetterSetter(sa,"clipY",void 0,Ke());de.addGetterSetter(sa,"clipWidth",void 0,Ke());de.addGetterSetter(sa,"clipHeight",void 0,Ke());de.addGetterSetter(sa,"clipFunc");const vp=new Map,n5=Ze._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){rp(t),e.getStage()&&(vp.set(t,e),n5&&e._fire("gotpointercapture",C2(new PointerEvent("gotpointercapture"))))}function rp(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",$h="pointermove",Vh="pointerdown",rd="pointerup",qh="pointercancel",eE="lostpointercapture",ng="pointerout",Wh="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"],[$h,"_pointermove"],[rd,"_pointerup"],[qh,"_pointercancel"],[Wh,"_pointerleave"],[eE,"_lostpointercapture"]],C1={mouse:{[ng]:JP,[Wh]:o5,[ig]:s5,[ag]:l5,[$h]:u5,[Vh]:c5,[rd]:f5,[qh]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[ng]:"touchout",[Wh]:"touchleave",[ig]:"touchover",[ag]:"touchenter",[$h]:p5,[Vh]:d5,[rd]:h5,[qh]:m5,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[ng]:ng,[Wh]:Wh,[ig]:ig,[ag]:ag,[$h]:$h,[Vh]:Vh,[rd]:rd,[qh]:qh,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Gh=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",Uf=t=>{const e=Gh(t);if(e==="pointer")return Ze.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);",np=[];let b0=class extends sa{constructor(e){super(Ow(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),np.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"),sa.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Te._isInDocument(e)&&this.container().removeChild(e);const r=np.indexOf(this);return r>-1&&np.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(),Ze.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){rp(e)}getLayers(){return this.children}_bindContentEvents(){Ze.isBrowser&&rE.forEach(([e,r])=>{this.content.addEventListener(e,n=>{this[r](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const r=Uf(e.type);r&&this._fire(r.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const r=Uf(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=Uf(e.type),n=Gh(e.type);if(!r)return;this.setPointersPositions(e);const i=this._getTargetShape(n),a=!(Ze.isDragging()||Ze.isTransforming())||Ze.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=Uf(e.type),n=Gh(e.type);if(!r)return;this.setPointersPositions(e);let i=!1;this._changedPointerPositions.forEach(a=>{const o=this.getIntersection(a);if(lr.justDragged=!1,Ze["_"+n+"ListenClick"]=!0,!o||!o.isListening()){this[n+"ClickStartShape"]=void 0;return}Ze.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=Uf(e.type),n=Gh(e.type);if(!r)return;const i=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Ze.isDragging()&&lr.node.preventDefault()&&e.cancelable&&i&&e.preventDefault(),this.setPointersPositions(e),!(!(Ze.isDragging()||Ze.isTransforming())||Ze.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=Uf(e.type),n=Gh(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;Ze["_"+n+"InDblClickWindow"]?(h=!0,clearTimeout(this[n+"DblTimeout"])):lr.justDragged||(Ze["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){Ze["_"+n+"InDblClickWindow"]=!1},Ze.dblClickWindow),d&&d.isListening()?(s=!0,this[n+"ClickEndShape"]=d,d._fireAndBubble(r.pointerup,{...p}),Ze["_"+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),Ze["_"+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}),Ze["_"+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(rd,C2(e)),rp(e.pointerId)}_lostpointercapture(e){rp(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()}),!Ze.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;Gr(b0);de.addGetterSetter(b0,"container");Ze.isBrowser&&document.addEventListener("visibilitychange",()=>{np.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 ip={};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 We=class extends Qe{constructor(e){super(e);let r,n=0;for(;r=Te.getHitColor(),!(r&&!(r in ip));)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,ip[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 oa;n.translate(this.fillPatternX(),this.fillPatternY()),n.rotate(Ze.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 Qe.prototype.destroy.call(this),delete ip[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),w=p&&this.shadowBlur()||0,k=v+w*2,S=b+w*2,P={width:k,height:S,x:-(u/2+w)+Math.min(h,0)+o.x,y:-(u/2+w)+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){rp(e)}};We.prototype._fillFunc=iE;We.prototype._strokeFunc=aE;We.prototype._fillFuncHit=oE;We.prototype._strokeFuncHit=sE;We.prototype._centroid=!1;We.prototype.nodeType="Shape";Gr(We);We.prototype.eventListeners={};We.prototype.on.call(We.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",lE);We.prototype.on.call(We.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",uE);We.prototype.on.call(We.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",cE);We.prototype.on.call(We.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",fE);We.prototype.on.call(We.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",dE);de.addGetterSetter(We,"stroke",void 0,r5());de.addGetterSetter(We,"strokeWidth",2,Ke());de.addGetterSetter(We,"fillAfterStrokeEnabled",!1);de.addGetterSetter(We,"hitStrokeWidth","auto",T2());de.addGetterSetter(We,"strokeHitEnabled",!0,uo());de.addGetterSetter(We,"perfectDrawEnabled",!0,uo());de.addGetterSetter(We,"shadowForStrokeEnabled",!0,uo());de.addGetterSetter(We,"lineJoin");de.addGetterSetter(We,"lineCap");de.addGetterSetter(We,"miterLimit");de.addGetterSetter(We,"sceneFunc");de.addGetterSetter(We,"hitFunc");de.addGetterSetter(We,"dash");de.addGetterSetter(We,"dashOffset",0,Ke());de.addGetterSetter(We,"shadowColor",void 0,Mc());de.addGetterSetter(We,"shadowBlur",0,Ke());de.addGetterSetter(We,"shadowOpacity",1,Ke());de.addComponentsGetterSetter(We,"shadowOffset",["x","y"]);de.addGetterSetter(We,"shadowOffsetX",0,Ke());de.addGetterSetter(We,"shadowOffsetY",0,Ke());de.addGetterSetter(We,"fillPatternImage");de.addGetterSetter(We,"fill",void 0,r5());de.addGetterSetter(We,"fillPatternX",0,Ke());de.addGetterSetter(We,"fillPatternY",0,Ke());de.addGetterSetter(We,"fillLinearGradientColorStops");de.addGetterSetter(We,"strokeLinearGradientColorStops");de.addGetterSetter(We,"fillRadialGradientStartRadius",0);de.addGetterSetter(We,"fillRadialGradientEndRadius",0);de.addGetterSetter(We,"fillRadialGradientColorStops");de.addGetterSetter(We,"fillPatternRepeat","repeat");de.addGetterSetter(We,"fillEnabled",!0);de.addGetterSetter(We,"strokeEnabled",!0);de.addGetterSetter(We,"shadowEnabled",!0);de.addGetterSetter(We,"dashEnabled",!0);de.addGetterSetter(We,"strokeScaleEnabled",!0);de.addGetterSetter(We,"fillPriority","color");de.addComponentsGetterSetter(We,"fillPatternOffset",["x","y"]);de.addGetterSetter(We,"fillPatternOffsetX",0,Ke());de.addGetterSetter(We,"fillPatternOffsetY",0,Ke());de.addComponentsGetterSetter(We,"fillPatternScale",["x","y"]);de.addGetterSetter(We,"fillPatternScaleX",1,Ke());de.addGetterSetter(We,"fillPatternScaleY",1,Ke());de.addComponentsGetterSetter(We,"fillLinearGradientStartPoint",["x","y"]);de.addComponentsGetterSetter(We,"strokeLinearGradientStartPoint",["x","y"]);de.addGetterSetter(We,"fillLinearGradientStartPointX",0);de.addGetterSetter(We,"strokeLinearGradientStartPointX",0);de.addGetterSetter(We,"fillLinearGradientStartPointY",0);de.addGetterSetter(We,"strokeLinearGradientStartPointY",0);de.addComponentsGetterSetter(We,"fillLinearGradientEndPoint",["x","y"]);de.addComponentsGetterSetter(We,"strokeLinearGradientEndPoint",["x","y"]);de.addGetterSetter(We,"fillLinearGradientEndPointX",0);de.addGetterSetter(We,"strokeLinearGradientEndPointX",0);de.addGetterSetter(We,"fillLinearGradientEndPointY",0);de.addGetterSetter(We,"strokeLinearGradientEndPointY",0);de.addComponentsGetterSetter(We,"fillRadialGradientStartPoint",["x","y"]);de.addGetterSetter(We,"fillRadialGradientStartPointX",0);de.addGetterSetter(We,"fillRadialGradientStartPointY",0);de.addComponentsGetterSetter(We,"fillRadialGradientEndPoint",["x","y"]);de.addGetterSetter(We,"fillRadialGradientEndPointX",0);de.addGetterSetter(We,"fillRadialGradientEndPointY",0);de.addGetterSetter(We,"fillPatternRotation",0);de.addGetterSetter(We,"fillRule",void 0,Mc());de.backCompat(We,{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 sa{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(){Qe.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(!Qe.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(Qe.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(Qe.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 Qe.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(),Qe.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=ip[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(),sa.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(),sa.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";Gr(Dc);de.addGetterSetter(Dc,"imageSmoothingEnabled",!0);de.addGetterSetter(Dc,"clearBeforeDraw",!0);de.addGetterSetter(Dc,"hitGraphEnabled",!0,uo());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";Gr(O2);let Sd=class extends sa{_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";Gr(Sd);const A1=(function(){return mc.performance&&mc.performance.now?function(){return mc.performance.now()}:function(){return new Date().getTime()}})();let Ad=class Gf{constructor(e,r){this.id=Gf.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=Gf.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(),Gf._addAnimation(this),this}stop(){return Gf._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=Gf;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 Ir{constructor(e){const r=this,n=e.node,i=n._id,a=e.easing||ap.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 Ze.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(),Ir.attrs[i]||(Ir.attrs[i]={}),Ir.attrs[i][this._id]||(Ir.attrs[i][this._id]={}),Ir.tweens[i]||(Ir.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=Ir.tweens[i][e];f&&delete Ir.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;Ir.attrs[i][this._id][e]={start:p,diff:a,end:r,trueEnd:s,trueStart:u},Ir.tweens[i][e]=this._id}_tweenFunc(e){const r=this.node,n=Ir.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=Ir.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=Ir.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=Ir.tweens[e];this.pause(),this.anim&&this.anim.stop();for(const i in n)delete Ir.tweens[e][i];delete Ir.attrs[e][r],Ir.tweens[e]&&(Object.keys(Ir.tweens[e]).length===0&&delete Ir.tweens[e],Object.keys(Ir.attrs[e]).length===0&&delete Ir.attrs[e])}}Ir.attrs={};Ir.tweens={};Qe.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new Ir(t).play()};const ap={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-ap.BounceEaseOut(n-t,0,r,n)+e},BounceEaseInOut(t,e,r,n){return t<n/2?ap.BounceEaseIn(t*2,0,r,n)*.5+e:ap.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(Ze,{Util:Te,Transform:oa,Node:Qe,Container:sa,Stage:b0,stages:np,Layer:Dc,FastLayer:O2,Group:Sd,DD:lr,Shape:We,shapes:ip,Animation:Ad,Tween:Ir,Easings:ap,Context:y0,Canvas:P2});let Js=class extends We{_sceneFunc(e){const r=Ze.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=Ze.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"];Gr(Js);de.addGetterSetter(Js,"innerRadius",0,Ke());de.addGetterSetter(Js,"outerRadius",0,Ke());de.addGetterSetter(Js,"angle",0,Ke());de.addGetterSetter(Js,"clockwise",!1,uo());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 We{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"];Gr(el);de.addGetterSetter(el,"closed",!1);de.addGetterSetter(el,"bezier",!1);de.addGetterSetter(el,"tension",0,Ke());de.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,w=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+w)};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 Li extends We{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Li.parsePathData(this.data()),this.pathLength=Li.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,w=d>f?1:d/f,k=d>f?f/d:1;e.translate(s,u),e.rotate(y),e.scale(w,k),e.arc(0,0,b,p,p+h,1-v),e.scale(1/w,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=Li.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=Li.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=Li.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 Li.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 Li.getPointOnLine(e,o.start.x,o.start.y,s[0],s[1]);case"C":return Li.getPointOnCubicBezier(Lw(e,Li.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 Li.getPointOnQuadraticBezier(Lw(e,Li.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,Li.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),w=Math.sqrt(e*e-b*b),k=Math.sqrt(w*w/(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(w){return w*w*w}function p(w){return 3*w*w*(1-w)}function h(w){return 3*w*(1-w)*(1-w)}function y(w){return(1-w)*(1-w)*(1-w)}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 w=0,k=o.length;w<k;w++){const S=o[w];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 w="",k=[];const S=s,P=u;let _,E,A,T,I,M,R,N,F,H;switch(y){case"l":s+=v.shift(),u+=v.shift(),w="L",k.push(s,u);break;case"L":s=v.shift(),u=v.shift(),k.push(s,u);break;case"m":const $=v.shift(),X=v.shift();if(s+=$,u+=X,w="M",a.length>2&&a[a.length-1].command==="z"){for(let Z=a.length-2;Z>=0;Z--)if(a[Z].command==="M"){s=a[Z].points[0]+$,u=a[Z].points[1]+X;break}}k.push(s,u),y="l";break;case"M":s=v.shift(),u=v.shift(),w="M",k.push(s,u),y="L";break;case"h":s+=v.shift(),w="L",k.push(s,u);break;case"H":s=v.shift(),w="L",k.push(s,u);break;case"v":u+=v.shift(),w="L",k.push(s,u);break;case"V":u=v.shift(),w="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(),w="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(),w="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(),w="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(),w="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(),w="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(),w="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(),F=s,H=u,s=v.shift(),u=v.shift(),w="A",k=this.convertEndpointToCenterParameterization(F,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(),F=s,H=u,s+=v.shift(),u+=v.shift(),w="A",k=this.convertEndpointToCenterParameterization(F,H,s,u,R,N,T,I,M);break}a.push({command:w||y,points:k,start:{x:S,y:P},pathLength:this.calcLength(S,P,w||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=Li;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,w=v*-u*p/s,k=(e+n)/2+Math.cos(f)*b-Math.sin(f)*w,S=(r+i)/2+Math.sin(f)*b+Math.cos(f)*w,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-w)/u]),T=[(p-b)/s,(h-w)/u],I=[(-1*p-b)/s,(-1*h-w)/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"];Gr(Ra);de.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";Gr(Nc);de.addGetterSetter(Nc,"pointerLength",10,Ke());de.addGetterSetter(Nc,"pointerWidth",10,Ke());de.addGetterSetter(Nc,"pointerAtBeginning",!1);de.addGetterSetter(Nc,"pointerAtEnding",!0);let Id=class extends We{_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"];Gr(Id);de.addGetterSetter(Id,"radius",0,Ke());class bu extends We{_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)}}bu.prototype.className="Ellipse";bu.prototype._centroid=!0;bu.prototype._attrsAffectingSize=["radiusX","radiusY"];Gr(bu);de.addComponentsGetterSetter(bu,"radius",["x","y"]);de.addGetterSetter(bu,"radiusX",0,Ke());de.addGetterSetter(bu,"radiusY",0,Ke());let co=class S5 extends We{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}};co.prototype.className="Image";co.prototype._attrsAffectingSize=["image"];Gr(co);de.addGetterSetter(co,"cornerRadius",0,v0(4));de.addGetterSetter(co,"image");de.addComponentsGetterSetter(co,"crop",["x","y","width","height"]);de.addGetterSetter(co,"cropX",0,Ke());de.addGetterSetter(co,"cropY",0,Ke());de.addGetterSetter(co,"cropWidth",0,Ke());de.addGetterSetter(co,"cropHeight",0,Ke());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";Gr(A2);let Lc=class extends We{_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";Gr(Lc);de.addGetterSetter(Lc,"pointerDirection",EE);de.addGetterSetter(Lc,"pointerWidth",0,Ke());de.addGetterSetter(Lc,"pointerHeight",0,Ke());de.addGetterSetter(Lc,"cornerRadius",0,v0(4));let zp=class extends We{_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";Gr(zp);de.addGetterSetter(zp,"cornerRadius",0,v0(4));class wu extends We{_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)}}wu.prototype.className="RegularPolygon";wu.prototype._centroid=!0;wu.prototype._attrsAffectingSize=["radius"];Gr(wu);de.addGetterSetter(wu,"radius",0,Ke());de.addGetterSetter(wu,"sides",0,Ke());de.addGetterSetter(wu,"cornerRadius",0,v0(4));const Fw=Math.PI*2;class Fc extends We{_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"];Gr(Fc);de.addGetterSetter(Fc,"innerRadius",0,Ke());de.addGetterSetter(Fc,"outerRadius",0,Ke());class Zo extends We{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)}}Zo.prototype.className="Sprite";Gr(Zo);de.addGetterSetter(Zo,"animation");de.addGetterSetter(Zo,"animations");de.addGetterSetter(Zo,"frameOffsets");de.addGetterSetter(Zo,"image");de.addGetterSetter(Zo,"frameIndex",0,Ke());de.addGetterSetter(Zo,"frameRate",17,Ke());de.backCompat(Zo,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class xu extends We{_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)}}xu.prototype.className="Star";xu.prototype._centroid=!0;xu.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Gr(xu);de.addGetterSetter(xu,"numPoints",5,Ke());de.addGetterSetter(xu,"innerRadius",0,Ke());de.addGetterSetter(xu,"outerRadius",0,Ke());function Zl(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 Hf="auto",CE="center",_5="inherit",Rh="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 Rr=class extends We{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(),w=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(!Ze.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,F=R.width,H=R.lastInParagraph;if(e.save(),h===LE?I+=y-F-o*2:h===CE&&(I+=(y-F-o*2)/2),P){e.save(),e.beginPath();const X=S??(Ze.legacyTextRendering?Math.round(s/2):Math.round(s/4)),Z=I,ee=A+M+X;e.moveTo(Z,ee);const V=h===Rh&&!H?y-o*2:F;e.lineTo(Z+Math.round(V),ee),e.lineWidth=s/15;const Q=this._getLinearGradient();e.strokeStyle=Q||w,e.stroke(),e.restore()}const $=I;if(f!==jw&&(v!==0||h===Rh||b)){const X=N.split(" ").length-1,Z=Zl(N);for(let ee=0;ee<Z.length;ee++){const V=Z[ee];if(V===" "&&!H&&h===Rh&&(I+=(y-o*2-F)/X),this._partialTextX=I,this._partialTextY=A+M,this._partialText=V,b){e.save();const U=i.slice(0,E).reduce((q,W)=>q+Zl(W.text).length,0),L=ee+U;b({char:V,index:L,x:I,y:A+M,lineIndex:E,column:ee,isLastInLine:H,width:this.measureSize(V).width,context:e})}e.fillStrokeShape(this),b&&e.restore(),I+=this.measureSize(V).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 X=Ze.legacyTextRendering?0:-Math.round(s/4),Z=$;e.moveTo(Z,A+M+X);const ee=h===Rh&&!H?y-o*2:F;e.lineTo(Z+Math.round(ee),A+M+X),e.lineWidth=s/15;const V=this._getLinearGradient();e.strokeStyle=V||w,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===Hf||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Hf||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 w=v/100;return{actualBoundingBoxAscent:(r=b.actualBoundingBoxAscent)!==null&&r!==void 0?r:71.58203125*w,actualBoundingBoxDescent:(n=b.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(i=b.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*w,actualBoundingBoxRight:(a=b.actualBoundingBoxRight)!==null&&a!==void 0?a:75.732421875*w,alphabeticBaseline:(o=b.alphabeticBaseline)!==null&&o!==void 0?o:0,emHeightAscent:(s=b.emHeightAscent)!==null&&s!==void 0?s:100*w,emHeightDescent:(u=b.emHeightDescent)!==null&&u!==void 0?u:-20*w,fontBoundingBoxAscent:(d=b.fontBoundingBoxAscent)!==null&&d!==void 0?d:91*w,fontBoundingBoxDescent:(f=b.fontBoundingBoxDescent)!==null&&f!==void 0?f:21*w,hangingBaseline:(p=b.hangingBaseline)!==null&&p!==void 0?p:72.80000305175781*w,ideographicBaseline:(h=b.ideographicBaseline)!==null&&h!==void 0?h:-21*w,width:b.width,height:v}}_getContextFont(){return this.fontStyle()+sg+this.fontVariant()+sg+(this.fontSize()+NE)+jE(this.fontFamily())}_addTextLine(e){this.align()===Rh&&(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!==Hf&&a!==void 0,u=o!==Hf&&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,w=this.ellipsis();this.textArr=[],R1().font=this._getContextFont();const k=w?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=Zl(_).length,I="",M=0;for(;A<T;){const R=A+T>>>1,N=Zl(_),F=N.slice(0,R+1).join(""),H=this._getTextWidth(F);(w&&u&&h+i>p?H+k:H)<=f?(A=R+1,I=F,M=H):T=R}if(I){if(b){const F=Zl(_),H=Zl(I),$=F[H.length],X=$===sg||$===Bw;let Z;if(X&&M<=f)Z=H.length;else{const ee=H.lastIndexOf(sg),V=H.lastIndexOf(Bw);Z=Math.max(ee,V)+1}Z>0&&(A=Z,I=F.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(_=Zl(_).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!==Hf&&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!==Hf&&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()}};Rr.prototype._fillFunc=UE;Rr.prototype._strokeFunc=HE;Rr.prototype.className=RE;Rr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];Gr(Rr);de.overWriteSetter(Rr,"width",T2());de.overWriteSetter(Rr,"height",T2());de.addGetterSetter(Rr,"direction",_5);de.addGetterSetter(Rr,"fontFamily","Arial");de.addGetterSetter(Rr,"fontSize",12,Ke());de.addGetterSetter(Rr,"fontStyle",E5);de.addGetterSetter(Rr,"fontVariant",E5);de.addGetterSetter(Rr,"padding",0,Ke());de.addGetterSetter(Rr,"align",P5);de.addGetterSetter(Rr,"verticalAlign",ME);de.addGetterSetter(Rr,"lineHeight",1,Ke());de.addGetterSetter(Rr,"wrap",FE);de.addGetterSetter(Rr,"ellipsis",!1,uo());de.addGetterSetter(Rr,"letterSpacing",0,Ke());de.addGetterSetter(Rr,"text","",Mc());de.addGetterSetter(Rr,"textDecoration","");de.addGetterSetter(Rr,"underlineOffset",void 0,Ke());de.addGetterSetter(Rr,"charRenderFunc",void 0);const VE="",C5="normal";function O5(t){t.fillText(this.partialText,0,0)}function A5(t){t.strokeText(this.partialText,0,0)}let Pn=class extends We{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 Rr.prototype.setText.call(this,e)}_getContextFont(){return Rr.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=Zl(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 w=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+w/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:w}),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()}};Pn.prototype._fillFunc=O5;Pn.prototype._strokeFunc=A5;Pn.prototype._fillFuncHit=O5;Pn.prototype._strokeFuncHit=A5;Pn.prototype.className="TextPath";Pn.prototype._attrsAffectingSize=["text","fontSize","data"];Gr(Pn);de.addGetterSetter(Pn,"data");de.addGetterSetter(Pn,"fontFamily","Arial");de.addGetterSetter(Pn,"fontSize",12,Ke());de.addGetterSetter(Pn,"fontStyle",C5);de.addGetterSetter(Pn,"align","left");de.addGetterSetter(Pn,"letterSpacing",0,Ke());de.addGetterSetter(Pn,"textBaseline","middle");de.addGetterSetter(Pn,"fontVariant",C5);de.addGetterSetter(Pn,"text",VE);de.addGetterSetter(Pn,"textDecoration","");de.addGetterSetter(Pn,"kerningFunc",void 0);const I5="tr-konva",qE=["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 Ze._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=Ze.getAngle(t[i]),o=Math.abs(a-e)%(Math.PI*2);Math.min(o,Math.PI*2-o)<r&&(n=a)}return n}let Vv=0,Yt=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(qE,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=(Ze.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,-Ze.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 oa;n.rotate(-Ze.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:Ze.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=Ze.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 We({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 w=y+p*b,k=v+h*b,S=Te._sign(s),P=w+p*d*S,_=k+h*d*S;r.moveTo(w,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},Vv++,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=Ze.getAngle(this.rotateAnchorAngle());let _=Math.atan2(-n,r)+Math.PI/2-P;S.height<0&&(_-=Math.PI);const A=Ze.getAngle(this.rotation())+_,T=Ze.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 w=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:w,height:k,rotation:Ze.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();Vv--,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 oa;if(a.rotate(Ze.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 oa;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/o,n.height/o);const u=new oa,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 w=new oa;w.multiply(v.copy().invert()).multiply(p).multiply(v).multiply(b);const k=w.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,w=i/2;let k=1/0;v<0?k=Math.min(k,-w/v):v>0&&(k=Math.min(k,(i-w)/v)),y<0?k=Math.min(k,-b/y):y>0&&(k=Math.min(k,(n-b)/y));const S=b+y*k,P=w+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 Qe.prototype.toObject.call(this)}clone(e){return Qe.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Yt.isTransforming=()=>Vv>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||[]}Yt.prototype.className="Transformer";Gr(Yt);de.addGetterSetter(Yt,"enabledAnchors",Ug,JE);de.addGetterSetter(Yt,"flipEnabled",!0,uo());de.addGetterSetter(Yt,"resizeEnabled",!0);de.addGetterSetter(Yt,"anchorSize",10,Ke());de.addGetterSetter(Yt,"rotateEnabled",!0);de.addGetterSetter(Yt,"rotateLineVisible",!0);de.addGetterSetter(Yt,"rotationSnaps",[]);de.addGetterSetter(Yt,"rotateAnchorOffset",50,Ke());de.addGetterSetter(Yt,"rotateAnchorAngle",0,Ke());de.addGetterSetter(Yt,"rotateAnchorCursor","crosshair");de.addGetterSetter(Yt,"rotationSnapTolerance",5,Ke());de.addGetterSetter(Yt,"borderEnabled",!0);de.addGetterSetter(Yt,"anchorStroke","rgb(0, 161, 255)");de.addGetterSetter(Yt,"anchorStrokeWidth",1,Ke());de.addGetterSetter(Yt,"anchorFill","white");de.addGetterSetter(Yt,"anchorCornerRadius",0,Ke());de.addGetterSetter(Yt,"borderStroke","rgb(0, 161, 255)");de.addGetterSetter(Yt,"borderStrokeWidth",1,Ke());de.addGetterSetter(Yt,"borderDash");de.addGetterSetter(Yt,"keepRatio",!0);de.addGetterSetter(Yt,"shiftBehavior","default");de.addGetterSetter(Yt,"centeredScaling",!1);de.addGetterSetter(Yt,"ignoreStroke",!1);de.addGetterSetter(Yt,"padding",0,Ke());de.addGetterSetter(Yt,"nodes");de.addGetterSetter(Yt,"node");de.addGetterSetter(Yt,"boundBoxFunc");de.addGetterSetter(Yt,"anchorDragBoundFunc");de.addGetterSetter(Yt,"anchorStyleFunc");de.addGetterSetter(Yt,"shouldOverdrawWholeArea",!1);de.addGetterSetter(Yt,"useSingleNodeRotation",!0);de.backCompat(Yt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class tl extends We{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Ze.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"];Gr(tl);de.addGetterSetter(tl,"radius",0,Ke());de.addGetterSetter(tl,"angle",0,Ke());de.addGetterSetter(tl,"clockwise",!1);de.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,w,k,S,P,_,E,A,T,I;const M=e+e+1,R=n-1,N=i-1,F=e+1,H=F*(F+1)/2,$=new $w,X=e7[e],Z=t7[e];let ee=null,V=$,Q=null,U=null;for(let L=1;L<M;L++)V=V.next=new $w,L===F&&(ee=V);V.next=$,s=o=0;for(let L=0;L<i;L++){w=k=S=P=u=d=f=p=0,h=F*(_=r[o]),y=F*(E=r[o+1]),v=F*(A=r[o+2]),b=F*(T=r[o+3]),u+=H*_,d+=H*E,f+=H*A,p+=H*T,V=$;for(let q=0;q<F;q++)V.r=_,V.g=E,V.b=A,V.a=T,V=V.next;for(let q=1;q<F;q++)a=o+((R<q?R:q)<<2),u+=(V.r=_=r[a])*(I=F-q),d+=(V.g=E=r[a+1])*I,f+=(V.b=A=r[a+2])*I,p+=(V.a=T=r[a+3])*I,w+=_,k+=E,S+=A,P+=T,V=V.next;Q=$,U=ee;for(let q=0;q<n;q++)r[o+3]=T=p*X>>Z,T!==0?(T=255/T,r[o]=(u*X>>Z)*T,r[o+1]=(d*X>>Z)*T,r[o+2]=(f*X>>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=q+e+1)<R?a:R)<<2,w+=Q.r=r[a],k+=Q.g=r[a+1],S+=Q.b=r[a+2],P+=Q.a=r[a+3],u+=w,d+=k,f+=S,p+=P,Q=Q.next,h+=_=U.r,y+=E=U.g,v+=A=U.b,b+=T=U.a,w-=_,k-=E,S-=A,P-=T,U=U.next,o+=4;s+=n}for(let L=0;L<n;L++){k=S=P=w=d=f=p=u=0,o=L<<2,h=F*(_=r[o]),y=F*(E=r[o+1]),v=F*(A=r[o+2]),b=F*(T=r[o+3]),u+=H*_,d+=H*E,f+=H*A,p+=H*T,V=$;for(let W=0;W<F;W++)V.r=_,V.g=E,V.b=A,V.a=T,V=V.next;let q=n;for(let W=1;W<=e;W++)o=q+L<<2,u+=(V.r=_=r[o])*(I=F-W),d+=(V.g=E=r[o+1])*I,f+=(V.b=A=r[o+2])*I,p+=(V.a=T=r[o+3])*I,w+=_,k+=E,S+=A,P+=T,V=V.next,W<N&&(q+=n);o=L,Q=$,U=ee;for(let W=0;W<i;W++)a=o<<2,r[a+3]=T=p*X>>Z,T>0?(T=255/T,r[a]=(u*X>>Z)*T,r[a+1]=(d*X>>Z)*T,r[a+2]=(f*X>>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=W+F)<N?a:N)*n<<2,u+=w+=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,w-=_,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)};de.addGetterSetter(Qe,"blurRadius",0,Ke(),de.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};de.addGetterSetter(Qe,"brightness",0,Ke(),de.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};de.addGetterSetter(Qe,"contrast",0,Ke(),de.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)),w=(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,_=w*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,X=0;X<f.length;X+=4,$++)M[$]=.2126*I[X]+.7152*I[X+1]+.0722*I[X+2];const R=[-1,0,1,-2,0,2,-1,0,1],N=[-1,-2,-1,0,0,0,1,2,1],F=[-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 X=1;X<p-1;X++){const Z=$*p+X;let ee=0,V=0;ee+=M[Z+F[0]]*R[0],V+=M[Z+F[0]]*N[0],ee+=M[Z+F[1]]*R[1],V+=M[Z+F[1]]*N[1],ee+=M[Z+F[2]]*R[2],V+=M[Z+F[2]]*N[2],ee+=M[Z+F[3]]*R[3],V+=M[Z+F[3]]*N[3],ee+=M[Z+F[5]]*R[5],V+=M[Z+F[5]]*N[5],ee+=M[Z+F[6]]*R[6],V+=M[Z+F[6]]*N[6],ee+=M[Z+F[7]]*R[7],V+=M[Z+F[7]]*N[7],ee+=M[Z+F[8]]*R[8],V+=M[Z+F[8]]*N[8];const Q=E*ee+A*V,U=H(P+Q*T),L=Z*4;if(k){const q=U-P;f[L]=H(I[L]+q),f[L+1]=H(I[L+1]+q),f[L+2]=H(I[L+2]+q),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 X=$*4,Z=((h-1)*p+$)*4;f[X]=I[X],f[X+1]=I[X+1],f[X+2]=I[X+2],f[X+3]=I[X+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 X=$*p*4,Z=($*p+(p-1))*4;f[X]=I[X],f[X+1]=I[X+1],f[X+2]=I[X+2],f[X+3]=I[X+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};de.addGetterSetter(Qe,"embossStrength",.5,Ke(),de.afterSetFilter);de.addGetterSetter(Qe,"embossWhiteLevel",.5,Ke(),de.afterSetFilter);de.addGetterSetter(Qe,"embossDirection","top-left",void 0,de.afterSetFilter);de.addGetterSetter(Qe,"embossBlend",!1,void 0,de.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,w,k,S;if(h>0)y=i+h*(255-i),v=n-h*(n-0),b=s+h*(255-s),w=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-_),w=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,w,b),e[P+2]=M1(e[P+2],d,f,S,k)};de.addGetterSetter(Qe,"enhance",0,Ke(),de.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}};de.addGetterSetter(Qe,"hue",0,Ke(),de.afterSetFilter);de.addGetterSetter(Qe,"saturation",0,Ke(),de.afterSetFilter);de.addGetterSetter(Qe,"luminance",0,Ke(),de.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,w=.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+w*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,w=.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+w*_,e[k+3]=E}};de.addGetterSetter(Qe,"hue",0,Ke(),de.afterSetFilter);de.addGetterSetter(Qe,"saturation",0,Ke(),de.afterSetFilter);de.addGetterSetter(Qe,"value",0,Ke(),de.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 w=0;w<v;w+=1){const k=Math.sin(w*b),S=Math.cos(w*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];_=(w+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 w,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,w=Math.floor(E),k=Math.floor(_);let A=(k*a+w)*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 w=Te.createCanvasElement();w.width=e,w.height=r;const k=w.getContext("2d").getImageData(0,0,e,r);Te.releaseCanvas(w),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,{})};de.addGetterSetter(Qe,"kaleidoscopePower",2,Ke(),de.afterSetFilter);de.addGetterSetter(Qe,"kaleidoscopeAngle",0,Ke(),de.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 Mh(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(Mh(r,n)<o&&Mh(n,a)<o&&Mh(a,i)<o&&Mh(i,r)<o){const s=g7([n,r,a,i]),u=[];for(let d=0;d<t.width*t.height;d++){const f=Mh(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,w=n[p*i+h];f+=t[b]*w}}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,w=n[p*i+h];f+=t[b]*w}}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,w=n[p*i+h];f+=t[b]*w}}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};de.addGetterSetter(Qe,"threshold",0,Ke(),de.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()};de.addGetterSetter(Qe,"noise",.2,Ke(),de.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,w=b+e;let k=0;for(let S=y;S<v;S+=1)if(!(S>=r))for(let P=b;P<w;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<w;P+=1){if(P>=n)continue;const _=(r*P+S)*4;o[_+0]=d,o[_+1]=f,o[_+2]=p,o[_+3]=h}}};de.addGetterSetter(Qe,"pixelSize",8,Ke(),de.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};de.addGetterSetter(Qe,"levels",.5,Ke(),de.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]}};de.addGetterSetter(Qe,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});de.addGetterSetter(Qe,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});de.addGetterSetter(Qe,"blue",0,t5,de.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}};de.addGetterSetter(Qe,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});de.addGetterSetter(Qe,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});de.addGetterSetter(Qe,"blue",0,t5,de.afterSetFilter);de.addGetterSetter(Qe,"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};de.addGetterSetter(Qe,"threshold",.5,Ke(),de.afterSetFilter);const Pt=Ec.Util._assign(Ec,{Arc:Js,Arrow:Nc,Circle:Id,Ellipse:bu,Image:co,Label:A2,Tag:Lc,Line:el,Path:Ra,Rect:zp,RegularPolygon:wu,Ring:Fc,Sprite:Zo,Star:xu,Text:Rr,TextPath:Pn,Transformer:Yt,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,Vw;function I7(){return Vw||(Vw=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"),w=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 w: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 F(m){return m=N(m),m!==null?H(m):null}function H(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){var g=H(m);if(g!==null)return g;m=m.sibling}return null}function $(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){if(m.tag!==4){var g=$(m);if(g!==null)return g}m=m.sibling}return null}var X=Array.isArray,Z=e.getPublicInstance,ee=e.getRootHostContext,V=e.getChildHostContext,Q=e.prepareForCommit,U=e.resetAfterCommit,L=e.createInstance,q=e.appendInitialChild,W=e.finalizeInitialChildren,J=e.prepareUpdate,te=e.shouldSetTextContent,K=e.createTextInstance,ne=e.scheduleTimeout,fe=e.cancelTimeout,oe=e.noTimeout,ue=e.isPrimaryRenderer,we=e.supportsMutation,Re=e.supportsPersistence,Ne=e.supportsHydration,He=e.getInstanceFromNode,$e=e.preparePortalMount,et=e.getCurrentEventPriority,xe=e.detachDeletedInstance,he=e.supportsMicrotasks,se=e.scheduleMicrotask,ge=e.supportsTestSelectors,Ce=e.findFiberRoot,ae=e.getBoundingRect,_e=e.getTextContent,Oe=e.isHiddenSubtree,Fe=e.matchAccessibilityRole,ot=e.setFocusIfFocusable,ke=e.setupIntersectionObserver,me=e.appendChild,Ue=e.appendChildToContainer,be=e.commitTextUpdate,je=e.commitMount,at=e.commitUpdate,Et=e.insertBefore,bt=e.insertInContainerBefore,At=e.removeChild,le=e.removeChildFromContainer,ye=e.resetTextContent,it=e.hideInstance,pt=e.hideTextInstance,yt=e.unhideInstance,ft=e.unhideTextInstance,Nt=e.clearContainer,Nr=e.cloneInstance,Gt=e.createContainerChildSet,fr=e.appendChildToContainerChildSet,ir=e.finalizeContainerChildren,er=e.replaceContainerChildren,ar=e.cloneHiddenInstance,En=e.cloneHiddenTextInstance,Hr=e.canHydrateInstance,Tn=e.canHydrateTextInstance,Xr=e.canHydrateSuspenseInstance,Pi=e.isSuspenseInstancePending,Jr=e.isSuspenseInstanceFallback,Vi=e.getSuspenseInstanceFallbackErrorDetails,Bn=e.registerSuspenseInstanceRetry,Ei=e.getNextHydratableSibling,al=e.getFirstHydratableChild,Ba=e.getFirstHydratableChildWithinContainer,ol=e.getFirstHydratableChildWithinSuspenseInstance,Cn=e.hydrateInstance,ho=e.hydrateTextInstance,po=e.hydrateSuspenseInstance,Jo=e.getNextHydratableInstanceAfterSuspenseInstance,ui=e.commitHydratedContainer,fa=e.commitHydratedSuspenseInstance,es=e.clearSuspenseBoundary,ts=e.clearSuspenseBoundaryFromContainer,da=e.shouldDeleteUnhydratedTailInstances,jc=e.didNotMatchHydratedContainerTextInstance,Er=e.didNotMatchHydratedTextInstance,Tu;function rs(m){if(Tu===void 0)try{throw Error()}catch(C){var g=C.stack.trim().match(/\n( *(at )?)/);Tu=g&&g[1]||""}return`
|
|
25
|
+
`+Tu+m}var Uc=!1;function sl(m,g){if(!m||Uc)return"";Uc=!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(Xe){var D=Xe}Reflect.construct(m,[],g)}else{try{g.call()}catch(Xe){D=Xe}m.call(g.prototype)}else{try{throw Error()}catch(Xe){D=Xe}m()}}catch(Xe){if(Xe&&D&&typeof Xe.stack=="string"){for(var z=Xe.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 Le=`
|
|
28
|
+
`+z[ie].replace(" at new "," at ");return m.displayName&&Le.includes("<anonymous>")&&(Le=Le.replace("<anonymous>",m.displayName)),Le}while(1<=ie&&0<=Pe);break}}}finally{Uc=!1,Error.prepareStackTrace=C}return(m=m?m.displayName||m.name:"")?rs(m):""}var F0=Object.prototype.hasOwnProperty,Hc=[],za=-1;function gn(m){return{current:m}}function wr(m){0>za||(m.current=Hc[za],Hc[za]=null,za--)}function jt(m,g){za++,Hc[za]=m.current,m.current=g}var mo={},On=gn(mo),Zn=gn(!1),ha=mo;function ja(m,g){var C=m.type.contextTypes;if(!C)return mo;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 cn(m){return m=m.childContextTypes,m!=null}function ns(){wr(Zn),wr(On)}function Xp(m,g,C){if(On.current!==mo)throw Error(o(168));jt(On,g),jt(Zn,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 ll(m){return m=(m=m.stateNode)&&m.__reactInternalMemoizedMergedChildContext||mo,ha=On.current,jt(On,m),jt(Zn,Zn.current),!0}function Fd(m,g,C){var D=m.stateNode;if(!D)throw Error(o(169));C?(m=Yp(m,g,ha),D.__reactInternalMemoizedMergedChildContext=m,wr(Zn),wr(On),jt(On,m)):wr(Zn),jt(Zn,C)}var ci=Math.clz32?Math.clz32:Bd,Cu=Math.log,B0=Math.LN2;function Bd(m){return m>>>=0,m===0?32:31-(Cu(m)/B0|0)|0}var Qt=64,Ou=4194304;function ul(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 cl(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=ul(Pe):(Y&=ie,Y!==0&&(D=ul(Y)))}else ie=C&~z,ie!==0?D=ul(ie):Y!==0&&(D=ul(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-ci(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-ci(Y),Pe=1<<ie,Le=z[ie];Le===-1?((Pe&C)===0||(Pe&D)!==0)&&(z[ie]=Kp(Pe,g)):Le<=g&&(m.expiredLanes|=Pe),Y&=~Pe}}function $c(m){return m=m.pendingLanes&-1073741825,m!==0?m:m&1073741824?1073741824:0}function Vc(){var m=Qt;return Qt<<=1,(Qt&4194240)===0&&(Qt=64),m}function fl(m){for(var g=[],C=0;31>C;C++)g.push(m);return g}function Ti(m,g,C){m.pendingLanes|=g,g!==536870912&&(m.suspendedLanes=0,m.pingedLanes=0),m=m.eventTimes,g=31-ci(g),m[g]=C}function go(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-ci(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-ci(C),z=1<<D;z&g|m[D]&g&&(m[D]|=g),C&=~z}}var Ut=0;function dl(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,fn=i.unstable_now,qc=i.unstable_ImmediatePriority,Wc=i.unstable_UserBlockingPriority,Gc=i.unstable_NormalPriority,z0=i.unstable_IdlePriority,yo=null,Jn=null;function hl(m){if(Jn&&typeof Jn.onCommitFiberRoot=="function")try{Jn.onCommitFiberRoot(yo,m,void 0,(m.current.flags&128)===128)}catch{}}function Xc(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var qi=typeof Object.is=="function"?Object.is:Xc,Ua=null,pl=!1,ml=!1;function Yc(m){Ua===null?Ua=[m]:Ua.push(m)}function em(m){pl=!0,Yc(m)}function yn(){if(!ml&&Ua!==null){ml=!0;var m=0,g=Ut;try{var C=Ua;for(Ut=1;m<C.length;m++){var D=C[m];do D=D(!0);while(D!==null)}Ua=null,pl=!1}catch(z){throw Ua!==null&&(Ua=Ua.slice(m+1)),ma(qc,yn),z}finally{Ut=g,ml=!1}}return null}var vo=[],Ha=0,Iu=null,is=0,zn=[],fi=0,en=null,ei=1,Wi="";function Gi(m,g){vo[Ha++]=is,vo[Ha++]=Iu,Iu=m,is=g}function tm(m,g,C){zn[fi++]=ei,zn[fi++]=Wi,zn[fi++]=en,en=m;var D=ei;m=Wi;var z=32-ci(D)-1;D&=~(1<<z),C+=1;var Y=32-ci(g)+z;if(30<Y){var ie=z-z%5;Y=(D&(1<<ie)-1).toString(32),D>>=ie,z-=ie,ei=1<<32-ci(g)+z|C<<z|D,Wi=Y+m}else ei=1<<Y|C<<z|D,Wi=m}function Ru(m){m.return!==null&&(Gi(m,1),tm(m,1,0))}function Mu(m){for(;m===Iu;)Iu=vo[--Ha],vo[Ha]=null,is=vo[--Ha],vo[Ha]=null;for(;m===en;)en=zn[--fi],zn[fi]=null,Wi=zn[--fi],zn[fi]=null,ei=zn[--fi],zn[fi]=null}var vn=null,jn=null,xr=!1,Du=!1,Xi=null;function rm(m,g){var C=xi(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 Kc(m,g){switch(m.tag){case 5:return g=Hr(g,m.type,m.pendingProps),g!==null?(m.stateNode=g,vn=m,jn=al(g),!0):!1;case 6:return g=Tn(g,m.pendingProps),g!==null?(m.stateNode=g,vn=m,jn=null,!0):!1;case 13:if(g=Xr(g),g!==null){var C=en!==null?{id:ei,overflow:Wi}:null;return m.memoizedState={dehydrated:g,treeContext:C,retryLane:1073741824},C=xi(18,null,null,0),C.stateNode=g,C.return=m,m.child=C,vn=m,jn=null,!0}return!1;default:return!1}}function zd(m){return(m.mode&1)!==0&&(m.flags&128)===0}function jd(m){if(xr){var g=jn;if(g){var C=g;if(!Kc(m,g)){if(zd(m))throw Error(o(418));g=Ei(C);var D=vn;g&&Kc(m,g)?rm(D,C):(m.flags=m.flags&-4097|2,xr=!1,vn=m)}}else{if(zd(m))throw Error(o(418));m.flags=m.flags&-4097|2,xr=!1,vn=m}}}function nm(m){for(m=m.return;m!==null&&m.tag!==5&&m.tag!==3&&m.tag!==13;)m=m.return;vn=m}function Qc(m){if(!Ne||m!==vn)return!1;if(!xr)return nm(m),xr=!0,!1;if(m.tag!==3&&(m.tag!==5||da(m.type)&&!te(m.type,m.memoizedProps))){var g=jn;if(g){if(zd(m))throw im(),Error(o(418));for(;g;)rm(m,g),g=Ei(g)}}if(nm(m),m.tag===13){if(!Ne)throw Error(o(316));if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));jn=Jo(m)}else jn=vn?Ei(m.stateNode):null;return!0}function im(){for(var m=jn;m;)m=Ei(m)}function as(){Ne&&(jn=vn=null,Du=xr=!1)}function Ud(m){Xi===null?Xi=[m]:Xi.push(m)}var j0=s.ReactCurrentBatchConfig;function Zc(m,g){if(qi(m,g))return!0;if(typeof m!="object"||m===null||typeof g!="object"||g===null)return!1;var C=Object.keys(m),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)||!qi(m[z],g[z]))return!1}return!0}function U0(m){switch(m.tag){case 5:return rs(m.type);case 16:return rs("Lazy");case 13:return rs("Suspense");case 19:return rs("SuspenseList");case 0:case 2:case 15:return m=sl(m.type,!1),m;case 11:return m=sl(m.type.render,!1),m;case 1:return m=sl(m.type,!0),m;default:return""}}function os(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 Jc(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 Be=Me.deletions;Be===null?(Me.deletions=[Ee],Me.flags|=16):Be.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=Lo(Me,Ee),Me.index=0,Me.sibling=null,Me}function Y(Me,Ee,Be){return Me.index=Be,m?(Be=Me.alternate,Be!==null?(Be=Be.index,Be<Ee?(Me.flags|=2,Ee):Be):(Me.flags|=2,Ee)):(Me.flags|=1048576,Ee)}function ie(Me){return m&&Me.alternate===null&&(Me.flags|=2),Me}function Pe(Me,Ee,Be,lt){return Ee===null||Ee.tag!==6?(Ee=jl(Be,Me.mode,lt),Ee.return=Me,Ee):(Ee=z(Ee,Be),Ee.return=Me,Ee)}function Le(Me,Ee,Be,lt){var kt=Be.type;return kt===f?ht(Me,Ee,Be.props.children,lt,Be.key):Ee!==null&&(Ee.elementType===kt||typeof kt=="object"&&kt!==null&&kt.$$typeof===P&&am(kt)===Ee.type)?(lt=z(Ee,Be.props),lt.ref=os(Me,Ee,Be),lt.return=Me,lt):(lt=Rf(Be.type,Be.key,Be.props,null,Me.mode,lt),lt.ref=os(Me,Ee,Be),lt.return=Me,lt)}function Xe(Me,Ee,Be,lt){return Ee===null||Ee.tag!==4||Ee.stateNode.containerInfo!==Be.containerInfo||Ee.stateNode.implementation!==Be.implementation?(Ee=Mf(Be,Me.mode,lt),Ee.return=Me,Ee):(Ee=z(Ee,Be.children||[]),Ee.return=Me,Ee)}function ht(Me,Ee,Be,lt,kt){return Ee===null||Ee.tag!==7?(Ee=xn(Be,Me.mode,lt,kt),Ee.return=Me,Ee):(Ee=z(Ee,Be),Ee.return=Me,Ee)}function Mt(Me,Ee,Be){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return Ee=jl(""+Ee,Me.mode,Be),Ee.return=Me,Ee;if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case u:return Be=Rf(Ee.type,Ee.key,Ee.props,null,Me.mode,Be),Be.ref=os(Me,null,Ee),Be.return=Me,Be;case d:return Ee=Mf(Ee,Me.mode,Be),Ee.return=Me,Ee;case P:var lt=Ee._init;return Mt(Me,lt(Ee._payload),Be)}if(X(Ee)||A(Ee))return Ee=xn(Ee,Me.mode,Be,null),Ee.return=Me,Ee;Jc(Me,Ee)}return null}function st(Me,Ee,Be,lt){var kt=Ee!==null?Ee.key:null;if(typeof Be=="string"&&Be!==""||typeof Be=="number")return kt!==null?null:Pe(Me,Ee,""+Be,lt);if(typeof Be=="object"&&Be!==null){switch(Be.$$typeof){case u:return Be.key===kt?Le(Me,Ee,Be,lt):null;case d:return Be.key===kt?Xe(Me,Ee,Be,lt):null;case P:return kt=Be._init,st(Me,Ee,kt(Be._payload),lt)}if(X(Be)||A(Be))return kt!==null?null:ht(Me,Ee,Be,lt,null);Jc(Me,Be)}return null}function br(Me,Ee,Be,lt,kt){if(typeof lt=="string"&<!==""||typeof lt=="number")return Me=Me.get(Be)||null,Pe(Ee,Me,""+lt,kt);if(typeof lt=="object"&<!==null){switch(lt.$$typeof){case u:return Me=Me.get(lt.key===null?Be:lt.key)||null,Le(Ee,Me,lt,kt);case d:return Me=Me.get(lt.key===null?Be:lt.key)||null,Xe(Ee,Me,lt,kt);case P:var Ft=lt._init;return br(Me,Ee,Be,Ft(lt._payload),kt)}if(X(lt)||A(lt))return Me=Me.get(Be)||null,ht(Ee,Me,lt,kt,null);Jc(Ee,lt)}return null}function sr(Me,Ee,Be,lt){for(var kt=null,Ft=null,Dt=Ee,Xt=Ee=0,on=null;Dt!==null&&Xt<Be.length;Xt++){Dt.index>Xt?(on=Dt,Dt=null):on=Dt.sibling;var Vt=st(Me,Dt,Be[Xt],lt);if(Vt===null){Dt===null&&(Dt=on);break}m&&Dt&&Vt.alternate===null&&g(Me,Dt),Ee=Y(Vt,Ee,Xt),Ft===null?kt=Vt:Ft.sibling=Vt,Ft=Vt,Dt=on}if(Xt===Be.length)return C(Me,Dt),xr&&Gi(Me,Xt),kt;if(Dt===null){for(;Xt<Be.length;Xt++)Dt=Mt(Me,Be[Xt],lt),Dt!==null&&(Ee=Y(Dt,Ee,Xt),Ft===null?kt=Dt:Ft.sibling=Dt,Ft=Dt);return xr&&Gi(Me,Xt),kt}for(Dt=D(Me,Dt);Xt<Be.length;Xt++)on=br(Dt,Me,Xt,Be[Xt],lt),on!==null&&(m&&on.alternate!==null&&Dt.delete(on.key===null?Xt:on.key),Ee=Y(on,Ee,Xt),Ft===null?kt=on:Ft.sibling=on,Ft=on);return m&&Dt.forEach(function(Nn){return g(Me,Nn)}),xr&&Gi(Me,Xt),kt}function Wn(Me,Ee,Be,lt){var kt=A(Be);if(typeof kt!="function")throw Error(o(150));if(Be=kt.call(Be),Be==null)throw Error(o(151));for(var Ft=kt=null,Dt=Ee,Xt=Ee=0,on=null,Vt=Be.next();Dt!==null&&!Vt.done;Xt++,Vt=Be.next()){Dt.index>Xt?(on=Dt,Dt=null):on=Dt.sibling;var Nn=st(Me,Dt,Vt.value,lt);if(Nn===null){Dt===null&&(Dt=on);break}m&&Dt&&Nn.alternate===null&&g(Me,Dt),Ee=Y(Nn,Ee,Xt),Ft===null?kt=Nn:Ft.sibling=Nn,Ft=Nn,Dt=on}if(Vt.done)return C(Me,Dt),xr&&Gi(Me,Xt),kt;if(Dt===null){for(;!Vt.done;Xt++,Vt=Be.next())Vt=Mt(Me,Vt.value,lt),Vt!==null&&(Ee=Y(Vt,Ee,Xt),Ft===null?kt=Vt:Ft.sibling=Vt,Ft=Vt);return xr&&Gi(Me,Xt),kt}for(Dt=D(Me,Dt);!Vt.done;Xt++,Vt=Be.next())Vt=br(Dt,Me,Xt,Vt.value,lt),Vt!==null&&(m&&Vt.alternate!==null&&Dt.delete(Vt.key===null?Xt:Vt.key),Ee=Y(Vt,Ee,Xt),Ft===null?kt=Vt:Ft.sibling=Vt,Ft=Vt);return m&&Dt.forEach(function(W0){return g(Me,W0)}),xr&&Gi(Me,Xt),kt}function _a(Me,Ee,Be,lt){if(typeof Be=="object"&&Be!==null&&Be.type===f&&Be.key===null&&(Be=Be.props.children),typeof Be=="object"&&Be!==null){switch(Be.$$typeof){case u:e:{for(var kt=Be.key,Ft=Ee;Ft!==null;){if(Ft.key===kt){if(kt=Be.type,kt===f){if(Ft.tag===7){C(Me,Ft.sibling),Ee=z(Ft,Be.props.children),Ee.return=Me,Me=Ee;break e}}else if(Ft.elementType===kt||typeof kt=="object"&&kt!==null&&kt.$$typeof===P&&am(kt)===Ft.type){C(Me,Ft.sibling),Ee=z(Ft,Be.props),Ee.ref=os(Me,Ft,Be),Ee.return=Me,Me=Ee;break e}C(Me,Ft);break}else g(Me,Ft);Ft=Ft.sibling}Be.type===f?(Ee=xn(Be.props.children,Me.mode,lt,Be.key),Ee.return=Me,Me=Ee):(lt=Rf(Be.type,Be.key,Be.props,null,Me.mode,lt),lt.ref=os(Me,Ee,Be),lt.return=Me,Me=lt)}return ie(Me);case d:e:{for(Ft=Be.key;Ee!==null;){if(Ee.key===Ft)if(Ee.tag===4&&Ee.stateNode.containerInfo===Be.containerInfo&&Ee.stateNode.implementation===Be.implementation){C(Me,Ee.sibling),Ee=z(Ee,Be.children||[]),Ee.return=Me,Me=Ee;break e}else{C(Me,Ee);break}else g(Me,Ee);Ee=Ee.sibling}Ee=Mf(Be,Me.mode,lt),Ee.return=Me,Me=Ee}return ie(Me);case P:return Ft=Be._init,_a(Me,Ee,Ft(Be._payload),lt)}if(X(Be))return sr(Me,Ee,Be,lt);if(A(Be))return Wn(Me,Ee,Be,lt);Jc(Me,Be)}return typeof Be=="string"&&Be!==""||typeof Be=="number"?(Be=""+Be,Ee!==null&&Ee.tag===6?(C(Me,Ee.sibling),Ee=z(Ee,Be),Ee.return=Me,Me=Ee):(C(Me,Ee),Ee=jl(Be,Me.mode,lt),Ee.return=Me,Me=Ee),ie(Me)):C(Me,Ee)}return _a}var ss=om(!0),sm=om(!1),ef=gn(null),tf=null,gl=null,Hd=null;function $d(){Hd=gl=tf=null}function lm(m,g,C){ue?(jt(ef,g._currentValue),g._currentValue=C):(jt(ef,g._currentValue2),g._currentValue2=C)}function Nu(m){var g=ef.current;wr(ef),ue?m._currentValue=g:m._currentValue2=g}function ls(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 yl(m,g){tf=m,Hd=gl=null,m=m.dependencies,m!==null&&m.firstContext!==null&&((m.lanes&g)!==0&&(rn=!0),m.firstContext=null)}function di(m){var g=ue?m._currentValue:m._currentValue2;if(Hd!==m)if(m={context:m,memoizedValue:g,next:null},gl===null){if(tf===null)throw Error(o(308));gl=m,tf.dependencies={lanes:0,firstContext:m}}else gl=gl.next=m;return g}var bo=null;function rf(m){bo===null?bo=[m]:bo.push(m)}function Vd(m,g,C,D){var z=g.interleaved;return z===null?(C.next=C,rf(g)):(C.next=z.next,z.next=C),g.interleaved=C,Yi(m,D)}function Yi(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 hi=!1;function qd(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 $a(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,Yi(m,C)}return z=D.interleaved,z===null?(g.next=g,rf(D)):(g.next=z.next,z.next=g),D.interleaved=g,Yi(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 vl(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 wo(m,g,C,D){var z=m.updateQueue;hi=!1;var Y=z.firstBaseUpdate,ie=z.lastBaseUpdate,Pe=z.shared.pending;if(Pe!==null){z.shared.pending=null;var Le=Pe,Xe=Le.next;Le.next=null,ie===null?Y=Xe:ie.next=Xe,ie=Le;var ht=m.alternate;ht!==null&&(ht=ht.updateQueue,Pe=ht.lastBaseUpdate,Pe!==ie&&(Pe===null?ht.firstBaseUpdate=Xe:Pe.next=Xe,ht.lastBaseUpdate=Le))}if(Y!==null){var Mt=z.baseState;ie=0,ht=Xe=Le=null,Pe=Y;do{var st=Pe.lane,br=Pe.eventTime;if((D&st)===st){ht!==null&&(ht=ht.next={eventTime:br,lane:0,tag:Pe.tag,payload:Pe.payload,callback:Pe.callback,next:null});e:{var sr=m,Wn=Pe;switch(st=g,br=C,Wn.tag){case 1:if(sr=Wn.payload,typeof sr=="function"){Mt=sr.call(br,Mt,st);break e}Mt=sr;break e;case 3:sr.flags=sr.flags&-65537|128;case 0:if(sr=Wn.payload,st=typeof sr=="function"?sr.call(br,Mt,st):sr,st==null)break e;Mt=a({},Mt,st);break e;case 2:hi=!0}}Pe.callback!==null&&Pe.lane!==0&&(m.flags|=64,st=z.effects,st===null?z.effects=[Pe]:st.push(Pe))}else br={eventTime:br,lane:st,tag:Pe.tag,payload:Pe.payload,callback:Pe.callback,next:null},ht===null?(Xe=ht=br,Le=Mt):ht=ht.next=br,ie|=st;if(Pe=Pe.next,Pe===null){if(Pe=z.shared.pending,Pe===null)break;st=Pe,Pe=st.next,st.next=null,z.lastBaseUpdate=st,z.shared.pending=null}}while(!0);if(ht===null&&(Le=Mt),z.baseState=Le,z.firstBaseUpdate=Xe,z.lastBaseUpdate=ht,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);Ya|=ie,m.lanes=ie,m.memoizedState=Mt}}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 xo={},Ci=gn(xo),bl=gn(xo),So=gn(xo);function Oi(m){if(m===xo)throw Error(o(174));return m}function nf(m,g){jt(So,g),jt(bl,m),jt(Ci,xo),m=ee(g),wr(Ci),jt(Ci,m)}function us(){wr(Ci),wr(bl),wr(So)}function Wd(m){var g=Oi(So.current),C=Oi(Ci.current);g=V(C,m.type,g),C!==g&&(jt(bl,m),jt(Ci,g))}function Gd(m){bl.current===m&&(wr(Ci),wr(bl))}var Lr=gn(0);function af(m){for(var g=m;g!==null;){if(g.tag===13){var C=g.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||Pi(C)||Jr(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 Xd=[];function Yd(){for(var m=0;m<Xd.length;m++){var g=Xd[m];ue?g._workInProgressVersionPrimary=null:g._workInProgressVersionSecondary=null}Xd.length=0}var ti=s.ReactCurrentDispatcher,cs=s.ReactCurrentBatchConfig,ko=0,Tr=null,Yr=null,tn=null,wl=!1,Fu=!1,Bu=0,xl=0;function dn(){throw Error(o(321))}function fs(m,g){if(g===null)return!1;for(var C=0;C<g.length&&C<m.length;C++)if(!qi(m[C],g[C]))return!1;return!0}function zu(m,g,C,D,z,Y){if(ko=Y,Tr=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,ti.current=m===null||m.memoizedState===null?ah:oh,m=C(D,z),Fu){Y=0;do{if(Fu=!1,Bu=0,25<=Y)throw Error(o(301));Y+=1,tn=Yr=null,g.updateQueue=null,ti.current=sh,m=C(D,z)}while(Fu)}if(ti.current=gs,g=Yr!==null&&Yr.next!==null,ko=0,tn=Yr=Tr=null,wl=!1,g)throw Error(o(300));return m}function of(){var m=Bu!==0;return Bu=0,m}function pi(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tn===null?Tr.memoizedState=tn=m:tn=tn.next=m,tn}function bn(){if(Yr===null){var m=Tr.alternate;m=m!==null?m.memoizedState:null}else m=Yr.next;var g=tn===null?Tr.memoizedState:tn.next;if(g!==null)tn=g,Yr=m;else{if(m===null)throw Error(o(310));Yr=m,m={memoizedState:Yr.memoizedState,baseState:Yr.baseState,baseQueue:Yr.baseQueue,queue:Yr.queue,next:null},tn===null?Tr.memoizedState=tn=m:tn=tn.next=m}return tn}function ds(m,g){return typeof g=="function"?g(m):g}function sf(m){var g=bn(),C=g.queue;if(C===null)throw Error(o(311));C.lastRenderedReducer=m;var D=Yr,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,Le=null,Xe=Y;do{var ht=Xe.lane;if((ko&ht)===ht)Le!==null&&(Le=Le.next={lane:0,action:Xe.action,hasEagerState:Xe.hasEagerState,eagerState:Xe.eagerState,next:null}),D=Xe.hasEagerState?Xe.eagerState:m(D,Xe.action);else{var Mt={lane:ht,action:Xe.action,hasEagerState:Xe.hasEagerState,eagerState:Xe.eagerState,next:null};Le===null?(Pe=Le=Mt,ie=D):Le=Le.next=Mt,Tr.lanes|=ht,Ya|=ht}Xe=Xe.next}while(Xe!==null&&Xe!==Y);Le===null?ie=D:Le.next=Pe,qi(D,g.memoizedState)||(rn=!0),g.memoizedState=D,g.baseState=ie,g.baseQueue=Le,C.lastRenderedState=D}if(m=C.interleaved,m!==null){z=m;do Y=z.lane,Tr.lanes|=Y,Ya|=Y,z=z.next;while(z!==m)}else z===null&&(C.lanes=0);return[g.memoizedState,C.dispatch]}function Sl(m){var g=bn(),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);qi(Y,g.memoizedState)||(rn=!0),g.memoizedState=Y,g.baseQueue===null&&(g.baseState=Y),C.lastRenderedState=Y}return[Y,D]}function Kd(){}function Qd(m,g){var C=Tr,D=bn(),z=g(),Y=!qi(D.memoizedState,z);if(Y&&(D.memoizedState=z,rn=!0),D=D.queue,cf(eh.bind(null,C,D,m),[m]),D.getSnapshot!==g||Y||tn!==null&&tn.memoizedState.tag&1){if(C.flags|=2048,hs(9,Jd.bind(null,C,D,z,g),void 0,null),mr===null)throw Error(o(349));(ko&30)!==0||Zd(C,g,z)}return z}function Zd(m,g,C){m.flags|=16384,m={getSnapshot:g,value:C},g=Tr.updateQueue,g===null?(g={lastEffect:null,stores:null},Tr.updateQueue=g,g.stores=[m]):(C=g.stores,C===null?g.stores=[m]:C.push(m))}function Jd(m,g,C,D){g.value=C,g.getSnapshot=D,th(g)&&qa(m)}function eh(m,g,C){return C(function(){th(g)&&qa(m)})}function th(m){var g=m.getSnapshot;m=m.value;try{var C=g();return!qi(m,C)}catch{return!0}}function qa(m){var g=Yi(m,1);g!==null&&Mn(g,m,1,-1)}function lf(m){var g=pi();return typeof m=="function"&&(m=m()),g.memoizedState=g.baseState=m,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:m},g.queue=m,m=m.dispatch=H0.bind(null,Tr,m),[g.memoizedState,m]}function hs(m,g,C,D){return m={tag:m,create:g,destroy:C,deps:D,next:null},g=Tr.updateQueue,g===null?(g={lastEffect:null,stores:null},Tr.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 bn().memoizedState}function uf(m,g,C,D){var z=pi();Tr.flags|=m,z.memoizedState=hs(1|g,C,void 0,D===void 0?null:D)}function _o(m,g,C,D){var z=bn();D=D===void 0?null:D;var Y=void 0;if(Yr!==null){var ie=Yr.memoizedState;if(Y=ie.destroy,D!==null&&fs(D,ie.deps)){z.memoizedState=hs(g,C,Y,D);return}}Tr.flags|=m,z.memoizedState=hs(1|g,C,Y,D)}function dm(m,g){return uf(8390656,8,m,g)}function cf(m,g){return _o(2048,8,m,g)}function rh(m,g){return _o(4,2,m,g)}function gr(m,g){return _o(4,4,m,g)}function ff(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,_o(4,4,ff.bind(null,g,m),C)}function ps(){}function nh(m,g){var C=bn();g=g===void 0?null:g;var D=C.memoizedState;return D!==null&&g!==null&&fs(g,D[1])?D[0]:(C.memoizedState=[m,g],m)}function df(m,g){var C=bn();g=g===void 0?null:g;var D=C.memoizedState;return D!==null&&g!==null&&fs(g,D[1])?D[0]:(m=m(),C.memoizedState=[m,g],m)}function kl(m,g,C){return(ko&21)===0?(m.baseState&&(m.baseState=!1,rn=!0),m.memoizedState=C):(qi(C,g)||(C=Vc(),Tr.lanes|=C,Ya|=C,m.baseState=!0),g)}function hf(m,g){var C=Ut;Ut=C!==0&&4>C?C:4,m(!0);var D=cs.transition;cs.transition={};try{m(!1),g()}finally{Ut=C,cs.transition=D}}function ms(){return bn().memoizedState}function hm(m,g,C){var D=an(m);if(C={lane:D,action:C,hasEagerState:!1,eagerState:null,next:null},pm(m))ih(g,C);else if(C=Vd(m,g,C,D),C!==null){var z=Sr();Mn(C,m,D,z),Uu(C,g,D)}}function H0(m,g,C){var D=an(m),z={lane:D,action:C,hasEagerState:!1,eagerState:null,next:null};if(pm(m))ih(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,qi(Pe,ie)){var Le=g.interleaved;Le===null?(z.next=z,rf(g)):(z.next=Le.next,Le.next=z),g.interleaved=z;return}}catch{}C=Vd(m,g,z,D),C!==null&&(z=Sr(),Mn(C,m,D,z),Uu(C,g,D))}}function pm(m){var g=m.alternate;return m===Tr||g!==null&&g===Tr}function ih(m,g){Fu=wl=!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 gs={readContext:di,useCallback:dn,useContext:dn,useEffect:dn,useImperativeHandle:dn,useInsertionEffect:dn,useLayoutEffect:dn,useMemo:dn,useReducer:dn,useRef:dn,useState:dn,useDebugValue:dn,useDeferredValue:dn,useTransition:dn,useMutableSource:dn,useSyncExternalStore:dn,useId:dn,unstable_isNewReconciler:!1},ah={readContext:di,useCallback:function(m,g){return pi().memoizedState=[m,g===void 0?null:g],m},useContext:di,useEffect:dm,useImperativeHandle:function(m,g,C){return C=C!=null?C.concat([m]):null,uf(4194308,4,ff.bind(null,g,m),C)},useLayoutEffect:function(m,g){return uf(4194308,4,m,g)},useInsertionEffect:function(m,g){return uf(4,2,m,g)},useMemo:function(m,g){var C=pi();return g=g===void 0?null:g,m=m(),C.memoizedState=[m,g],m},useReducer:function(m,g,C){var D=pi();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,Tr,m),[D.memoizedState,m]},useRef:function(m){var g=pi();return m={current:m},g.memoizedState=m},useState:lf,useDebugValue:ps,useDeferredValue:function(m){return pi().memoizedState=m},useTransition:function(){var m=lf(!1),g=m[0];return m=hf.bind(null,m[1]),pi().memoizedState=m,[g,m]},useMutableSource:function(){},useSyncExternalStore:function(m,g,C){var D=Tr,z=pi();if(xr){if(C===void 0)throw Error(o(407));C=C()}else{if(C=g(),mr===null)throw Error(o(349));(ko&30)!==0||Zd(D,g,C)}z.memoizedState=C;var Y={value:C,getSnapshot:g};return z.queue=Y,dm(eh.bind(null,D,Y,m),[m]),D.flags|=2048,hs(9,Jd.bind(null,D,Y,C,g),void 0,null),C},useId:function(){var m=pi(),g=mr.identifierPrefix;if(xr){var C=Wi,D=ei;C=(D&~(1<<32-ci(D)-1)).toString(32)+C,g=":"+g+"R"+C,C=Bu++,0<C&&(g+="H"+C.toString(32)),g+=":"}else C=xl++,g=":"+g+"r"+C.toString(32)+":";return m.memoizedState=g},unstable_isNewReconciler:!1},oh={readContext:di,useCallback:nh,useContext:di,useEffect:cf,useImperativeHandle:ju,useInsertionEffect:rh,useLayoutEffect:gr,useMemo:df,useReducer:sf,useRef:fm,useState:function(){return sf(ds)},useDebugValue:ps,useDeferredValue:function(m){var g=bn();return kl(g,Yr.memoizedState,m)},useTransition:function(){var m=sf(ds)[0],g=bn().memoizedState;return[m,g]},useMutableSource:Kd,useSyncExternalStore:Qd,useId:ms,unstable_isNewReconciler:!1},sh={readContext:di,useCallback:nh,useContext:di,useEffect:cf,useImperativeHandle:ju,useInsertionEffect:rh,useLayoutEffect:gr,useMemo:df,useReducer:Sl,useRef:fm,useState:function(){return Sl(ds)},useDebugValue:ps,useDeferredValue:function(m){var g=bn();return Yr===null?g.memoizedState=m:kl(g,Yr.memoizedState,m)},useTransition:function(){var m=Sl(ds)[0],g=bn().memoizedState;return[m,g]},useMutableSource:Kd,useSyncExternalStore:Qd,useId:ms,unstable_isNewReconciler:!1};function mi(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 lh(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=Sr(),z=an(m),Y=$a(D,z);Y.payload=g,C!=null&&(Y.callback=C),g=Va(m,Y,z),g!==null&&(Mn(g,m,z,D),Lu(g,m,z))},enqueueReplaceState:function(m,g,C){m=m._reactInternals;var D=Sr(),z=an(m),Y=$a(D,z);Y.tag=1,Y.payload=g,C!=null&&(Y.callback=C),g=Va(m,Y,z),g!==null&&(Mn(g,m,z,D),Lu(g,m,z))},enqueueForceUpdate:function(m,g){m=m._reactInternals;var C=Sr(),D=an(m),z=$a(C,D);z.tag=2,g!=null&&(z.callback=g),g=Va(m,z,D),g!==null&&(Mn(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?!Zc(C,D)||!Zc(z,Y):!0}function gm(m,g,C){var D=!1,z=mo,Y=g.contextType;return typeof Y=="object"&&Y!==null?Y=di(Y):(z=cn(g)?ha:On.current,D=g.contextTypes,Y=(D=D!=null)?ja(m,z):mo),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 pf(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={},qd(m);var Y=g.contextType;typeof Y=="object"&&Y!==null?z.context=di(Y):(Y=cn(g)?ha:On.current,z.context=ja(m,Y)),z.state=m.memoizedState,Y=g.getDerivedStateFromProps,typeof Y=="function"&&(lh(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),wo(m,C,z,D),z.state=m.memoizedState),typeof z.componentDidMount=="function"&&(m.flags|=4194308)}function ys(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 Po(m,g,C){return{value:m,source:null,stack:C??null,digest:g??null}}function Ai(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=$a(-1,C),C.tag=3,C.payload={element:null};var D=g.value;return C.callback=function(){jr||(jr=!0,Kr=D),Ai(m,g)},C}function mf(m,g,C){C=$a(-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(){Ai(m,g)}}var Y=m.stateNode;return Y!==null&&typeof Y.componentDidCatch=="function"&&(C.callback=function(){Ai(m,g),typeof D!="function"&&(Qi===null?Qi=new Set([this]):Qi.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 Eo(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=$a(-1,1),g.tag=2,Va(C,g,1))),C.lanes|=1),m):(m.flags|=65536,m.lanes=z,m)}var Vu=s.ReactCurrentOwner,rn=!1;function hn(m,g,C,D){g.child=m===null?sm(g,null,C,D):ss(g,m.child,C,D)}function gf(m,g,C,D,z){C=C.render;var Y=g.ref;return yl(g,z),D=zu(m,g,C,D,Y,z),C=of(),m!==null&&!rn?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~z,Ga(m,g,z)):(xr&&C&&Ru(g),g.flags|=1,hn(m,g,D,z),g.child)}function vs(m,g,C,D,z){if(m===null){var Y=C.type;return typeof Y=="function"&&!Bl(Y)&&Y.defaultProps===void 0&&C.compare===null&&C.defaultProps===void 0?(g.tag=15,g.type=Y,Wa(m,g,Y,D,z)):(m=Rf(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:Zc,C(ie,D)&&m.ref===g.ref)return Ga(m,g,z)}return g.flags|=1,m=Lo(Y,D),m.ref=g.ref,m.return=g,g.child=m}function Wa(m,g,C,D,z){if(m!==null){var Y=m.memoizedProps;if(Zc(Y,D)&&m.ref===g.ref)if(rn=!1,g.pendingProps=D=Y,(m.lanes&z)!==0)(m.flags&131072)!==0&&(rn=!0);else return g.lanes=m.lanes,Ga(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},jt(Ro,nn),nn|=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,jt(Ro,nn),nn|=m,null;g.memoizedState={baseLanes:0,cachePool:null,transitions:null},D=Y!==null?Y.baseLanes:C,jt(Ro,nn),nn|=D}else Y!==null?(D=Y.baseLanes|C,g.memoizedState=null):D=C,jt(Ro,nn),nn|=D;return hn(m,g,z,C),g.child}function pr(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=cn(C)?ha:On.current;return Y=ja(g,Y),yl(g,z),C=zu(m,g,C,D,Y,z),D=of(),m!==null&&!rn?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~z,Ga(m,g,z)):(xr&&D&&Ru(g),g.flags|=1,hn(m,g,C,z),g.child)}function wn(m,g,C,D,z){if(cn(C)){var Y=!0;ll(g)}else Y=!1;if(yl(g,z),g.stateNode===null)qu(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 Le=ie.context,Xe=C.contextType;typeof Xe=="object"&&Xe!==null?Xe=di(Xe):(Xe=cn(C)?ha:On.current,Xe=ja(g,Xe));var ht=C.getDerivedStateFromProps,Mt=typeof ht=="function"||typeof ie.getSnapshotBeforeUpdate=="function";Mt||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(Pe!==D||Le!==Xe)&&pf(g,ie,D,Xe),hi=!1;var st=g.memoizedState;ie.state=st,wo(g,D,ie,z),Le=g.memoizedState,Pe!==D||st!==Le||Zn.current||hi?(typeof ht=="function"&&(lh(g,C,ht,D),Le=g.memoizedState),(Pe=hi||mm(g,C,Pe,D,st,Le,Xe))?(Mt||typeof ie.UNSAFE_componentWillMount!="function"&&typeof ie.componentWillMount!="function"||(typeof ie.componentWillMount=="function"&&ie.componentWillMount(),typeof ie.UNSAFE_componentWillMount=="function"&&ie.UNSAFE_componentWillMount()),typeof ie.componentDidMount=="function"&&(g.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=D,g.memoizedState=Le),ie.props=D,ie.state=Le,ie.context=Xe,D=Pe):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),D=!1)}else{ie=g.stateNode,um(m,g),Pe=g.memoizedProps,Xe=g.type===g.elementType?Pe:mi(g.type,Pe),ie.props=Xe,Mt=g.pendingProps,st=ie.context,Le=C.contextType,typeof Le=="object"&&Le!==null?Le=di(Le):(Le=cn(C)?ha:On.current,Le=ja(g,Le));var br=C.getDerivedStateFromProps;(ht=typeof br=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(Pe!==Mt||st!==Le)&&pf(g,ie,D,Le),hi=!1,st=g.memoizedState,ie.state=st,wo(g,D,ie,z);var sr=g.memoizedState;Pe!==Mt||st!==sr||Zn.current||hi?(typeof br=="function"&&(lh(g,C,br,D),sr=g.memoizedState),(Xe=hi||mm(g,C,Xe,D,st,sr,Le)||!1)?(ht||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(D,sr,Le),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(D,sr,Le)),typeof ie.componentDidUpdate=="function"&&(g.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof ie.componentDidUpdate!="function"||Pe===m.memoizedProps&&st===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||Pe===m.memoizedProps&&st===m.memoizedState||(g.flags|=1024),g.memoizedProps=D,g.memoizedState=sr),ie.props=D,ie.state=sr,ie.context=Le,D=Xe):(typeof ie.componentDidUpdate!="function"||Pe===m.memoizedProps&&st===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||Pe===m.memoizedProps&&st===m.memoizedState||(g.flags|=1024),D=!1)}return An(m,g,C,D,Y,z)}function An(m,g,C,D,z,Y){pr(m,g);var ie=(g.flags&128)!==0;if(!D&&!ie)return z&&Fd(g,C,!1),Ga(m,g,Y);D=g.stateNode,Vu.current=g;var Pe=ie&&typeof C.getDerivedStateFromError!="function"?null:D.render();return g.flags|=1,m!==null&&ie?(g.child=ss(g,m.child,null,Y),g.child=ss(g,null,Pe,Y)):hn(m,g,Pe,Y),g.memoizedState=D.state,z&&Fd(g,C,!0),g.child}function To(m){var g=m.stateNode;g.pendingContext?Xp(m,g.pendingContext,g.pendingContext!==g.context):g.context&&Xp(m,g.context,!1),nf(m,g.containerInfo)}function bs(m,g,C,D,z){return as(),Ud(z),g.flags|=256,hn(m,g,C,D),g.child}var In={dehydrated:null,treeContext:null,retryLane:0};function _l(m){return{baseLanes:m,cachePool:null,transitions:null}}function uh(m,g,C){var D=g.pendingProps,z=Lr.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),jt(Lr,z&1),m===null)return jd(g),m=g.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((g.mode&1)===0?g.lanes=1:Jr(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=zl(ie,D,0,null),m=xn(m,D,C,null),Y.return=g,m.return=g,Y.sibling=m,g.child=Y,g.child.memoizedState=_l(C),g.memoizedState=In,m):yf(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 Le={mode:"hidden",children:D.children};return(ie&1)===0&&g.child!==z?(D=g.child,D.childLanes=0,D.pendingProps=Le,g.deletions=null):(D=Lo(z,Le),D.subtreeFlags=z.subtreeFlags&14680064),Pe!==null?Y=Lo(Pe,Y):(Y=xn(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?_l(C):{baseLanes:ie.baseLanes|C,cachePool:null,transitions:ie.transitions},Y.memoizedState=ie,Y.childLanes=m.childLanes&~C,g.memoizedState=In,D}return Y=m.child,m=Y.sibling,D=Lo(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 yf(m,g){return g=zl({mode:"visible",children:g},m.mode,0,null),g.return=m,m.child=g}function ws(m,g,C,D){return D!==null&&Ud(D),ss(g,m.child,null,C),m=yf(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=Po(Error(o(422))),ws(m,g,ie,D)):g.memoizedState!==null?(g.child=m.child,g.flags|=128,null):(Y=D.fallback,z=g.mode,D=zl({mode:"visible",children:D.children},z,0,null),Y=xn(Y,z,ie,null),Y.flags|=2,D.return=g,Y.return=g,D.sibling=Y,g.child=D,(g.mode&1)!==0&&ss(g,m.child,null,ie),g.child.memoizedState=_l(ie),g.memoizedState=In,Y);if((g.mode&1)===0)return ws(m,g,ie,null);if(Jr(z))return D=Vi(z).digest,Y=Error(o(419)),D=Po(Y,D,void 0),ws(m,g,ie,D);if(C=(ie&m.childLanes)!==0,rn||C){if(D=mr,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,Yi(m,z),Mn(D,m,z,-1))}return Fl(),D=Po(Error(o(421))),ws(m,g,ie,D)}return Pi(z)?(g.flags|=128,g.child=m.child,g=Tm.bind(null,m),Bn(z,g),null):(m=Y.treeContext,Ne&&(jn=ol(z),vn=g,xr=!0,Xi=null,Du=!1,m!==null&&(zn[fi++]=ei,zn[fi++]=Wi,zn[fi++]=en,ei=m.id,Wi=m.overflow,en=g)),g=yf(g,D.children),g.flags|=4096,g)}function ba(m,g,C){m.lanes|=g;var D=m.alternate;D!==null&&(D.lanes|=g),ls(m.return,g,C)}function Pl(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 vf(m,g,C){var D=g.pendingProps,z=D.revealOrder,Y=D.tail;if(hn(m,g,D.children,C),D=Lr.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(jt(Lr,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&&af(m)===null&&(z=C),C=C.sibling;C=z,C===null?(z=g.child,g.child=null):(z=C.sibling,C.sibling=null),Pl(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&&af(m)===null){g.child=z;break}m=z.sibling,z.sibling=C,C=z,z=m}Pl(g,!0,C,null,Y);break;case"together":Pl(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function qu(m,g){(g.mode&1)===0&&m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2)}function Ga(m,g,C){if(m!==null&&(g.dependencies=m.dependencies),Ya|=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=Lo(m,m.pendingProps),g.child=C,C.return=g;m.sibling!==null;)m=m.sibling,C=C.sibling=Lo(m,m.pendingProps),C.return=g;C.sibling=null}return g.child}function Co(m,g,C){switch(g.tag){case 3:To(g),as();break;case 5:Wd(g);break;case 1:cn(g.type)&&ll(g);break;case 4:nf(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?(jt(Lr,Lr.current&1),g.flags|=128,null):(C&g.child.childLanes)!==0?uh(m,g,C):(jt(Lr,Lr.current&1),m=Ga(m,g,C),m!==null?m.sibling:null);jt(Lr,Lr.current&1);break;case 19:if(D=(C&g.childLanes)!==0,(m.flags&128)!==0){if(D)return vf(m,g,C);g.flags|=128}var z=g.memoizedState;if(z!==null&&(z.rendering=null,z.tail=null,z.lastEffect=null),jt(Lr,Lr.current),D)break;return null;case 22:case 23:return g.lanes=0,yr(m,g,C)}return Ga(m,g,C)}function Un(m){m.flags|=4}function xs(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 Oo,Ao,Hn,$n;if(we)Oo=function(m,g){for(var C=g.child;C!==null;){if(C.tag===5||C.tag===6)q(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}},Ao=function(){},Hn=function(m,g,C,D,z){if(m=m.memoizedProps,m!==D){var Y=g.stateNode,ie=Oi(Ci.current);C=J(Y,C,m,D,z,ie),(g.updateQueue=C)&&Un(g)}},$n=function(m,g,C,D){C!==D&&Un(g)};else if(Re){Oo=function(m,g,C,D){for(var z=g.child;z!==null;){if(z.tag===5){var Y=z.stateNode;C&&D&&(Y=ar(Y,z.type,z.memoizedProps,z)),q(m,Y)}else if(z.tag===6)Y=z.stateNode,C&&D&&(Y=En(Y,z.memoizedProps,z)),q(m,Y);else if(z.tag!==4){if(z.tag===22&&z.memoizedState!==null)Y=z.child,Y!==null&&(Y.return=z),Oo(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 Io=function(m,g,C,D){for(var z=g.child;z!==null;){if(z.tag===5){var Y=z.stateNode;C&&D&&(Y=ar(Y,z.type,z.memoizedProps,z)),fr(m,Y)}else if(z.tag===6)Y=z.stateNode,C&&D&&(Y=En(Y,z.memoizedProps,z)),fr(m,Y);else if(z.tag!==4){if(z.tag===22&&z.memoizedState!==null)Y=z.child,Y!==null&&(Y.return=z),Io(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}};Ao=function(m,g){var C=g.stateNode;if(!xs(m,g)){m=C.containerInfo;var D=Gt(m);Io(D,g,!1,!1),C.pendingChildren=D,Un(g),ir(m,D)}},Hn=function(m,g,C,D,z){var Y=m.stateNode,ie=m.memoizedProps;if((m=xs(m,g))&&ie===D)g.stateNode=Y;else{var Pe=g.stateNode,Le=Oi(Ci.current),Xe=null;ie!==D&&(Xe=J(Pe,C,ie,D,z,Le)),m&&Xe===null?g.stateNode=Y:(Y=Nr(Y,Xe,C,ie,D,g,m,Pe),W(Y,C,D,z,Le)&&Un(g),g.stateNode=Y,m?Un(g):Oo(Y,g,!1,!1))}},$n=function(m,g,C,D){C!==D?(m=Oi(So.current),C=Oi(Ci.current),g.stateNode=K(D,m,C,g),Un(g)):g.stateNode=m.stateNode}}else Ao=function(){},Hn=function(){},$n=function(){};function gi(m,g){if(!xr)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 Cr(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 Ss(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 Cr(g),null;case 1:return cn(g.type)&&ns(),Cr(g),null;case 3:return C=g.stateNode,us(),wr(Zn),wr(On),Yd(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(m===null||m.child===null)&&(Qc(g)?Un(g):m===null||m.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,Xi!==null&&(Af(Xi),Xi=null))),Ao(m,g),Cr(g),null;case 5:Gd(g),C=Oi(So.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 Cr(g),null}if(m=Oi(Ci.current),Qc(g)){if(!Ne)throw Error(o(175));m=Cn(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);Oo(Y,g,!1,!1),g.stateNode=Y,W(Y,z,D,C,m)&&Un(g)}g.ref!==null&&(g.flags|=512,g.flags|=2097152)}return Cr(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=Oi(So.current),C=Oi(Ci.current),Qc(g)){if(!Ne)throw Error(o(176));if(m=g.stateNode,C=g.memoizedProps,(D=ho(m,C,g,!Du))&&(z=vn,z!==null))switch(z.tag){case 3:jc(z.stateNode.containerInfo,m,C,(z.mode&1)!==0);break;case 5:Er(z.type,z.memoizedProps,z.stateNode,m,C,(z.mode&1)!==0)}D&&Un(g)}else g.stateNode=K(D,m,C,g)}return Cr(g),null;case 13:if(wr(Lr),D=g.memoizedState,m===null||m.memoizedState!==null&&m.memoizedState.dehydrated!==null){if(xr&&jn!==null&&(g.mode&1)!==0&&(g.flags&128)===0)im(),as(),g.flags|=98560,z=!1;else if(z=Qc(g),D!==null&&D.dehydrated!==null){if(m===null){if(!z)throw Error(o(318));if(!Ne)throw Error(o(344));if(z=g.memoizedState,z=z!==null?z.dehydrated:null,!z)throw Error(o(317));po(z,g)}else as(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Cr(g),z=!1}else Xi!==null&&(Af(Xi),Xi=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||(Lr.current&1)!==0?Ar===0&&(Ar=3):Fl())),g.updateQueue!==null&&(g.flags|=4),Cr(g),null);case 4:return us(),Ao(m,g),m===null&&$e(g.stateNode.containerInfo),Cr(g),null;case 10:return Nu(g.type._context),Cr(g),null;case 17:return cn(g.type)&&ns(),Cr(g),null;case 19:if(wr(Lr),z=g.memoizedState,z===null)return Cr(g),null;if(D=(g.flags&128)!==0,Y=z.rendering,Y===null)if(D)gi(z,!1);else{if(Ar!==0||m!==null&&(m.flags&128)!==0)for(m=g.child;m!==null;){if(Y=af(m),Y!==null){for(g.flags|=128,gi(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 jt(Lr,Lr.current&1|2),g.child}m=m.sibling}z.tail!==null&&fn()>Zu&&(g.flags|=128,D=!0,gi(z,!1),g.lanes=4194304)}else{if(!D)if(m=af(Y),m!==null){if(g.flags|=128,D=!0,m=m.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),gi(z,!0),z.tail===null&&z.tailMode==="hidden"&&!Y.alternate&&!xr)return Cr(g),null}else 2*fn()-z.renderingStartTime>Zu&&C!==1073741824&&(g.flags|=128,D=!0,gi(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=fn(),g.sibling=null,m=Lr.current,jt(Lr,D?m&1|2:m&1),g):(Cr(g),null);case 22:case 23:return If(),C=g.memoizedState!==null,m!==null&&m.memoizedState!==null!==C&&(g.flags|=8192),C&&(g.mode&1)!==0?(nn&1073741824)!==0&&(Cr(g),we&&g.subtreeFlags&6&&(g.flags|=8192)):Cr(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 cn(g.type)&&ns(),m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 3:return us(),wr(Zn),wr(On),Yd(),m=g.flags,(m&65536)!==0&&(m&128)===0?(g.flags=m&-65537|128,g):null;case 5:return Gd(g),null;case 13:if(wr(Lr),m=g.memoizedState,m!==null&&m.dehydrated!==null){if(g.alternate===null)throw Error(o(340));as()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 19:return wr(Lr),null;case 4:return us(),null;case 10:return Nu(g.type._context),null;case 22:case 23:return If(),null;case 24:return null;default:return null}}var El=!1,pn=!1,yi=typeof WeakSet=="function"?WeakSet:Set,tt=null;function or(m,g){var C=m.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(D){kr(m,g,D)}else C.current=null}function vi(m,g,C){try{C()}catch(D){kr(m,g,D)}}var ch=!1;function xm(m,g){for(Q(m.containerInfo),tt=g;tt!==null;)if(m=tt,g=m.child,(m.subtreeFlags&1028)!==0&&g!==null)g.return=m,tt=g;else for(;tt!==null;){m=tt;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:mi(m.type,D),z);Y.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:we&&Nt(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Pe){kr(m,m.return,Pe)}if(g=m.sibling,g!==null){g.return=m.return,tt=g;break}tt=m.return}return C=ch,ch=!1,C}function ks(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&&vi(g,C,Y)}z=z.next}while(z!==D)}}function Tl(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 bf(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&&xe(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 fh(m){return m.tag===5||m.tag===3||m.tag===4}function _s(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||fh(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?bt(C,m,g):Ue(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 dh(m,g,C){var D=m.tag;if(D===5||D===6)m=m.stateNode,g?Et(C,m,g):me(C,m);else if(D!==4&&(m=m.child,m!==null))for(dh(m,g,C),m=m.sibling;m!==null;)dh(m,g,C),m=m.sibling}var $r=null,ri=!1;function Ki(m,g,C){for(C=C.child;C!==null;)wf(m,g,C),C=C.sibling}function wf(m,g,C){if(Jn&&typeof Jn.onCommitFiberUnmount=="function")try{Jn.onCommitFiberUnmount(yo,C)}catch{}switch(C.tag){case 5:pn||or(C,g);case 6:if(we){var D=$r,z=ri;$r=null,Ki(m,g,C),$r=D,ri=z,$r!==null&&(ri?le($r,C.stateNode):At($r,C.stateNode))}else Ki(m,g,C);break;case 18:we&&$r!==null&&(ri?ts($r,C.stateNode):es($r,C.stateNode));break;case 4:we?(D=$r,z=ri,$r=C.stateNode.containerInfo,ri=!0,Ki(m,g,C),$r=D,ri=z):(Re&&(D=C.stateNode.containerInfo,z=Gt(D),er(D,z)),Ki(m,g,C));break;case 0:case 11:case 14:case 15:if(!pn&&(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)&&vi(C,g,ie),z=z.next}while(z!==D)}Ki(m,g,C);break;case 1:if(!pn&&(or(C,g),D=C.stateNode,typeof D.componentWillUnmount=="function"))try{D.props=C.memoizedProps,D.state=C.memoizedState,D.componentWillUnmount()}catch(Pe){kr(C,g,Pe)}Ki(m,g,C);break;case 21:Ki(m,g,C);break;case 22:C.mode&1?(pn=(D=pn)||C.memoizedState!==null,Ki(m,g,C),pn=D):Ki(m,g,C);break;default:Ki(m,g,C)}}function Ps(m){var g=m.updateQueue;if(g!==null){m.updateQueue=null;var C=m.stateNode;C===null&&(C=m.stateNode=new yi),g.forEach(function(D){var z=$0.bind(null,m,D);C.has(D)||(C.add(D),D.then(z,z))})}}function Ii(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(we){var Pe=ie;e:for(;Pe!==null;){switch(Pe.tag){case 5:$r=Pe.stateNode,ri=!1;break e;case 3:$r=Pe.stateNode.containerInfo,ri=!0;break e;case 4:$r=Pe.stateNode.containerInfo,ri=!0;break e}Pe=Pe.return}if($r===null)throw Error(o(160));wf(Y,ie,z),$r=null,ri=!1}else wf(Y,ie,z);var Le=z.alternate;Le!==null&&(Le.return=null),z.return=null}catch(Xe){kr(z,g,Xe)}}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(Ii(g,m),bi(m),D&4){try{ks(3,m,m.return),Tl(3,m)}catch(st){kr(m,m.return,st)}try{ks(5,m,m.return)}catch(st){kr(m,m.return,st)}}break;case 1:Ii(g,m),bi(m),D&512&&C!==null&&or(C,C.return);break;case 5:if(Ii(g,m),bi(m),D&512&&C!==null&&or(C,C.return),we){if(m.flags&32){var z=m.stateNode;try{ye(z)}catch(st){kr(m,m.return,st)}}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{at(z,g,D,C,Y,m)}catch(st){kr(m,m.return,st)}}}break;case 6:if(Ii(g,m),bi(m),D&4&&we){if(m.stateNode===null)throw Error(o(162));z=m.stateNode,Y=m.memoizedProps,C=C!==null?C.memoizedProps:Y;try{be(z,C,Y)}catch(st){kr(m,m.return,st)}}break;case 3:if(Ii(g,m),bi(m),D&4){if(we&&Ne&&C!==null&&C.memoizedState.isDehydrated)try{ui(g.containerInfo)}catch(st){kr(m,m.return,st)}if(Re){z=g.containerInfo,Y=g.pendingChildren;try{er(z,Y)}catch(st){kr(m,m.return,st)}}}break;case 4:if(Ii(g,m),bi(m),D&4&&Re){Y=m.stateNode,z=Y.containerInfo,Y=Y.pendingChildren;try{er(z,Y)}catch(st){kr(m,m.return,st)}}break;case 13:Ii(g,m),bi(m),z=m.child,z.flags&8192&&(Y=z.memoizedState!==null,z.stateNode.isHidden=Y,!Y||z.alternate!==null&&z.alternate.memoizedState!==null||(Ml=fn())),D&4&&Ps(m);break;case 22:var ie=C!==null&&C.memoizedState!==null;if(m.mode&1?(pn=(C=pn)||ie,Ii(g,m),pn=C):Ii(g,m),bi(m),D&8192){if(C=m.memoizedState!==null,(m.stateNode.isHidden=C)&&!ie&&(m.mode&1)!==0)for(tt=m,D=m.child;D!==null;){for(g=tt=D;tt!==null;){ie=tt;var Pe=ie.child;switch(ie.tag){case 0:case 11:case 14:case 15:ks(4,ie,ie.return);break;case 1:or(ie,ie.return);var Le=ie.stateNode;if(typeof Le.componentWillUnmount=="function"){var Xe=ie,ht=ie.return;try{var Mt=Xe;Le.props=Mt.memoizedProps,Le.state=Mt.memoizedState,Le.componentWillUnmount()}catch(st){kr(Xe,ht,st)}}break;case 5:or(ie,ie.return);break;case 22:if(ie.memoizedState!==null){kf(g);continue}}Pe!==null?(Pe.return=ie,tt=Pe):kf(g)}D=D.sibling}if(we){e:if(D=null,we)for(g=m;;){if(g.tag===5){if(D===null){D=g;try{z=g.stateNode,C?it(z):yt(g.stateNode,g.memoizedProps)}catch(st){kr(m,m.return,st)}}}else if(g.tag===6){if(D===null)try{Y=g.stateNode,C?pt(Y):ft(Y,g.memoizedProps)}catch(st){kr(m,m.return,st)}}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:Ii(g,m),bi(m),D&4&&Ps(m);break;case 21:break;default:Ii(g,m),bi(m)}}function bi(m){var g=m.flags;if(g&2){try{if(we){e:{for(var C=m.return;C!==null;){if(fh(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&&(ye(z),D.flags&=-33);var Y=_s(m);dh(m,Y,z);break;case 3:case 4:var ie=D.stateNode.containerInfo,Pe=_s(m);Gu(m,Pe,ie);break;default:throw Error(o(161))}}}catch(Le){kr(m,m.return,Le)}m.flags&=-3}g&4096&&(m.flags&=-4097)}function Cl(m,g,C){tt=m,xf(m)}function xf(m,g,C){for(var D=(m.mode&1)!==0;tt!==null;){var z=tt,Y=z.child;if(z.tag===22&&D){var ie=z.memoizedState!==null||El;if(!ie){var Pe=z.alternate,Le=Pe!==null&&Pe.memoizedState!==null||pn;Pe=El;var Xe=pn;if(El=ie,(pn=Le)&&!Xe)for(tt=z;tt!==null;)ie=tt,Le=ie.child,ie.tag===22&&ie.memoizedState!==null?_f(z):Le!==null?(Le.return=ie,tt=Le):_f(z);for(;Y!==null;)tt=Y,xf(Y),Y=Y.sibling;tt=z,El=Pe,pn=Xe}Sf(m)}else(z.subtreeFlags&8772)!==0&&Y!==null?(Y.return=z,tt=Y):Sf(m)}}function Sf(m){for(;tt!==null;){var g=tt;if((g.flags&8772)!==0){var C=g.alternate;try{if((g.flags&8772)!==0)switch(g.tag){case 0:case 11:case 15:pn||Tl(5,g);break;case 1:var D=g.stateNode;if(g.flags&4&&!pn)if(C===null)D.componentDidMount();else{var z=g.elementType===g.type?C.memoizedProps:mi(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&&je(Pe,g.type,g.memoizedProps,g);break;case 6:break;case 4:break;case 12:break;case 13:if(Ne&&g.memoizedState===null){var Le=g.alternate;if(Le!==null){var Xe=Le.memoizedState;if(Xe!==null){var ht=Xe.dehydrated;ht!==null&&fa(ht)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}pn||g.flags&512&&bf(g)}catch(Mt){kr(g,g.return,Mt)}}if(g===m){tt=null;break}if(C=g.sibling,C!==null){C.return=g.return,tt=C;break}tt=g.return}}function kf(m){for(;tt!==null;){var g=tt;if(g===m){tt=null;break}var C=g.sibling;if(C!==null){C.return=g.return,tt=C;break}tt=g.return}}function _f(m){for(;tt!==null;){var g=tt;try{switch(g.tag){case 0:case 11:case 15:var C=g.return;try{Tl(4,g)}catch(Le){kr(g,C,Le)}break;case 1:var D=g.stateNode;if(typeof D.componentDidMount=="function"){var z=g.return;try{D.componentDidMount()}catch(Le){kr(g,z,Le)}}var Y=g.return;try{bf(g)}catch(Le){kr(g,Y,Le)}break;case 5:var ie=g.return;try{bf(g)}catch(Le){kr(g,ie,Le)}}}catch(Le){kr(g,g.return,Le)}if(g===m){tt=null;break}var Pe=g.sibling;if(Pe!==null){Pe.return=g.return,tt=Pe;break}tt=g.return}}var Xa=0,Vn=1,wa=2,Ol=3,Yu=4;if(typeof Symbol=="function"&&Symbol.for){var wi=Symbol.for;Xa=wi("selector.component"),Vn=wi("selector.has_pseudo_class"),wa=wi("selector.role"),Ol=wi("selector.test_id"),Yu=wi("selector.text")}function xa(m){var g=He(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 Xa:if(m.type===g.value)return!0;break;case Vn: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&&Fe(m.stateNode,g.value))return!0;break;case Yu:if((m.tag===5||m.tag===6)&&(m=_e(m),m!==null&&0<=m.indexOf(g.value)))return!0;break;case Ol: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 Pf(m){switch(m.$$typeof){case Xa:return"<"+(T(m.value)||"Unknown")+">";case Vn:return":has("+(Pf(m)||"")+")";case wa:return'[role="'+m.value+'"]';case Yu:return'"'+m.value+'"';case Ol: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(!ge)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 Ef=Math.ceil,Qu=s.ReactCurrentDispatcher,Al=s.ReactCurrentOwner,zr=s.ReactCurrentBatchConfig,Lt=0,mr=null,Or=null,Vr=0,nn=0,Ro=gn(0),Ar=0,Il=null,Ya=0,vr=0,Rl=0,Es=null,Rn=null,Ml=0,Zu=1/0,qn=null;function dr(){Zu=fn()+500}var jr=!1,Kr=null,Qi=null,Mo=!1,Ri=null,Tf=0,Qr=0,Ju=null,Dl=-1,Nl=0;function Sr(){return(Lt&6)!==0?fn():Dl!==-1?Dl:Dl=fn()}function an(m){return(m.mode&1)===0?1:(Lt&2)!==0&&Vr!==0?Vr&-Vr:j0.transition!==null?(Nl===0&&(Nl=Vc()),Nl):(m=Ut,m!==0?m:et())}function Mn(m,g,C,D){if(50<Qr)throw Qr=0,Ju=null,Error(o(185));Ti(m,C,D),((Lt&2)===0||m!==mr)&&(m===mr&&((Lt&2)===0&&(vr|=C),Ar===4&&Ka(m,Vr)),Dn(m,D),C===1&&Lt===0&&(g.mode&1)===0&&(dr(),pl&&yn()))}function Dn(m,g){var C=m.callbackNode;Qp(m,g);var D=cl(m,m===mr?Vr: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(hh.bind(null,m)):Yc(hh.bind(null,m)),he?se(function(){(Lt&6)===0&&yn()}):ma(qc,yn),C=null;else{switch(dl(D)){case 1:C=qc;break;case 4:C=Wc;break;case 16:C=Gc;break;case 536870912:C=z0;break;default:C=Gc}C=wh(C,Cf.bind(null,m))}m.callbackPriority=g,m.callbackNode=C}}function Cf(m,g){if(Dl=-1,Nl=0,(Lt&6)!==0)throw Error(o(327));var C=m.callbackNode;if(Qa()&&m.callbackNode!==C)return null;var D=cl(m,m===mr?Vr:0);if(D===0)return null;if((D&30)!==0||(D&m.expiredLanes)!==0||g)g=Ts(m,D);else{g=D;var z=Lt;Lt|=2;var Y=mh();(mr!==m||Vr!==g)&&(qn=null,dr(),Do(m,g));do try{gh();break}catch(Pe){Ll(m,Pe)}while(!0);$d(),Qu.current=Y,Lt=z,Or!==null?g=0:(mr=null,Vr=0,g=Ar)}if(g!==0){if(g===2&&(z=$c(m),z!==0&&(D=z,g=Of(m,z))),g===1)throw C=Il,Do(m,0),Ka(m,D),Dn(m,fn()),C;if(g===6)Ka(m,D);else{if(z=m.current.alternate,(D&30)===0&&!Sm(z)&&(g=Ts(m,D),g===2&&(Y=$c(m),Y!==0&&(D=Y,g=Of(m,Y))),g===1))throw C=Il,Do(m,0),Ka(m,D),Dn(m,fn()),C;switch(m.finishedWork=z,m.finishedLanes=D,g){case 0:case 1:throw Error(o(345));case 2:No(m,Rn,qn);break;case 3:if(Ka(m,D),(D&130023424)===D&&(g=Ml+500-fn(),10<g)){if(cl(m,0)!==0)break;if(z=m.suspendedLanes,(z&D)!==D){Sr(),m.pingedLanes|=m.suspendedLanes&z;break}m.timeoutHandle=ne(No.bind(null,m,Rn,qn),g);break}No(m,Rn,qn);break;case 4:if(Ka(m,D),(D&4194240)===D)break;for(g=m.eventTimes,z=-1;0<D;){var ie=31-ci(D);Y=1<<ie,ie=g[ie],ie>z&&(z=ie),D&=~Y}if(D=z,D=fn()-D,D=(120>D?120:480>D?480:1080>D?1080:1920>D?1920:3e3>D?3e3:4320>D?4320:1960*Ef(D/1960))-D,10<D){m.timeoutHandle=ne(No.bind(null,m,Rn,qn),D);break}No(m,Rn,qn);break;case 5:No(m,Rn,qn);break;default:throw Error(o(329))}}}return Dn(m,fn()),m.callbackNode===C?Cf.bind(null,m):null}function Of(m,g){var C=Es;return m.current.memoizedState.isDehydrated&&(Do(m,g).flags|=256),m=Ts(m,g),m!==2&&(g=Rn,Rn=C,g!==null&&Af(g)),m}function Af(m){Rn===null?Rn=m:Rn.push.apply(Rn,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(!qi(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 Ka(m,g){for(g&=~Rl,g&=~vr,m.suspendedLanes|=g,m.pingedLanes&=~g,m=m.expirationTimes;0<g;){var C=31-ci(g),D=1<<C;m[C]=-1,g&=~D}}function hh(m){if((Lt&6)!==0)throw Error(o(327));Qa();var g=cl(m,0);if((g&1)===0)return Dn(m,fn()),null;var C=Ts(m,g);if(m.tag!==0&&C===2){var D=$c(m);D!==0&&(g=D,C=Of(m,D))}if(C===1)throw C=Il,Do(m,0),Ka(m,g),Dn(m,fn()),C;if(C===6)throw Error(o(345));return m.finishedWork=m.current.alternate,m.finishedLanes=g,No(m,Rn,qn),Dn(m,fn()),null}function ph(m){Ri!==null&&Ri.tag===0&&(Lt&6)===0&&Qa();var g=Lt;Lt|=1;var C=zr.transition,D=Ut;try{if(zr.transition=null,Ut=1,m)return m()}finally{Ut=D,zr.transition=C,Lt=g,(Lt&6)===0&&yn()}}function If(){nn=Ro.current,wr(Ro)}function Do(m,g){m.finishedWork=null,m.finishedLanes=0;var C=m.timeoutHandle;if(C!==oe&&(m.timeoutHandle=oe,fe(C)),Or!==null)for(C=Or.return;C!==null;){var D=C;switch(Mu(D),D.tag){case 1:D=D.type.childContextTypes,D!=null&&ns();break;case 3:us(),wr(Zn),wr(On),Yd();break;case 5:Gd(D);break;case 4:us();break;case 13:wr(Lr);break;case 19:wr(Lr);break;case 10:Nu(D.type._context);break;case 22:case 23:If()}C=C.return}if(mr=m,Or=m=Lo(m.current,null),Vr=nn=g,Ar=0,Il=null,Rl=vr=Ya=0,Rn=Es=null,bo!==null){for(g=0;g<bo.length;g++)if(C=bo[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}bo=null}return m}function Ll(m,g){do{var C=Or;try{if($d(),ti.current=gs,wl){for(var D=Tr.memoizedState;D!==null;){var z=D.queue;z!==null&&(z.pending=null),D=D.next}wl=!1}if(ko=0,tn=Yr=Tr=null,Fu=!1,Bu=0,Al.current=null,C===null||C.return===null){Ar=1,Il=g,Or=null;break}e:{var Y=m,ie=C.return,Pe=C,Le=g;if(g=Vr,Pe.flags|=32768,Le!==null&&typeof Le=="object"&&typeof Le.then=="function"){var Xe=Le,ht=Pe,Mt=ht.tag;if((ht.mode&1)===0&&(Mt===0||Mt===11||Mt===15)){var st=ht.alternate;st?(ht.updateQueue=st.updateQueue,ht.memoizedState=st.memoizedState,ht.lanes=st.lanes):(ht.updateQueue=null,ht.memoizedState=null)}var br=vm(ie);if(br!==null){br.flags&=-257,Eo(br,ie,Pe,Y,g),br.mode&1&&ym(Y,Xe,g),g=br,Le=Xe;var sr=g.updateQueue;if(sr===null){var Wn=new Set;Wn.add(Le),g.updateQueue=Wn}else sr.add(Le);break e}else{if((g&1)===0){ym(Y,Xe,g),Fl();break e}Le=Error(o(426))}}else if(xr&&Pe.mode&1){var _a=vm(ie);if(_a!==null){(_a.flags&65536)===0&&(_a.flags|=256),Eo(_a,ie,Pe,Y,g),Ud(ys(Le,Pe));break e}}Y=Le=ys(Le,Pe),Ar!==4&&(Ar=2),Es===null?Es=[Y]:Es.push(Y),Y=ie;do{switch(Y.tag){case 3:Y.flags|=65536,g&=-g,Y.lanes|=g;var Me=ya(Y,Le,g);vl(Y,Me);break e;case 1:Pe=Le;var Ee=Y.type,Be=Y.stateNode;if((Y.flags&128)===0&&(typeof Ee.getDerivedStateFromError=="function"||Be!==null&&typeof Be.componentDidCatch=="function"&&(Qi===null||!Qi.has(Be)))){Y.flags|=65536,g&=-g,Y.lanes|=g;var lt=mf(Y,Pe,g);vl(Y,lt);break e}}Y=Y.return}while(Y!==null)}vh(C)}catch(kt){g=kt,Or===C&&C!==null&&(Or=C=C.return);continue}break}while(!0)}function mh(){var m=Qu.current;return Qu.current=gs,m===null?gs:m}function Fl(){(Ar===0||Ar===3||Ar===2)&&(Ar=4),mr===null||(Ya&268435455)===0&&(vr&268435455)===0||Ka(mr,Vr)}function Ts(m,g){var C=Lt;Lt|=2;var D=mh();(mr!==m||Vr!==g)&&(qn=null,Do(m,g));do try{km();break}catch(z){Ll(m,z)}while(!0);if($d(),Lt=C,Qu.current=D,Or!==null)throw Error(o(261));return mr=null,Vr=0,Ar}function km(){for(;Or!==null;)yh(Or)}function gh(){for(;Or!==null&&!Jp();)yh(Or)}function yh(m){var g=Cm(m.alternate,m,nn);m.memoizedProps=m.pendingProps,g===null?vh(m):Or=g,Al.current=null}function vh(m){var g=m;do{var C=g.alternate;if(m=g.return,(g.flags&32768)===0){if(C=Ss(C,g,nn),C!==null){Or=C;return}}else{if(C=wm(C,g),C!==null){C.flags&=32767,Or=C;return}if(m!==null)m.flags|=32768,m.subtreeFlags=0,m.deletions=null;else{Ar=6,Or=null;return}}if(g=g.sibling,g!==null){Or=g;return}Or=g=m}while(g!==null);Ar===0&&(Ar=5)}function No(m,g,C){var D=Ut,z=zr.transition;try{zr.transition=null,Ut=1,_m(m,g,C,D)}finally{zr.transition=z,Ut=D}return null}function _m(m,g,C,D){do Qa();while(Ri!==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(go(m,Y),m===mr&&(Or=mr=null,Vr=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||Mo||(Mo=!0,wh(Gc,function(){return Qa(),null})),Y=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||Y){Y=zr.transition,zr.transition=null;var ie=Ut;Ut=1;var Pe=Lt;Lt|=4,Al.current=null,xm(m,C),Xu(C,m),U(m.containerInfo),m.current=C,Cl(C),Au(),Lt=Pe,Ut=ie,zr.transition=Y}else m.current=C;if(Mo&&(Mo=!1,Ri=m,Tf=z),Y=m.pendingLanes,Y===0&&(Qi=null),hl(C.stateNode),Dn(m,fn()),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(jr)throw jr=!1,m=Kr,Kr=null,m;return(Tf&1)!==0&&m.tag!==0&&Qa(),Y=m.pendingLanes,(Y&1)!==0?m===Ju?Qr++:(Qr=0,Ju=m):Qr=0,yn(),null}function Qa(){if(Ri!==null){var m=dl(Tf),g=zr.transition,C=Ut;try{if(zr.transition=null,Ut=16>m?16:m,Ri===null)var D=!1;else{if(m=Ri,Ri=null,Tf=0,(Lt&6)!==0)throw Error(o(331));var z=Lt;for(Lt|=4,tt=m.current;tt!==null;){var Y=tt,ie=Y.child;if((tt.flags&16)!==0){var Pe=Y.deletions;if(Pe!==null){for(var Le=0;Le<Pe.length;Le++){var Xe=Pe[Le];for(tt=Xe;tt!==null;){var ht=tt;switch(ht.tag){case 0:case 11:case 15:ks(8,ht,Y)}var Mt=ht.child;if(Mt!==null)Mt.return=ht,tt=Mt;else for(;tt!==null;){ht=tt;var st=ht.sibling,br=ht.return;if(Wu(ht),ht===Xe){tt=null;break}if(st!==null){st.return=br,tt=st;break}tt=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)}}tt=Y}}if((Y.subtreeFlags&2064)!==0&&ie!==null)ie.return=Y,tt=ie;else e:for(;tt!==null;){if(Y=tt,(Y.flags&2048)!==0)switch(Y.tag){case 0:case 11:case 15:ks(9,Y,Y.return)}var Me=Y.sibling;if(Me!==null){Me.return=Y.return,tt=Me;break e}tt=Y.return}}var Ee=m.current;for(tt=Ee;tt!==null;){ie=tt;var Be=ie.child;if((ie.subtreeFlags&2064)!==0&&Be!==null)Be.return=ie,tt=Be;else e:for(ie=Ee;tt!==null;){if(Pe=tt,(Pe.flags&2048)!==0)try{switch(Pe.tag){case 0:case 11:case 15:Tl(9,Pe)}}catch(kt){kr(Pe,Pe.return,kt)}if(Pe===ie){tt=null;break e}var lt=Pe.sibling;if(lt!==null){lt.return=Pe.return,tt=lt;break e}tt=Pe.return}}if(Lt=z,yn(),Jn&&typeof Jn.onPostCommitFiberRoot=="function")try{Jn.onPostCommitFiberRoot(yo,m)}catch{}D=!0}return D}finally{Ut=C,zr.transition=g}}return!1}function bh(m,g,C){g=ys(C,g),g=ya(m,g,1),m=Va(m,g,1),g=Sr(),m!==null&&(Ti(m,1,g),Dn(m,g))}function kr(m,g,C){if(m.tag===3)bh(m,m,C);else for(;g!==null;){if(g.tag===3){bh(g,m,C);break}else if(g.tag===1){var D=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof D.componentDidCatch=="function"&&(Qi===null||!Qi.has(D))){m=ys(C,m),m=mf(g,m,1),g=Va(g,m,1),m=Sr(),g!==null&&(Ti(g,1,m),Dn(g,m));break}}g=g.return}}function Pm(m,g,C){var D=m.pingCache;D!==null&&D.delete(g),g=Sr(),m.pingedLanes|=m.suspendedLanes&C,mr===m&&(Vr&C)===C&&(Ar===4||Ar===3&&(Vr&130023424)===Vr&&500>fn()-Ml?Do(m,0):Rl|=C),Dn(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=Sr();m=Yi(m,g),m!==null&&(Ti(m,g,C),Dn(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||Zn.current)rn=!0;else{if((m.lanes&C)===0&&(g.flags&128)===0)return rn=!1,Co(m,g,C);rn=(m.flags&131072)!==0}else rn=!1,xr&&(g.flags&1048576)!==0&&tm(g,is,g.index);switch(g.lanes=0,g.tag){case 2:var D=g.type;qu(m,g),m=g.pendingProps;var z=ja(g,On.current);yl(g,C),z=zu(null,g,D,m,z,C);var Y=of();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,cn(D)?(Y=!0,ll(g)):Y=!1,g.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,qd(g),z.updater=Hu,g.stateNode=z,z._reactInternals=g,ga(g,D,m,C),g=An(null,g,D,!0,Y,C)):(g.tag=0,xr&&Y&&Ru(g),hn(null,g,z,C),g=g.child),g;case 16:D=g.elementType;e:{switch(qu(m,g),m=g.pendingProps,z=D._init,D=z(D._payload),g.type=D,z=g.tag=V0(D),m=mi(D,m),z){case 0:g=va(null,g,D,m,C);break e;case 1:g=wn(null,g,D,m,C);break e;case 11:g=gf(null,g,D,m,C);break e;case 14:g=vs(null,g,D,mi(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:mi(D,z),va(m,g,D,z,C);case 1:return D=g.type,z=g.pendingProps,z=g.elementType===D?z:mi(D,z),wn(m,g,D,z,C);case 3:e:{if(To(g),m===null)throw Error(o(387));D=g.pendingProps,Y=g.memoizedState,z=Y.element,um(m,g),wo(g,D,null,C);var ie=g.memoizedState;if(D=ie.element,Ne&&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=ys(Error(o(423)),g),g=bs(m,g,D,C,z);break e}else if(D!==z){z=ys(Error(o(424)),g),g=bs(m,g,D,C,z);break e}else for(Ne&&(jn=Ba(g.stateNode.containerInfo),vn=g,xr=!0,Xi=null,Du=!1),C=sm(g,null,D,C),g.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(as(),D===z){g=Ga(m,g,C);break e}hn(m,g,D,C)}g=g.child}return g;case 5:return Wd(g),m===null&&jd(g),D=g.type,z=g.pendingProps,Y=m!==null?m.memoizedProps:null,ie=z.children,te(D,z)?ie=null:Y!==null&&te(D,Y)&&(g.flags|=32),pr(m,g),hn(m,g,ie,C),g.child;case 6:return m===null&&jd(g),null;case 13:return uh(m,g,C);case 4:return nf(g,g.stateNode.containerInfo),D=g.pendingProps,m===null?g.child=ss(g,null,D,C):hn(m,g,D,C),g.child;case 11:return D=g.type,z=g.pendingProps,z=g.elementType===D?z:mi(D,z),gf(m,g,D,z,C);case 7:return hn(m,g,g.pendingProps,C),g.child;case 8:return hn(m,g,g.pendingProps.children,C),g.child;case 12:return hn(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(qi(Y.value,ie)){if(Y.children===z.children&&!Zn.current){g=Ga(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 Le=Pe.firstContext;Le!==null;){if(Le.context===D){if(Y.tag===1){Le=$a(-1,C&-C),Le.tag=2;var Xe=Y.updateQueue;if(Xe!==null){Xe=Xe.shared;var ht=Xe.pending;ht===null?Le.next=Le:(Le.next=ht.next,ht.next=Le),Xe.pending=Le}}Y.lanes|=C,Le=Y.alternate,Le!==null&&(Le.lanes|=C),ls(Y.return,C,g),Pe.lanes|=C;break}Le=Le.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),ls(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}hn(m,g,z.children,C),g=g.child}return g;case 9:return z=g.type,D=g.pendingProps.children,yl(g,C),z=di(z),D=D(z),g.flags|=1,hn(m,g,D,C),g.child;case 14:return D=g.type,z=mi(D,g.pendingProps),z=mi(D.type,z),vs(m,g,D,z,C);case 15:return Wa(m,g,g.type,g.pendingProps,C);case 17:return D=g.type,z=g.pendingProps,z=g.elementType===D?z:mi(D,z),qu(m,g),g.tag=1,cn(D)?(m=!0,ll(g)):m=!1,yl(g,C),gm(g,D,z),ga(g,D,z,C),An(null,g,D,!0,m,C);case 19:return vf(m,g,C);case 22:return yr(m,g,C)}throw Error(o(156,g.tag))};function wh(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 xi(m,g,C,D){return new Om(m,g,C,D)}function Bl(m){return m=m.prototype,!(!m||!m.isReactComponent)}function V0(m){if(typeof m=="function")return Bl(m)?1:0;if(m!=null){if(m=m.$$typeof,m===b)return 11;if(m===S)return 14}return 2}function Lo(m,g){var C=m.alternate;return C===null?(C=xi(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 Rf(m,g,C,D,z,Y){var ie=2;if(D=m,typeof m=="function")Bl(m)&&(ie=1);else if(typeof m=="string")ie=5;else e:switch(m){case f:return xn(C.children,z,Y,g);case p:ie=8,z|=8;break;case h:return m=xi(12,C,g,z|2),m.elementType=h,m.lanes=Y,m;case w:return m=xi(13,C,g,z),m.elementType=w,m.lanes=Y,m;case k:return m=xi(19,C,g,z),m.elementType=k,m.lanes=Y,m;case _:return zl(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=xi(ie,C,g,z),g.elementType=m,g.type=D,g.lanes=Y,g}function xn(m,g,C,D){return m=xi(7,m,D,g),m.lanes=C,m}function zl(m,g,C,D){return m=xi(22,m,D,g),m.elementType=_,m.lanes=C,m.stateNode={isHidden:!1},m}function jl(m,g,C){return m=xi(6,m,null,g),m.lanes=C,m}function Mf(m,g,C){return g=xi(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=oe,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fl(0),this.expirationTimes=fl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fl(0),this.identifierPrefix=D,this.onRecoverableError=z,Ne&&(this.mutableSourceEagerHydrationData=null)}function xh(m,g,C,D,z,Y,ie,Pe,Le){return m=new Am(m,g,C,Pe,Le),g===1?(g=1,Y===!0&&(g|=8)):g=0,Y=xi(3,null,null,g),m.current=Y,Y.stateNode=m,Y.memoizedState={element:D,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},qd(Y),m}function Df(m){if(!m)return mo;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(cn(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(cn(C))return Yp(m,C,g)}return g}function Cs(m){var g=m._reactInternals;if(g===void 0)throw typeof m.render=="function"?Error(o(188)):(m=Object.keys(m).join(","),Error(o(268,m)));return m=F(g),m===null?null:m.stateNode}function Nf(m,g){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var C=m.retryLane;m.retryLane=C!==0&&C<g?C:g}}function Ul(m,g){Nf(m,g),(m=m.alternate)&&Nf(m,g)}function q0(m){return m=F(m),m===null?null:m.stateNode}function Im(){return null}return r.attemptContinuousHydration=function(m){if(m.tag===13){var g=Yi(m,134217728);if(g!==null){var C=Sr();Mn(g,m,134217728,C)}Ul(m,134217728)}},r.attemptDiscreteHydration=function(m){if(m.tag===13){var g=Yi(m,1);if(g!==null){var C=Sr();Mn(g,m,1,C)}Ul(m,1)}},r.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13){var g=an(m),C=Yi(m,g);if(C!==null){var D=Sr();Mn(C,m,g,D)}Ul(m,g)}},r.attemptSynchronousHydration=function(m){switch(m.tag){case 3:var g=m.stateNode;if(g.current.memoizedState.isDehydrated){var C=ul(g.pendingLanes);C!==0&&(pa(g,C|1),Dn(g,fn()),(Lt&6)===0&&(dr(),yn()))}break;case 13:ph(function(){var D=Yi(m,1);if(D!==null){var z=Sr();Mn(D,m,1,z)}}),Ul(m,1)}},r.batchedUpdates=function(m,g){var C=Lt;Lt|=1;try{return m(g)}finally{Lt=C,Lt===0&&(dr(),pl&&yn())}},r.createComponentSelector=function(m){return{$$typeof:Xa,value:m}},r.createContainer=function(m,g,C,D,z,Y,ie){return xh(m,g,!1,null,C,D,z,Y,ie)},r.createHasPseudoClassSelector=function(m){return{$$typeof:Vn,value:m}},r.createHydrationContainer=function(m,g,C,D,z,Y,ie,Pe,Le){return m=xh(C,D,!0,m,z,Y,ie,Pe,Le),m.context=Df(null),C=m.current,D=Sr(),z=an(C),Y=$a(D,z),Y.callback=g??null,Va(C,Y,z),m.current.lanes=z,Ti(m,z,D),Dn(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:Ol,value:m}},r.createTextSelector=function(m){return{$$typeof:Yu,value:m}},r.deferredUpdates=function(m){var g=Ut,C=zr.transition;try{return zr.transition=null,Ut=16,m()}finally{Ut=g,zr.transition=C}},r.discreteUpdates=function(m,g,C,D,z){var Y=Ut,ie=zr.transition;try{return zr.transition=null,Ut=1,m(g,C,D,z)}finally{Ut=Y,zr.transition=ie,Lt===0&&dr()}},r.findAllNodes=ka,r.findBoundingRects=function(m,g){if(!ge)throw Error(o(363));g=ka(m,g),m=[];for(var C=0;C<g.length;C++)m.push(ae(g[C]));for(g=m.length-1;0<g;g--){C=m[g];for(var D=C.x,z=D+C.width,Y=C.y,ie=Y+C.height,Pe=g-1;0<=Pe;Pe--)if(g!==Pe){var Le=m[Pe],Xe=Le.x,ht=Xe+Le.width,Mt=Le.y,st=Mt+Le.height;if(D>=Xe&&Y>=Mt&&z<=ht&&ie<=st){m.splice(g,1);break}else if(D!==Xe||C.width!==Le.width||st<Y||Mt>ie){if(!(Y!==Mt||C.height!==Le.height||ht<D||Xe>z)){Xe>D&&(Le.width+=Xe-D,Le.x=D),ht<z&&(Le.width=z-Xe),m.splice(g,1);break}}else{Mt>Y&&(Le.height+=Mt-Y,Le.y=Y),st<ie&&(Le.height=ie-Mt),m.splice(g,1);break}}}return m},r.findHostInstance=Cs,r.findHostInstanceWithNoPortals=function(m){return m=N(m),m=m!==null?$(m):null,m===null?null:m.stateNode},r.findHostInstanceWithWarning=function(m){return Cs(m)},r.flushControlled=function(m){var g=Lt;Lt|=1;var C=zr.transition,D=Ut;try{zr.transition=null,Ut=1,m()}finally{Ut=D,zr.transition=C,Lt=g,Lt===0&&(dr(),yn())}},r.flushPassiveEffects=Qa,r.flushSync=ph,r.focusWithin=function(m,g){if(!ge)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&&ot(C.stateNode))return!0;for(C=C.child;C!==null;)g.push(C),C=C.sibling}}return!1},r.getCurrentUpdatePriority=function(){return Ut},r.getFindAllNodesFailureDescription=function(m,g){if(!ge)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(Pf(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(Pf(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:q0,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{yo=g.inject(m),Jn=g}catch{}m=!!g.checkDCE}}return m},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(m,g,C,D){if(!ge)throw Error(o(363));m=ka(m,g);var z=ke(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=Ut;try{return Ut=m,g()}finally{Ut=C}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(m,g,C,D){var z=g.current,Y=Sr(),ie=an(z);return C=Df(C),g.context===null?g.context=C:g.pendingContext=C,g=$a(Y,ie),g.payload={element:m},D=D===void 0?null:D,D!==null&&(g.callback=D),m=Va(z,g,ie),m!==null&&(Mn(m,z,ie,Y),Lu(m,z,ie)),ie},r}),N1}var qw;function R7(){return qw||(qw=1,D1.exports=I7()),D1.exports}var M7=R7();const D7=Oc(M7);var L1={exports:{}},Yl={};var Ww;function N7(){return Ww||(Ww=1,Yl.ConcurrentRoot=1,Yl.ContinuousEventPriority=4,Yl.DefaultEventPriority=16,Yl.DiscreteEventPriority=1,Yl.IdleEventPriority=536870912,Yl.LegacyRoot=0),Yl}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),Su(t));for(var u in y)t.on(u+I2,y[u])}function Su(t){if(!Ze.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),Su(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 V7(t,e,r){return!1}function q7(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),Su(t)}function lT(t,e){e.parent===t?e.moveToTop():t.add(e),Su(t)}function N5(t,e,r){e._remove(),t.add(e),e.setZIndex(r.getZIndex()),Su(t)}function uT(t,e,r){N5(t,e,r)}function cT(t,e){e.destroy(),e.off(I2),Su(t)}function fT(t,e){e.destroy(),e.off(I2),Su(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(),Su(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:V7,getChildHostContext:J7,getCurrentEventPriority:xT,getPublicInstance:q7,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")?qr.useLayoutEffect:qr.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(qr.createContext(null));class B5 extends qr.Component{render(){return qr.createElement(R2.Provider,{value:this._reactInternals},this.props.children)}}function OT(){const t=qr.useContext(R2);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=qr.useId();return qr.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]=qr.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,qr.useContext(F5(i)))}r=r.return}return e}function z5(){const t=AT();return qr.useMemo(()=>Array.from(t.keys()).reduce((e,r)=>n=>qr.createElement(e,null,qr.createElement(r.Provider,CT(Jw({},n),{value:t.get(r)}))),e=>qr.createElement(B5,Jw({},e))),[t])}function IT(t){const e=G.useRef({});return G.useLayoutEffect(()=>{e.current=t}),G.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const RT=t=>{const e=G.useRef(null),r=G.useRef(null),n=G.useRef(null),i=IT(t),a=z5(),o=s=>{const{forwardedRef:u}=t;u&&(typeof u=="function"?u(s):u.current=s)};return G.useLayoutEffect(()=>(r.current=new Ec.Stage({width:t.width,height:t.height,container:e.current}),o(r.current),n.current=Xh.createContainer(r.current,M5.LegacyRoot,!1,null),Xh.updateContainer(G.createElement(a,{},t.children),n.current),()=>{Ec.isBrowser&&(o(null),Xh.updateContainer(null,n.current,null),r.current.destroy())}),[]),G.useLayoutEffect(()=>{o(r.current),w0(r.current,t,i),Xh.updateContainer(G.createElement(a,{},t.children),n.current,null)}),G.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",Kt="Group",Hg="Label",ur="Rect",DT="Circle",Hs="Line",Ho="Image",Na="Text",NT="TextPath",M2="Arc",$g="Tag",bp="Path",wp="Transformer",Xh=D7(ST);Xh.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:G.version,rendererPackageName:"react-konva"});const LT=G.forwardRef((t,e)=>G.createElement(B5,{},G.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=G.useRef(t);return e.current=t,G.useCallback((...r)=>e.current.apply(null,r),[])}const Vg=({children:t,groupProps:e,divProps:r,transform:n,transformFunc:i,parentNodeFunc:a})=>{const o=z5(),s=G.useRef(null),[u]=G.useState(()=>document.createElement("div")),d=G.useMemo(()=>tS.createRoot(u),[u]),f=n??!0,p=UT(()=>{if(f&&s.current){let w=s.current.getAbsoluteTransform().decompose();i&&(w=i(w)),u.style.position="absolute",u.style.zIndex="10",u.style.top="0px",u.style.left="0px",u.style.transform=`translate(${w.x}px, ${w.y}px) rotate(${w.rotation}deg) scaleX(${w.scaleX}) scaleY(${w.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 G.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]),G.useLayoutEffect(()=>{p()},[r,i]),G.useLayoutEffect(()=>{queueMicrotask(()=>{JS.flushSync(()=>{d.render(G.createElement(o,null,t))})})}),G.useLayoutEffect(()=>()=>{setTimeout(()=>{d.unmount()})},[]),G.createElement(Kt,Object.assign({ref:s},e))},N2=({selector:t,enabled:e,children:r})=>{const n=G.useRef(null),i=G.useRef(null),a=G.useRef(null),o=e??!0;return G.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]),G.useEffect(()=>()=>{var s;(s=a.current)===null||s===void 0||s.destroy()},[]),G.createElement(Kt,{name:"_outer_portal",ref:n},G.createElement(Kt,{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 VT(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 qv(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,qv(t,e-1)),t[e].marker==="Z"&&qv(t,e-1)}function qT(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(VT),qv(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,w=b*(180/Math.PI),k=qT(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:w,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(W){var J=new Error(r+": "+W);throw J.source=r,J}function i(){var W=a();return r.length>0&&n("Invalid input not EOF"),W}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(W,J,te){return u(J,function(K){var ne=te();return ne&&(L(e.comma)||n("Missing comma before color stops")),{type:W,orientation:ne,colorStops:_(E)}})}function u(W,J){var te=L(W);if(te){L(e.startCall)||n("Missing (");var K=J(te);return L(e.endCall)||n("Missing )"),K}}function d(){var W=f();if(W)return W;var J=U("position-keyword",e.positionKeywords,1);return J?{type:"directional",value:J.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 W,J=y(),te;return J&&(W=[],W.push(J),te=r,L(e.comma)&&(J=y(),J?W.push(J):r=te)),W}function y(){var W=v()||b();if(W)W.at=k();else{var J=w();if(J){W=J;var te=k();te&&(W.at=te)}else{var K=k();if(K)W={type:"default-radial",at:K};else{var ne=S();ne&&(W={type:"default-radial",at:ne})}}}return W}function v(){var W=U("shape",/^(circle)/i,0);return W&&(W.style=Q()||w()),W}function b(){var W=U("shape",/^(ellipse)/i,0);return W&&(W.style=S()||Z()||w()),W}function w(){return U("extent-keyword",e.extentKeywords,1)}function k(){if(U("position",/^at/,0)){var W=S();return W||n("Missing positioning value"),W}}function S(){var W=P();if(W.x||W.y)return{type:"position",value:W}}function P(){return{x:Z(),y:Z()}}function _(W){var J=W(),te=[];if(J)for(te.push(J);L(e.comma);)J=W(),J?te.push(J):n("One extra comma");return te}function E(){var W=A();return W||n("Expected color definition"),W.length=Z(),W}function A(){return I()||H()||F()||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:_(X)}})}function R(){return u(e.rgbaColor,function(){return{type:"rgba",value:_(X)}})}function N(){return u(e.varColor,function(){return{type:"var",value:$()}})}function F(){return u(e.hslColor,function(){var W=L(e.percentageValue);W&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");var J=X();L(e.comma);var te=L(e.percentageValue),K=te?te[1]:null;L(e.comma),te=L(e.percentageValue);var ne=te?te[1]:null;return(!K||!ne)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[J,K,ne]}})}function H(){return u(e.hslaColor,function(){var W=X();L(e.comma);var J=L(e.percentageValue),te=J?J[1]:null;L(e.comma),J=L(e.percentageValue);var K=J?J[1]:null;L(e.comma);var ne=X();return(!te||!K)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[W,te,K,ne]}})}function $(){return L(e.variableName)[1]}function X(){return L(e.number)[1]}function Z(){return U("%",e.percentageValue,1)||ee()||V()||Q()}function ee(){return U("position-keyword",e.positionKeywords,1)}function V(){return u(e.calcValue,function(){for(var W=1,J=0;W>0&&J<r.length;){var te=r.charAt(J);te==="("?W++:te===")"&&W--,J++}W>0&&n("Missing closing parenthesis in calc() expression");var K=r.substring(0,J-1);return q(J-1),{type:"calc",value:K}})}function Q(){return U("px",e.pixelValue,1)||U("em",e.emValue,1)}function U(W,J,te){var K=L(J);if(K)return{type:W,value:K[te]}}function L(W){var J,te;return te=/^[\n\r\t\s]+/.exec(r),te&&q(te[0].length),J=W.exec(r),J&&q(J[0].length),J}function q(W){r=r.substr(W)}return function(W){return r=W.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),un=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(!un(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)}))}},Yo=(t,e,r)=>{var n;return e===void 0&&(e=(n=t.fill)!==null&&n!==void 0?n:""),r===void 0&&(r="fill"),G.useMemo(()=>{if(!un(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=Pt.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 qg=!1;const JT=(t=!qg)=>{qg=t},eC=()=>qg;function Up(t,e){const r=G.useRef();G.useLayoutEffect(()=>{r.current&&r.current.destroy()},[e]),G.useLayoutEffect(()=>{if(!qg)return;const n=t.current.opacity();return n?(t.current.opacity(0),r.current=new Pt.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 V5=6e3;const rC=t=>{V5=t},nC=()=>V5;function Xs(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 q5=[];function aC(t){q5.push(t)}function Rd(t){q5.forEach(e=>e(t))}Wt(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]);Wt({value:!1});const L2=Wt([]);function oC(t){L2.push(t)}var Gv="Some test text;?#D-ПРИВЕТ!1230o9u8i7y6t5r4e3w2q1";let Ls;function fg(t,e="sans-serif",r="normal",n="normal"){Ls||(Ls=document.createElement("canvas"));var i=Ls.getContext("2d");return i.font=`${r} ${n} 40px '${t}', ${e}`,i.measureText(Gv).width}const op={Arial:!0},h3=t=>Object.keys(op).some(e=>e.startsWith(t+"_"))||!!op[t];async function sC(t,e,r,n=""){var i;const a=`${t}_${e}_${r}`;if(op[a])return;const o=!!(!((i=document.fonts)===null||i===void 0)&&i.load),s=(function(p="normal",h="normal"){Ls||(Ls=document.createElement("canvas"));var y=Ls.getContext("2d");return y.font=`${p} ${h} 40px sans-serif`,y.measureText(Gv).width})(e,r);if(o)try{if(await document.fonts.load(`${e} ${r} 16px '${t}'`),s!==fg(t,"sans-serif",e,r))return void(op[a]=!0)}catch{}const u=(function(p="normal",h="normal"){Ls||(Ls=document.createElement("canvas"));var y=Ls.getContext("2d");return y.font=`${p} ${h} 40px serif`,y.measureText(Gv).width})(e,r),d=fg(t,"sans-serif",e,r),f=Math.min(6e3,nC())/60;for(let p=0;p<f;p++){const h=fg(t,"sans-serif",e,r),y=fg(t,"serif",e,r);if(h!==d||h!==s||y!==u)return await new Promise(v=>setTimeout(v,100)),void(op[a]=!0);await new Promise(v=>setTimeout(v,60))}console.warn(`Timeout for loading font "${t}". Looks like polotno can't load it. Is it a correct font family?`),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 hr=Wt({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=Bt(t=>{hr.textVerticalResizeEnabled=t}),Y5=Bt(t=>{hr.removeBackgroundEnabled=t});Bt(t=>{X5&&console.warn("useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead."),Y5(t)});Bt(t=>{hr.aiTextEnabled=t});Bt(t=>{X5&&console.warn("useHtmlTextRender is deprecated. Use setRichTextEnabled instead."),hr.htmlRenderEnabled=t});const pC=Bt(t=>{hr.htmlRenderEnabled=t}),mC=Bt(t=>{hr.imageDownScalingEnabled=t});Bt(t=>{console.warn("useDownScaling is deprecated. Use setDownScalingEnabled instead."),mC(t)});Bt(t=>{console.warn("setForceTextFit is deprecated. Use setTextOverflow instead."),hr.textOverflow="change-font-size"});const K5=Bt(t=>{hr.textOverflow=t}),gC=Bt(t=>{hr.textSplitAllowed=t});Bt(t=>{hr.animationsEnabled=t});Bt(t=>{hr.autoDeleteEmptyText=t});function oi(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 nd(t,e,r,n){if(!un(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 Pt.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:oi(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=un(i.fill),s=un(i.stroke),u=hr.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,w=Math.max(1,b*i.fontSize),k=Math.max(1,Math.floor(v/w));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),w=Tc(b,v,i.curvePower,i.fontSize),k=oi(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="${w}" fill="none" />`;if(o){const E=`curve-fill-grad-${i.id||"temp"}`;_+=nd(i.fill,E)}if(s&&i.strokeWidth){const E=`curve-stroke-grad-${i.id||"temp"}`;_+=nd(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),w=["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?`${w}; ${f(i.stroke)}; -webkit-text-stroke: ${i.strokeWidth}px transparent`:`${w}; 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="${w}; ${o?f(i.fill):`color: ${r||i.fill}`}; position: relative;" contentEditable dir="${xp(oi(i.text))}">${v}</div>
|
|
88
|
+
</div>
|
|
89
|
+
`}return`<div style="${y}" contentEditable dir="${xp(oi(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 zi(t,e){var r;const n={filters:[]},i={};e.brightnessEnabled&&(n.filters.push(Pt.Filters.Brighten),n.brightness=e.brightness),e.blurEnabled&&(n.filters.push(Pt.Filters.Blur),n.blurRadius=e.blurRadius,e.type==="text"&&e.lineHeight<1&&(i.offset=e.fontSize)),e.sepiaEnabled&&n.filters.push(Pt.Filters.Sepia),e.grayscaleEnabled&&n.filters.push(Pt.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 ku=()=>"ontouchstart"in window||navigator.maxTouchPoints>0;var y3={},Z5="warn";function SC(t){Z5=t}function kC(){return Z5}var kn;(function(t){t.afterCreate="afterCreate",t.afterAttach="afterAttach",t.afterCreationFinalization="afterCreationFinalization",t.beforeDetach="beforeDetach",t.beforeDestroy="beforeDestroy"})(kn||(kn={}));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 Dr(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 Ko=function(){return Ko=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},Ko.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 mu(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 $t(t).type}function ek(t,e){return $t(t).onSnapshot(e)}function v3(t,e){$t(t).applyPatches(uk(e))}function Yv(t,e){return $t(t).applySnapshot(e)}function jo(t,e){e===void 0&&(e=!0);var r=$t(t);return e?r.snapshot:r.type.getSnapshot(r,!1)}function dg(t,e){for(var r=$t(t).parent;r;){if(e.is(r.storedValue))return!0;r=r.parent}return!1}function dc(t,e){for(var r=$t(t).parent;r;){if(e.is(r.storedValue))return r.storedValue;r=r.parent}throw new St("Failed to find the parent of ".concat($t(t)," of a given type"))}function PC(t){return $t(t).root.storedValue}function EC(t){return $t(t).path}function TC(t,e){var r=XC($t(t),e);return r?r.value:void 0}function CC(t){return $t(t).identifier}function bc(t){return $t(t).detach(),t}function j1(t){var e=$t(t);e.isRoot?e.die():e.parent.removeChild(e.subpath)}function b3(t){return $t(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(kn.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(kn.beforeDestroy)}}),t})(),Sp=(function(t){Dr(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 St("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=Bt(Sp.prototype.die);var OC=1,ro;(function(t){t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.CREATING=1]="CREATING",t[t.CREATED=2]="CREATED"})(ro||(ro={}));var Ji;(function(t){t.Dispose="dispose",t.Patch="patch",t.Snapshot="snapshot"})(Ji||(Ji={}));var AC={onError:function(t){throw t}},ji=(function(t){Dr(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:ro.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 qC),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 St("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===ro.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=ro.CREATING;for(var s=[],u=this.parent;u&&u._observableInstanceState===ro.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=ro.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=Pd,this.state=Kn.CREATED,r){this.fireHook(kn.afterCreate),this.finalizeCreation();try{for(var y=sp(s.reverse()),v=y.next();!v.done;v=y.next()){var p=v.value;p.fireHook(kn.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(kn.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(kn.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===ro.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 St(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===ro.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===ro.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 St("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(kn.afterCreationFinalization)})}}),Object.defineProperty(e.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw new St("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!==ro.UNINITIALIZED&&(this.getChildren().forEach(function(r){r.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(Ji.Dispose),this._internalEventsClear(Ji.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(Ji.Snapshot,r)}}),Object.defineProperty(e.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this._internalEventsEmit(Ji.Snapshot,r)}}),Object.defineProperty(e.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._internalEventsRegister(Ji.Patch,r)}}),Object.defineProperty(e.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this._internalEventsHasSubscribers(Ji.Patch)){var i=n.path.substr(this.path.length)+(r.path?"/"+r.path:""),a=eO({},r,{path:i}),o=mu(oO(a),2),s=o[0],u=o[1];this._internalEventsEmit(Ji.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(Ji.Dispose,r)}}),Object.defineProperty(e.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!this.hasDisposer(r)){this._internalEventsRegister(Ji.Dispose,r,!0);return}throw new St("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(Ji.Dispose,r))throw new St("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister(Ji.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],mu(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);ji.prototype.createObservableInstance=Bt(ji.prototype.createObservableInstance);ji.prototype.detach=Bt(ji.prototype.detach);ji.prototype.die=Bt(ji.prototype.die);var rk,Zt;(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"})(Zt||(Zt={}));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 Ws(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 St("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)?Ui():Hi(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 St("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 St("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 St("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 St("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=Bt(Ys.prototype.create);var kd=(function(t){Dr(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||Wr(n)&&$t(n)===r?!0:r.type===this&&ck(n)&&!Wr(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(),Wr(n)&&this.isAssignableFrom(J5(n))){var s=$t(n);return s.setParent(i,a),s}return this.instantiate(i,a,void 0,n)}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),e})(Ys);kd.prototype.create=Bt(kd.prototype.create);var Bc=(function(t){Dr(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=$t(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([],mu(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 Bt(r).apply(null,e.args);var i=null;function a(o){var s=n.getNextMiddleware(),u=s&&s.handler;if(!u)return Bt(r).apply(null,o.args);if(!s.includeHooks&&kn[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:"",">"):Wr(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=Wr(e)?"value of type ".concat($t(e).type.name,":"):_p(e)?"value":"snapshot",o=r&&Wr(e)&&r.is($t(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 Ui(){return _d}function Hi(t,e,r){return[{context:t,value:e,message:r}]}function x0(t){return t.reduce(function(e,r){return e.concat(r)},[])}function Ws(t,e){aO()&&HC(t,e)}function HC(t,e){var r=t.validate(e,[{path:"",type:t}]);if(r.length>0)throw new St($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 VC=0,qC=(function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:VC++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Wt.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Wt.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,Wt.array([],S0));var i=this.cache.get(n);if(i.indexOf(e)!==-1)throw new St("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=mu(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 St("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 St("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 ji(t,e,r,n,i)}function _u(t,e,r,n,i){return new Sp(t,e,r,n,i)}function WC(t){return t instanceof Sp||t instanceof ji}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 Wr(t){return!!(t&&t.$treenode)}function $t(t){if(!Wr(t))throw new St("Value ".concat(t," is no MST Node"));return t.$treenode}function ak(t){return t&&t.$treenode||null}function GC(){return $t(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;Wr(o)&&(n=$t(o))}if(n instanceof ji){var s=n.getChildType(a);if(s&&(n=n.getChildNode(a),n))continue}}}throw new St("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 St=(function(t){Dr(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)||Qo(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 id(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){lo(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([],mu(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([],mu(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 St("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 St("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){Dr(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|Zt.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 ji&&(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=Wr(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,Wr(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?Hi(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:Wr(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 tu;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.YES=1]="YES",t[t.NO=2]="NO"})(tu||(tu={}));var pO=(function(t){Dr(e,t);function e(r,n){return t.call(this,r,Wt.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 St("Map.put cannot be used to set empty values");if(Wr(r)){var n=$t(r);if(n.identifier===null)throw new St(x3);return this.set(n.identifier,r),r}else if(ck(r)){var i=$t(this),a=i.type;if(a.identifierMode!==tu.YES)throw new St(x3);var o=a.mapIdentifierAttribute,s=r[o];if(!z2(s)){var u=this.put(a.getChildType().create(r,i.environment));return this.put(jo(u))}var d=Hp(s);return this.set(d,r),this.get(d)}else throw new St("Map.put can only be used to store complex values")}}),e})(S2),Gg=(function(t){Dr(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:tu.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:Zt.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===tu.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 St("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=tu.YES,this.mapIdentifierAttribute=n):this.identifierMode=tu.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 St("Not a child "+n);return i}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=$t(r.object),i=r.name;n.assertWritable({subpath:i});var a=n.type,o=a._subType;switch(r.type){case"update":{var s=r.newValue,u=r.object.get(i);if(s===u)return null;Ws(o,s),r.newValue=o.reconcile(n.getChildNode(i),r.newValue,n,i),a.processIdentifier(i,r.newValue)}break;case"add":Ws(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===tu.YES&&n instanceof ji){var i=n.identifier;if(i!==r)throw new St("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(i,"', but expected: '").concat(r,"'"))}}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return r.getChildren().forEach(function(i){n[i.subpath]=i.snapshot}),n}}),Object.defineProperty(e.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return Object.keys(r).forEach(function(i){n[i]=r[i].getSnapshot()}),n}}),Object.defineProperty(e.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=$t(r.object);switch(r.type){case"update":return void n.emitPatch({op:"replace",path: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){Ws(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 id(r)?x0(Object.keys(r).map(function(a){return i._subType.validate(r[a],F2(n,a,i._subType))})):Hi(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=Bt(Gg.prototype.applySnapshot);function mO(t){return new Gg("Map<string, ".concat(t.name,">"),t)}var Xg=(function(t){Dr(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:Zt.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=Ko(Ko({},S0),{name:this.name});return Wt.array(sk(r),n)}}),Object.defineProperty(e.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){Xo(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 St("Not a child: "+n)}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=$t(r.object);n.assertWritable({subpath:""+r.index});var i=n.type._subType,a=n.getChildren();switch(r.type){case"update":{if(r.newValue===r.object[r.index])return null;var o=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=$t(r.object);switch(r.type){case"update":return void n.emitPatch({op:"replace",path:""+r.index,value:r.newValue.snapshot,oldValue:r.oldValue?r.oldValue.snapshot:void 0},n);case"splice":if(r.removedCount&&r.addedCount===r.object.length)return void n.emitPatch({op:"replace",path:"",value:n.snapshot,oldValue:r.removed.map(function(a){return a.snapshot})},n);for(var i=r.removedCount-1;i>=0;i--)n.emitPatch({op:"remove",path:""+(r.index+i),oldValue:r.removed[i].snapshot},n);for(var i=0;i<r.addedCount;i++)n.emitPatch({op:"add",path:""+(r.index+i),value:r.added[i].snapshot,oldValue:void 0},n);return}}}),Object.defineProperty(e.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){var a=r.storedValue,o=n==="-"?a.length:Number(n);switch(i.op){case"replace":a[o]=i.value;break;case"add":a.splice(o,0,i.value);break;case"remove":a.splice(o,1);break}}}),Object.defineProperty(e.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){Ws(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))})):Hi(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=Bt(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 ji&&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(Wr(d)&&$t(d).parent===t)throw new St("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($t(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){Ws(t,n);function a(){if(Wr(n)){var s=$t(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 ji&&i.createObservableInstanceIfNeeded(),i.die()),o}function k3(t,e){if(!t.isAlive)return!1;if(Wr(e)){var r=$t(e);return r.isAlive&&r===t}if(t.snapshot===e)return!0;if(!(t instanceof ji))return!1;var n=t.getReconciliationType();return t.identifier!==null&&t.identifierAttribute&&id(e)&&n.is(e)&&n.isMatchingSnapshotId(t,e)}var _3="preProcessSnapshot",P3="postProcessSnapshot";function yO(){return $t(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 St("".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 kn)throw new St("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 St("Getters are not supported as properties. Please use views instead");var o=a.value;if(o==null)throw new St("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 St("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(o,"' (").concat(typeof o,")"));return n},Ko({},t))}var Pp=(function(t){Dr(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:Zt.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&Zt.Identifier){if(r)throw new St("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(!id(n))throw new St("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(n).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as an action"));if(a===_3)throw new St("Cannot define action '".concat(_3,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(a===P3)throw new St("Cannot define action '".concat(P3,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var o=n[a],s=r[a];if(a in kn&&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 St("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(!id(n))throw new St("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(n).forEach(function(a){if(a in i.properties)throw new St("'".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 St("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(!id(n))throw new St("views initializer should return a plain object containing views");Object.getOwnPropertyNames(n).forEach(function(a){var o;if(a in i.properties)throw new St("'".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),qS(r,(o={},o[a]=Ac,o));else if(typeof s.value=="function")wc(r,a,s.value);else throw new St("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=Wr(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=Ko(Ko({},S0),{name:this.name});return Wt.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=$t(n.object),a=n.name;i.assertWritable({subpath:a});var o=i.type.properties[a];return o&&(Ws(o,n.newValue),n.newValue=o.reconcile(i.getChildNode(a),n.newValue,i,a)),n}}),Object.defineProperty(e.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r,i=$t(n.object),a=i.type.properties[n.name];if(a){var o=n.oldValue?n.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path: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 St("Not a value property: "+n);var a=Xo(r.storedValue,n),o=(i=a.raw)===null||i===void 0?void 0:i.call(a);if(!o)throw new St("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 St("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){Ws(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 id(a)?x0(this.propertyNames.map(function(o){return i.properties[o].validate(a[o],F2(n,o,i.properties[o]))})):Hi(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=Bt(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&Zt.Object)>0}var rl=(function(t){Dr(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 _u(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 Ui();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return Hi(n,r,"Value is not a ".concat(i))}}),e})(Bc),mk=new rl("string",Zt.String,function(t){return typeof t=="string"}),gk=new rl("number",Zt.Number,function(t){return typeof t=="number"}),SO=new rl("integer",Zt.Integer,function(t){return QC(t)}),kO=new rl("float",Zt.Float,function(t){return ZC(t)}),_O=new rl("finite",Zt.Finite,function(t){return JC(t)}),yk=new rl("boolean",Zt.Boolean,function(t){return typeof t=="boolean"}),vk=new rl("null",Zt.Null,function(t){return t===null}),bk=new rl("undefined",Zt.Undefined,function(t){return t===void 0}),wk=new rl("Date",Zt.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 St("Cannot determine primitive type from value "+t)}function EO(t){return Ks(t)&&(t.flags&(Zt.String|Zt.Number|Zt.Integer|Zt.Boolean|Zt.Date))>0}var TO=(function(t){Dr(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:Zt.Literal}),n.value=r,n}return Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return _u(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?Ui():Hi(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){Dr(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|Zt.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=Wr(r)?$t(r).snapshot:r;return this._predicate(a)?Ui():Hi(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([],mu(r.map(function(i){return Sk(""+i)})),!1));return typeof t=="string"&&(n.name=t),n}var IO=(function(t){Dr(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=Ko({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=Zt.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 St("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 St("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 Ui();a++}else i.push(u)}return a===1?Ui():Hi(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],mu(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&Zt.Union)>0}var MO=(function(t){Dr(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|Zt.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"&&Ws(this,r),r}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this.optionalValues.indexOf(r)>=0?Ui():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"&&Wr(e))throw new St("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){Dr(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)|Zt.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 St("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):Ui()}}),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){Dr(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:Zt.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Wt.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(Bt(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=_u(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)?Ui():Hi(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){Dr(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:Zt.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 _u(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):Ui():Hi(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 VO(t){switch(t){case kn.beforeDestroy:return"destroy";case kn.beforeDetach:return"detach";default:return}}var qO=(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(Wr(e)){var n=$t(e);if(!n.identifierAttribute)throw new St("Can only store references with a defined identifier attribute.");var i=n.unnormalizedIdentifier;if(i==null)throw new St("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new St("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){Dr(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){Dr(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:Zt.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)?Ui():Hi(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=$t(a),s=function(f,p){var h=VO(p);h&&i.fireInvalidated(h,r,n,o)},u=o.registerHook(kn.beforeDetach,s),d=o.registerHook(kn.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(kn.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(kn.afterCreationFinalization,function(){r.parent&&r.parent.createObservableInstanceIfNeeded()}),r.registerHook(kn.afterAttach,function(){s(!1)}))}}}),e})(Bc),GO=(function(t){Dr(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=Wr(a)?CC(a):a,s=new qO(a,this.targetType),u=_u(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=Wr(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){Dr(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=Wr(a)?this.options.set(a,r?r.storedValue:null):a,s=_u(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=Wr(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,Ko(Ko({},e),{onInvalidated:function(n){e&&e.onInvalidated&&e.onInvalidated(n),n.removeRef()}}));return e&&e.acceptsUndefined===!1?r:kk(r)}var Tk=(function(t){Dr(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:Zt.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 St("Identifier types can only be instantiated as direct child of a model type");return _u(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 St("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?Hi(n,r,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):Ui()}}),e})(Bc),KO=(function(t){Dr(e,t);function e(){var r=t.call(this,"identifier","string")||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Zt.Identifier}),r}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),e})(Tk),QO=(function(t){Dr(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){Dr(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:Zt.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 Ui();var i=this.options.getValidationMessage(r);return i?Hi(n,r,"Invalid value for type '".concat(this.name,"': ").concat(i)):Ui()}}),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 _u(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),ct={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=Pt.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(un(t))return rA(t);const e=Pt.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)}Pt._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=_r(({textNodeRef:t,element:e,onBlur:r,selectAll:n,cursorPosition:i})=>{const[a,o]=G.useState(O3),s=t.current;G.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=G.useRef(null);if(G.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))},[]),G.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=oi(e.text);return G.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=>G.createElement(Vg,null,G.createElement(iA,Object.assign({},t))),Ak=(t,e)=>{const[r,n]=G.useReducer(o=>o+1,0),i=G.useRef(h3(e)),a=G.useRef(null);return G.useLayoutEffect(()=>{if(i.current=h3(e),i.current)return;let o=!0;return(async()=>{i.current=!1,n();const s=Xs(`text ${e}`);await t.loadFont(e),o?(a.current=s,i.current=!0,n()):s()})(),()=>{a.current&&(a.current(),a.current=null),o=!1}},[e]),G.useEffect(()=>{i.current&&setTimeout(()=>{a.current&&(a.current(),a.current=null)})},[i.current]),[i.current]},Ik=({fontLoaded:t,fontFamily:e,fontSize:r,lineHeight:n})=>G.useMemo(()=>wC({fontFamily:e,fontSize:r,lineHeight:n}),[t,e,r,n]);function Yg(t){const e=G.useRef(t),r=G.useRef(t);return G.useMemo(()=>{r.current=e.current,e.current=t},[t]),r.current}const oA=_r(({element:t,store:e})=>{const r=G.useRef(null),n=G.useRef(null),i=G.useRef(null),a=G.useRef([]),[,o]=G.useReducer(Q=>Q+1,0),{editorEnabled:s,selectAll:u}=(Q=>{const[U,L]=G.useState(!1),q=G.useRef(!1);return G.useEffect(()=>{var W=!0;return setTimeout(()=>{W&&(Q._editModeEnabled&&(q.current=!0),L(!0),setTimeout(()=>{q.current=!1},50))},50),()=>{W=!1}},[]),{editorEnabled:U&&Q._editModeEnabled,selectAll:q.current}})(t),[d,f]=G.useState(!1),p=G.useRef(t.a.height),h=e.selectedShapes.indexOf(t)>=0&&t.selectable,y=Yg(h),{textVerticalResizeEnabled:v}=hr,b=hr.autoDeleteEmptyText,w=Yg(t.fontFamily),[k,S]=G.useState([]);G.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)}),G.useEffect(()=>{if(t.a.width)return;const Q=r.current;Q.width(600),t.set({width:1.4*Q.getTextWidth()})},[]),G.useEffect(()=>{y&&!h&&b&&t.text===""&&t.removable&&!t.placeholder&&e.deleteElements([t.id])},[b,t.placeholder,t.removable,t.text,h,y]),G.useLayoutEffect(()=>oo(()=>{const Q=r.current;zi(Q,t)})),G.useEffect(()=>{const Q=a.current;Q.length>0&&(a.current=[],Q.forEach(U=>U()))});const[P]=Ak(e,t.fontFamily);let _=oi(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};G.useLayoutEffect(()=>{if(!P)return;const{textOverflow:Q,textSplitAllowed:U}=hr,L=(q,...W)=>{const J=Xs(`text ${t.id} before ignore`);e.history.ignore(q,...W).then(()=>{a.current.push(J),o()})};if(!t.height){const q=E();return void L(()=>{t.set({height:q})})}if(!e.isPlaying)if(Q!=="change-font-size"||d){if(Q==="resize"){const q=E();v&&t.height<q&&!d&&L(()=>{var W;b3(t)&&t.set({height:q}),(W=r.current)===null||W===void 0||W.height(q)},!1,!0),v||t.height===q||d||L(()=>{var W;b3(t)&&t.set({height:q}),(W=r.current)===null||W===void 0||W.height(q)},!1,!0)}}else{const q=(function(J,te,K=!1){const ne=J.fontSize(),fe=J.height(),oe=oi(te.text);let ue=te.a.fontSize;J.height(void 0);const we=Math.round(2*te.a.fontSize)-1;for(let Re=1;Re<we;Re++){const Ne=te.a.height&&J.height()>te.a.height;let He=oe.split(`
|
|
98
|
+
`).join(" ").split(/[\s-]+/).reduce((xe,he)=>(he=he.toLowerCase(),/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(he)?xe.concat(he.split("")):xe.concat(he)),[]),$e=J.textArr.map(xe=>xe.text.toLowerCase()).join(";");const et=He.find(xe=>!$e.includes(xe)||($e=$e.replace(xe,""),!1));if(!(Ne||et&&!K))break;ue-=.5,J.fontSize(ue)}return J.fontSize(ne),J.height(fe),ue})(r.current,t,U);if(q!==t.fontSize)return void L(()=>{t.set({fontSize:q})},!1,!0);const W=E();t.height===W||v||L(()=>{t.set({height:W})},!1,!0)}}),G.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,q=t.a.rotation*Math.PI/180,W=-L/2*Math.cos(q),J=-L/2*Math.sin(q);t.set({width:U,x:t.a.x+W,y:t.a.y+J})}}},[P,t.curveEnabled,t.curvePower,t.text,t.fontSize,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing]),G.useLayoutEffect(()=>{const Q=r.current;Q&&(Q.width(Q.width()+1e-8),Q.width(Q.width()-1e-8),Q._setTextData(),zi(Q,t))},[P]);const A=G.useRef(null),T=G.useRef(0),I=Q=>{Q.evt.preventDefault(),e.selectedShapes.find(L=>L===t)&&t.contentEditable&&(T.current=(function(L){var q;const W=L.target,J=(function(ue){var we=ue.getAbsoluteTransform().copy();we.invert();var Re=ue.getStage().getPointerPosition();return we.point(Re)})(W),te=W.textArr,K=Math.floor(J.y/(W.fontSize()*W.lineHeight())),ne=te.slice(0,K).reduce((ue,we)=>ue+we.text.length,K),fe=(q=te[K])!==null&&q!==void 0?q:te[0];let oe=0;return W.align()==="right"?oe=W.width()-fe.width:W.align()==="center"&&(oe=W.width()/2-fe.width/2),ne+Math.round((J.x-oe)/fe.width*fe.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",F=Yo(t),H=Yo(t,t.stroke,"stroke"),$=G.useMemo(()=>t.backgroundEnabled?t.curveEnabled?(function({width:Q,height:U,padding:L=0,cornerRadius:q=0}){const W=-L,J=-L,te=Q+L,K=U+L,ne=u3(`M ${W} ${J} L ${te} ${J} L ${te} ${K} L ${W} ${K} Z`);return c3(ne,q).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:q="left",padding:W=0,cornerRadius:J=0}){var te;Q.forEach((oe,ue)=>{oe.cx=L/2,q==="right"?oe.cx=L-oe.width/2:q==="left"&&(oe.cx=oe.width/2),q!=="justify"||oe.lastInParagraph||(oe.width=L),q==="justify"&&(oe.cx=oe.width/2)});let K=`M ${(te=Q[0])===null||te===void 0?void 0:te.cx} ${-W}`;Q.forEach((oe,ue)=>{const{cx:we}=oe,Re=Q[ue-1];Re&&Re.width>oe.width?K+=` L ${we+oe.width/2+W} ${ue*U+W}`:K+=` L ${we+oe.width/2+W} ${ue*U-W}`;const Ne=Q[ue+1];Ne&&Ne.width>oe.width?K+=` L ${we+oe.width/2+W} ${(ue+1)*U-W}`:K+=` L ${we+oe.width/2+W} ${(ue+1)*U+W}`});for(var ne=Q.length-1;ne>=0;ne--){const oe=Q[ne],{cx:ue}=oe,we=Q[ne+1];we&&we.width>oe.width?K+=` L ${ue-oe.width/2-W} ${(ne+1)*U-W}`:K+=` L ${ue-oe.width/2-W} ${(ne+1)*U+W}`;const Re=Q[ne-1];Re&&Re.width>oe.width?K+=` L ${ue-oe.width/2-W} ${ne*U+W}`:K+=` L ${ue-oe.width/2-W} ${ne*U-W}`}K+=" Z";const fe=u3(K);return c3(fe,J).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]),X=ku();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 ee=t.curveEnabled?Tc(t.a.width,t.a.height,t.curvePower,t.a.fontSize):"",V=P?'"'+t.fontFamily+'"':w===t.fontFamily?"Arial":'"'+w+'"';return G.createElement(G.Fragment,null,G.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}),G.createElement(bp,{data:ee,stroke:"red",strokeWidth:1,x:t.a.x,y:t.a.y,rotation:t.a.rotation,visible:!1}),G.createElement(NT,Object.assign({ref:n,visible:t.curveEnabled,data:ee,text:_||t.placeholder,listening:!1,align:"center",textBaseline:"middle"},F,H,{strokeWidth:t.strokeWidth,lineJoin:"round",fillAfterStrokeEnabled:!0,fontSize:t.a.fontSize,fontFamily:`"${t.fontFamily}", "${w}"`,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})),G.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(_)},F,H,{lineJoin:"round",strokeWidth:t.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:t.a.fontSize,fontFamily:V,fontStyle:t.fontStyle+" "+t.fontWeight,textDecoration:t.textDecoration,align:t.align,verticalAlign:t.verticalAlign,draggable:X?t.draggable&&h:t.draggable,preventDefault:!X||h,opacity:t.curveEnabled?0:M,visible:!t._editModeEnabled,ellipsis:hr.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,q;const W=Q.target;(U=i.current)===null||U===void 0||U.setAttrs({x:W.x(),y:W.y(),rotation:W.rotation(),scale:W.scale()});const J=((L=W.getStage())===null||L===void 0?void 0:L.findOne("Transformer")).getActiveAnchor();if(J==="middle-left"||J==="middle-right"){const K=W.scaleX(),ne=W.width()*K,fe=t.a.fontSize;let oe=ne;ne<fe&&(oe=fe,A.current&&W.position(A.current)),W.width(oe),W.scaleX(1),W.scaleY(1);let ue=E();if(hr.textOverflow==="ellipsis")ue=p.current;else{const Re=Math.max(ue,p.current);W.height(Re),t.set({height:W.height()})}const we=hr.textVerticalResizeEnabled?Math.max(ue,p.current):E();t.set({x:W.x(),width:W.width(),rotation:W.rotation(),height:we}),zi(W,t)}if(J==="top-center"||J==="bottom-center"){let K=hr.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 te=Q.target.scaleX();(q=i.current)===null||q===void 0||q.setAttrs({scaleX:1,scaleY:1}),Q.target.scaleX(1),Q.target.scaleY(1),t.set({fontSize:t.a.fontSize*te,width:Q.target.width()*te,x:Q.target.x(),y:Q.target.y(),rotation:Q.target.rotation(),height:Q.target.height()*te,shadowBlur:t.shadowBlur*te,shadowOffsetX:t.shadowOffsetX*te,shadowOffsetY:t.shadowOffsetY*te,strokeWidth:t.strokeWidth*te})},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&&G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation},G.createElement(aA,{textNodeRef:r,element:t,selectAll:u,cursorPosition:T.current,onBlur:()=>{t.toggleEditMode(!1)}})))});var V1={exports:{}},q1={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
|
+
`)}})(q1)),q1.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 w(ee){return ee?p[p.length-1-ee]:f}function k(ee){var V=s+1;return ee===n.slice(V,V+ee.length)}function S(ee){var V=n.slice(s).indexOf(ee);return V>0?V:!1}function P(ee){return ee===_(1)}function _(ee){return n[s+(ee||1)]}function E(){var ee=p.pop();return f=p[p.length-1],ee}function A(ee){return f=ee,p.push(f),p.length}function T(ee){var V=f;return p[p.length-1]=f=ee,V}function I(ee){if((ee||1)==1)n[s]==`
|
|
100
|
+
`?(d++,o=1):o++,s++;else{var V=n.slice(s,s+ee).split(`
|
|
101
|
+
`);V.length>1&&(d+=V.length-1,o=1),o+=V[V.length-1].length,s=s+ee}}function M(){h.end={line:d,col:o},y.push(h),i="",h={}}function R(ee){h={type:ee,start:{line:d,col:o}}}for(;a=b();)switch(a){case" ":switch(w()){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(w()){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(w()){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(w()){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(w()){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(w()){case"before-name":case"name":case"before-value":case"value":i&&(h.value=i.trim()),h.name&&h.value&&M(),R("end"),M(),E(),w()==="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&&w(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(w()){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(w()){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 w()=="before-value"&&T("value"),i+=a;break;default:P("*")?(R("comment"),A("comment"),I()):i+=a;break}break;case"*":switch(w()){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(w()){case"comment":case"double-string":case"single-string":i+=a;break;case"before-value":T("value"),i+=a;break;default:for(var F=!1,H,$,X=0,Z=v.length;!F&&X<Z;++X)$=v[X],H=$.name||$,k(H)&&(F=!0,R(H),A($.state||"at-group"),I(H.length),$.prefix&&(h.prefix=$.prefix),$.type&&(h.type=$.type));F||(i+=a);break}break;case"(":switch(w()){case"value":A("value-paren");break;case"before-value":T("value");break}i+=a;break;case")":switch(w()){case"value-paren":E();break;case"before-value":T("value");break}i+=a;break;default:switch(w()){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}})(V1)),V1.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 w(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 w(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=w(A,T),A&&(A=o+A+(E?"":o)),"{"+A+d()+"}"}function w(_,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=Pt.Util.colorToRGBA(t),n=Pt.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(un(h)){const{rotation:y,stops:v}=jp(h),b=v.map(k=>({offset:100*k.offset+"%","stop-color":k.color})),w="color"+Math.round(1e8*Math.random());(function(k,S,P,_){var E=k.namespaceURI,A=document.createElementNS(E,"linearGradient");const T=Pt.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 F=0;F<_.length;F++){var H=_[F],$=document.createElementNS(E,"stop");for(var X in H)H.hasOwnProperty(X)&&$.setAttribute(X,H[X]);A.appendChild($)}(k.querySelector("defs")||k.insertBefore(document.createElementNS(E,"defs"),k.firstChild)).appendChild(A)})(r.children[0],w,y,b),o.style[d]=null,o.setAttribute(d,`url('#${w}')`)}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 w=Math.round(y*p.pixelRatio),k=Math.round(v*p.pixelRatio);(b.width!==w||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=G.useRef(n??t),[,a]=G.useReducer(u=>u+1,0),o=G.useCallback(u=>{i.current!==u&&(i.current=u,a())},[i]),s=G.useRef(null);return t===r&&(s.current&&(clearTimeout(s.current),s.current=null),i.current=r),G.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]=G.useState(t);return G.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&&hr.imageDownScalingEnabled&&f<1&&!a,h=r.x===0&&r.y===0&&r.width===e?.width&&r.height===e?.height,y=G.useMemo(()=>{if(e&&e.width&&e.height)return h&&d===0&&!p?void 0:gc()},[e,d,p,h]);return G.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,F,H,$,X){for(var Z=new ImageData(R,N),ee=new Int32Array(M.data.buffer),V=M.width,Q=new Int32Array(Z.data.buffer),U=Z.width,L=R/$,q=N/X,W=Math.round(1/L),J=Math.round(1/q),te=W*J,K=0;K<Z.height;K++)for(var ne=0;ne<U;ne++){for(var fe=0+Math.round(ne/L)+(0+Math.round(K/q))*V,oe=0,ue=0,we=0,Re=0,Ne=0;Ne<J;Ne++)for(var He=0;He<W;He++){var $e=ee[fe+He+Ne*V];oe+=$e<<24>>>24,ue+=$e<<16>>>24,we+=$e<<8>>>24,Re+=$e>>>24}oe=Math.round(oe/te),ue=Math.round(ue/te),we=Math.round(we/te),Re=Math.round(Re/te),Q[ne+K*U]=Re<<24|we<<16|ue<<8|oe}return Z})(E.getContext("2d").getImageData(0,0,E.width,E.height),A,T,0,0,E.width,E.height);return E.width=A,E.height=T,(_=E.getContext("2d"))===null||_===void 0||_.putImageData(I,0,0),E})(e,f):e,w=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,w.x,w.y,w.width,w.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]),G.useEffect(()=>()=>{y&&y.nodeName==="CANVAS"&&Pt.Util.releaseCanvas(y)},[y]),y||e},xA=gc(),SA=_r(({element:t})=>{const e=Math.min(30,t.a.width/4,t.a.height/4),r=G.useRef(null);return G.useEffect(()=>{const n=r.current;if(!n)return;const i=new Pt.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}}),G.createElement(Kt,{x:t.x,y:t.y,rotation:t.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},G.createElement(ur,{width:t.a.width,height:t.a.height,fill:"rgba(124, 173, 212, 0.8)"}),G.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=_r(({element:t})=>{const e=Math.max(10,Math.min(30,t.a.width/25));return G.createElement(Kt,{x:t.x,y:t.y,rotation:t.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},G.createElement(ur,{width:t.a.width,height:t.a.height,fill:"rgba(223, 102, 102, 0.8)"}),G.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=G.useRef(),i=()=>{var a;(a=n.current)===null||a===void 0||a.call(n),n.current=void 0};G.useEffect(()=>i,[]),G.useLayoutEffect(()=>{const a=e.slice(0,200),o=`image with id ${r} url: ${a}`;t!=="loading"||n.current||(n.current=Xs(o)),t!=="loading"&&i(),t==="failed"&&Rd(o)},[t])},z3=_r(({element:t,store:e})=>{var r;const[n,i]=G.useState(!1),a=G.useRef(null),o=G.useRef(null),s=e.selectedShapes.indexOf(t)>=0&&t.selectable,[u,d]=(xe=>{const[he,se]=G.useReducer(Oe=>Oe+1,0),ge=G.useRef("loading"),Ce=G.useRef(xe.src),ae=G.useRef(xe.src);ae.current!==xe.src&&(ae.current=xe.src,ge.current="loading");const _e=G.useMemo(()=>Dk(xe.src)||xe.type==="svg",[xe.src,xe.type]);return G.useEffect(()=>{if(!_e||!xe.src)return;let Oe=!1;return(async()=>{ge.current="loading",se();const Fe=await $p(xe.src),ot=U2(Fe);let ke;ke=xe.colorsReplace?H2(ot,xe.colorsReplace||new Map):nl(ot),Oe||(Ce.current=ke,ge.current="loaded",se())})(),()=>{Oe=!0}},[xe.src,JSON.stringify(xe.colorsReplace)]),_e?[Ce.current,ge.current]:[xe.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:xe,status:he,type:se})=>{const ge=G.useRef();return G.useEffect(()=>{ge.current=xe||ge.current},[xe]),he!=="failed"||he!=="failed"&&se==="svg"?ge.current:void 0})({image:f,status:p,type:t.type}),w=((xe,he,se)=>{const ge=G.useMemo(()=>{var Ce,ae;const{flipX:_e,flipY:Oe}=xe,Fe=xe.type==="svg"||xe.src.indexOf("data:image/svg+xml")>=0||xe.src.indexOf(".svg")>=0,ot=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,ke=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||ot)&&Fe||xe.maskSrc;if(!_e&&!Oe&&!ke)return he;if(!he||!he.width||!he.height)return null;const me=gc();let Ue=1;xe.type==="svg"&&(Ue=Math.max(xe.a.width/he.width*se,xe.a.height/he.height*se)),$2(me,Math.max(he.width*Ue,1),Math.max(he.height*Ue,1));let be=_e?-me.width:0,je=Oe?-me.height:0;return(Ce=me.getContext("2d"))===null||Ce===void 0||Ce.scale(_e?-1:1,Oe?-1:1),(ae=me.getContext("2d"))===null||ae===void 0||ae.drawImage(he,be,je,me.width,me.height),me},[xe.maskSrc,xe.flipX,xe.flipY,he,xe.a.width,xe.a.height,se]);return G.useEffect(()=>()=>{ge&&ge.nodeName==="CANVAS"&&Pt.Util.releaseCanvas(ge)},[ge]),ge})(t,f||b,v),k=((xe,he)=>{const se=L3(xe.maskSrc||""),[ge,Ce]=Y1(se,"anonymous");return up(se?Ce:"loaded",se||"",xe.id),G.useMemo(()=>{if(!ge||!he||!he.width||!he.height)return he;const ae=gc();ae.width=Math.max(he.width,1),ae.height=Math.max(he.height,1);const _e=ae.getContext("2d");if(!_e)return he;_e.drawImage(he,0,0),_e.globalCompositeOperation="source-in";const Oe=(function(Fe,ot){const ke=ot.width/ot.height;let me,Ue;return ke>=Fe.width/Fe.height?(me=Fe.width,Ue=Fe.width/ke):(me=Fe.height*ke,Ue=Fe.height),{x:(Fe.width-me)/2,y:(Fe.height-Ue)/2,width:me,height:Ue}})(ge,xe);return _e.drawImage(ge,Oe.x,Oe.y,Oe.width,Oe.height,0,0,he.width,he.height),ae},[he,ge,xe.a.width,xe.a.height])})(t,w)||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,F=t.stretchEnabled;F?(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,X=t.page._exportingOrRendering?1:Math.min(2,e.scale),Z=e._elementsPixelRatio*X;let ee=((xe,he,se,ge)=>{const Ce=L3(xe.clipSrc||""),[ae,_e]=Y1(Ce,"anonymous"),Oe=xe.clipSrc?_e:"loaded";up(Oe,xe.clipSrc,xe.id);const Fe=G.useMemo(()=>{if(he&&ae)return gc()},[he,ae]);return G.useLayoutEffect(()=>{var ot;if(!ae||!he||!he.width||!he.height||!ae||!ae.width||!ae.height||!Fe)return;const ke=gc(),me=Math.max(xe.a.width/ae.width*se,xe.a.height/ae.height*se);ke.width=Math.max(ae.width*me,1),ke.height=Math.max(ae.height*me,1),(ot=ke.getContext("2d"))===null||ot===void 0||ot.drawImage(ae,0,0,ke.width,ke.height),Fe.width=Math.max(he.width,1),Fe.height=Math.max(he.height,1);const Ue=Fe.getContext("2d");Ue&&(Ue.save(),Ue.drawImage(ke,0,0,he.width,he.height),Pt.Util.releaseCanvas(ke),Ue.globalCompositeOperation="source-in",Ue.drawImage(he,0,0,Fe.width,Fe.height),Ue.restore())},[Fe,he,ae,xe.a.width,xe.a.height,se,...ge]),xe.clipSrc&&ae?Fe:he})(t,wA(t,k,H,Z,$,n||t._cropModeEnabled||t.type==="svg",!0),Z,[H,$,Z]);const V=Math.max(t.a.width/M,t.a.height/R);G.useEffect(()=>{var xe;if(!t._cropModeEnabled)return;const he=(xe=a.current)===null||xe===void 0?void 0:xe.getStage();function se(Ce){t._cropModeEnabled&&Ce.target!==o.current&&t.toggleCropMode(!1)}function ge(Ce){t._cropModeEnabled&&Ce.target.parentNode!==he?.content&&t.toggleCropMode(!1)}return document.body.addEventListener("click",ge),he?.on("click",se),he?.on("tap",se),()=>{document.body.removeEventListener("click",ge),document.body.removeEventListener("touchstart",ge),he?.off("click",se),he?.off("click",se)}},[t._cropModeEnabled]),G.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled)return zi(a.current,t),oo(()=>{zi(a.current,t)},{delay:100})},[ee,t.page._exportingOrRendering,n,_,E,t._cropModeEnabled]),G.useLayoutEffect(()=>{var xe;n||t._cropModeEnabled?(xe=a.current)===null||xe===void 0||xe.clearCache():zi(a.current,t)},[n,t.a.width,t.a.height,t._cropModeEnabled]),G.useEffect(()=>{zi(a.current,t)},[t.shadowEnabled,t.shadowBlur,t.cornerRadius,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]);const Q=G.useRef(null),U=G.useRef(null),L=G.useRef(null);G.useLayoutEffect(()=>{t._cropModeEnabled&&(U.current.nodes([Q.current]),L.current.nodes([o.current]))},[t._cropModeEnabled]);var q=G.useRef(null),W=G.useRef(0),J=G.useRef(!1);const te=xe=>{var he;((he=xe.evt.touches)===null||he===void 0?void 0:he.length)>2&&xe.target.stopDrag(),Math.round(xe.target.x())>0&&(xe.target.x(0),xe.target.scaleX(1)),Math.round(xe.target.y())>0&&(xe.target.y(0),xe.target.scaleY(1));const se=xe.target.width()*xe.target.scaleX(),ge=xe.target.height()*xe.target.scaleY(),Ce=Math.min(1,M/se),ae=Math.min(1,R/ge),_e=1-Ce,Oe=Math.min(_e,Math.max(0,Math.round(-xe.target.x())/se)),Fe=1-ae,ot=Math.min(Fe,Math.max(0,Math.round(-xe.target.y())/ge));xe.target.setAttrs({x:-Oe*k.width,y:-ot*k.height,scaleX:1,scaleY:1}),t.set({cropX:Oe,cropY:ot,cropWidth:Ce,cropHeight:ae})},K=()=>{t.type!=="svg"&&t.contentEditable&&(t.stretchEnabled||setTimeout(()=>{t.toggleCropMode(!0)}))},ne=t.type==="svg"&&b,fe=p==="loading"&&!ne,[oe]=Kv(fe,100,!1,!1),ue=p==="failed",we=!oe&&!ue,Re=G.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Ne=we?t.a.opacity:0;Up(a,Ne);const He=t.selectable||e.role==="admin",$e=ku(),et=Yo(t,t.borderColor,"stroke");return G.createElement(G.Fragment,null,oe&&G.createElement(SA,{element:t}),ue&&G.createElement(kA,{element:t}),G.createElement(Ho,{ref:a,name:"element",id:t.id,image:ee,x:t.a.x,y:t.a.y,width:t.a.width||1,height:t.a.height||1,rotation:t.a.rotation,opacity:Ne,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,customCrop:H,listening:He,draggable:$e?t.draggable&&s:t.draggable,preventDefault:!$e||s,hideInExport:!t.showInExport,onDragMove:xe=>{t.set({x:xe.target.x(),y:xe.target.y()})},onDragEnd:xe=>{t.set({x:xe.target.x(),y:xe.target.y()})},onDblClick:K,onDblTap:K,onTransformStart:()=>{i(!0),Re.current={cropX:t.cropX,cropY:t.cropY,cropWidth:t.cropWidth,cropHeight:t.cropHeight}},onTransform:xe=>{var he;const se=xe.currentTarget,ge=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 ae=(he=xe.target.getStage())===null||he===void 0?void 0:he.findOne("Transformer"),_e=1-M/k.width,Oe=Math.min(_e,Math.max(0,t.cropX)),Fe=1-R/k.height,ot=Math.min(Fe,Math.max(0,t.cropY)),ke=ae.getActiveAnchor(),me=!(ke.indexOf("middle")>=0||ke.indexOf("center")>=0),Ue=!me&&ge<1&&Re.current.cropHeight>R/k.height;let be=me?t.cropWidth:t.cropWidth*ge;Ue&&(be=t.cropWidth);const je=!me&&Ce<1&&Re.current.cropWidth>M/k.width;let at=me?t.cropHeight:t.cropHeight*Ce;je&&(at=t.cropHeight),F&&(be=t.cropWidth,at=t.cropHeight),t.set({cropX:Oe,cropY:ot,x:se.x(),y:se.y(),width:se.width()*ge,height:se.height()*Ce,rotation:xe.target.rotation(),cropWidth:Math.min(be,1-Oe),cropHeight:Math.min(at,1-ot)})},onTransformEnd:xe=>{const he=xe.currentTarget;t.set({width:he.width(),height:he.height(),x:he.x(),y:he.y(),rotation:xe.target.rotation(),cropWidth:M/k.width,cropHeight:R/k.height}),i(!1)}}),G.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:Ne,offsetX:-t.borderSize/2,offsetY:-t.borderSize/2},et,{strokeWidth:t.borderSize,listening:!1,visible:!!t.borderSize,rotation:t.rotation,cornerRadius:Math.max(0,$-t.borderSize),hideInExport:!t.showInExport})),t._cropModeEnabled&&G.createElement(N2,{selector:".page-abs-container",enabled:!0},G.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)"}),G.createElement(Ho,{listening:!1,image:ee,x:t.x,y:t.y,width:t.a.width,height:t.a.height,rotation:t.rotation,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur}),G.createElement(Kt,{x:t.x,y:t.y,rotation:t.rotation,scaleX:V,scaleY:V},G.createElement(Ho,{image:k,ref:o,opacity:.4,draggable:!0,x:-t.cropX*k.width,y:-t.cropY*k.height,onDragMove:te,onTransform:te,onTouchMove:xe=>{xe.evt.preventDefault();const he=xe.target.getStage().getPointersPositions();var se=he[0],ge=he[1];const Ce=xe.target;if(se&&!ge&&!Ce.isDragging()&&J.current&&(Ce.startDrag(),J.current=!1),se&&ge){Pt.hitOnDragEnabled=!0,Ce.isDragging()&&(J.current=!0,Ce.stopDrag());const je=xe.target.getAbsoluteTransform().copy();je.invert();var ae={x:se.x,y:se.y},_e={x:ge.x,y:ge.y};if(!q.current)return void(q.current=F3(ae,_e));var Oe=F3(ae,_e),Fe=(function(At,le){return Math.sqrt(Math.pow(le.x-At.x,2)+Math.pow(le.y-At.y,2))})(ae,_e);W.current||(W.current=Fe);const at=Ce.position();var ot={x:Oe.x-at.x,y:Oe.y-at.y},ke=Fe/W.current;Ce.scaleX(ke),Ce.scaleY(ke);const Et=je.point(Oe),bt=je.point(q.current);var me=Et.x-bt.x,Ue=Et.y-bt.y,be={x:Math.min(0,Oe.x-ot.x*ke+me),y:Math.min(0,Oe.y-ot.y*ke+Ue)};Ce.position(be),W.current=Fe,q.current=Oe,te(xe)}},onTouchEnd:xe=>{W.current=0,q.current=null,Pt.hitOnDragEnabled=!1}}),G.createElement(wp,Object.assign({ref:L},bA)),G.createElement(ur,{width:M,height:R,ref:Q,listening:!1,onTransform:xe=>{if(t.cropX<Math.abs(xe.target.x()/k.width)&&xe.target.x()<0&&t.cropX>0){const Fe=(t.cropWidth+t.cropX)*k.width;xe.target.scaleX(1),xe.target.width(Fe)}if(t.cropY<Math.abs(xe.target.y()/k.height)&&xe.target.y()<0&&t.cropY>0){const Fe=(t.cropHeight+t.cropY)*k.height;xe.target.scaleY(1),xe.target.height(Fe)}xe.target.x()<-t.cropX*k.width-1e-9&&(xe.target.x(-t.cropX*k.width),xe.target.scaleX(1)),xe.target.y()<-t.cropY*k.height-1e-9&&(xe.target.y(-t.cropY*k.height),xe.target.scaleY(1));const he=Math.min(1,Math.max(0,t.cropX+xe.target.x()/k.width)),se=Math.min(1,Math.max(0,xe.target.y()/k.height+t.cropY)),ge=xe.target.width()*xe.target.scaleX(),Ce=xe.target.height()*xe.target.scaleY(),ae=Math.min(1-he,ge/k.width),_e=Math.min(1-se,Ce/k.height),Oe=xe.target.getAbsolutePosition(xe.target.getParent().getParent());xe.target.scale({x:1,y:1}),xe.target.position({x:0,y:0}),t.set({x:Oe.x,y:Oe.y,cropX:he,cropY:se,cropWidth:ae,cropHeight:_e,width:Math.min(ge*V,k.width*(1-he)*V),height:Math.min(Ce*V,k.height*(1-se)*V)})}}),G.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),w=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:w.default}};n.default=S}),(function(r,n,i){var a=this&&this.__extends||(function(){var w=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){w(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(w){a(k,w);function k(S){var P=this;return S="[Parchment] "+S,P=w.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(w){w[w.TYPE=3]="TYPE",w[w.LEVEL=12]="LEVEL",w[w.ATTRIBUTE=13]="ATTRIBUTE",w[w.BLOT=14]="BLOT",w[w.INLINE=7]="INLINE",w[w.BLOCK=11]="BLOCK",w[w.BLOCK_BLOT=10]="BLOCK_BLOT",w[w.INLINE_BLOT=6]="INLINE_BLOT",w[w.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",w[w.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",w[w.ANY=15]="ANY"})(p=n.Scope||(n.Scope={}));function h(w,k){var S=v(w);if(S==null)throw new o("Unable to create "+w+" blot");var P=S,_=w instanceof Node||w.nodeType===Node.TEXT_NODE?w:P.create(k);return new P(_,k)}n.create=h;function y(w,k){return k===void 0&&(k=!1),w==null?null:w[n.DATA_KEY]!=null?w[n.DATA_KEY].blot:k?y(w.parentNode,k):null}n.find=y;function v(w,k){k===void 0&&(k=p.ANY);var S;if(typeof w=="string")S=f[w]||s[w];else if(w instanceof Text||w.nodeType===Node.TEXT_NODE)S=f.text;else if(typeof w=="number")w&p.LEVEL&p.BLOCK?S=f.block:w&p.LEVEL&p.INLINE&&(S=f.inline);else if(w instanceof HTMLElement){var P=(w.getAttribute("class")||"").split(/\s+/);for(var _ in P)if(S=u[P[_]],S)break;S=S||d[w.tagName]}return S==null?null:k&p.LEVEL&S.scope&&k&p.TYPE&S.scope?S:null}n.query=v;function b(){for(var w=[],k=0;k<arguments.length;k++)w[k]=arguments[k];if(w.length>1)return w.map(function(_){return b(_)});var S=w[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 w;b<p?w=v.next(p-b):(w=v.next(h-b),y.push(w)),b+=u.length(w)}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 w=b.retain;h.peekType()==="insert"&&h.peekLength()<=w;)w-=h.peekLength(),v.push(h.next());b.retain-w>0&&y.next(b.retain-w)}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),w=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,w.peekLength()),w.next(_),v.delete(_);break;case a.EQUAL:_=Math.min(w.peekLength(),k.peekLength(),P);var E=w.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 w=y.peek(),k=u.length(w)-y.peekLength(),S=typeof w.insert=="string"?w.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 w=Math.min(y.peekLength(),v.peekLength()),k=y.next(w),S=v.next(w);if(k.delete)continue;S.delete?b.push(S):b.retain(w,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(),w=y.peekType();if(y.next(),w==="delete"){p-=Math.min(b,p-v);continue}else w==="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 w;for(w in y);return typeof w>"u"||i.call(y,w)},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,w,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),w=p(y,v),P!==w&&(A&&w&&(d(w)||(k=u(w)))?(k?(k=!1,S=b&&u(b)?b:[]):S=b&&d(b)?b:{},f(P,{name:v,newValue:h(A,S,w)})):typeof w<"u"&&f(P,{name:v,newValue:w}));return P}}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BlockEmbed=n.bubbleFormats=void 0;var a=(function(){function N(F,H){for(var $=0;$<H.length;$++){var X=H[$];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(F,X.key,X)}}return function(F,H,$){return H&&N(F.prototype,H),$&&N(F,$),F}})(),o=function N(F,H,$){F===null&&(F=Function.prototype);var X=Object.getOwnPropertyDescriptor(F,H);if(X===void 0){var Z=Object.getPrototypeOf(F);return Z===null?void 0:N(Z,H,$)}else{if("value"in X)return X.value;var ee=X.get;return ee===void 0?void 0:ee.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),w=P(b),k=i(7),S=P(k);function P(N){return N&&N.__esModule?N:{default:N}}function _(N,F){if(!(N instanceof F))throw new TypeError("Cannot call a class as a function")}function E(N,F){if(!N)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F&&(typeof F=="object"||typeof F=="function")?F:N}function A(N,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof F);N.prototype=Object.create(F&&F.prototype,{constructor:{value:N,enumerable:!1,writable:!0,configurable:!0}}),F&&(Object.setPrototypeOf?Object.setPrototypeOf(N,F):N.__proto__=F)}var T=1,I=(function(N){A(F,N);function F(){return _(this,F),E(this,(F.__proto__||Object.getPrototypeOf(F)).apply(this,arguments))}return a(F,[{key:"attach",value:function(){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"attach",this).call(this),this.attributes=new 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($,X){var Z=h.default.query($,h.default.Scope.BLOCK_ATTRIBUTE);Z!=null&&this.attributes.attribute(Z,X)}},{key:"formatAt",value:function($,X,Z,ee){this.format(Z,ee)}},{key:"insertAt",value:function($,X,Z){if(typeof X=="string"&&X.endsWith(`
|
|
107
|
+
`)){var ee=h.default.create(M.blotName);this.parent.insertBefore(ee,$===0?this:this.next),ee.insertAt(0,X.slice(0,-1))}else o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertAt",this).call(this,$,X,Z)}}]),F})(h.default.Embed);I.scope=h.default.Scope.BLOCK_BLOT;var M=(function(N){A(F,N);function F(H){_(this,F);var $=E(this,(F.__proto__||Object.getPrototypeOf(F)).call(this,H));return $.cache={},$}return a(F,[{key:"delta",value:function(){return this.cache.delta==null&&(this.cache.delta=this.descendants(h.default.Leaf).reduce(function($,X){return X.length()===0?$:$.insert(X.value(),R(X))},new f.default).insert(`
|
|
108
|
+
`,R(this))),this.cache.delta}},{key:"deleteAt",value:function($,X){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"deleteAt",this).call(this,$,X),this.cache={}}},{key:"formatAt",value:function($,X,Z,ee){X<=0||(h.default.query(Z,h.default.Scope.BLOCK)?$+X===this.length()&&this.format(Z,ee):o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"formatAt",this).call(this,$,Math.min(X,this.length()-$-1),Z,ee),this.cache={})}},{key:"insertAt",value:function($,X,Z){if(Z!=null)return o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertAt",this).call(this,$,X,Z);if(X.length!==0){var ee=X.split(`
|
|
109
|
+
`),V=ee.shift();V.length>0&&($<this.length()-1||this.children.tail==null?o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertAt",this).call(this,Math.min($,this.length()-1),V):this.children.tail.insertAt(this.children.tail.length(),V),this.cache={});var Q=this;ee.reduce(function(U,L){return Q=Q.split(U,!0),Q.insertAt(0,L),L.length},$+V.length)}}},{key:"insertBefore",value:function($,X){var Z=this.children.head;o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertBefore",this).call(this,$,X),Z instanceof v.default&&Z.remove(),this.cache={}}},{key:"length",value:function(){return this.cache.length==null&&(this.cache.length=o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"length",this).call(this)+T),this.cache.length}},{key:"moveChildren",value:function($,X){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"moveChildren",this).call(this,$,X),this.cache={}}},{key:"optimize",value:function($){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"optimize",this).call(this,$),this.cache={}}},{key:"path",value:function($){return o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"path",this).call(this,$,!0)}},{key:"removeChild",value:function($){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"removeChild",this).call(this,$),this.cache={}}},{key:"split",value:function($){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(X&&($===0||$>=this.length()-T)){var Z=this.clone();return $===0?(this.parent.insertBefore(Z,this),this):(this.parent.insertBefore(Z,this.next),Z)}else{var ee=o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"split",this).call(this,$,X);return this.cache={},ee}}}]),F})(h.default.Block);M.blotName="block",M.tagName="P",M.defaultChild="break",M.allowedChildren=[w.default,h.default.Embed,S.default];function R(N){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return N==null||(typeof N.formats=="function"&&(F=(0,u.default)(F,N.formats())),N.parent==null||N.parent.blotName=="scroll"||N.parent.statics.scope!==N.statics.scope)?F:R(N.parent,F)}n.bubbleFormats=R,n.BlockEmbed=I,n.default=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 q=[],W=!0,J=!1,te=void 0;try{for(var K=U[Symbol.iterator](),ne;!(W=(ne=K.next()).done)&&(q.push(ne.value),!(L&&q.length===L));W=!0);}catch(fe){J=!0,te=fe}finally{try{!W&&K.return&&K.return()}finally{if(J)throw te}}return q}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 q=0;q<L.length;q++){var W=L[q];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,W.key,W)}}return function(U,L,q){return L&&Q(U.prototype,L),q&&Q(U,q),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),w=i(0),k=R(w),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 F(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,q){var W=this,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof L!="string"){var te=L.attrName||L.blotName;typeof te=="string"?this.register("formats/"+te,L,q):Object.keys(L).forEach(function(K){W.register(K,L[K],q)})}else this.imports[L]!=null&&!J&&H.warn("Overwriting "+L+" with",q),this.imports[L]=q,(L.startsWith("blots/")||L.startsWith("formats/"))&&q.blotName!=="abstract"?k.default.register(q):L.startsWith("modules")&&typeof q.register=="function"&&q.register()}}]);function Q(U){var L=this,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(F(this,Q),this.options=X(U,q),this.container=this.options.container,this.container==null)return H.error("Invalid Quill container",U);this.options.debug&&Q.debug(this.options.debug);var W=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(te){te===y.default.events.TEXT_CHANGE&&L.root.classList.toggle("ql-blank",L.editor.isBlank())}),this.emitter.on(y.default.events.SCROLL_UPDATE,function(te,K){var ne=L.selection.lastRange,fe=ne&&ne.length===0?ne.index:void 0;Z.call(L,function(){return L.editor.update(null,K,fe)},te)});var J=this.clipboard.convert(`<div class='ql-editor' style="white-space: normal;">`+W+"<p><br></p></div>");this.setContents(J),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 q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof L=="string"){var W=L;L=document.createElement("div"),L.classList.add(W)}return this.container.insertBefore(L,q),L}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(L,q,W){var J=this,te=ee(L,q,W),K=o(te,4);return L=K[0],q=K[1],W=K[3],Z.call(this,function(){return J.editor.deleteText(L,q)},W,L,-1*q)}},{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,q){var W=this,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.default.sources.API;return Z.call(this,function(){var te=W.getSelection(!0),K=new d.default;if(te==null)return K;if(k.default.query(L,k.default.Scope.BLOCK))K=W.editor.formatLine(te.index,te.length,N({},L,q));else{if(te.length===0)return W.selection.format(L,q),K;K=W.editor.formatText(te.index,te.length,N({},L,q))}return W.setSelection(te,y.default.sources.SILENT),K},J)}},{key:"formatLine",value:function(L,q,W,J,te){var K=this,ne=void 0,fe=ee(L,q,W,J,te),oe=o(fe,4);return L=oe[0],q=oe[1],ne=oe[2],te=oe[3],Z.call(this,function(){return K.editor.formatLine(L,q,ne)},te,L,0)}},{key:"formatText",value:function(L,q,W,J,te){var K=this,ne=void 0,fe=ee(L,q,W,J,te),oe=o(fe,4);return L=oe[0],q=oe[1],ne=oe[2],te=oe[3],Z.call(this,function(){return K.editor.formatText(L,q,ne)},te,L,0)}},{key:"getBounds",value:function(L){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,W=void 0;typeof L=="number"?W=this.selection.getBounds(L,q):W=this.selection.getBounds(L.index,L.length);var J=this.container.getBoundingClientRect();return{bottom:W.bottom-J.top,height:W.height,left:W.left-J.left,right:W.right-J.left,top:W.top-J.top,width:W.width}}},{key:"getContents",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-L,W=ee(L,q),J=o(W,2);return L=J[0],q=J[1],this.editor.getContents(L,q)}},{key:"getFormat",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof L=="number"?this.editor.getFormat(L,q):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,q=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,q)}},{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,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-L,W=ee(L,q),J=o(W,2);return L=J[0],q=J[1],this.editor.getText(L,q)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(L,q,W){var J=this,te=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Q.sources.API;return Z.call(this,function(){return J.editor.insertEmbed(L,q,W)},te,L)}},{key:"insertText",value:function(L,q,W,J,te){var K=this,ne=void 0,fe=ee(L,0,W,J,te),oe=o(fe,4);return L=oe[0],ne=oe[2],te=oe[3],Z.call(this,function(){return K.editor.insertText(L,q,ne)},te,L,q.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,q,W){this.clipboard.dangerouslyPasteHTML(L,q,W)}},{key:"removeFormat",value:function(L,q,W){var J=this,te=ee(L,q,W),K=o(te,4);return L=K[0],q=K[1],W=K[3],Z.call(this,function(){return J.editor.removeFormat(L,q)},W,L)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(L){var q=this,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API;return Z.call(this,function(){L=new d.default(L);var J=q.getLength(),te=q.editor.deleteText(0,J),K=q.editor.applyDelta(L),ne=K.ops[K.ops.length-1];ne!=null&&typeof ne.insert=="string"&&ne.insert[ne.insert.length-1]===`
|
|
110
|
+
`&&(q.editor.deleteText(q.getLength()-1,1),K.delete(1));var fe=te.compose(K);return fe},W)}},{key:"setSelection",value:function(L,q,W){if(L==null)this.selection.setRange(null,q||Q.sources.API);else{var J=ee(L,q,W),te=o(J,4);L=te[0],q=te[1],W=te[3],this.selection.setRange(new S.Range(L,q),W),W!==y.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(L){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API,W=new d.default().insert(L);return this.setContents(W,q)}},{key:"update",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y.default.sources.USER,q=this.scroll.update(L);return this.selection.update(L),q}},{key:"updateContents",value:function(L){var q=this,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API;return Z.call(this,function(){return L=new d.default(L),q.editor.applyDelta(L,W)},W,!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 X(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(J){J.modules=J.modules||{},Object.keys(J.modules).forEach(function(te){J.modules[te]===!0&&(J.modules[te]={})})});var q=Object.keys(L.modules).concat(Object.keys(U.modules)),W=q.reduce(function(J,te){var K=$.import("modules/"+te);return K==null?H.error("Cannot load "+te+" module. Are you sure you registered it?"):J[te]=K.DEFAULTS||{},J},{});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:W},L,U),["bounds","container","scrollingContainer"].forEach(function(J){typeof U[J]=="string"&&(U[J]=document.querySelector(U[J]))}),U.modules=Object.keys(U.modules).reduce(function(J,te){return U.modules[te]&&(J[te]=U.modules[te]),J},{}),U}function Z(Q,U,L,q){if(this.options.strict&&!this.isEnabled()&&U===y.default.sources.USER)return new d.default;var W=L==null?null:this.getSelection(),J=this.editor.delta,te=Q();if(W!=null&&(L===!0&&(L=W.index),q==null?W=V(W,te,U):q!==0&&(W=V(W,L,q,U)),this.setSelection(W,y.default.sources.SILENT)),te.length()>0){var K,ne=[y.default.events.TEXT_CHANGE,te,J,U];if((K=this.emitter).emit.apply(K,[y.default.events.EDITOR_CHANGE].concat(ne)),U!==y.default.sources.SILENT){var fe;(fe=this.emitter).emit.apply(fe,ne)}}return te}function ee(Q,U,L,q,W){var J={};return typeof Q.index=="number"&&typeof Q.length=="number"?typeof U!="number"?(W=q,q=L,L=U,U=Q.length,Q=Q.index):(U=Q.length,Q=Q.index):typeof U!="number"&&(W=q,q=L,L=U,U=0),(typeof L>"u"?"undefined":a(L))==="object"?(J=L,W=q):typeof L=="string"&&(q!=null?J[L]=q:W=L),W=W||y.default.sources.API,[Q,U,J,W]}function V(Q,U,L,q){if(Q==null)return null;var W=void 0,J=void 0;if(U instanceof d.default){var te=[Q.index,Q.index+Q.length].map(function(oe){return U.transformPosition(oe,q!==y.default.sources.USER)}),K=o(te,2);W=K[0],J=K[1]}else{var ne=[Q.index,Q.index+Q.length].map(function(oe){return oe<U||oe===U&&q===y.default.sources.USER?oe:L>=0?oe+L:Math.max(U,oe+L)}),fe=o(ne,2);W=fe[0],J=fe[1]}return new S.Range(W,J-W)}n.expandConfig=X,n.overload=ee,n.default=$}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function w(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&&w(k.prototype,S),P&&w(k,P),k}})(),o=function w(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:w(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(w){return w&&w.__esModule?w:{default:w}}function h(w,k){if(!(w instanceof k))throw new TypeError("Cannot call a class as a function")}function y(w,k){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:w}function v(w,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);w.prototype=Object.create(k&&k.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(w,k):w.__proto__=k)}var b=(function(w){v(k,w);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"),w=["selectionchange","mousedown","mouseup","click"];w.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,w;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(w=k[b],!u(h[w],y[w],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=[],F=!0,H=!1,$=void 0;try{for(var X=M[Symbol.iterator](),Z;!(F=(Z=X.next()).done)&&(N.push(Z.value),!(R&&N.length===R));F=!0);}catch(ee){H=!0,$=ee}finally{try{!F&&X.return&&X.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 F=R[N];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(M,F.key,F)}}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 F=Object.getOwnPropertyDescriptor(M,R);if(F===void 0){var H=Object.getPrototypeOf(M);return H===null?void 0:I(H,R,N)}else{if("value"in F)return F.value;var $=F.get;return $===void 0?void 0:$.call(N)}},u=i(2),d=S(u),f=i(0),p=S(f),h=i(4),y=S(h),v=i(6),b=S(v),w=i(7),k=S(w);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,F=this.domNode.textContent;return F.endsWith(`
|
|
111
|
+
`)&&(F=F.slice(0,-1)),F.split(`
|
|
112
|
+
`).reduce(function(H,$){return H.insert($).insert(`
|
|
113
|
+
`,N.formats())},new d.default)}},{key:"format",value:function(N,F){if(!(N===this.statics.blotName&&F)){var H=this.descendant(k.default,this.length()-1),$=a(H,1),X=$[0];X?.deleteAt(X.length()-1,1),s(M.prototype.__proto__||Object.getPrototypeOf(M.prototype),"format",this).call(this,N,F)}}},{key:"formatAt",value:function(N,F,H,$){if(F!==0&&!(p.default.query(H,p.default.Scope.BLOCK)==null||H===this.statics.blotName&&$===this.statics.formats(this.domNode))){var X=this.newlineIndex(N);if(!(X<0||X>=N+F)){var Z=this.newlineIndex(N,!0)+1,ee=X-Z+1,V=this.isolate(Z,ee),Q=V.next;V.format(H,$),Q instanceof M&&Q.formatAt(0,N-Z+F-ee,H,$)}}}},{key:"insertAt",value:function(N,F,H){if(H==null){var $=this.descendant(k.default,N),X=a($,2),Z=X[0],ee=X[1];Z.insertAt(ee,F)}}},{key:"length",value:function(){var N=this.domNode.textContent.length;return this.domNode.textContent.endsWith(`
|
|
114
|
+
`)?N:N+1}},{key:"newlineIndex",value:function(N){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(F)return this.domNode.textContent.slice(0,N).lastIndexOf(`
|
|
115
|
+
`);var H=this.domNode.textContent.slice(N).indexOf(`
|
|
116
|
+
`);return H>-1?N+H:-1}},{key:"optimize",value:function(N){this.domNode.textContent.endsWith(`
|
|
117
|
+
`)||this.appendChild(p.default.create("text",`
|
|
118
|
+
`)),s(M.prototype.__proto__||Object.getPrototypeOf(M.prototype),"optimize",this).call(this,N);var F=this.next;F!=null&&F.prev===this&&F.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===F.statics.formats(F.domNode)&&(F.optimize(N),F.moveChildren(this),F.remove())}},{key:"replace",value:function(N){s(M.prototype.__proto__||Object.getPrototypeOf(M.prototype),"replace",this).call(this,N),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(F){var H=p.default.find(F);H==null?F.parentNode.removeChild(F):H instanceof p.default.Embed?H.remove():H.unwrap()})}}],[{key:"create",value:function(N){var F=s(M.__proto__||Object.getPrototypeOf(M),"create",this).call(this,N);return F.setAttribute("spellcheck",!1),F}},{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 q=[],W=!0,J=!1,te=void 0;try{for(var K=U[Symbol.iterator](),ne;!(W=(ne=K.next()).done)&&(q.push(ne.value),!(L&&q.length===L));W=!0);}catch(fe){J=!0,te=fe}finally{try{!W&&K.return&&K.return()}finally{if(J)throw te}}return q}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 q=0;q<L.length;q++){var W=L[q];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,W.key,W)}}return function(U,L,q){return L&&Q(U.prototype,L),q&&Q(U,q),U}})(),u=i(2),d=F(u),f=i(20),p=F(f),h=i(0),y=F(h),v=i(13),b=F(v),w=i(24),k=F(w),S=i(4),P=F(S),_=i(16),E=F(_),A=i(21),T=F(A),I=i(11),M=F(I),R=i(3),N=F(R);function F(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 X=/^[ -~]*$/,Z=(function(){function Q(U){$(this,Q),this.scroll=U,this.delta=this.getDelta()}return s(Q,[{key:"applyDelta",value:function(L){var q=this,W=!1;this.scroll.update();var J=this.scroll.length();return this.scroll.batchStart(),L=V(L),L.reduce(function(te,K){var ne=K.retain||K.delete||K.insert.length||1,fe=K.attributes||{};if(K.insert!=null){if(typeof K.insert=="string"){var oe=K.insert;oe.endsWith(`
|
|
119
|
+
`)&&W&&(W=!1,oe=oe.slice(0,-1)),te>=J&&!oe.endsWith(`
|
|
120
|
+
`)&&(W=!0),q.scroll.insertAt(te,oe);var ue=q.scroll.line(te),we=o(ue,2),Re=we[0],Ne=we[1],He=(0,N.default)({},(0,S.bubbleFormats)(Re));if(Re instanceof P.default){var $e=Re.descendant(y.default.Leaf,Ne),et=o($e,1),xe=et[0];He=(0,N.default)(He,(0,S.bubbleFormats)(xe))}fe=p.default.attributes.diff(He,fe)||{}}else if(a(K.insert)==="object"){var he=Object.keys(K.insert)[0];if(he==null)return te;q.scroll.insertAt(te,he,K.insert[he])}J+=ne}return Object.keys(fe).forEach(function(se){q.scroll.formatAt(te,ne,se,fe[se])}),te+ne},0),L.reduce(function(te,K){return typeof K.delete=="number"?(q.scroll.deleteAt(te,K.delete),te):te+(K.retain||K.insert.length||1)},0),this.scroll.batchEnd(),this.update(L)}},{key:"deleteText",value:function(L,q){return this.scroll.deleteAt(L,q),this.update(new d.default().retain(L).delete(q))}},{key:"formatLine",value:function(L,q){var W=this,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(J).forEach(function(te){if(!(W.scroll.whitelist!=null&&!W.scroll.whitelist[te])){var K=W.scroll.lines(L,Math.max(q,1)),ne=q;K.forEach(function(fe){var oe=fe.length();if(!(fe instanceof b.default))fe.format(te,J[te]);else{var ue=L-fe.offset(W.scroll),we=fe.newlineIndex(ue+ne)-ue+1;fe.formatAt(ue,we,te,J[te])}ne-=oe})}}),this.scroll.optimize(),this.update(new d.default().retain(L).retain(q,(0,T.default)(J)))}},{key:"formatText",value:function(L,q){var W=this,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(J).forEach(function(te){W.scroll.formatAt(L,q,te,J[te])}),this.update(new d.default().retain(L).retain(q,(0,T.default)(J)))}},{key:"getContents",value:function(L,q){return this.delta.slice(L,L+q)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(L,q){return L.concat(q.delta())},new d.default)}},{key:"getFormat",value:function(L){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,W=[],J=[];q===0?this.scroll.path(L).forEach(function(K){var ne=o(K,1),fe=ne[0];fe instanceof P.default?W.push(fe):fe instanceof y.default.Leaf&&J.push(fe)}):(W=this.scroll.lines(L,q),J=this.scroll.descendants(y.default.Leaf,L,q));var te=[W,J].map(function(K){if(K.length===0)return{};for(var ne=(0,S.bubbleFormats)(K.shift());Object.keys(ne).length>0;){var fe=K.shift();if(fe==null)return ne;ne=ee((0,S.bubbleFormats)(fe),ne)}return ne});return N.default.apply(N.default,te)}},{key:"getText",value:function(L,q){return this.getContents(L,q).filter(function(W){return typeof W.insert=="string"}).map(function(W){return W.insert}).join("")}},{key:"insertEmbed",value:function(L,q,W){return this.scroll.insertAt(L,q,W),this.update(new d.default().retain(L).insert(H({},q,W)))}},{key:"insertText",value:function(L,q){var W=this,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return q=q.replace(/\r\n/g,`
|
|
121
|
+
`).replace(/\r/g,`
|
|
122
|
+
`),this.scroll.insertAt(L,q),Object.keys(J).forEach(function(te){W.scroll.formatAt(L,q.length,te,J[te])}),this.update(new d.default().retain(L).insert(q,(0,T.default)(J)))}},{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,q){var W=this.getText(L,q),J=this.scroll.line(L+q),te=o(J,2),K=te[0],ne=te[1],fe=0,oe=new d.default;K!=null&&(K instanceof b.default?fe=K.newlineIndex(ne)-ne+1:fe=K.length()-ne,oe=K.delta().slice(ne,ne+fe-1).insert(`
|
|
123
|
+
`));var ue=this.getContents(L,q+fe),we=ue.diff(new d.default().insert(W).concat(oe)),Re=new d.default().retain(L).concat(we);return this.applyDelta(Re)}},{key:"update",value:function(L){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,J=this.delta;if(q.length===1&&q[0].type==="characterData"&&q[0].target.data.match(X)&&y.default.find(q[0].target)){var te=y.default.find(q[0].target),K=(0,S.bubbleFormats)(te),ne=te.offset(this.scroll),fe=q[0].oldValue.replace(k.default.CONTENTS,""),oe=new d.default().insert(fe),ue=new d.default().insert(te.value()),we=new d.default().retain(ne).concat(oe.diff(ue,W));L=we.reduce(function(Re,Ne){return Ne.insert?Re.insert(Ne.insert,K):Re.push(Ne)},new d.default),this.delta=J.compose(L)}else this.delta=this.getDelta(),(!L||!(0,M.default)(J.compose(L),this.delta))&&(L=J.diff(this.delta,W));return L}}]),Q})();function ee(Q,U){return Object.keys(U).reduce(function(L,q){return Q[q]==null||(U[q]===Q[q]?L[q]=U[q]:Array.isArray(U[q])?U[q].indexOf(Q[q])<0&&(L[q]=U[q].concat([Q[q]])):L[q]=[U[q],Q[q]]),L},{})}function V(Q){return Q.reduce(function(U,L){if(L.insert===1){var q=(0,T.default)(L.attributes);return delete q.image,U.insert({image:L.attributes.image},q)}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 W=L.insert.replace(/\r\n/g,`
|
|
124
|
+
`).replace(/\r/g,`
|
|
125
|
+
`);return U.insert(W,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=[],F=!0,H=!1,$=void 0;try{for(var X=M[Symbol.iterator](),Z;!(F=(Z=X.next()).done)&&(N.push(Z.value),!(R&&N.length===R));F=!0);}catch(ee){H=!0,$=ee}finally{try{!F&&X.return&&X.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 F=R[N];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(M,F.key,F)}}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),w=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,w.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(F,H){F===v.default.events.TEXT_CHANGE&&H.length()>0&&N.update(v.default.sources.SILENT)}),this.emitter.on(v.default.events.SCROLL_BEFORE_UPDATE,function(){if(N.hasFocus()){var F=N.getNativeRange();F!=null&&F.start.node!==N.cursor.textNode&&N.emitter.once(v.default.events.SCROLL_UPDATE,function(){try{N.setNativeRange(F.start.node,F.start.offset,F.end.node,F.end.offset)}catch{}})}}),this.emitter.on(v.default.events.SCROLL_OPTIMIZE,function(F,H){if(H.range){var $=H.range,X=$.startNode,Z=$.startOffset,ee=$.endNode,V=$.endOffset;N.setNativeRange(X,Z,ee,V)}}),this.update(v.default.sources.SILENT)}return o(I,[{key:"handleComposition",value:function(){var R=this;this.root.addEventListener("compositionstart",function(){R.composing=!0}),this.root.addEventListener("compositionend",function(){if(R.composing=!1,R.cursor.parent){var N=R.cursor.restore();if(!N)return;setTimeout(function(){R.setNativeRange(N.startNode,N.startOffset,N.endNode,N.endOffset)},1)}})}},{key:"handleDragging",value:function(){var R=this;this.emitter.listenDOM("mousedown",document.body,function(){R.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){R.mouseDown=!1,R.update(v.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(R,N){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[R])){this.scroll.update();var F=this.getNativeRange();if(!(F==null||!F.native.collapsed||u.default.query(R,u.default.Scope.BLOCK))){if(F.start.node!==this.cursor.textNode){var H=u.default.find(F.start.node,!1);if(H==null)return;if(H instanceof u.default.Leaf){var $=H.split(F.start.offset);H.parent.insertBefore(this.cursor,$)}else H.insertBefore(this.cursor,F.start.node);this.cursor.attach()}this.cursor.format(R,N),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(R){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,F=this.scroll.length();R=Math.min(R,F-1),N=Math.min(R+N,F-1)-R;var H=void 0,$=this.scroll.leaf(R),X=a($,2),Z=X[0],ee=X[1];if(Z==null)return null;var V=Z.position(ee,!0),Q=a(V,2);H=Q[0],ee=Q[1];var U=document.createRange();if(N>0){U.setStart(H,ee);var L=this.scroll.leaf(R+N),q=a(L,2);if(Z=q[0],ee=q[1],Z==null)return null;var W=Z.position(ee,!0),J=a(W,2);return H=J[0],ee=J[1],U.setEnd(H,ee),U.getBoundingClientRect()}else{var te="left",K=void 0;return H instanceof Text?(ee<H.data.length?(U.setStart(H,ee),U.setEnd(H,ee+1)):(U.setStart(H,ee-1),U.setEnd(H,ee),te="right"),K=U.getBoundingClientRect()):(K=Z.domNode.getBoundingClientRect(),ee>0&&(te="right")),{bottom:K.top+K.height,height:K.height,left:K[te],right:K[te],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 F=this.normalizeNative(N);return _.info("getNativeRange",F),F}},{key:"getRange",value:function(){var R=this.getNativeRange();if(R==null)return[null,null];var N=this.normalizedToRange(R);return[N,R]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(R){var N=this,F=[[R.start.node,R.start.offset]];R.native.collapsed||F.push([R.end.node,R.end.offset]);var H=F.map(function(Z){var ee=a(Z,2),V=ee[0],Q=ee[1],U=u.default.find(V,!0),L=U.offset(N.scroll);return Q===0?L:U instanceof u.default.Container?L+U.length():L+U.index(V,Q)}),$=Math.min(Math.max.apply(Math,S(H)),this.scroll.length()-1),X=Math.min.apply(Math,[$].concat(S(H)));return new E(X,$-X)}},{key:"normalizeNative",value:function(R){if(!T(this.root,R.startContainer)||!R.collapsed&&!T(this.root,R.endContainer))return null;var N={start:{node:R.startContainer,offset:R.startOffset},end:{node:R.endContainer,offset:R.endOffset},native:R};return[N.start,N.end].forEach(function(F){for(var H=F.node,$=F.offset;!(H instanceof Text)&&H.childNodes.length>0;)if(H.childNodes.length>$)H=H.childNodes[$],$=0;else if(H.childNodes.length===$)H=H.lastChild,$=H instanceof Text?H.data.length:H.childNodes.length+1;else break;F.node=H,F.offset=$}),N}},{key:"rangeToNative",value:function(R){var N=this,F=R.collapsed?[R.index]:[R.index,R.index+R.length],H=[],$=this.scroll.length();return F.forEach(function(X,Z){X=Math.min($-1,X);var ee=void 0,V=N.scroll.leaf(X),Q=a(V,2),U=Q[0],L=Q[1],q=U.position(L,Z!==0),W=a(q,2);ee=W[0],L=W[1],H.push(ee,L)}),H.length<2&&(H=H.concat(H)),H}},{key:"scrollIntoView",value:function(R){var N=this.lastRange;if(N!=null){var F=this.getBounds(N.index,N.length);if(F!=null){var H=this.scroll.length()-1,$=this.scroll.line(Math.min(N.index,H)),X=a($,1),Z=X[0],ee=Z;if(N.length>0){var V=this.scroll.line(Math.min(N.index+N.length,H)),Q=a(V,1);ee=Q[0]}if(!(Z==null||ee==null)){var U=R.getBoundingClientRect();F.top<U.top?R.scrollTop-=U.top-F.top:F.bottom>U.bottom&&(R.scrollTop+=F.bottom-U.bottom)}}}}},{key:"setNativeRange",value:function(R,N){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:R,H=arguments.length>3&&arguments[3]!==void 0?arguments[3]:N,$=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(_.info("setNativeRange",R,N,F,H),!(R!=null&&(this.root.parentNode==null||R.parentNode==null||F.parentNode==null))){var X=document.getSelection();if(X!=null)if(R!=null){this.hasFocus()||this.root.focus();var Z=(this.getNativeRange()||{}).native;if(Z==null||$||R!==Z.startContainer||N!==Z.startOffset||F!==Z.endContainer||H!==Z.endOffset){R.tagName=="BR"&&(N=[].indexOf.call(R.parentNode.childNodes,R),R=R.parentNode),F.tagName=="BR"&&(H=[].indexOf.call(F.parentNode.childNodes,F),F=F.parentNode);var ee=document.createRange();ee.setStart(R,N),ee.setEnd(F,H),X.removeAllRanges(),X.addRange(ee)}}else X.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(R){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:v.default.sources.API;if(typeof N=="string"&&(F=N,N=!1),_.info("setRange",R),R!=null){var H=this.rangeToNative(R);this.setNativeRange.apply(this,S(H).concat([N]))}else this.setNativeRange(null);this.update(F)}},{key:"update",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v.default.sources.USER,N=this.lastRange,F=this.getRange(),H=a(F,2),$=H[0],X=H[1];if(this.lastRange=$,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,h.default)(N,this.lastRange)){var Z;!this.composing&&X!=null&&X.native.collapsed&&X.start.node!==this.cursor.textNode&&this.cursor.restore();var ee=[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(ee)),R!==v.default.sources.SILENT){var V;(V=this.emitter).emit.apply(V,ee)}}}}]),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,w){for(var k=0;k<w.length;k++){var S=w[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,w,k){return w&&v(b.prototype,w),k&&v(b,k),b}})(),o=function v(b,w,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,w);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,w,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(w){if(w instanceof u.ParchmentError)return;throw w}})},h.prototype.deleteAt=function(y,v){if(y===0&&v===this.length())return this.remove();this.children.forEachAt(y,v,function(b,w,k){b.deleteAt(w,k)})},h.prototype.descendant=function(y,v){var b=this.children.find(v),w=b[0],k=b[1];return y.blotName==null&&y(w)||y.blotName!=null&&w instanceof y?[w,k]:w instanceof h?w.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 w=[],k=b;return this.children.forEachAt(v,b,function(S,P,_){(y.blotName==null&&y(S)||y.blotName!=null&&S instanceof y)&&w.push(S),S instanceof h&&(w=w.concat(S.descendants(y,P,k))),k-=_}),w},h.prototype.detach=function(){this.children.forEach(function(y){y.detach()}),p.prototype.detach.call(this)},h.prototype.formatAt=function(y,v,b,w){this.children.forEachAt(y,v,function(k,S,P){k.formatAt(S,P,b,w)})},h.prototype.insertAt=function(y,v,b){var w=this.children.find(y),k=w[0],S=w[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),w=b[0],k=b[1],S=[[this,y]];return w instanceof h?S.concat(w.path(k,v)):(w!=null&&S.push([w,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(w,k,S){w=w.split(k,v),b.appendChild(w)}),b},h.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},h.prototype.update=function(y,v){var b=this,w=[],k=[];y.forEach(function(S){S.target===b.domNode&&S.type==="childList"&&(w.push.apply(w,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()}}),w.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(w){return w.target===b.domNode&&w.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,w){return w!=null&&b instanceof w}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,w,k,S,P){typeof w=="object"&&(k=w.depth,S=w.prototype,P=w.includeNonEnumerable,w=w.circular);var _=[],E=[],A=typeof Buffer<"u";typeof w>"u"&&(w=!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(q){U(T(q,M-1))},function(q){L(T(q,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(w){var F=_.indexOf(I);if(F!=-1)return E[F];_.push(I),E.push(R)}a(I,o)&&I.forEach(function(U,L){var q=T(L,M-1),W=T(U,M-1);R.set(q,W)}),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 X=Object.getOwnPropertySymbols(I),H=0;H<X.length;H++){var Z=X[H],ee=Object.getOwnPropertyDescriptor(I,Z);ee&&!ee.enumerable&&!P||(R[Z]=T(I[Z],M-1),ee.enumerable||Object.defineProperty(R,Z,{enumerable:!1}))}if(P)for(var V=Object.getOwnPropertyNames(I),H=0;H<V.length;H++){var Q=V[H],ee=Object.getOwnPropertyDescriptor(I,Q);ee&&ee.enumerable||(R[Q]=T(I[Q],M-1),Object.defineProperty(R,Q,{enumerable:!1}))}return R}return T(b,k)}d.clonePrototype=function(w){if(w===null)return null;var k=function(){};return k.prototype=w,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 w="";return b.global&&(w+="g"),b.ignoreCase&&(w+="i"),b.multiline&&(w+="m"),w}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,F){var H=[],$=!0,X=!1,Z=void 0;try{for(var ee=N[Symbol.iterator](),V;!($=(V=ee.next()).done)&&(H.push(V.value),!(F&&H.length===F));$=!0);}catch(Q){X=!0,Z=Q}finally{try{!$&&ee.return&&ee.return()}finally{if(X)throw Z}}return H}return function(N,F){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return R(N,F);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function R(N,F){for(var H=0;H<F.length;H++){var $=F[H];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(N,$.key,$)}}return function(N,F,H){return F&&R(N.prototype,F),H&&R(N,H),N}})(),s=function R(N,F,H){N===null&&(N=Function.prototype);var $=Object.getOwnPropertyDescriptor(N,F);if($===void 0){var X=Object.getPrototypeOf(N);return X===null?void 0:R(X,F,H)}else{if("value"in $)return $.value;var Z=$.get;return Z===void 0?void 0:Z.call(H)}},u=i(0),d=_(u),f=i(8),p=_(f),h=i(4),y=_(h),v=i(16),b=_(v),w=i(13),k=_(w),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(F,H){E(this,N);var $=A(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,F));return $.emitter=H.emitter,Array.isArray(H.whitelist)&&($.whitelist=H.whitelist.reduce(function(X,Z){return X[Z]=!0,X},{})),$.domNode.addEventListener("DOMNodeInserted",function(){}),$.optimize(),$.enable(),$}return o(N,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(H,$){var X=this.line(H),Z=a(X,2),ee=Z[0],V=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&&ee!==L&&V>0){if(ee instanceof h.BlockEmbed||L instanceof h.BlockEmbed){this.optimize();return}if(ee instanceof k.default){var q=ee.newlineIndex(ee.length(),!0);if(q>-1&&(ee=ee.split(q+1),ee===L)){this.optimize();return}}else if(L instanceof k.default){var W=L.newlineIndex(0);W>-1&&L.split(W+1)}var J=L.children.head instanceof b.default?null:L.children.head;ee.moveChildren(L,J),ee.remove()}this.optimize()}},{key:"enable",value:function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",H)}},{key:"formatAt",value:function(H,$,X,Z){this.whitelist!=null&&!this.whitelist[X]||(s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"formatAt",this).call(this,H,$,X,Z),this.optimize())}},{key:"insertAt",value:function(H,$,X){if(!(X!=null&&this.whitelist!=null&&!this.whitelist[$])){if(H>=this.length())if(X==null||d.default.query($,d.default.Scope.BLOCK)==null){var Z=d.default.create(this.statics.defaultChild);this.appendChild(Z),X==null&&$.endsWith(`
|
|
126
|
+
`)&&($=$.slice(0,-1)),Z.insertAt(0,$,X)}else{var ee=d.default.create($,X);this.appendChild(ee)}else s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"insertAt",this).call(this,H,$,X);this.optimize()}}},{key:"insertBefore",value:function(H,$){if(H.statics.scope===d.default.Scope.INLINE_BLOT){var X=d.default.create(this.statics.defaultChild);X.appendChild(H),H=X}s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"insertBefore",this).call(this,H,$)}},{key:"leaf",value:function(H){return this.path(H).pop()||[null,-1]}},{key:"line",value:function(H){return H===this.length()?this.line(H-1):this.descendant(I,H)}},{key:"lines",value:function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,X=function Z(ee,V,Q){var U=[],L=Q;return ee.children.forEachAt(V,Q,function(q,W,J){I(q)?U.push(q):q instanceof d.default.Container&&(U=U.concat(Z(q,W,L))),L-=J}),U};return X(this,H,$)}},{key:"optimize",value:function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"optimize",this).call(this,H,$),H.length>0&&this.emitter.emit(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,fe){var oe=[],ue=!0,we=!1,Re=void 0;try{for(var Ne=ne[Symbol.iterator](),He;!(ue=(He=Ne.next()).done)&&(oe.push(He.value),!(fe&&oe.length===fe));ue=!0);}catch($e){we=!0,Re=$e}finally{try{!ue&&Ne.return&&Ne.return()}finally{if(we)throw Re}}return oe}return function(ne,fe){if(Array.isArray(ne))return ne;if(Symbol.iterator in Object(ne))return K(ne,fe);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function K(ne,fe){for(var oe=0;oe<fe.length;oe++){var ue=fe[oe];ue.enumerable=ue.enumerable||!1,ue.configurable=!0,"value"in ue&&(ue.writable=!0),Object.defineProperty(ne,ue.key,ue)}}return function(ne,fe,oe){return fe&&K(ne.prototype,fe),oe&&K(ne,oe),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),w=i(20),k=R(w),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,fe){return ne in K?Object.defineProperty(K,ne,{value:fe,enumerable:!0,configurable:!0,writable:!0}):K[ne]=fe,K}function F(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 X=(0,T.default)("quill:keyboard"),Z=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",ee=(function(K){$(ne,K),s(ne,null,[{key:"match",value:function(oe,ue){return ue=te(ue),["altKey","ctrlKey","metaKey","shiftKey"].some(function(we){return!!ue[we]!==oe[we]&&ue[we]!==null})?!1:ue.key===(oe.which||oe.keyCode)}}]);function ne(fe,oe){F(this,ne);var ue=H(this,(ne.__proto__||Object.getPrototypeOf(ne)).call(this,fe,oe));return ue.bindings={},Object.keys(ue.options.bindings).forEach(function(we){we==="list autofill"&&fe.scroll.whitelist!=null&&!fe.scroll.whitelist.list||ue.options.bindings[we]&&ue.addBinding(ue.options.bindings[we])}),ue.addBinding({key:ne.keys.ENTER,shiftKey:null},q),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(oe){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},we=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Re=te(oe);if(Re==null||Re.key==null)return X.warn("Attempted to add invalid keyboard binding",Re);typeof ue=="function"&&(ue={handler:ue}),typeof we=="function"&&(we={handler:we}),Re=(0,y.default)(Re,ue,we),this.bindings[Re.key]=this.bindings[Re.key]||[],this.bindings[Re.key].push(Re)}},{key:"listen",value:function(){var oe=this;this.quill.root.addEventListener("keydown",function(ue){if(!ue.defaultPrevented){var we=ue.which||ue.keyCode,Re=(oe.bindings[we]||[]).filter(function(be){return ne.match(ue,be)});if(Re.length!==0){var Ne=oe.quill.getSelection();if(!(Ne==null||!oe.quill.hasFocus())){var He=oe.quill.getLine(Ne.index),$e=o(He,2),et=$e[0],xe=$e[1],he=oe.quill.getLeaf(Ne.index),se=o(he,2),ge=se[0],Ce=se[1],ae=Ne.length===0?[ge,Ce]:oe.quill.getLeaf(Ne.index+Ne.length),_e=o(ae,2),Oe=_e[0],Fe=_e[1],ot=ge instanceof P.default.Text?ge.value().slice(0,Ce):"",ke=Oe instanceof P.default.Text?Oe.value().slice(Fe):"",me={collapsed:Ne.length===0,empty:Ne.length===0&&et.length()<=1,format:oe.quill.getFormat(Ne),offset:xe,prefix:ot,suffix:ke},Ue=Re.some(function(be){if(be.collapsed!=null&&be.collapsed!==me.collapsed||be.empty!=null&&be.empty!==me.empty||be.offset!=null&&be.offset!==me.offset)return!1;if(Array.isArray(be.format)){if(be.format.every(function(je){return me.format[je]==null}))return!1}else if(a(be.format)==="object"&&!Object.keys(be.format).every(function(je){return be.format[je]===!0?me.format[je]!=null:be.format[je]===!1?me.format[je]==null:(0,p.default)(be.format[je],me.format[je])}))return!1;return be.prefix!=null&&!be.prefix.test(me.prefix)||be.suffix!=null&&!be.suffix.test(me.suffix)?!1:be.handler.call(oe,Ne,me)!==!0});Ue&&ue.preventDefault()}}}})}}]),ne})(M.default);ee.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},ee.DEFAULTS={bindings:{bold:J("bold"),italic:J("italic"),underline:J("underline"),indent:{key:ee.keys.TAB,format:["blockquote","indent","list"],handler:function(ne,fe){if(fe.collapsed&&fe.offset!==0)return!0;this.quill.format("indent","+1",E.default.sources.USER)}},outdent:{key:ee.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(ne,fe){if(fe.collapsed&&fe.offset!==0)return!0;this.quill.format("indent","-1",E.default.sources.USER)}},"outdent backspace":{key:ee.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(ne,fe){fe.format.indent!=null?this.quill.format("indent","-1",E.default.sources.USER):fe.format.list!=null&&this.quill.format("list",!1,E.default.sources.USER)}},"indent code-block":W(!0),"outdent code-block":W(!1),"remove tab":{key:ee.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(ne){this.quill.deleteText(ne.index-1,1,E.default.sources.USER)}},tab:{key:ee.keys.TAB,handler:function(ne){this.quill.history.cutoff();var fe=new b.default().retain(ne.index).delete(ne.length).insert(" ");this.quill.updateContents(fe,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(ne.index+1,E.default.sources.SILENT)}},"list empty enter":{key:ee.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(ne,fe){this.quill.format("list",!1,E.default.sources.USER),fe.format.indent&&this.quill.format("indent",!1,E.default.sources.USER)}},"checklist enter":{key:ee.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(ne){var fe=this.quill.getLine(ne.index),oe=o(fe,2),ue=oe[0],we=oe[1],Re=(0,y.default)({},ue.formats(),{list:"checked"}),Ne=new b.default().retain(ne.index).insert(`
|
|
127
|
+
`,Re).retain(ue.length()-we-1).retain(1,{list:"unchecked"});this.quill.updateContents(Ne,E.default.sources.USER),this.quill.setSelection(ne.index+1,E.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:ee.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(ne,fe){var oe=this.quill.getLine(ne.index),ue=o(oe,2),we=ue[0],Re=ue[1],Ne=new b.default().retain(ne.index).insert(`
|
|
128
|
+
`,fe.format).retain(we.length()-Re-1).retain(1,{header:null});this.quill.updateContents(Ne,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,fe){var oe=fe.prefix.length,ue=this.quill.getLine(ne.index),we=o(ue,2),Re=we[0],Ne=we[1];if(Ne>oe)return!0;var He=void 0;switch(fe.prefix.trim()){case"[]":case"[ ]":He="unchecked";break;case"[x]":He="checked";break;case"-":case"*":He="bullet";break;default:He="ordered"}this.quill.insertText(ne.index," ",E.default.sources.USER),this.quill.history.cutoff();var $e=new b.default().retain(ne.index-Ne).delete(oe+1).retain(Re.length()-2-Ne).retain(1,{list:He});this.quill.updateContents($e,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(ne.index-oe,E.default.sources.SILENT)}},"code exit":{key:ee.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(ne){var fe=this.quill.getLine(ne.index),oe=o(fe,2),ue=oe[0],we=oe[1],Re=new b.default().retain(ne.index+ue.length()-we-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(Re,E.default.sources.USER)}},"embed left":V(ee.keys.LEFT,!1),"embed left shift":V(ee.keys.LEFT,!0),"embed right":V(ee.keys.RIGHT,!1),"embed right shift":V(ee.keys.RIGHT,!0)}};function V(K,ne){var fe,oe=K===ee.keys.LEFT?"prefix":"suffix";return fe={key:K,shiftKey:ne,altKey:null},N(fe,oe,/^$/),N(fe,"handler",function(we){var Re=we.index;K===ee.keys.RIGHT&&(Re+=we.length+1);var Ne=this.quill.getLeaf(Re),He=o(Ne,1),$e=He[0];return $e instanceof P.default.Embed?(K===ee.keys.LEFT?ne?this.quill.setSelection(we.index-1,we.length+1,E.default.sources.USER):this.quill.setSelection(we.index-1,E.default.sources.USER):ne?this.quill.setSelection(we.index,we.length+1,E.default.sources.USER):this.quill.setSelection(we.index+we.length+1,E.default.sources.USER),!1):!0}),fe}function Q(K,ne){if(!(K.index===0||this.quill.getLength()<=1)){var fe=this.quill.getLine(K.index),oe=o(fe,1),ue=oe[0],we={};if(ne.offset===0){var Re=this.quill.getLine(K.index-1),Ne=o(Re,1),He=Ne[0];if(He!=null&&He.length()>1){var $e=ue.formats(),et=this.quill.getFormat(K.index-1,1);we=k.default.attributes.diff($e,et)||{}}}var xe=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(ne.prefix)?2:1;this.quill.deleteText(K.index-xe,xe,E.default.sources.USER),Object.keys(we).length>0&&this.quill.formatLine(K.index-xe,xe,we,E.default.sources.USER),this.quill.focus()}}function U(K,ne){var fe=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(ne.suffix)?2:1;if(!(K.index>=this.quill.getLength()-fe)){var oe={},ue=0,we=this.quill.getLine(K.index),Re=o(we,1),Ne=Re[0];if(ne.offset>=Ne.length()-1){var He=this.quill.getLine(K.index+1),$e=o(He,1),et=$e[0];if(et){var xe=Ne.formats(),he=this.quill.getFormat(K.index,1);oe=k.default.attributes.diff(xe,he)||{},ue=et.length()}}this.quill.deleteText(K.index,fe,E.default.sources.USER),Object.keys(oe).length>0&&this.quill.formatLine(K.index+ue-1,fe,oe,E.default.sources.USER)}}function L(K){var ne=this.quill.getLines(K),fe={};if(ne.length>1){var oe=ne[0].formats(),ue=ne[ne.length-1].formats();fe=k.default.attributes.diff(ue,oe)||{}}this.quill.deleteText(K,E.default.sources.USER),Object.keys(fe).length>0&&this.quill.formatLine(K.index,1,fe,E.default.sources.USER),this.quill.setSelection(K.index,E.default.sources.SILENT),this.quill.focus()}function q(K,ne){var fe=this;K.length>0&&this.quill.scroll.deleteAt(K.index,K.length);var oe=Object.keys(ne.format).reduce(function(ue,we){return P.default.query(we,P.default.Scope.BLOCK)&&!Array.isArray(ne.format[we])&&(ue[we]=ne.format[we]),ue},{});this.quill.insertText(K.index,`
|
|
129
|
+
`,oe,E.default.sources.USER),this.quill.setSelection(K.index+1,E.default.sources.SILENT),this.quill.focus(),Object.keys(ne.format).forEach(function(ue){oe[ue]==null&&(Array.isArray(ne.format[ue])||ue!=="link"&&fe.quill.format(ue,ne.format[ue],E.default.sources.USER))})}function W(K){return{key:ee.keys.TAB,shiftKey:!K,format:{"code-block":!0},handler:function(fe){var oe=P.default.query("code-block"),ue=fe.index,we=fe.length,Re=this.quill.scroll.descendant(oe,ue),Ne=o(Re,2),He=Ne[0],$e=Ne[1];if(He!=null){var et=this.quill.getIndex(He),xe=He.newlineIndex($e,!0)+1,he=He.newlineIndex(et+$e+we),se=He.domNode.textContent.slice(xe,he).split(`
|
|
130
|
+
`);$e=0,se.forEach(function(ge,Ce){K?(He.insertAt(xe+$e,oe.TAB),$e+=oe.TAB.length,Ce===0?ue+=oe.TAB.length:we+=oe.TAB.length):ge.startsWith(oe.TAB)&&(He.deleteAt(xe+$e,oe.TAB.length),$e-=oe.TAB.length,Ce===0?ue-=oe.TAB.length:we-=oe.TAB.length),$e+=ge.length+1}),this.quill.update(E.default.sources.USER),this.quill.setSelection(ue,we,E.default.sources.SILENT)}}}}function J(K){return{key:K[0].toUpperCase(),shortKey:!0,handler:function(fe,oe){this.quill.format(K,!oe.format[K],E.default.sources.USER)}}}function te(K){if(typeof K=="string"||typeof K=="number")return te({key:K});if((typeof K>"u"?"undefined":a(K))==="object"&&(K=(0,d.default)(K,!1)),typeof K.key=="string")if(ee.keys[K.key.toUpperCase()]!=null)K.key=ee.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=ee,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 w=(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))}),F=a(N,2);return T=F[0],I=F[1],{startNode:A,startOffset:T,endNode:A,endOffset:I}}}}},{key:"update",value:function(_,E){var A=this;if(_.some(function(I){return I.type==="characterData"&&I.target===A.textNode})){var T=this.restore();T&&(E.range=T)}}},{key:"value",value:function(){return""}}]),S})(d.default.Embed);w.blotName="cursor",w.className="ql-cursor",w.tagName="span",w.CONTENTS="\uFEFF",n.default=w}),(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 w(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&&w(k.prototype,S),P&&w(k,P),k}})(),o=function w(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:w(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(w){return w&&w.__esModule?w:{default:w}}function f(w,k){if(!(w instanceof k))throw new TypeError("Cannot call a class as a function")}function p(w,k){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:w}function h(w,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);w.prototype=Object.create(k&&k.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(w,k):w.__proto__=k)}var y=(function(w){h(k,w);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(w,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(w,P.key,P)}}return function(w,k,S){return k&&b(w.prototype,k),S&&b(w,S),w}})(),o=function b(w,k,S){w===null&&(w=Function.prototype);var P=Object.getOwnPropertyDescriptor(w,k);if(P===void 0){var _=Object.getPrototypeOf(w);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,w){if(!(b instanceof w))throw new TypeError("Cannot call a class as a function")}function p(b,w){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w&&(typeof w=="object"||typeof w=="function")?w:b}function h(b,w){if(typeof w!="function"&&w!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof w);b.prototype=Object.create(w&&w.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),w&&(Object.setPrototypeOf?Object.setPrototypeOf(b,w):b.__proto__=w)}var y=(function(b){h(w,b);function w(){return f(this,w),p(this,(w.__proto__||Object.getPrototypeOf(w)).apply(this,arguments))}return a(w,[{key:"format",value:function(S,P){if(S!==this.statics.blotName||!P)return o(w.prototype.__proto__||Object.getPrototypeOf(w.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(w.__proto__||Object.getPrototypeOf(w),"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}}]),w})(u.default);y.blotName="link",y.tagName="A",y.SANITIZED_URL="about:blank",y.PROTOCOL_WHITELIST=["http","https","mailto","tel"];function v(b,w){var k=document.createElement("a");k.href=b;var S=k.href.slice(0,k.href.indexOf(":"));return w.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(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},o=(function(){function w(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&&w(k.prototype,S),P&&w(k,P),k}})(),s=i(23),u=p(s),d=i(107),f=p(d);function p(w){return w&&w.__esModule?w:{default:w}}function h(w,k){if(!(w instanceof k))throw new TypeError("Cannot call a class as a function")}var y=0;function v(w,k){w.setAttribute(k,w.getAttribute(k)!=="true")}var b=(function(){function w(k){var S=this;h(this,w),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(w,[{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",_)}}]),w})();n.default=b}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(0),o=X(a),s=i(5),u=X(s),d=i(4),f=X(d),p=i(16),h=X(p),y=i(25),v=X(y),b=i(24),w=X(b),k=i(35),S=X(k),P=i(6),_=X(P),E=i(22),A=X(E),T=i(7),I=X(T),M=i(55),R=X(M),N=i(42),F=X(N),H=i(23),$=X(H);function X(Z){return Z&&Z.__esModule?Z:{default:Z}}u.default.register({"blots/block":f.default,"blots/block/embed":d.BlockEmbed,"blots/break":h.default,"blots/container":v.default,"blots/cursor":w.default,"blots/embed":S.default,"blots/inline":_.default,"blots/scroll":A.default,"blots/text":I.default,"modules/clipboard":R.default,"modules/history":F.default,"modules/keyboard":$.default}),o.default.register(f.default,h.default,w.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 w=u.query(b,u.Scope.ATTRIBUTE);w instanceof a.default&&(p.attributes[w.attrName]=w)})},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",w=(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=w}),(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),w=new b("font","font-family",y);n.FontStyle=w,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 w=(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);w.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=w,n.getLastChangeIndex=S}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BaseTooltip=void 0;var a=(function(){function q(W,J){for(var te=0;te<J.length;te++){var K=J[te];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(W,K.key,K)}}return function(W,J,te){return J&&q(W.prototype,J),te&&q(W,te),W}})(),o=function q(W,J,te){W===null&&(W=Function.prototype);var K=Object.getOwnPropertyDescriptor(W,J);if(K===void 0){var ne=Object.getPrototypeOf(W);return ne===null?void 0:q(ne,J,te)}else{if("value"in K)return K.value;var fe=K.get;return fe===void 0?void 0:fe.call(te)}},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),w=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(q){return q&&q.__esModule?q:{default:q}}function R(q,W){if(!(q instanceof W))throw new TypeError("Cannot call a class as a function")}function N(q,W){if(!q)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return W&&(typeof W=="object"||typeof W=="function")?W:q}function F(q,W){if(typeof W!="function"&&W!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof W);q.prototype=Object.create(W&&W.prototype,{constructor:{value:q,enumerable:!1,writable:!0,configurable:!0}}),W&&(Object.setPrototypeOf?Object.setPrototypeOf(q,W):q.__proto__=W)}var H=[!1,"center","right","justify"],$=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],X=[!1,"serif","monospace"],Z=["1","2","3",!1],ee=["small",!1,"large","huge"],V=(function(q){F(W,q);function W(J,te){R(this,W);var K=N(this,(W.__proto__||Object.getPrototypeOf(W)).call(this,J,te)),ne=function fe(oe){if(!document.body.contains(J.root))return document.body.removeEventListener("click",fe);K.tooltip!=null&&!K.tooltip.root.contains(oe.target)&&document.activeElement!==K.tooltip.textbox&&!K.quill.hasFocus()&&K.tooltip.hide(),K.pickers!=null&&K.pickers.forEach(function(ue){ue.container.contains(oe.target)||ue.close()})};return J.emitter.listenDOM("click",document.body,ne),K}return a(W,[{key:"addModule",value:function(te){var K=o(W.prototype.__proto__||Object.getPrototypeOf(W.prototype),"addModule",this).call(this,te);return te==="toolbar"&&this.extendToolbar(K),K}},{key:"buildButtons",value:function(te,K){te.forEach(function(ne){var fe=ne.getAttribute("class")||"";fe.split(/\s+/).forEach(function(oe){if(oe.startsWith("ql-")&&(oe=oe.slice(3),K[oe]!=null))if(oe==="direction")ne.innerHTML=K[oe][""]+K[oe].rtl;else if(typeof K[oe]=="string")ne.innerHTML=K[oe];else{var ue=ne.value||"";ue!=null&&K[oe][ue]&&(ne.innerHTML=K[oe][ue])}})})}},{key:"buildPickers",value:function(te,K){var ne=this;this.pickers=te.map(function(oe){if(oe.classList.contains("ql-align"))return oe.querySelector("option")==null&&L(oe,H),new _.default(oe,K.align);if(oe.classList.contains("ql-background")||oe.classList.contains("ql-color")){var ue=oe.classList.contains("ql-background")?"background":"color";return oe.querySelector("option")==null&&L(oe,$,ue==="background"?"#ffffff":"#000000"),new S.default(oe,K[ue])}else return oe.querySelector("option")==null&&(oe.classList.contains("ql-font")?L(oe,X):oe.classList.contains("ql-header")?L(oe,Z):oe.classList.contains("ql-size")&&L(oe,ee)),new A.default(oe)});var fe=function(){ne.pickers.forEach(function(ue){ue.update()})};this.quill.on(h.default.events.EDITOR_CHANGE,fe)}}]),W})(w.default);V.DEFAULTS=(0,u.default)(!0,{},w.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var W=this,J=this.container.querySelector("input.ql-image[type=file]");J==null&&(J=document.createElement("input"),J.setAttribute("type","file"),J.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),J.classList.add("ql-image"),J.addEventListener("change",function(){if(J.files!=null&&J.files[0]!=null){var te=new FileReader;te.onload=function(K){var ne=W.quill.getSelection(!0);W.quill.updateContents(new f.default().retain(ne.index).delete(ne.length).insert({image:K.target.result}),h.default.sources.USER),W.quill.setSelection(ne.index+1,h.default.sources.SILENT),J.value=""},te.readAsDataURL(J.files[0])}}),this.container.appendChild(J)),J.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}});var Q=(function(q){F(W,q);function W(J,te){R(this,W);var K=N(this,(W.__proto__||Object.getPrototypeOf(W)).call(this,J,te));return K.textbox=K.root.querySelector('input[type="text"]'),K.listen(),K}return a(W,[{key:"listen",value:function(){var te=this;this.textbox.addEventListener("keydown",function(K){v.default.match(K,"enter")?(te.save(),K.preventDefault()):v.default.match(K,"escape")&&(te.cancel(),K.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var te=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:te!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+te)||""),this.root.setAttribute("data-mode",te)}},{key:"restoreFocus",value:function(){var te=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=te}},{key:"save",value:function(){var te=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var K=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",te,h.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",te,h.default.sources.USER)),this.quill.root.scrollTop=K;break}case"video":te=U(te);case"formula":{if(!te)break;var ne=this.quill.getSelection(!0);if(ne!=null){var fe=ne.index+ne.length;this.quill.insertEmbed(fe,this.root.getAttribute("data-mode"),te,h.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(fe+1," ",h.default.sources.USER),this.quill.setSelection(fe+2,h.default.sources.USER)}break}}this.textbox.value="",this.hide()}}]),W})(I.default);function U(q){var W=q.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||q.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return W?(W[1]||"https")+"://www.youtube.com/embed/"+W[2]+"?showinfo=0":(W=q.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(W[1]||"https")+"://player.vimeo.com/video/"+W[2]+"/":q}function L(q,W){var J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;W.forEach(function(te){var K=document.createElement("option");te===J?K.setAttribute("selected","selected"):K.setAttribute("value",te),q.appendChild(K)})}n.BaseTooltip=Q,n.default=V}),(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 w=y.length();s>v?d(y,s-v,Math.min(u,v+w-s)):d(y,0,Math.min(w,s+u-v)),v+=w}},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,w){this.update(),p.prototype.formatAt.call(this,y,v,b,w)},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 w=[].slice.call(this.observer.takeRecords());w.length>0;)y.push(w.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()),w=P.slice();w.length>0;)y.push(w.pop())}},h.prototype.update=function(y,v){var b=this;v===void 0&&(v={}),y=y||this.observer.takeRecords(),y.map(function(w){var k=s.find(w.target,!0);return k==null?null:k.domNode[s.DATA_KEY].mutations==null?(k.domNode[s.DATA_KEY].mutations=[w],k):(k.domNode[s.DATA_KEY].mutations.push(w),null)}).forEach(function(w){w==null||w===b||w.domNode[s.DATA_KEY]==null||w.update(w.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 w=this.isolate(h,y);w.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],F=R[1],H=R[2],$=R[3],X=R[4],Z=s(N,H),ee=s(F,$);return Z.concat([[o,X]],ee)}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),F=new Array(R),H=0;H<R;H++)N[H]=-1,F[H]=-1;N[M+1]=0,F[M+1]=0;for(var $=A-T,X=$%2!=0,Z=0,ee=0,V=0,Q=0,U=0;U<I;U++){for(var L=-U+Z;L<=U-ee;L+=2){var q=M+L,W;L==-U||L!=U&&N[q-1]<N[q+1]?W=N[q+1]:W=N[q-1]+1;for(var J=W-L;W<A&&J<T&&_.charAt(W)==E.charAt(J);)W++,J++;if(N[q]=W,W>A)ee+=2;else if(J>T)Z+=2;else if(X){var te=M+$-L;if(te>=0&&te<R&&F[te]!=-1){var K=A-F[te];if(W>=K)return f(_,E,W,J)}}}for(var ne=-U+V;ne<=U-Q;ne+=2){var te=M+ne,K;ne==-U||ne!=U&&F[te-1]<F[te+1]?K=F[te+1]:K=F[te-1]+1;for(var fe=K-ne;K<A&&fe<T&&_.charAt(A-K-1)==E.charAt(T-fe-1);)K++,fe++;if(F[te]=K,K>A)Q+=2;else if(fe>T)V+=2;else if(!X){var q=M+$-ne;if(q>=0&&q<R&&N[q]!=-1){var W=N[q],J=M+W-q;if(K=A-K,W>=K)return f(_,E,W,J)}}}}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),F=s(I,M),H=s(R,N);return F.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(ee,V,Q){for(var U=ee.substring(Q,Q+Math.floor(ee.length/4)),L=-1,q="",W,J,te,K;(L=V.indexOf(U,L+1))!=-1;){var ne=p(ee.substring(Q),V.substring(L)),fe=h(ee.substring(0,Q),V.substring(0,L));q.length<fe+ne&&(q=V.substring(L-fe,L)+V.substring(L,L+ne),W=ee.substring(0,Q-fe),J=ee.substring(Q+ne),te=V.substring(0,L-fe),K=V.substring(L+ne))}return q.length*2>=ee.length?[W,J,te,K,q]: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 F,H,$,X;_.length>E.length?(F=N[0],H=N[1],$=N[2],X=N[3]):($=N[0],X=N[1],F=N[2],H=N[3]);var Z=N[4];return[F,H,$,X,Z]}function v(_){_.push([o,""]);for(var E=0,A=0,T=0,I="",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 w(_,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)],F=[I[0],I[1].slice(R)];return _.splice(T,1,N,F),[T+1,_]}else A=M}}throw new Error("cursor_pos is out of bounds!")}function k(_,E){var A=w(_,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,w=new Array(b);v<b;v++)w[v]=y[v].fn;return w},u.prototype.emit=function(f,p,h,y,v,b){var w=a?a+f:f;if(!this._events[w])return!1;var k=this._events[w],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 w=0,k=[],S=b.length;w<S;w++)(b[w].fn!==p||y&&!b[w].once||h&&b[w].context!==h)&&k.push(b[w]);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(he){return typeof he}:function(he){return he&&typeof Symbol=="function"&&he.constructor===Symbol&&he!==Symbol.prototype?"symbol":typeof he},o=(function(){function he(se,ge){var Ce=[],ae=!0,_e=!1,Oe=void 0;try{for(var Fe=se[Symbol.iterator](),ot;!(ae=(ot=Fe.next()).done)&&(Ce.push(ot.value),!(ge&&Ce.length===ge));ae=!0);}catch(ke){_e=!0,Oe=ke}finally{try{!ae&&Fe.return&&Fe.return()}finally{if(_e)throw Oe}}return Ce}return function(se,ge){if(Array.isArray(se))return se;if(Symbol.iterator in Object(se))return he(se,ge);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function he(se,ge){for(var Ce=0;Ce<ge.length;Ce++){var ae=ge[Ce];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(se,ae.key,ae)}}return function(se,ge,Ce){return ge&&he(se.prototype,ge),Ce&&he(se,Ce),se}})(),u=i(3),d=F(u),f=i(2),p=F(f),h=i(0),y=F(h),v=i(5),b=F(v),w=i(10),k=F(w),S=i(9),P=F(S),_=i(36),E=i(37),A=i(13),T=F(A),I=i(26),M=i(38),R=i(39),N=i(40);function F(he){return he&&he.__esModule?he:{default:he}}function H(he,se,ge){return se in he?Object.defineProperty(he,se,{value:ge,enumerable:!0,configurable:!0,writable:!0}):he[se]=ge,he}function $(he,se){if(!(he instanceof se))throw new TypeError("Cannot call a class as a function")}function X(he,se){if(!he)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return se&&(typeof se=="object"||typeof se=="function")?se:he}function Z(he,se){if(typeof se!="function"&&se!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof se);he.prototype=Object.create(se&&se.prototype,{constructor:{value:he,enumerable:!1,writable:!0,configurable:!0}}),se&&(Object.setPrototypeOf?Object.setPrototypeOf(he,se):he.__proto__=se)}var ee=(0,k.default)("quill:clipboard"),V="__ql-matcher",Q=[[Node.TEXT_NODE,xe],[Node.TEXT_NODE,He],["br",we],[Node.ELEMENT_NODE,He],[Node.ELEMENT_NODE,ue],[Node.ELEMENT_NODE,$e],[Node.ELEMENT_NODE,oe],[Node.ELEMENT_NODE,et],["li",Ne],["b",fe.bind(fe,"bold")],["i",fe.bind(fe,"italic")],["style",Re]],U=[_.AlignAttribute,M.DirectionAttribute].reduce(function(he,se){return he[se.keyName]=se,he},{}),L=[_.AlignStyle,E.BackgroundStyle,I.ColorStyle,M.DirectionStyle,R.FontStyle,N.SizeStyle].reduce(function(he,se){return he[se.keyName]=se,he},{}),q=(function(he){Z(se,he);function se(ge,Ce){$(this,se);var ae=X(this,(se.__proto__||Object.getPrototypeOf(se)).call(this,ge,Ce));return ae.quill.root.addEventListener("paste",ae.onPaste.bind(ae)),ae.container=ae.quill.addContainer("ql-clipboard"),ae.container.setAttribute("contenteditable",!0),ae.container.setAttribute("tabindex",-1),ae.matchers=[],Q.concat(ae.options.matchers).forEach(function(_e){var Oe=o(_e,2),Fe=Oe[0],ot=Oe[1];!Ce.matchVisual&&ot===$e||ae.addMatcher(Fe,ot)}),ae}return s(se,[{key:"addMatcher",value:function(Ce,ae){this.matchers.push([Ce,ae])}},{key:"convert",value:function(Ce){if(typeof Ce=="string")return this.container.innerHTML=Ce.replace(/\>\r?\n +\</g,"><"),this.convert();var ae=this.quill.getFormat(this.quill.selection.savedRange.index);if(ae[T.default.blotName]){var _e=this.container.innerText;return this.container.innerHTML="",new p.default().insert(_e,H({},T.default.blotName,ae[T.default.blotName]))}var Oe=this.prepareMatching(),Fe=o(Oe,2),ot=Fe[0],ke=Fe[1],me=ne(this.container,ot,ke);return te(me,`
|
|
132
|
+
`)&&me.ops[me.ops.length-1].attributes==null&&(me=me.compose(new p.default().retain(me.length()-1).delete(1))),ee.log("convert",this.container.innerHTML,me),this.container.innerHTML="",me}},{key:"dangerouslyPasteHTML",value:function(Ce,ae){var _e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:b.default.sources.API;if(typeof Ce=="string")this.quill.setContents(this.convert(Ce),ae),this.quill.setSelection(0,b.default.sources.SILENT);else{var Oe=this.convert(ae);this.quill.updateContents(new p.default().retain(Ce).concat(Oe),_e),this.quill.setSelection(Ce+Oe.length(),b.default.sources.SILENT)}}},{key:"onPaste",value:function(Ce){var ae=this;if(!(Ce.defaultPrevented||!this.quill.isEnabled())){var _e=this.quill.getSelection(),Oe=new p.default().retain(_e.index),Fe=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(b.default.sources.SILENT),setTimeout(function(){Oe=Oe.concat(ae.convert()).delete(_e.length),ae.quill.updateContents(Oe,b.default.sources.USER),ae.quill.setSelection(Oe.length()-_e.length,b.default.sources.SILENT),ae.quill.scrollingContainer.scrollTop=Fe,ae.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var Ce=this,ae=[],_e=[];return this.matchers.forEach(function(Oe){var Fe=o(Oe,2),ot=Fe[0],ke=Fe[1];switch(ot){case Node.TEXT_NODE:_e.push(ke);break;case Node.ELEMENT_NODE:ae.push(ke);break;default:[].forEach.call(Ce.container.querySelectorAll(ot),function(me){me[V]=me[V]||[],me[V].push(ke)});break}}),[ae,_e]}}]),se})(P.default);q.DEFAULTS={matchers:[],matchVisual:!0};function W(he,se,ge){return(typeof se>"u"?"undefined":a(se))==="object"?Object.keys(se).reduce(function(Ce,ae){return W(Ce,ae,se[ae])},he):he.reduce(function(Ce,ae){return ae.attributes&&ae.attributes[se]?Ce.push(ae):Ce.insert(ae.insert,(0,d.default)({},H({},se,ge),ae.attributes))},new p.default)}function J(he){if(he.nodeType!==Node.ELEMENT_NODE)return{};var se="__ql-computed-style";return he[se]||(he[se]=window.getComputedStyle(he))}function te(he,se){for(var ge="",Ce=he.ops.length-1;Ce>=0&&ge.length<se.length;--Ce){var ae=he.ops[Ce];if(typeof ae.insert!="string")break;ge=ae.insert+ge}return ge.slice(-1*se.length)===se}function K(he){if(he.childNodes.length===0)return!1;var se=J(he);return["block","list-item"].indexOf(se.display)>-1}function ne(he,se,ge){return he.nodeType===he.TEXT_NODE?ge.reduce(function(Ce,ae){return ae(he,Ce)},new p.default):he.nodeType===he.ELEMENT_NODE?[].reduce.call(he.childNodes||[],function(Ce,ae){var _e=ne(ae,se,ge);return ae.nodeType===he.ELEMENT_NODE&&(_e=se.reduce(function(Oe,Fe){return Fe(ae,Oe)},_e),_e=(ae[V]||[]).reduce(function(Oe,Fe){return Fe(ae,Oe)},_e)),Ce.concat(_e)},new p.default):new p.default}function fe(he,se,ge){return W(ge,he,!0)}function oe(he,se){var ge=y.default.Attributor.Attribute.keys(he),Ce=y.default.Attributor.Class.keys(he),ae=y.default.Attributor.Style.keys(he),_e={};return ge.concat(Ce).concat(ae).forEach(function(Oe){var Fe=y.default.query(Oe,y.default.Scope.ATTRIBUTE);Fe!=null&&(_e[Fe.attrName]=Fe.value(he),_e[Fe.attrName])||(Fe=U[Oe],Fe!=null&&(Fe.attrName===Oe||Fe.keyName===Oe)&&(_e[Fe.attrName]=Fe.value(he)||void 0),Fe=L[Oe],Fe!=null&&(Fe.attrName===Oe||Fe.keyName===Oe)&&(Fe=L[Oe],_e[Fe.attrName]=Fe.value(he)||void 0))}),Object.keys(_e).length>0&&(se=W(se,_e)),se}function ue(he,se){var ge=y.default.query(he);if(ge==null)return se;if(ge.prototype instanceof y.default.Embed){var Ce={},ae=ge.value(he);ae!=null&&(Ce[ge.blotName]=ae,se=new p.default().insert(Ce,ge.formats(he)))}else typeof ge.formats=="function"&&(se=W(se,ge.blotName,ge.formats(he)));return se}function we(he,se){return te(se,`
|
|
133
|
+
`)||se.insert(`
|
|
134
|
+
`),se}function Re(){return new p.default}function Ne(he,se){var ge=y.default.query(he);if(ge==null||ge.blotName!=="list-item"||!te(se,`
|
|
135
|
+
`))return se;for(var Ce=-1,ae=he.parentNode;!ae.classList.contains("ql-clipboard");)(y.default.query(ae)||{}).blotName==="list"&&(Ce+=1),ae=ae.parentNode;return Ce<=0?se:se.compose(new p.default().retain(se.length()-1).retain(1,{indent:Ce}))}function He(he,se){return te(se,`
|
|
136
|
+
`)||(K(he)||se.length()>0&&he.nextSibling&&K(he.nextSibling))&&se.insert(`
|
|
137
|
+
`),se}function $e(he,se){if(K(he)&&he.nextElementSibling!=null&&!te(se,`
|
|
138
|
+
|
|
139
|
+
`)){var ge=he.offsetHeight+parseFloat(J(he).marginTop)+parseFloat(J(he).marginBottom);he.nextElementSibling.offsetTop>he.offsetTop+ge*1.5&&se.insert(`
|
|
140
|
+
`)}return se}function et(he,se){var ge={},Ce=he.style||{};return Ce.fontStyle&&J(he).fontStyle==="italic"&&(ge.italic=!0),Ce.fontWeight&&(J(he).fontWeight.startsWith("bold")||parseInt(J(he).fontWeight)>=700)&&(ge.bold=!0),Object.keys(ge).length>0&&(se=W(se,ge)),parseFloat(Ce.textIndent||0)>0&&(se=new p.default().insert(" ").concat(se)),se}function xe(he,se){var ge=he.data;if(he.parentNode.tagName==="O:P")return se.insert(ge.trim());if(ge.trim().length===0&&he.parentNode.classList.contains("ql-clipboard"))return se;if(!J(he.parentNode).whiteSpace.startsWith("pre")){var Ce=function(_e,Oe){return Oe=Oe.replace(/[^\u00a0]/g,""),Oe.length<1&&_e?" ":Oe};ge=ge.replace(/\r\n/g," ").replace(/\n/g," "),ge=ge.replace(/\s\s+/g,Ce.bind(Ce,!0)),(he.previousSibling==null&&K(he.parentNode)||he.previousSibling!=null&&K(he.previousSibling))&&(ge=ge.replace(/^\s+/,Ce.bind(Ce,!1))),(he.nextSibling==null&&K(he.parentNode)||he.nextSibling!=null&&K(he.nextSibling))&&(ge=ge.replace(/\s+$/,Ce.bind(Ce,!1)))}return se.insert(ge)}n.default=q,n.matchAttributor=oe,n.matchBlot=ue,n.matchNewline=He,n.matchSpacing=$e,n.matchText=xe}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(b,w){for(var k=0;k<w.length;k++){var S=w[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,w,k){return w&&v(b.prototype,w),k&&v(b,k),b}})(),o=function v(b,w,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,w);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,w,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(F,H){var $=[],X=!0,Z=!1,ee=void 0;try{for(var V=F[Symbol.iterator](),Q;!(X=(Q=V.next()).done)&&($.push(Q.value),!(H&&$.length===H));X=!0);}catch(U){Z=!0,ee=U}finally{try{!X&&V.return&&V.return()}finally{if(Z)throw ee}}return $}return function(F,H){if(Array.isArray(F))return F;if(Symbol.iterator in Object(F))return N(F,H);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function N(F,H){for(var $=0;$<H.length;$++){var X=H[$];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(F,X.key,X)}}return function(F,H,$){return H&&N(F.prototype,H),$&&N(F,$),F}})(),s=i(2),u=k(s),d=i(0),f=k(d),p=i(5),h=k(p),y=i(10),v=k(y),b=i(9),w=k(b);function k(N){return N&&N.__esModule?N:{default:N}}function S(N,F,H){return F in N?Object.defineProperty(N,F,{value:H,enumerable:!0,configurable:!0,writable:!0}):N[F]=H,N}function P(N,F){if(!(N instanceof F))throw new TypeError("Cannot call a class as a function")}function _(N,F){if(!N)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F&&(typeof F=="object"||typeof F=="function")?F:N}function E(N,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof F);N.prototype=Object.create(F&&F.prototype,{constructor:{value:N,enumerable:!1,writable:!0,configurable:!0}}),F&&(Object.setPrototypeOf?Object.setPrototypeOf(N,F):N.__proto__=F)}var A=(0,v.default)("quill:toolbar"),T=(function(N){E(F,N);function F(H,$){P(this,F);var X=_(this,(F.__proto__||Object.getPrototypeOf(F)).call(this,H,$));if(Array.isArray(X.options.container)){var Z=document.createElement("div");M(Z,X.options.container),H.container.parentNode.insertBefore(Z,H.container),X.container=Z}else typeof X.options.container=="string"?X.container=document.querySelector(X.options.container):X.container=X.options.container;if(!(X.container instanceof HTMLElement)){var ee;return ee=A.error("Container required for toolbar",X.options),_(X,ee)}return X.container.classList.add("ql-toolbar"),X.controls=[],X.handlers={},Object.keys(X.options.handlers).forEach(function(V){X.addHandler(V,X.options.handlers[V])}),[].forEach.call(X.container.querySelectorAll("button, select"),function(V){X.attach(V)}),X.quill.on(h.default.events.EDITOR_CHANGE,function(V,Q){V===h.default.events.SELECTION_CHANGE&&X.update(Q)}),X.quill.on(h.default.events.SCROLL_OPTIMIZE,function(){var V=X.quill.selection.getRange(),Q=a(V,1),U=Q[0];X.update(U)}),X}return o(F,[{key:"addHandler",value:function($,X){this.handlers[$]=X}},{key:"attach",value:function($){var X=this,Z=[].find.call($.classList,function(V){return V.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 ee=$.tagName==="SELECT"?"change":"click";$.addEventListener(ee,function(V){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"),V.preventDefault();X.quill.focus();var L=X.quill.selection.getRange(),q=a(L,1),W=q[0];if(X.handlers[Z]!=null)X.handlers[Z].call(X,Q);else if(f.default.query(Z).prototype instanceof f.default.Embed){if(Q=prompt("Enter "+Z),!Q)return;X.quill.updateContents(new u.default().retain(W.index).delete(W.length).insert(S({},Z,Q)),h.default.sources.USER)}else X.quill.format(Z,Q,h.default.sources.USER);X.update(W)}),this.controls.push([Z,$])}}},{key:"update",value:function($){var X=$==null?{}:this.quill.getFormat($);this.controls.forEach(function(Z){var ee=a(Z,2),V=ee[0],Q=ee[1];if(Q.tagName==="SELECT"){var U=void 0;if($==null)U=null;else if(X[V]==null)U=Q.querySelector("option[selected]");else if(!Array.isArray(X[V])){var L=X[V];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 q=X[V]===Q.getAttribute("value")||X[V]!=null&&X[V].toString()===Q.getAttribute("value")||X[V]==null&&!Q.getAttribute("value");Q.classList.toggle("ql-active",q)}else Q.classList.toggle("ql-active",X[V]!=null)})}}]),F})(w.default);T.DEFAULTS={};function I(N,F,H){var $=document.createElement("button");$.setAttribute("type","button"),$.classList.add("ql-"+F),H!=null&&($.value=H),N.appendChild($)}function M(N,F){Array.isArray(F[0])||(F=[F]),F.forEach(function(H){var $=document.createElement("span");$.classList.add("ql-formats"),H.forEach(function(X){if(typeof X=="string")I($,X);else{var Z=Object.keys(X)[0],ee=X[Z];Array.isArray(ee)?R($,Z,ee):I($,Z,ee)}}),N.appendChild($)})}function R(N,F,H){var $=document.createElement("select");$.classList.add("ql-"+F),H.forEach(function(X){var Z=document.createElement("option");X!==!1?Z.setAttribute("value",X):Z.setAttribute("selected","selected"),$.appendChild(Z)}),N.appendChild($)}T.DEFAULTS={container:null,handlers:{clean:function(){var F=this,H=this.quill.getSelection();if(H!=null)if(H.length==0){var $=this.quill.getFormat();Object.keys($).forEach(function(X){f.default.query(X,f.default.Scope.INLINE)!=null&&F.quill.format(X,!1)})}else this.quill.removeFormat(H,h.default.sources.USER)},direction:function(F){var H=this.quill.getFormat().align;F==="rtl"&&H==null?this.quill.format("align","right",h.default.sources.USER):!F&&H==="right"&&this.quill.format("align",!1,h.default.sources.USER),this.quill.format("direction",F,h.default.sources.USER)},indent:function(F){var H=this.quill.getSelection(),$=this.quill.getFormat(H),X=parseInt($.indent||0);if(F==="+1"||F==="-1"){var Z=F==="+1"?1:-1;$.direction==="rtl"&&(Z*=-1),this.quill.format("indent",X+Z,h.default.sources.USER)}},link:function(F){F===!0&&(F=prompt("Enter link URL:")),this.quill.format("link",F,h.default.sources.USER)},list:function(F){var H=this.quill.getSelection(),$=this.quill.getFormat(H);F==="check"?$.list==="checked"||$.list==="unchecked"?this.quill.format("list",!1,h.default.sources.USER):this.quill.format("list","unchecked",h.default.sources.USER):this.quill.format("list",F,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,w){for(var k=0;k<w.length;k++){var S=w[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,w,k){return w&&v(b.prototype,w),k&&v(b,k),b}})(),o=function v(b,w,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,w);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,w,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(w,k){f(this,b);var S=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,w));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,w){for(var k=0;k<w.length;k++){var S=w[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,w,k){return w&&v(b.prototype,w),k&&v(b,k),b}})(),o=function v(b,w,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,w);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,w,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(w,k){f(this,b);var S=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,w));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 w=v.bottom-v.top,k=f.bottom-f.top+w;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,F){var H=[],$=!0,X=!1,Z=void 0;try{for(var ee=N[Symbol.iterator](),V;!($=(V=ee.next()).done)&&(H.push(V.value),!(F&&H.length===F));$=!0);}catch(Q){X=!0,Z=Q}finally{try{!$&&ee.return&&ee.return()}finally{if(X)throw Z}}return H}return function(N,F){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return R(N,F);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=function R(N,F,H){N===null&&(N=Function.prototype);var $=Object.getOwnPropertyDescriptor(N,F);if($===void 0){var X=Object.getPrototypeOf(N);return X===null?void 0:R(X,F,H)}else{if("value"in $)return $.value;var Z=$.get;return Z===void 0?void 0:Z.call(H)}},s=(function(){function R(N,F){for(var H=0;H<F.length;H++){var $=F[H];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(N,$.key,$)}}return function(N,F,H){return F&&R(N.prototype,F),H&&R(N,H),N}})(),u=i(3),d=P(u),f=i(8),p=P(f),h=i(43),y=P(h),v=i(27),b=P(v),w=i(15),k=i(41),S=P(k);function P(R){return R&&R.__esModule?R:{default:R}}function _(R,N){if(!(R instanceof N))throw new TypeError("Cannot call a class as a function")}function E(R,N){if(!R)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return N&&(typeof N=="object"||typeof N=="function")?N:R}function A(R,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof N);R.prototype=Object.create(N&&N.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),N&&(Object.setPrototypeOf?Object.setPrototypeOf(R,N):R.__proto__=N)}var T=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],I=(function(R){A(N,R);function N(F,H){_(this,N),H.modules.toolbar!=null&&H.modules.toolbar.container==null&&(H.modules.toolbar.container=T);var $=E(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,F,H));return $.quill.container.classList.add("ql-snow"),$}return s(N,[{key:"extendToolbar",value:function(H){H.container.classList.add("ql-snow"),this.buildButtons([].slice.call(H.container.querySelectorAll("button")),S.default),this.buildPickers([].slice.call(H.container.querySelectorAll("select")),S.default),this.tooltip=new M(this.quill,this.options.bounds),H.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function($,X){H.handlers.link.call(H,!X.format.link)})}}]),N})(y.default);I.DEFAULTS=(0,d.default)(!0,{},y.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(N){if(N){var F=this.quill.getSelection();if(F==null||F.length==0)return;var H=this.quill.getText(F);/^\S+@\S+\.\S+$/.test(H)&&H.indexOf("mailto:")!==0&&(H="mailto:"+H);var $=this.quill.theme.tooltip;$.edit("link",H)}else this.quill.format("link",!1)}}}}});var M=(function(R){A(N,R);function N(F,H){_(this,N);var $=E(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,F,H));return $.preview=$.root.querySelector("a.ql-preview"),$}return s(N,[{key:"listen",value:function(){var H=this;o(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function($){H.root.classList.contains("ql-editing")?H.save():H.edit("link",H.preview.textContent),$.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function($){if(H.linkRange!=null){var X=H.linkRange;H.restoreFocus(),H.quill.formatText(X,"link",!1,p.default.sources.USER),delete H.linkRange}$.preventDefault(),H.hide()}),this.quill.on(p.default.events.SELECTION_CHANGE,function($,X,Z){if($!=null){if($.length===0&&Z===p.default.sources.USER){var ee=H.quill.scroll.descendant(b.default,$.index),V=a(ee,2),Q=V[0],U=V[1];if(Q!=null){H.linkRange=new w.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=ae(a),s=i(36),u=i(38),d=i(64),f=i(65),p=ae(f),h=i(66),y=ae(h),v=i(67),b=ae(v),w=i(37),k=i(26),S=i(39),P=i(40),_=i(56),E=ae(_),A=i(68),T=ae(A),I=i(27),M=ae(I),R=i(69),N=ae(R),F=i(70),H=ae(F),$=i(71),X=ae($),Z=i(72),ee=ae(Z),V=i(73),Q=ae(V),U=i(13),L=ae(U),q=i(74),W=ae(q),J=i(75),te=ae(J),K=i(57),ne=ae(K),fe=i(41),oe=ae(fe),ue=i(28),we=ae(ue),Re=i(59),Ne=ae(Re),He=i(60),$e=ae(He),et=i(61),xe=ae(et),he=i(108),se=ae(he),ge=i(62),Ce=ae(ge);function ae(_e){return _e&&_e.__esModule?_e:{default:_e}}o.default.register({"attributors/attribute/direction":u.DirectionAttribute,"attributors/class/align":s.AlignClass,"attributors/class/background":w.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":w.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":w.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":X.default,"formats/image":ee.default,"formats/video":Q.default,"formats/list/item":v.ListItem,"modules/formula":W.default,"modules/syntax":te.default,"modules/toolbar":ne.default,"themes/bubble":se.default,"themes/snow":Ce.default,"ui/icons":oe.default,"ui/picker":we.default,"ui/icon-picker":$e.default,"ui/color-picker":Ne.default,"ui/tooltip":xe.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(w,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(w,P.key,P)}}return function(w,k,S){return k&&b(w.prototype,k),S&&b(w,S),w}})(),o=function b(w,k,S){w===null&&(w=Function.prototype);var P=Object.getOwnPropertyDescriptor(w,k);if(P===void 0){var _=Object.getPrototypeOf(w);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,w){if(!(b instanceof w))throw new TypeError("Cannot call a class as a function")}function p(b,w){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w&&(typeof w=="object"||typeof w=="function")?w:b}function h(b,w){if(typeof w!="function"&&w!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof w);b.prototype=Object.create(w&&w.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),w&&(Object.setPrototypeOf?Object.setPrototypeOf(b,w):b.__proto__=w)}var y=(function(b){h(w,b);function w(){return f(this,w),p(this,(w.__proto__||Object.getPrototypeOf(w)).apply(this,arguments))}return a(w,[{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(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"add",this).call(this,S,P)}},{key:"canAdd",value:function(S,P){return o(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"canAdd",this).call(this,S,P)||o(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"canAdd",this).call(this,S,parseInt(P))}},{key:"value",value:function(S){return parseInt(o(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"value",this).call(this,S))||void 0}}]),w})(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 w=0;w<b.length;w++){var k=b[w];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(v,k.key,k)}}return function(v,b,w){return b&&y(v.prototype,b),w&&y(v,w),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(w){return this.tagName.indexOf(w.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 w(_,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),w(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=w(this,(E.__proto__||Object.getPrototypeOf(E)).call(this,A)),I=function(R){if(R.target.parentNode===A){var N=T.statics.formats(A),F=u.default.find(R.target);N==="checked"?F.format("list","unchecked"):N==="unchecked"&&F.format("list","checked")}};return A.addEventListener("touchstart",I),A.addEventListener("mousedown",I),T}return a(E,[{key:"format",value:function(T,I){this.children.length>0&&this.children.tail.format(T,I)}},{key:"formats",value:function(){return v({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(T,I){if(T instanceof S)o(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"insertBefore",this).call(this,T,I);else{var 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,w){for(var k=0;k<w.length;k++){var S=w[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,w,k){return w&&v(b.prototype,w),k&&v(b,k),b}})(),o=function v(b,w,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,w);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,w,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 w(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&&w(k.prototype,S),P&&w(k,P),k}})(),o=function w(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:w(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(w){return w&&w.__esModule?w:{default:w}}function p(w,k){if(!(w instanceof k))throw new TypeError("Cannot call a class as a function")}function h(w,k){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:w}function y(w,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);w.prototype=Object.create(k&&k.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(w,k):w.__proto__=k)}var v=["alt","height","width"],b=(function(w){y(k,w);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 w(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&&w(k.prototype,S),P&&w(k,P),k}})(),o=function w(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:w(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(w){return w&&w.__esModule?w:{default:w}}function p(w,k){if(!(w instanceof k))throw new TypeError("Cannot call a class as a function")}function h(w,k){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:w}function y(w,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);w.prototype=Object.create(k&&k.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(w,k):w.__proto__=k)}var v=["height","width"],b=(function(w){y(k,w);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 w(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){w(_,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){w(_,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 F=R.get;return F===void 0?void 0:F.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 w(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 w(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){w(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 F=Object.getPrototypeOf(I);return F===null?void 0:T(F,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=w(s),d=i(8),f=w(d),p=i(43),h=w(p),y=i(15),v=i(41),b=w(v);function w(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(F,H,$,X){if(F===f.default.events.SELECTION_CHANGE)if(H!=null&&H.length>0&&X===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 ee=Z[Z.length-1],V=N.quill.getIndex(ee),Q=Math.min(ee.length()-1,H.index+H.length-V),U=N.quill.getBounds(new y.Range(V,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),F=this.root.querySelector(".ql-tooltip-arrow");if(F.style.marginLeft="",N===0)return N;F.style.marginLeft=-1*N-F.offsetWidth/2+"px"}}]),I})(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={},Yh={exports:{}};var TA=Yh.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="-",w=/^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 q=U.length,W=[];q--;)W[q]=L(U[q]);return W}function R(U,L){var q=U.split("@"),W="";q.length>1&&(W=q[0]+"@",U=q[1]),U=U.replace(S,".");var J=U.split("."),te=M(J,L).join(".");return W+te}function N(U){for(var L=[],q=0,W=U.length,J,te;q<W;)J=U.charCodeAt(q++),J>=55296&&J<=56319&&q<W?(te=U.charCodeAt(q++),(te&64512)==56320?L.push(((J&1023)<<10)+(te&1023)+65536):(L.push(J),q--)):L.push(J);return L}function F(U){return M(U,function(L){var q="";return L>65535&&(L-=65536,q+=A(L>>>10&1023|55296),L=56320|L&1023),q+=A(L),q}).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 X(U,L,q){var W=0;for(U=q?E(U/h):U>>1,U+=E(U/L);U>_*f>>1;W+=u)U=E(U/_);return E(W+(_+1)*U/(U+p))}function Z(U){var L=[],q=U.length,W,J=0,te=v,K=y,ne,fe,oe,ue,we,Re,Ne,He,$e;for(ne=U.lastIndexOf(b),ne<0&&(ne=0),fe=0;fe<ne;++fe)U.charCodeAt(fe)>=128&&I("not-basic"),L.push(U.charCodeAt(fe));for(oe=ne>0?ne+1:0;oe<q;){for(ue=J,we=1,Re=u;oe>=q&&I("invalid-input"),Ne=H(U.charCodeAt(oe++)),(Ne>=u||Ne>E((s-J)/we))&&I("overflow"),J+=Ne*we,He=Re<=K?d:Re>=K+f?f:Re-K,!(Ne<He);Re+=u)$e=u-He,we>E(s/$e)&&I("overflow"),we*=$e;W=L.length+1,K=X(J-ue,W,ue==0),E(J/W)>s-te&&I("overflow"),te+=E(J/W),J%=W,L.splice(J++,0,te)}return F(L)}function ee(U){var L,q,W,J,te,K,ne,fe,oe,ue,we,Re=[],Ne,He,$e,et;for(U=N(U),Ne=U.length,L=v,q=0,te=y,K=0;K<Ne;++K)we=U[K],we<128&&Re.push(A(we));for(W=J=Re.length,J&&Re.push(b);W<Ne;){for(ne=s,K=0;K<Ne;++K)we=U[K],we>=L&&we<ne&&(ne=we);for(He=W+1,ne-L>E((s-q)/He)&&I("overflow"),q+=(ne-L)*He,L=ne,K=0;K<Ne;++K)if(we=U[K],we<L&&++q>s&&I("overflow"),we==L){for(fe=q,oe=u;ue=oe<=te?d:oe>=te+f?f:oe-te,!(fe<ue);oe+=u)et=fe-ue,$e=u-ue,Re.push(A($(ue+et%$e,0))),fe=E(et/$e);Re.push(A($(fe,0))),te=X(q,He,W==J),q=0,++W}++q,++L}return Re.join("")}function V(U){return R(U,function(L){return w.test(L)?Z(L.slice(4).toLowerCase()):L})}function Q(U){return R(U,function(L){return k.test(L)?"xn--"+ee(L):L})}if(o={version:"1.4.1",ucs2:{decode:N,encode:F},decode:Z,encode:ee,toASCII:Q,toUnicode:V},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)})(Yh,Yh.exports)),Yh.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,w=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,F=Object.getOwnPropertySymbols,H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,$=typeof Symbol=="function"&&typeof Symbol.iterator=="object",X=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===$||!0)?Symbol.toStringTag:null,Z=Object.prototype.propertyIsEnumerable,ee=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(le){return le.__proto__}:null);function V(le,ye){if(le===1/0||le===-1/0||le!==le||le&&le>-1e3&&le<1e3||A.call(/e/,ye))return ye;var it=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof le=="number"){var pt=le<0?-R(-le):R(le);if(pt!==le){var yt=String(pt),ft=S.call(ye,yt.length+1);return P.call(yt,it,"$&_")+"."+P.call(P.call(ft,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(ye,it,"$&_")}var Q=IA,U=Q.custom,L=He(U)?U:null,q={__proto__:null,double:'"',single:"'"},W={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Q1=function le(ye,it,pt,yt){var ft=it||{};if(xe(ft,"quoteStyle")&&!xe(q,ft.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(xe(ft,"maxStringLength")&&(typeof ft.maxStringLength=="number"?ft.maxStringLength<0&&ft.maxStringLength!==1/0:ft.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Nt=xe(ft,"customInspect")?ft.customInspect:!0;if(typeof Nt!="boolean"&&Nt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(xe(ft,"indent")&&ft.indent!==null&&ft.indent!==" "&&!(parseInt(ft.indent,10)===ft.indent&&ft.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(xe(ft,"numericSeparator")&&typeof ft.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Nr=ft.numericSeparator;if(typeof ye>"u")return"undefined";if(ye===null)return"null";if(typeof ye=="boolean")return ye?"true":"false";if(typeof ye=="string")return ke(ye,ft);if(typeof ye=="number"){if(ye===0)return 1/0/ye>0?"0":"-0";var Gt=String(ye);return Nr?V(ye,Gt):Gt}if(typeof ye=="bigint"){var fr=String(ye)+"n";return Nr?V(ye,fr):fr}var ir=typeof ft.depth>"u"?5:ft.depth;if(typeof pt>"u"&&(pt=0),pt>=ir&&ir>0&&typeof ye=="object")return ne(ye)?"[Array]":"[Object]";var er=Et(ft,pt);if(typeof yt>"u")yt=[];else if(ge(yt,ye)>=0)return"[Circular]";function ar(ui,fa,es){if(fa&&(yt=M.call(yt),yt.push(fa)),es){var ts={depth:ft.depth};return xe(ft,"quoteStyle")&&(ts.quoteStyle=ft.quoteStyle),le(ui,ts,pt+1,yt)}return le(ui,ft,pt+1,yt)}if(typeof ye=="function"&&!oe(ye)){var En=se(ye),Hr=At(ye,ar);return"[Function"+(En?": "+En:" (anonymous)")+"]"+(Hr.length>0?" { "+I.call(Hr,", ")+" }":"")}if(He(ye)){var Tn=$?P.call(String(ye),/^(Symbol\(.*\))_[^)]*$/,"$1"):H.call(ye);return typeof ye=="object"&&!$?Ue(Tn):Tn}if(ot(ye)){for(var Xr="<"+E.call(String(ye.nodeName)),Pi=ye.attributes||[],Jr=0;Jr<Pi.length;Jr++)Xr+=" "+Pi[Jr].name+"="+J(te(Pi[Jr].value),"double",ft);return Xr+=">",ye.childNodes&&ye.childNodes.length&&(Xr+="..."),Xr+="</"+E.call(String(ye.nodeName))+">",Xr}if(ne(ye)){if(ye.length===0)return"[]";var Vi=At(ye,ar);return er&&!at(Vi)?"["+bt(Vi,er)+"]":"[ "+I.call(Vi,", ")+" ]"}if(ue(ye)){var Bn=At(ye,ar);return!("cause"in Error.prototype)&&"cause"in ye&&!Z.call(ye,"cause")?"{ ["+String(ye)+"] "+I.call(T.call("[cause]: "+ar(ye.cause),Bn),", ")+" }":Bn.length===0?"["+String(ye)+"]":"{ ["+String(ye)+"] "+I.call(Bn,", ")+" }"}if(typeof ye=="object"&&Nt){if(L&&typeof ye[L]=="function"&&Q)return Q(ye,{depth:ir-pt});if(Nt!=="symbol"&&typeof ye.inspect=="function")return ye.inspect()}if(Ce(ye)){var Ei=[];return n&&n.call(ye,function(ui,fa){Ei.push(ar(fa,ye,!0)+" => "+ar(ui,ye))}),je("Map",r.call(ye),Ei,er)}if(Oe(ye)){var al=[];return s&&s.call(ye,function(ui){al.push(ar(ui,ye))}),je("Set",o.call(ye),al,er)}if(ae(ye))return be("WeakMap");if(Fe(ye))return be("WeakSet");if(_e(ye))return be("WeakRef");if(Re(ye))return Ue(ar(Number(ye)));if($e(ye))return Ue(ar(N.call(ye)));if(Ne(ye))return Ue(v.call(ye));if(we(ye))return Ue(ar(String(ye)));if(typeof window<"u"&&ye===window)return"{ [object Window] }";if(typeof globalThis<"u"&&ye===globalThis||typeof Ig<"u"&&ye===Ig)return"{ [object globalThis] }";if(!fe(ye)&&!oe(ye)){var Ba=At(ye,ar),ol=ee?ee(ye)===Object.prototype:ye instanceof Object||ye.constructor===Object,Cn=ye instanceof Object?"":"null prototype",ho=!ol&&X&&Object(ye)===ye&&X in ye?S.call(he(ye),8,-1):Cn?"Object":"",po=ol||typeof ye.constructor!="function"?"":ye.constructor.name?ye.constructor.name+" ":"",Jo=po+(ho||Cn?"["+I.call(T.call([],ho||[],Cn||[]),": ")+"] ":"");return Ba.length===0?Jo+"{}":er?Jo+"{"+bt(Ba,er)+"}":Jo+"{ "+I.call(Ba,", ")+" }"}return String(ye)};function J(le,ye,it){var pt=it.quoteStyle||ye,yt=q[pt];return yt+le+yt}function te(le){return P.call(String(le),/"/g,""")}function K(le){return!X||!(typeof le=="object"&&(X in le||typeof le[X]<"u"))}function ne(le){return he(le)==="[object Array]"&&K(le)}function fe(le){return he(le)==="[object Date]"&&K(le)}function oe(le){return he(le)==="[object RegExp]"&&K(le)}function ue(le){return he(le)==="[object Error]"&&K(le)}function we(le){return he(le)==="[object String]"&&K(le)}function Re(le){return he(le)==="[object Number]"&&K(le)}function Ne(le){return he(le)==="[object Boolean]"&&K(le)}function He(le){if($)return le&&typeof le=="object"&&le instanceof Symbol;if(typeof le=="symbol")return!0;if(!le||typeof le!="object"||!H)return!1;try{return H.call(le),!0}catch{}return!1}function $e(le){if(!le||typeof le!="object"||!N)return!1;try{return N.call(le),!0}catch{}return!1}var et=Object.prototype.hasOwnProperty||function(le){return le in this};function xe(le,ye){return et.call(le,ye)}function he(le){return b.call(le)}function se(le){if(le.name)return le.name;var ye=k.call(w.call(le),/^function\s*([\w$]+)/);return ye?ye[1]:null}function ge(le,ye){if(le.indexOf)return le.indexOf(ye);for(var it=0,pt=le.length;it<pt;it++)if(le[it]===ye)return it;return-1}function Ce(le){if(!r||!le||typeof le!="object")return!1;try{r.call(le);try{o.call(le)}catch{return!0}return le instanceof Map}catch{}return!1}function ae(le){if(!d||!le||typeof le!="object")return!1;try{d.call(le,d);try{p.call(le,p)}catch{return!0}return le instanceof WeakMap}catch{}return!1}function _e(le){if(!y||!le||typeof le!="object")return!1;try{return y.call(le),!0}catch{}return!1}function Oe(le){if(!o||!le||typeof le!="object")return!1;try{o.call(le);try{r.call(le)}catch{return!0}return le instanceof Set}catch{}return!1}function Fe(le){if(!p||!le||typeof le!="object")return!1;try{p.call(le,p);try{d.call(le,d)}catch{return!0}return le instanceof WeakSet}catch{}return!1}function ot(le){return!le||typeof le!="object"?!1:typeof HTMLElement<"u"&&le instanceof HTMLElement?!0:typeof le.nodeName=="string"&&typeof le.getAttribute=="function"}function ke(le,ye){if(le.length>ye.maxStringLength){var it=le.length-ye.maxStringLength,pt="... "+it+" more character"+(it>1?"s":"");return ke(S.call(le,0,ye.maxStringLength),ye)+pt}var yt=W[ye.quoteStyle||"single"];yt.lastIndex=0;var ft=P.call(P.call(le,yt,"\\$1"),/[\x00-\x1f]/g,me);return J(ft,"single",ye)}function me(le){var ye=le.charCodeAt(0),it={8:"b",9:"t",10:"n",12:"f",13:"r"}[ye];return it?"\\"+it:"\\x"+(ye<16?"0":"")+_.call(ye.toString(16))}function Ue(le){return"Object("+le+")"}function be(le){return le+" { ? }"}function je(le,ye,it,pt){var yt=pt?bt(it,pt):I.call(it,", ");return le+" ("+ye+") {"+yt+"}"}function at(le){for(var ye=0;ye<le.length;ye++)if(ge(le[ye],`
|
|
141
|
+
`)>=0)return!1;return!0}function Et(le,ye){var it;if(le.indent===" ")it=" ";else if(typeof le.indent=="number"&&le.indent>0)it=I.call(Array(le.indent+1)," ");else return null;return{base:it,prev:I.call(Array(ye+1),it)}}function bt(le,ye){if(le.length===0)return"";var it=`
|
|
142
|
+
`+ye.prev+ye.base;return it+I.call(le,","+it)+`
|
|
143
|
+
`+ye.prev}function At(le,ye){var it=ne(le),pt=[];if(it){pt.length=le.length;for(var yt=0;yt<le.length;yt++)pt[yt]=xe(le,yt)?ye(le[yt],le):""}var ft=typeof F=="function"?F(le):[],Nt;if($){Nt={};for(var Nr=0;Nr<ft.length;Nr++)Nt["$"+ft[Nr]]=ft[Nr]}for(var Gt in le)xe(le,Gt)&&(it&&String(Number(Gt))===Gt&&Gt<le.length||$&&Nt["$"+Gt]instanceof Symbol||(A.call(/[^\w$]/,Gt)?pt.push(ye(Gt,le)+": "+ye(le[Gt],le)):pt.push(Gt+": "+ye(le[Gt],le))));if(typeof F=="function")for(var fr=0;fr<ft.length;fr++)Z.call(le,ft[fr])&&pt.push("["+ye(ft[fr])+"]: "+ye(le[ft[fr]],le));return pt}return Q1}var Z1,V3;function RA(){if(V3)return Z1;V3=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,q3;function Lk(){return q3||(q3=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 VA(){return n4||(n4=1,fy=Math.round),fy}var dy,i4;function qA(){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=qA();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 w=function(){};w.prototype=d.prototype,p.prototype=new w,w.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 V2(){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=V2(),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=V2(),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 q2(){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=VA(),b=WA(),w=Function,k=function(oe){try{return w('"use strict"; return ('+oe+").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=V2(),F={},H=typeof Uint8Array>"u"||!T?t:T(Uint8Array),$={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":A&&T?T([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":F,"%AsyncGenerator%":F,"%AsyncGeneratorFunction%":F,"%AsyncIteratorPrototype%":F,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float16Array%":typeof Float16Array>"u"?t:Float16Array,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":w,"%GeneratorFunction%":F,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":A&&T?T(T([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!A||!T?t:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!A||!T?t:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":A&&T?T(""[Symbol.iterator]()):t,"%Symbol%":A?Symbol:t,"%SyntaxError%":o,"%ThrowTypeError%":E,"%TypedArray%":H,"%TypeError%":s,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet,"%Function.prototype.call%":N,"%Function.prototype.apply%":R,"%Object.defineProperty%":P,"%Object.getPrototypeOf%":I,"%Math.abs%":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(oe){var X=T(T(oe));$["%Error.prototype%"]=X}var Z=function oe(ue){var we;if(ue==="%AsyncFunction%")we=k("async function () {}");else if(ue==="%GeneratorFunction%")we=k("function* () {}");else if(ue==="%AsyncGeneratorFunction%")we=k("async function* () {}");else if(ue==="%AsyncGenerator%"){var Re=oe("%AsyncGeneratorFunction%");Re&&(we=Re.prototype)}else if(ue==="%AsyncIteratorPrototype%"){var Ne=oe("%AsyncGenerator%");Ne&&T&&(we=T(Ne.prototype))}return $[ue]=we,we},ee={__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"]},V=P0(),Q=rI(),U=V.call(N,Array.prototype.concat),L=V.call(R,Array.prototype.splice),q=V.call(N,String.prototype.replace),W=V.call(N,String.prototype.slice),J=V.call(N,RegExp.prototype.exec),te=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,ne=function(ue){var we=W(ue,0,1),Re=W(ue,-1);if(we==="%"&&Re!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(Re==="%"&&we!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var Ne=[];return q(ue,te,function(He,$e,et,xe){Ne[Ne.length]=et?q(xe,K,"$1"):$e||He}),Ne},fe=function(ue,we){var Re=ue,Ne;if(Q(ee,Re)&&(Ne=ee[Re],Re="%"+Ne[0]+"%"),Q($,Re)){var He=$[Re];if(He===F&&(He=Z(Re)),typeof He>"u"&&!we)throw new s("intrinsic "+ue+" exists, but is not available. Please file an issue!");return{alias:Ne,name:Re,value:He}}throw new o("intrinsic "+ue+" does not exist!")};return Iy=function(ue,we){if(typeof ue!="string"||ue.length===0)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof we!="boolean")throw new s('"allowMissing" argument must be a boolean');if(J(/^%?[^%]*%?$/,ue)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Re=ne(ue),Ne=Re.length>0?Re[0]:"",He=fe("%"+Ne+"%",we),$e=He.name,et=He.value,xe=!1,he=He.alias;he&&(Ne=he[0],L(Re,U([0,1],he)));for(var se=1,ge=!0;se<Re.length;se+=1){var Ce=Re[se],ae=W(Ce,0,1),_e=W(Ce,-1);if((ae==='"'||ae==="'"||ae==="`"||_e==='"'||_e==="'"||_e==="`")&&ae!==_e)throw new o("property names with quotes must have matching quotes");if((Ce==="constructor"||!ge)&&(xe=!0),Ne+="."+Ce,$e="%"+Ne+"%",Q($,$e))et=$[$e];else if(et!=null){if(!(Ce in et)){if(!we)throw new s("base intrinsic for "+ue+" exists, but the property is not available.");return}if(S&&se+1>=Re.length){var Oe=S(et,Ce);ge=!!Oe,ge&&"get"in Oe&&!("originalValue"in Oe.get)?et=Oe.get:et=et[Ce]}else ge=Q(et,Ce),et=et[Ce];ge&&!xe&&($[$e]=et)}}return et},Iy}var Ry,_4;function Hk(){if(_4)return Ry;_4=1;var t=q2(),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=q2(),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=q2(),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 Vk(){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 qk(){if(O4)return Fy;O4=1;var t=W2(),e=Vk(),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),F=M&&M.plainObjects?{__proto__:null,0:T}:{0:T},H=0;H<N.length;H++){var $=parseInt(N[H],10);F[$+1]=I[N[H]]}return a(F,s(I)+1)}return[T].concat(I)}var X=T;return n(T)&&!n(I)&&(X=p(T,M)),n(T)&&n(I)?(I.forEach(function(Z,ee){if(r.call(T,ee)){var V=T[ee];V&&typeof V=="object"&&Z&&typeof Z=="object"?T[ee]=A(V,Z,M):T.push(Z)}else T[ee]=Z}),T):Object.keys(I).reduce(function(Z,ee){var V=I[ee];return r.call(Z,ee)?Z[ee]=A(Z[ee],V,M):Z[ee]=V,Z},X)},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,w=function(T,I,M,R,N){if(T.length===0)return T;var F=T;if(typeof T=="symbol"?F=Symbol.prototype.toString.call(T):typeof T!="string"&&(F=String(T)),M==="iso-8859-1")return escape(F).replace(/%u[0-9a-f]{4}/gi,function(Q){return"%26%23"+parseInt(Q.slice(2),16)+"%3B"});for(var H="",$=0;$<F.length;$+=b){for(var X=F.length>=b?F.slice($,$+b):F,Z=[],ee=0;ee<X.length;++ee){var V=X.charCodeAt(ee);if(V===45||V===46||V===95||V===126||V>=48&&V<=57||V>=65&&V<=90||V>=97&&V<=122||N===t.RFC1738&&(V===40||V===41)){Z[Z.length]=X.charAt(ee);continue}if(V<128){Z[Z.length]=d[V];continue}if(V<2048){Z[Z.length]=d[192|V>>6]+d[128|V&63];continue}if(V<55296||V>=57344){Z[Z.length]=d[224|V>>12]+d[128|V>>6&63]+d[128|V&63];continue}ee+=1,V=65536+((V&1023)<<10|X.charCodeAt(ee)&1023),Z[Z.length]=d[240|V>>18]+d[128|V>>12&63]+d[128|V>>6&63]+d[128|V&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],F=N.obj[N.prop],H=Object.keys(F),$=0;$<H.length;++$){var X=H[$],Z=F[X];typeof Z=="object"&&Z!==null&&M.indexOf(Z)===-1&&(I.push({obj:F,prop:X}),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 F=[].concat(T,I);return F.length>M?a(p(F,{plainObjects:R}),F.length-1):F},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:w,isBuffer:P,isOverflow:o,isRegExp:S,maybeMap:E,merge:h},Fy}var By,A4;function iI(){if(A4)return By;A4=1;var t=Vk(),e=qk(),r=W2(),n=Object.prototype.hasOwnProperty,i={brackets:function(w){return w+"[]"},comma:"comma",indices:function(w,k){return w+"["+k+"]"},repeat:function(w){return w}},a=Array.isArray,o=Array.prototype.push,s=function(b,w){o.apply(b,a(w)?w:[w])},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(w){return u.call(w)},skipNulls:!1,strictNullHandling:!1},p=function(w){return typeof w=="string"||typeof w=="number"||typeof w=="boolean"||typeof w=="symbol"||typeof w=="bigint"},h={},y=function b(w,k,S,P,_,E,A,T,I,M,R,N,F,H,$,X,Z,ee){for(var V=w,Q=ee,U=0,L=!1;(Q=Q.get(h))!==void 0&&!L;){var q=Q.get(w);if(U+=1,typeof q<"u"){if(q===U)throw new RangeError("Cyclic object value");L=!0}typeof Q.get(h)>"u"&&(U=0)}if(typeof M=="function"?V=M(k,V):V instanceof Date?V=F(V):S==="comma"&&a(V)&&(V=e.maybeMap(V,function($e){return $e instanceof Date?F($e):$e})),V===null){if(E)return I&&!X?I(k,f.encoder,Z,"key",H):k;V=""}if(p(V)||e.isBuffer(V)){if(I){var W=X?k:I(k,f.encoder,Z,"key",H);return[$(W)+"="+$(I(V,f.encoder,Z,"value",H))]}return[$(k)+"="+$(String(V))]}var J=[];if(typeof V>"u")return J;var te;if(S==="comma"&&a(V))X&&I&&(V=e.maybeMap(V,I)),te=[{value:V.length>0?V.join(",")||null:void 0}];else if(a(M))te=M;else{var K=Object.keys(V);te=R?K.sort(R):K}var ne=T?String(k).replace(/\./g,"%2E"):String(k),fe=P&&a(V)&&V.length===1?ne+"[]":ne;if(_&&a(V)&&V.length===0)return fe+"[]";for(var oe=0;oe<te.length;++oe){var ue=te[oe],we=typeof ue=="object"&&ue&&typeof ue.value<"u"?ue.value:V[ue];if(!(A&&we===null)){var Re=N&&T?String(ue).replace(/\./g,"%2E"):String(ue),Ne=a(V)?typeof S=="function"?S(fe,Re):fe:fe+(N?"."+Re:"["+Re+"]");ee.set(w,U);var He=t();He.set(h,ee),s(J,b(we,Ne,S,P,_,E,A,T,S==="comma"&&X&&a(V)?null:I,M,R,N,F,H,$,X,Z,He))}}return J},v=function(w){if(!w)return f;if(typeof w.allowEmptyArrays<"u"&&typeof w.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof w.encodeDotInKeys<"u"&&typeof w.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(w.encoder!==null&&typeof w.encoder<"u"&&typeof w.encoder!="function")throw new TypeError("Encoder has to be a function.");var k=w.charset||f.charset;if(typeof w.charset<"u"&&w.charset!=="utf-8"&&w.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 w.format<"u"){if(!n.call(r.formatters,w.format))throw new TypeError("Unknown format option provided.");S=w.format}var P=r.formatters[S],_=f.filter;(typeof w.filter=="function"||a(w.filter))&&(_=w.filter);var E;if(w.arrayFormat in i?E=w.arrayFormat:"indices"in w?E=w.indices?"indices":"repeat":E=f.arrayFormat,"commaRoundTrip"in w&&typeof w.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var A=typeof w.allowDots>"u"?w.encodeDotInKeys===!0?!0:f.allowDots:!!w.allowDots;return{addQueryPrefix:typeof w.addQueryPrefix=="boolean"?w.addQueryPrefix:f.addQueryPrefix,allowDots:A,allowEmptyArrays:typeof w.allowEmptyArrays=="boolean"?!!w.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:E,charset:k,charsetSentinel:typeof w.charsetSentinel=="boolean"?w.charsetSentinel:f.charsetSentinel,commaRoundTrip:!!w.commaRoundTrip,delimiter:typeof w.delimiter>"u"?f.delimiter:w.delimiter,encode:typeof w.encode=="boolean"?w.encode:f.encode,encodeDotInKeys:typeof w.encodeDotInKeys=="boolean"?w.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof w.encoder=="function"?w.encoder:f.encoder,encodeValuesOnly:typeof w.encodeValuesOnly=="boolean"?w.encodeValuesOnly:f.encodeValuesOnly,filter:_,format:S,formatter:P,serializeDate:typeof w.serializeDate=="function"?w.serializeDate:f.serializeDate,skipNulls:typeof w.skipNulls=="boolean"?w.skipNulls:f.skipNulls,sort:typeof w.sort=="function"?w.sort:null,strictNullHandling:typeof w.strictNullHandling=="boolean"?w.strictNullHandling:f.strictNullHandling}};return By=function(b,w){var k=b,S=v(w),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 F=E.join(S.delimiter),H=S.addQueryPrefix===!0?"?":"";return S.charsetSentinel&&(S.charset==="iso-8859-1"?H+="utf8=%26%2310003%3B&":H+="utf8=%E2%9C%93&"),F.length>0?H+F:""},By}var zy,I4;function aI(){if(I4)return zy;I4=1;var t=qk(),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 w={__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(w[R])?w[R].length:0),function(H){return b.decoder(H,n.decoder,A,"value")}))),N&&b.interpretNumericEntities&&A==="iso-8859-1"&&(N=i(String(N))),T.indexOf("[]=")>-1&&(N=r(N)?[N]:N),R!==null){var F=e.call(w,R);F&&b.duplicates==="combine"?w[R]=t.combine(w[R],N,b.arrayLimit,b.plainObjects):(!F||b.duplicates==="last")&&(w[R]=N)}}return w},d=function(y,v,b,w){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=w?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 w=b.allowDots?v.replace(/\.([^.[]+)/g,"[$1]"):v;if(b.depth<=0)return!b.plainObjects&&e.call(Object.prototype,w)&&!b.allowPrototypes?void 0:[w];var k=/(\[[^[\]]*])/,S=/(\[[^[\]]*])/g,P=k.exec(w),_=P?w.slice(0,P.index):w,E=[];if(_){if(!b.plainObjects&&e.call(Object.prototype,_)&&!b.allowPrototypes)return;E.push(_)}for(var A=0;(P=S.exec(w))!==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("["+w.slice(P.index)+"]")}return E},p=function(v,b,w,k){if(v){var S=f(v,w);if(S)return d(S,b,w,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,w=typeof v.duplicates>"u"?n.duplicates:v.duplicates;if(w!=="combine"&&w!=="first"&&w!=="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:w,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 w=typeof y=="string"?u(y,b):y,k=b.plainObjects?{__proto__:null}:{},S=Object.keys(w),P=0;P<S.length;++P){var _=S[P],E=p(_,w[_],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},w=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 F=E;if(F=F.trim(),!T&&E.split("#").length===1){var H=i.exec(F);if(H)return this.path=F,this.href=F,this.pathname=H[1],H[2]?(this.search=H[2],A?this.query=w.parse(this.search.substr(1)):this.query=this.search.substr(1)):A&&(this.search="",this.query={}),this}var $=r.exec(F);if($){$=$[0];var X=$.toLowerCase();this.protocol=X,F=F.substr($.length)}if(T||$||F.match(/^\/\/[^@/]+@[^@/]+/)){var Z=F.substr(0,2)==="//";Z&&!($&&v[$])&&(F=F.substr(2),this.slashes=!0)}if(!v[$]&&(Z||$&&!b[$])){for(var ee=-1,V=0;V<d.length;V++){var Q=F.indexOf(d[V]);Q!==-1&&(ee===-1||Q<ee)&&(ee=Q)}var U,L;ee===-1?L=F.lastIndexOf("@"):L=F.lastIndexOf("@",ee),L!==-1&&(U=F.slice(0,L),F=F.slice(L+1),this.auth=decodeURIComponent(U)),ee=-1;for(var V=0;V<u.length;V++){var Q=F.indexOf(u[V]);Q!==-1&&(ee===-1||Q<ee)&&(ee=Q)}ee===-1&&(ee=F.length),this.host=F.slice(0,ee),F=F.slice(ee),this.parseHost(),this.hostname=this.hostname||"";var q=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!q)for(var W=this.hostname.split(/\./),V=0,J=W.length;V<J;V++){var te=W[V];if(te&&!te.match(p)){for(var K="",ne=0,fe=te.length;ne<fe;ne++)te.charCodeAt(ne)>127?K+="x":K+=te[ne];if(!K.match(p)){var oe=W.slice(0,V),ue=W.slice(V+1),we=te.match(h);we&&(oe.push(we[1]),ue.unshift(we[2])),ue.length&&(F="/"+ue.join(".")+F),this.hostname=oe.join(".");break}}}this.hostname.length>f?this.hostname="":this.hostname=this.hostname.toLowerCase(),q||(this.hostname=t.toASCII(this.hostname));var Re=this.port?":"+this.port:"",Ne=this.hostname||"";this.host=Ne+Re,this.href+=this.host,q&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),F[0]!=="/"&&(F="/"+F))}if(!y[X])for(var V=0,J=s.length;V<J;V++){var He=s[V];if(F.indexOf(He)!==-1){var $e=encodeURIComponent(He);$e===He&&($e=escape(He)),F=F.split(He).join($e)}}var et=F.indexOf("#");et!==-1&&(this.hash=F.substr(et),F=F.slice(0,et));var xe=F.indexOf("?");if(xe!==-1?(this.search=F.substr(xe),this.query=F.substr(xe+1),A&&(this.query=w.parse(this.query)),F=F.slice(0,xe)):A&&(this.search="",this.query={}),F&&(this.pathname=F),b[X]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Re=this.pathname||"",he=this.search||"";this.path=Re+he}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=w.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(F){return encodeURIComponent(F)}),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),F=0;F<N.length;F++){var H=N[F];H!=="protocol"&&(T[H]=E[H])}return b[T.protocol]&&T.hostname&&!T.pathname&&(T.pathname="/",T.path=T.pathname),T.href=T.format(),T}if(E.protocol&&E.protocol!==T.protocol){if(!b[E.protocol]){for(var $=Object.keys(E),X=0;X<$.length;X++){var Z=$[X];T[Z]=E[Z]}return T.href=T.format(),T}if(T.protocol=E.protocol,!E.host&&!v[E.protocol]){for(var J=(E.pathname||"").split("/");J.length&&!(E.host=J.shift()););E.host||(E.host=""),E.hostname||(E.hostname=""),J[0]!==""&&J.unshift(""),J.length<2&&J.unshift(""),T.pathname=J.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 ee=T.pathname||"",V=T.search||"";T.path=ee+V}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,q=L,W=T.pathname&&T.pathname.split("/")||[],J=E.pathname&&E.pathname.split("/")||[],te=T.protocol&&!b[T.protocol];if(te&&(T.hostname="",T.port=null,T.host&&(W[0]===""?W[0]=T.host:W.unshift(T.host)),T.host="",E.protocol&&(E.hostname=null,E.port=null,E.host&&(J[0]===""?J[0]=E.host:J.unshift(E.host)),E.host=null),L=L&&(J[0]===""||W[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,W=J;else if(J.length)W||(W=[]),W.pop(),W=W.concat(J),T.search=E.search,T.query=E.query;else if(E.search!=null){if(te){T.host=W.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(!W.length)return T.pathname=null,T.search?T.path="/"+T.search:T.path=null,T.href=T.format(),T;for(var ne=W.slice(-1)[0],fe=(T.host||E.host||W.length>1)&&(ne==="."||ne==="..")||ne==="",oe=0,ue=W.length;ue>=0;ue--)ne=W[ue],ne==="."?W.splice(ue,1):ne===".."?(W.splice(ue,1),oe++):oe&&(W.splice(ue,1),oe--);if(!L&&!q)for(;oe--;oe)W.unshift("..");L&&W[0]!==""&&(!W[0]||W[0].charAt(0)!=="/")&&W.unshift(""),fe&&W.join("/").substr(-1)!=="/"&&W.push("");var we=W[0]===""||W[0]&&W[0].charAt(0)==="/";if(te){T.hostname=we?"":W.length?W.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&&W.length,L&&!we&&W.unshift(""),W.length>0?T.pathname=W.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(w){return w.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(w){b+=i(w)}),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 Vy={},F4;function cI(){if(F4)return Vy;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 Vy.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)})}))},Vy}var qy={},B4;function fI(){if(B4)return qy;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 qy.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)})}))},qy}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"),w=[],k;for(k=b.exec(v);k;)w.push(k[1]),k=b.exec(v);return w};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 w(k){return k?'"'+h(k)+'"':"end of input"}return"Expected "+b(u)+" but "+w(d)+" found."};function s(u,d){d=d!==void 0?d:{};var f={},p={start:Re},h=Re,y="",v=function(){return[]},b=",",w=te(",",!1),k=function(ae,_e){return[ae].concat(_e)},S=function(ae){return[ae]},P=function(ae,_e){return{url:ae,format:_e}},_=function(ae){return{url:ae}},E="url(",A=te("url(",!1),T=")",I=te(")",!1),M=function(ae){return ae},R="format(",N=te("format(",!1),F="local(",H=te("local(",!1),$=function(ae){return{local:ae}},X=/^[^)]/,Z=K([")"],!0,!1),ee=function(ae){return Ce.extractValue(ae.join(""))},V=/^[ \t\r\n\f]/,Q=K([" "," ","\r",`
|
|
147
|
+
`,"\f"],!1,!1),U=0,L=[{line:1,column:1}],q=0,W=[],J;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 te(ae,_e){return{type:"literal",text:ae,ignoreCase:_e}}function K(ae,_e,Oe){return{type:"class",parts:ae,inverted:_e,ignoreCase:Oe}}function ne(){return{type:"end"}}function fe(ae){var _e=L[ae],Oe;if(_e)return _e;for(Oe=ae-1;!L[Oe];)Oe--;for(_e=L[Oe],_e={line:_e.line,column:_e.column};Oe<ae;)u.charCodeAt(Oe)===10?(_e.line++,_e.column=1):_e.column++,Oe++;return L[ae]=_e,_e}function oe(ae,_e){var Oe=fe(ae),Fe=fe(_e);return{start:{offset:ae,line:Oe.line,column:Oe.column},end:{offset:_e,line:Fe.line,column:Fe.column}}}function ue(ae){U<q||(U>q&&(q=U,W=[]),W.push(ae))}function we(ae,_e,Oe){return new o(o.buildMessage(ae,_e),ae,_e,Oe)}function Re(){var ae,_e;return ae=Ne(),ae===f&&(ae=U,_e=y,_e!==f&&(_e=v()),ae=_e),ae}function Ne(){var ae,_e,Oe,Fe,ot,ke;if(ae=U,_e=He(),_e!==f){for(Oe=[],Fe=ge();Fe!==f;)Oe.push(Fe),Fe=ge();if(Oe!==f)if(u.charCodeAt(U)===44?(Fe=b,U++):(Fe=f,ue(w)),Fe!==f){for(ot=[],ke=ge();ke!==f;)ot.push(ke),ke=ge();ot!==f?(ke=Ne(),ke!==f?(_e=k(_e,ke),ae=_e):(U=ae,ae=f)):(U=ae,ae=f)}else U=ae,ae=f;else U=ae,ae=f}else U=ae,ae=f;return ae===f&&(ae=U,_e=He(),_e!==f&&(_e=S(_e)),ae=_e),ae}function He(){var ae;return ae=$e(),ae===f&&(ae=he()),ae}function $e(){var ae,_e,Oe,Fe;if(ae=U,_e=et(),_e!==f){if(Oe=[],Fe=ge(),Fe!==f)for(;Fe!==f;)Oe.push(Fe),Fe=ge();else Oe=f;Oe!==f?(Fe=xe(),Fe!==f?(_e=P(_e,Fe),ae=_e):(U=ae,ae=f)):(U=ae,ae=f)}else U=ae,ae=f;return ae===f&&(ae=U,_e=et(),_e!==f&&(_e=_(_e)),ae=_e),ae}function et(){var ae,_e,Oe,Fe;return ae=U,u.substr(U,4)===E?(_e=E,U+=4):(_e=f,ue(A)),_e!==f?(Oe=se(),Oe!==f?(u.charCodeAt(U)===41?(Fe=T,U++):(Fe=f,ue(I)),Fe!==f?(_e=M(Oe),ae=_e):(U=ae,ae=f)):(U=ae,ae=f)):(U=ae,ae=f),ae}function xe(){var ae,_e,Oe,Fe;return ae=U,u.substr(U,7)===R?(_e=R,U+=7):(_e=f,ue(N)),_e!==f?(Oe=se(),Oe!==f?(u.charCodeAt(U)===41?(Fe=T,U++):(Fe=f,ue(I)),Fe!==f?(_e=M(Oe),ae=_e):(U=ae,ae=f)):(U=ae,ae=f)):(U=ae,ae=f),ae}function he(){var ae,_e,Oe,Fe;return ae=U,u.substr(U,6)===F?(_e=F,U+=6):(_e=f,ue(H)),_e!==f?(Oe=se(),Oe!==f?(u.charCodeAt(U)===41?(Fe=T,U++):(Fe=f,ue(I)),Fe!==f?(_e=$(Oe),ae=_e):(U=ae,ae=f)):(U=ae,ae=f)):(U=ae,ae=f),ae}function se(){var ae,_e,Oe;if(ae=U,_e=[],X.test(u.charAt(U))?(Oe=u.charAt(U),U++):(Oe=f,ue(Z)),Oe!==f)for(;Oe!==f;)_e.push(Oe),X.test(u.charAt(U))?(Oe=u.charAt(U),U++):(Oe=f,ue(Z));else _e=f;return _e!==f&&(_e=ee(_e)),ae=_e,ae}function ge(){var ae;return V.test(u.charAt(U))?(ae=u.charAt(U),U++):(ae=f,ue(Q)),ae}var Ce=r("../util");if(J=h(),J!==f&&U===u.length)return J;throw J!==f&&U<u.length&&ue(ne()),we(W,q<u.length?u.charAt(q):null,q<u.length?oe(q,q+1):oe(q,q))}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(F){var H=M[F].url,$=e.joinUrl(S,H);M[F].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(F){var H=R[F].url,$=e.joinUrl(S,H);R[F].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}})},w=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 w(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(w){return e.joinUrl(w,".")},s=function(w){var k=w.map(function(S,P){return P===w.length-1&&(S={baseUrl:o(S.baseUrl)}),JSON.stringify(S)});return k},u=function(w,k){return k.cache!==!1&&k.cache!=="none"&&k.cacheBucket?e.memoize(w,s,k.cacheBucket):w},d=function(w,k,S){var P=a.rulesForCssText(w,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&&(w=a.cssRulesToText(P)),{hasChanges:T,content:w,errors:A}})})},f=function(w,k,S){var P=w.textContent,_=u(d,k);return _(P,S,k).then(function(E){return E.hasChanges&&(w.childNodes[0].nodeValue=E.content),e.cloneArray(E.errors)})},p=function(w){var k=w.getElementsByTagName("style");return Array.prototype.filter.call(k,function(S){return!S.attributes.type||S.attributes.type.value==="text/css"})};t.loadAndInlineStyles=function(w,k){var S=p(w),P=[],_=[],E;return E=e.clone(k),E.baseUrl=E.baseUrl||e.getDocumentBaseUrl(w),Promise.all(S.map(function(A){return f(A,E,_).then(function(T){P=P.concat(T)})})).then(function(){return P})};var h=function(w,k,S){var P=w.parentNode,_;k=k.trim(),k&&(_=w.ownerDocument.createElement("style"),_.type="text/css",S&&S.nonce&&(_.nonce=S.nonce),_.appendChild(w.ownerDocument.createTextNode(k)),P.insertBefore(_,w)),P.removeChild(w)},y=function(w,k){return e.ajax(w,k).then(function(S){var P=a.rulesForCssText(S,k);return{content:S,cssRules:P}}).then(function(S){var P=i.adjustPathsOfCssResources(w,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(w,k){var S=w.attributes.href.value,P=e.getDocumentBaseUrl(w.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(w){var k=w.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(w,k){var S=b(w),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(w,k){var S=[],P=[t.loadAndInlineImages,t.loadAndInlineStyles,t.loadAndInlineCssLinks];return k.inlineScripts!==!1&&P.push(t.loadAndInlineScript),Promise.all(P.map(function(_){return _(w,k).then(function(E){S=S.concat(E)})})).then(function(){return S})}})(Hy)),Hy}var gI=_g.exports,V4;function yI(){return V4||(V4=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={},w=[];b.joinUrl=function(P,_){return P?v.resolve(P,_):_},b.getConstantUniqueIdFor=function(P){return w.indexOf(P)<0&&w.push(P),w.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={},w=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 w(_,"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 w(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 w=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;w(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 F=b(N.sheet.cssRules).filter(function(H){return H.selectorText&&new RegExp(R,"i").test(H.selectorText)});F.length&&(F.forEach(function(H){var $=H.selectorText.replace(new RegExp(R,"gi"),function(X,Z,ee){return Z+M(ee)});$!==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(F){return!R[F]})},v})(),u=(function(v){var b={},w=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"};w(P).filter(E).forEach(function(A){A.checked?A.setAttribute("checked",""):A.removeAttribute("checked")}),w(P).filter(function(A){return!E(A)}).forEach(function(A){A.setAttribute("value",A.value)}),w(_).forEach(function(A){A.textContent=A.value})},b.rewriteTagNameSelectorsToLowerCase=function(S){v.lowercaseCssTypeSelectors(S,v.findHtmlOnlyNodeNames(S))},b})(s),d=(function(v,b,w,k){var S={},P=function(ee,V,Q,U){var L=ee.createElement(V);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",ee.getElementsByTagName("body")[0].appendChild(L),L},_=function(ee){return ee>0?new Promise(function(V){setTimeout(V,ee)}):Promise.resolve()};S.executeJavascript=function(ee,V){return new Promise(function(Q){var U=P(k.document,"iframe",V.width,V.height),L=ee.outerHTML,q=[],W=V.executeJsTimeout||0,J=function(){k.document.getElementsByTagName("body")[0].removeChild(U)},te=function(){var oe=U.contentDocument;Q({document:oe,errors:q,cleanUp:J})},K=U.contentWindow.XMLHttpRequest,ne=b.finishNotifyingXhr(K),fe=b.baseUrlRespectingXhr(ne,V.baseUrl);U.onload=function(){_(W).then(ne.waitForRequestsToFinish).then(te)},U.contentDocument.open(),U.contentWindow.XMLHttpRequest=fe,U.contentWindow.onerror=function(oe){q.push({resourceType:"scriptExecution",msg:oe})},U.contentDocument.write("<!DOCTYPE html>"),U.contentDocument.write(L),U.contentDocument.close()})};var E=function(ee,V,Q){var U=ee.createElement("iframe");return U.style.width=V+"px",U.style.height=Q+"px",U.style.visibility="hidden",U.style.position="absolute",U.style.top=-1e4-Q+"px",U.style.left=-1e4-V+"px",U.style.borderWidth=0,U.sandbox="allow-same-origin",U.scrolling="no",U},A=function(ee,V,Q){var U=Math.floor(ee/Q),L=Math.floor(V/Q);return E(k.document,U,L)},T=function(ee,V,Q,U){return{width:Math.max(ee.width*U,V),height:Math.max(ee.height*U,Q)}},I=function(ee,V){var Q=ee.querySelector(V);if(Q)return Q;if(ee.ownerDocument.querySelector(V)===ee)return ee;throw{message:"Clipping selector not found"}},M=function(ee,V,Q,U,L){var q=Math.max(ee.scrollWidth,ee.clientWidth),W=Math.max(ee.scrollHeight,ee.clientHeight),J,te,K,ne,fe,oe,ue,we;return V?(oe=I(ee,V),ue=oe.getBoundingClientRect(),J=ue.top,te=ue.left,K=ue.width,ne=ue.height):(J=0,te=0,K=q,ne=W),we=T({width:K,height:ne},Q,U,L),fe=k.getComputedStyle(ee.ownerDocument.documentElement).fontSize,{left:te,top:J,width:we.width,height:we.height,viewportWidth:q,viewportHeight:W,rootFontSize:fe}},R=function(ee,V){var Q=ee.tagName;return V.querySelector(Q)},N=function(ee){var V=ee.tagName.toLowerCase();return V==="html"||V==="body"?ee.outerHTML:'<body style="margin: 0;">'+ee.outerHTML+"</body>"};S.calculateDocumentContentSize=function(ee,V){return new Promise(function(Q,U){var L=V.zoom||1,q;q=A(V.width,V.height,L),k.document.getElementsByTagName("body")[0].appendChild(q),q.onload=function(){var W=q.contentDocument,J;try{J=M(R(ee,W),V.clip,V.width,V.height,L),Q(J)}catch(te){U(te)}finally{k.document.getElementsByTagName("body")[0].removeChild(q)}},q.contentDocument.open(),q.contentDocument.write("<!DOCTYPE html>"),q.contentDocument.write(N(ee)),q.contentDocument.close()})},S.parseHtmlFragment=function(ee){var V=k.document.implementation.createHTMLDocument("");V.documentElement.innerHTML=ee;var Q=V.querySelector("body").firstChild;if(!Q)throw"Invalid source";return Q};var F=function(ee,V){var Q=/<html((?:\s+[^>]*)?)>/im.exec(V),U=k.document.implementation.createHTMLDocument(""),L,q,W,J;if(Q)for(L="<div"+Q[1]+"></div>",U.documentElement.innerHTML=L,W=U.querySelector("div"),q=0;q<W.attributes.length;q++)J=W.attributes[q],ee.documentElement.setAttribute(J.name,J.value)};S.parseHTML=function(ee){var V=k.document.implementation.createHTMLDocument("");return V.documentElement.innerHTML=ee,F(V,ee),V};var H=function(ee){try{return w.failOnParseError(ee)}catch(V){throw{message:"Invalid source",originalError:V}}};S.validateXHTML=function(ee){var V=new DOMParser,Q=V.parseFromString(ee,"application/xml");H(Q)};var $=null,X=function(ee,V){return V==="none"||V==="repeated"?(($===null||V!=="repeated")&&($=Date.now()),ee+"?_="+$):ee},Z=function(ee,V){return new Promise(function(Q,U){var L=new window.XMLHttpRequest,q=v.joinUrl(V.baseUrl,ee),W=X(q,V.cache),J=function(te){U({message:"Unable to load page",originalError:te})};L.addEventListener("load",function(){L.status===200||L.status===0?Q(L.responseXML):J(L.statusText)},!1),L.addEventListener("error",function(te){J(te)},!1);try{L.open("GET",W,!0),L.responseType="document",L.send(null)}catch(te){J(te)}})};return S.loadDocument=function(ee,V){return Z(ee,V).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)},w=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"),F=new Image;F.onload=function(){var H=N.getContext("2d");try{H.drawImage(F,0,0),N.toDataURL("image/png"),M(!0)}catch{M(!1)}},F.onerror=R,F.src=I})},P=function(){var I=b(k,!0);return S(I).then(function(M){return w(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,F,H=function(){F.onload=null,F.onerror=null},$=function(){N&&w(N)};F=new Image,F.onload=function(){H(),$(),M(F)},F.onerror=function(){$(),R()},T(I).then(function(X){N=X,F.src=N},R)})},v})(),p=(function(v,b,w,k){var S={},P=function(R,N){var F=N||1,H={width:R.width,height:R.height,"font-size":R.rootFontSize};return F!==1&&(H.style="transform:scale("+F+"); transform-origin: 0 0;"),H},_=function(R){var N,F,H,$;N=Math.round(R.viewportWidth),F=Math.round(R.viewportHeight),H=-R.left,$=-R.top;var X={x:H,y:$,width:N,height:F};return X},E=function(R){var N=R.style||"";R.style=N+"float: left;"},A=function(R){R.externalResourcesRequired=!0},T=function(){return'<style scoped="">html::-webkit-scrollbar { display: none; }</style>'},I=function(R){var N=Object.keys(R);return N.length?" "+N.map(function(F){return F+'="'+R[F]+'"'}).join(" "):""},M=function(R,N,F){var H=k.serializeToString(R);b.validateXHTML(H);var $=_(N);return E($),A($),'<svg xmlns="http://www.w3.org/2000/svg"'+I(P(N,F))+">"+T()+"<foreignObject"+I($)+">"+H+"</foreignObject></svg>"};return S.getSvgForDocument=function(R,N,F){return w.rewriteTagNameSelectorsToLowerCase(R),M(R,N,F)},S.drawDocumentAsSvg=function(R,N){return["hover","active","focus","target"].forEach(function(F){N[F]&&w.fakeUserAction(R,N[F],F)}),b.calculateDocumentContentSize(R,N).then(function(F){return S.getSvgForDocument(R,F,N.zoom)})},S})(a,d,u,r),h=(function(v,b,w,k,S,P){var _={},E=function(R){return{message:"Error rendering page",originalError:R}},A=function(R){return S.renderSvg(R).then(function(N){return{image:N,svg:R}},function(N){throw E(N)})},T=function(R,N){try{N.getContext("2d").drawImage(R,0,0)}catch(F){throw E(F)}},I=function(R,N,F){return k.drawDocumentAsSvg(R,F).then(A).then(function(H){return N&&T(H.image,N),H})},M=function(R,N){return b.executeJavascript(R,N).then(function(F){var H=F.document;return w.persistInputValues(H),{document:H,errors:F.errors,cleanUp:F.cleanUp}})};return _.rasterize=function(R,N,F){var H;return H=v.clone(F),H.inlineScripts=F.executeJs===!0,P.inlineReferences(R,H).then(function($){return F.executeJs?M(R,F).then(function(X){return{element:X.document.documentElement,errors:$.concat(X.errors),cleanUp:X.cleanUp}}):{element:R,errors:$,cleanUp:function(){}}}).then(function($){return I($.element,N,F).then(function(X){return $.cleanUp(),{image:X.image,svg:X.svg,errors:$.errors}})})},_})(a,d,u,p,f,i),y=(function(v,b,w){var k={},S=function(T,I){var M=300,R=200,N=T?T.width:M,F=T?T.height:R,H=I.width!==void 0?I.width:N,$=I.height!==void 0?I.height:F;return{width:H,height:$}},P=function(T){var I=S(T.canvas,T.options),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 w.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=oi(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,w=b]=v.replace("U+","").split("-").map(k=>parseInt(k,16));return[b,w]});return s.some(v=>y.some(([b,w])=>v>=b&&v<=w))})(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 Kl;const Gk=()=>(Kl||(Kl=document.createElement("div"),Kl.id="polotno-hidden-do-not-touch",Kl.style.overflow="hidden",Kl.style.position="relative",document.body.appendChild(Kl),Kl.innerHTML=`<style>#polotno-hidden-do-not-touch {${Ep}}</style>`),Kl);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 q4(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,w){const k=`${b}|${w}`;if(Qy.has(k))return Qy.get(k);const S=`https://fonts.googleapis.com/css?family=${b}:${w}&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 w=(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=w.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,ru=(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"?ru(o,a):a+"{"+ru(o,a[1]=="k"?"":e)+"}":typeof o=="object"?n+=ru(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+=ru.p?ru.p(a,o):a+":"+o+";")}return r+(e&&i?e+"{"+i+"}":i)+n},Dh={},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=Dh[a]||(Dh[a]=(s=>{let u=0,d=11;for(;u<s.length;)d=101*d+s.charCodeAt(u++)>>>0;return"go"+d})(a));if(!Dh[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);Dh[o]=ru(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)})(Dh[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?"":ru(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){ru.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(G.createElement,void 0,void 0,void 0);function Kk(t,e){if(e===1)return t;const r=Pt.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=Wt({enabled:!1,currentFormat:{},editor:Wt.object({instance:null},{},{deep:!1})}),Qk=Dd("div",G.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=G.useRef(null);G.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 w=b.innerHTML;r(G4(w))},10)}),X4(d,t),i?MI(d,i):d.setSelection(0,0,"api"),d.on("selection-change",(v,b,w)=>{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,w;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>";(w=v.clipboardData)===null||w===void 0||w.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}},[]),G.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}),[]),G.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 G.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(oi(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=_r(({element:t,store:e})=>{var r,n;const i=G.useRef(null),[a,o]=G.useState(),[s,u]=G.useState(!1),[d,f]=G.useState(!1),p=G.useRef(t.height),h=e.selectedShapes.indexOf(t)>=0&&t.selectable,y=Yg(h),v=t.fontSize/3,{textVerticalResizeEnabled:b}=hr,w=hr.autoDeleteEmptyText,k=Yg(t.fontFamily),[S]=Ak(e,t.fontFamily),P=t._editModeEnabled;Up(i);const _=S?t.fontFamily:k!==t.fontFamily?k:"Arial",E=Yo(t).fill,A=z1(t,{fontFamily:_,color:E}),T=z1(t,{fontFamily:_,color:E,forEditor:!0});let{width:I,height:M}=(function(J,te,K){return G.useMemo(()=>q4(J),[J,te.width,K])})(A,t,S);G.useEffect(()=>{if(!S)return;if(!t.height)return void e.history.ignore(()=>{t.set({height:M})});const{textOverflow:J}=hr;if(J!=="change-font-size"||s)J==="resize"&&(b&&t.height<M&&!s&&e.history.ignore(()=>{t.set({height:M})}),b||t.height===M||e.history.ignore(()=>{t.set({height:M})}));else{const te=(K=>{let ne=K.fontSize;for(let fe=1;fe<50;fe++){const oe=z1(Object.assign(Object.assign({},K.toJSON()),{fontSize:ne}),{fontFamily:K.fontFamily}),{height:ue}=q4(oe);if(!(K.height&&ue>K.height||!hr.textSplitAllowed&&!K.curveEnabled&&xI({html:oe})))break;ne-=.5}return ne})(t);te!==t.fontSize?e.history.ignore(()=>{t.set({fontSize:te})}):t.height!==M&&(b&&t.height<M?e.history.ignore(()=>{t.set({height:M})}):b||e.history.ignore(()=>{t.set({height:M})}))}});const R=G.useMemo(()=>{const J={lastArgs:null,lastResult:null};return async function(te){return J.lastArgs&&J.lastResult&&(K=J.lastArgs,ne=te,JSON.stringify(K)===JSON.stringify(ne))||(J.lastResult=await W4(te),J.lastArgs=Object.assign({},te)),J.lastResult;var K,ne}},[]),N=G.useRef(0),F=G.useRef(null);G.useEffect(()=>{s||P||(async()=>{N.current++;const J=N.current;let te=Xs(`text ${t.id} ${J}`);F.current&&F.current(),F.current=te,f(!0);let K=null;const ne=Y4?5:1;for(let fe=0;fe<ne;fe++){const oe=fe>0?R:W4;try{if(K=await oe({skipCache:fe>0,html:A,width:t.width||1,height:t.height||M||1,fontFamily:_,padding:v,pixelRatio:e._elementsPixelRatio,font:e.fonts.find(ue=>ue.fontFamily===_)||L2.find(ue=>ue.fontFamily===_)}),J!==N.current)return;if(Y4&&K&&II(K)){await new Promise(ue=>setTimeout(ue,50*(fe+1)));continue}break}catch(ue){console.error(ue),Rd(`Error rendering rich text with id ${t.id}`);break}}K?o(K):te?(te(),te=null):console.error("Finish function is called twice!"),f(!1)})()},[A,s,M,P,_,t.height,e._elementsPixelRatio,S]);const[H,$]=Kv(d,300),[X]=Kv(s,300,!0),Z=X||H;G.useEffect(()=>{var J;if(!Z)return oo(()=>{const te=i.current;zi(te,t)});(J=i.current)===null||J===void 0||J.clearCache()},[a,Z,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]),G.useEffect(()=>{a&&!d&&F.current&&(F.current(),F.current=null)},[a,d]),G.useLayoutEffect(()=>{if(!S||!t.curveEnabled)return;const J=new Pt.TextPath({data:Tc(t.a.width,t.a.height,t.curvePower,t.a.fontSize),text:oi(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}),te=J.getSelfRect().width;if(te){const K=te-t.a.width,ne=t.a.rotation*Math.PI/180,fe=-K/2*Math.cos(ne),oe=-K/2*Math.sin(ne);t.set({width:te,x:t.a.x+fe,y:t.a.y+oe})}J.destroy()},[S,t.curveEnabled,t.curvePower,t.text,t.fontSize,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing]),G.useEffect(()=>()=>{F.current&&F.current()},[]),G.useEffect(()=>{y&&!h&&w&&oi(t.text)===""&&t.removable&&!t.placeholder&&e.deleteElements([t.id])},[w,t.placeholder,t.removable,t.text,h,y]);let ee=0;t.verticalAlign==="middle"&&(ee=(t.height-M)/2),t.verticalAlign==="bottom"&&(ee=t.height-M);const V=Ik({fontLoaded:S,fontFamily:t.fontFamily,fontSize:t.fontSize,lineHeight:t.lineHeight}),Q=ku(),U=Tc(t.a.width,M,t.curvePower,t.fontSize),L=G.useRef(null),q=G.useRef(null),W=P&&t.strokeWidth>0&&!t.curveEnabled;return G.createElement(G.Fragment,null,G.createElement(ur,{x:t.a.x,y:t.a.y,offsetX:t.backgroundPadding*(t.fontSize*V*.5),offsetY:t.backgroundPadding*(t.fontSize*V*.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*V),height:t.a.height+t.backgroundPadding*(t.fontSize*V),cornerRadius:t.backgroundCornerRadius*(t.fontSize*V*.5)}),G.createElement(bp,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,data:U,stroke:"red",strokeWidth:1,visible:!1}),G.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:!Z,draggable:Q?t.draggable&&h:t.draggable,preventDefault:!Q||h,opacity:P?0:t.a.opacity,hideInExport:!t.showInExport,onDragMove:J=>{t.set({x:J.target.x(),y:J.target.y()})},onDragEnd:J=>{t.set({x:J.target.x(),y:J.target.y()})},id:t.id,onDblClick:J=>{t.contentEditable&&(q.current={x:J.evt.clientX,y:J.evt.clientY},t.toggleEditMode(!0))},onDblTap:J=>{var te;if(t.contentEditable){const K=(te=J.evt.changedTouches)===null||te===void 0?void 0:te[0];q.current=K?{x:K.clientX,y:K.clientY}:null,t.toggleEditMode(!0)}},onTransformStart:J=>{u(!0),p.current=t.height},onTransform:J=>{var te;const K=J.target,ne=((te=K.getStage())===null||te===void 0?void 0:te.findOne("Transformer")).getActiveAnchor(),fe=ne==="middle-left"||ne==="middle-right",oe=ne==="top-center"||ne==="bottom-center",ue=K.scaleX();if(fe){const we=K.scaleX(),Re=K.width()*we,Ne=t.fontSize;let He=Re;if(Re<Ne&&(He=Ne,L.current&&K.position(L.current)),K.width(He),K.scaleX(1),hr.textVerticalResizeEnabled){const $e=Math.max(M,p.current);t.set({height:$e})}t.set({width:K.width(),x:K.x(),y:K.y()})}else if(oe){const we=hr.textOverflow==="resize",Re=typeof t.lineHeight=="number"?t.lineHeight:1;let Ne=we?M:Re*t.fontSize;const He=Math.max(Ne,J.target.height()*J.target.scaleY());K.scaleY(1),t.set({x:K.x(),y:K.y(),height:He,rotation:K.rotation()})}else K.scaleX(1),K.scaleY(1),t.set({fontSize:t.fontSize*ue,letterSpacing:t.letterSpacing,width:K.width()*ue,x:K.x(),y:K.y(),rotation:K.rotation(),height:K.height()*ue});L.current=J.target.position()},onTransformEnd:J=>{u(!1),f(!0);const te=J.target.scaleX();J.target.scaleX(1),J.target.scaleY(1),t.set({fontSize:t.fontSize*te,width:J.target.width()*te,x:J.target.x(),y:J.target.y(),rotation:J.target.rotation(),shadowBlur:t.shadowBlur*te,shadowOffsetX:t.shadowOffsetX*te,shadowOffsetY:t.shadowOffsetY*te,strokeWidth:t.strokeWidth*te})}}),G.createElement(Ho,{ref:i,image:a,x:t.a.x,y:t.a.y,offsetX:v,offsetY:v-ee,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:!Z&&!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||Z}),(Z||W)&&G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,offsetY:-ee},G.createElement(Vg,{divProps:{style:{pointerEvents:"none"}}},G.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&&G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,offsetY:-ee},G.createElement(Vg,null,G.createElement(AI,{html:T,element:t,onChange:J=>{const te=Ck({oldText:oi(t.text),newText:oi(J),element:t});t.set({text:J,fontSize:te})},onBlur:J=>{t.toggleEditMode(!1),$(!0)},clickCoords:q.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 ki={stroke:"rgb(0, 161, 255)",strokeWidth:1,dash:[4,6]},FI=({stroke:t,strokeWidth:e,dash:r})=>{t!==void 0&&(ki.stroke=t),e!==void 0&&(ki.strokeWidth=e),r!==void 0&&(ki.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(Pt.DD._dragElements.size===0)return;const t=[...Pt.DD._dragElements.entries()],e=t.find(([r,n])=>n.node instanceof Pt.Transformer);e&&(t.splice(t.indexOf(e),1),t.unshift(e),Pt.DD._dragElements.clear(),t.forEach(([r,n])=>{Pt.DD._dragElements.set(r,n)}))};function BI(t,e,r){const n=G.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 w=b.getClientRect({skipShadow:!0,skipStroke:!0});y.push({offset:w.x,node:b,snap:"start"},{offset:w.x+w.width,node:b,snap:"end"},{offset:w.x+w.width/2,node:b,snap:"center"}),v.push({offset:w.y,node:b,snap:"start"},{offset:w.y+w.height,node:b,snap:"end"},{offset:w.y+w.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 Pt.Line({x:-h.getStage().x(),y:-h.getStage().y(),points:[-6e3,v.lineGuide,6e3,v.lineGuide],stroke:ki.stroke,strokeWidth:ki.strokeWidth,name:"guid-line",dash:ki.dash});y?.add(b),h.batchDraw()}else v.orientation==="V"&&(b=new Pt.Line({x:-h.getStage().x(),y:-h.getStage().y(),points:[v.lineGuide,-6e3,v.lineGuide,6e3],stroke:ki.stroke,strokeWidth:ki.strokeWidth,name:"guid-line",dash:ki.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:Pt.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(),w=(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":w.x=P.lineGuide+P.offset;break;case"H":w.y=P.lineGuide+P.offset}}});const k=w.x-b.x,S=w.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 w=v.getActiveAnchor(),k=zI[w],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,F){if(F.orientation==="V"){const H=F.lineGuide;if(Math.abs(N.x-R.x)<1e-4)return null;const $=(N.y-R.y)/(N.x-R.x);return{x:H,y:$*H+(R.y-$*R.x)}}{const H=F.lineGuide;if(Math.abs(N.y-R.y)<1e-4)return null;const $=(N.y-R.y)/(N.x-R.x);return{x:(H-R.y)/$+R.x,y:H}}})(E,S,{orientation:I.orientation,lineGuide:I.lineGuide});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()};G.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 w=(b=t.current)===null||b===void 0?void 0:b.getStage();var k=[],S=[];return w.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 w=(b=t.current)===null||b===void 0?void 0:b.getLayer(),k=w?.children.find(S=>S.name()==="line-guides");v.forEach(S=>{if(S.orientation==="H"){var P=new Pt.Line({x:-w.getStage().x(),y:-w.getStage().y(),points:[-6e3,S.lineGuide,6e3,S.lineGuide],stroke:ki.stroke,strokeWidth:ki.strokeWidth,name:"guid-line",dash:ki.dash});k?.add(P),w.batchDraw()}else S.orientation==="V"&&(P=new Pt.Line({x:-w.getStage().x(),y:-w.getStage().y(),points:[S.lineGuide,-6e3,S.lineGuide,6e3],stroke:ki.stroke,strokeWidth:ki.strokeWidth,name:"guid-line",dash:ki.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()};G.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=Us.anchorSize||10;return{offsetX:r/2/t,offsetY:r/2/t,width:r/t,height:r/t,cornerRadius:(Us.anchorCornerRadius||0)/t,fill:Us.anchorFill||"white",stroke:Us.anchorStroke||"rgb(0, 161, 255)",strokeWidth:Us.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=_r(({element:t,type:e})=>{const r=Yo(t,t.a.color,"fill"),n=Yo(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 G.createElement(G.Fragment,null,e==="arrow"&&G.createElement(Hs,Object.assign({points:[3*t.height,2*-t.height,0,0,3*t.height,2*t.height]},i)),e==="triangle"&&G.createElement(Hs,Object.assign({points:[3*t.height,2*-t.height,0,0,3*t.height,2*t.height],closed:!0},i)),e==="bar"&&G.createElement(Hs,Object.assign({points:[0,2*-t.height,0,2*t.height],closed:!0},i)),e==="square"&&G.createElement(Hs,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"&&G.createElement(DT,Object.assign({x:2*t.height,y:0,radius:2*t.height},i)))}),UI=_r(({element:t,store:e})=>{const r=G.useRef(null),n=G.useRef(null),i=G.useRef(null),a=t.selectable||e.role==="admin",o=ku(),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=Yo(t,t.a.color,"stroke");return G.createElement(G.Fragment,null,G.createElement(Hs,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()})}})),G.createElement(Kt,{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)}},G.createElement(tx,{element:t,type:t.startHead})),G.createElement(Kt,{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)}},G.createElement(tx,{element:t,type:t.endHead})),s&&t.resizable&&G.createElement(N2,{selector:".page-abs-container",enabled:!0},G.createElement(Kt,{visible:s},G.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})}})),G.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}.`)},si=t=>t&&t[t.length-1],bL=t=>t>=0&&t<2**32;class Br{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 Br(this.bytes);return e.pos=this.pos,e}}const Je=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)},$s=t=>{const e=Je(t);return(e&1)===0?-(e>>1):e+1>>1},fu=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),Ur=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 Vp{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),qp=(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)},ra=()=>{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},VI=(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,qI=t=>{let e=0;for(;t;)e++,t>>=1;return e},WI=/^[a-z]{3}$/,n8=t=>WI.test(t),iu=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},Xf=(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.")}},Pu={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}],au=[{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)??si(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)??si(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.${(au.find(u=>a<=u.maxPictureSize&&n<=u.maxBitrate)??si(au)).level.toString().padStart(2,"0")}.08`}else if(t==="av1"){const a=e*r,o=ux.find(d=>a<=d.maxPictureSize&&n<=d.maxBitrate)??si(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,w=e[5]?Number(e[5][2]):0,k=(d<<7)+(p<<6)+(h<<5)+(y<<4)+(v<<3)+(b<<2)+w;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=Ur(r),w=b.getUint8(1);u=w>>6&3,d=w&31,f=nx(b.getUint32(2)),p=w>>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=si(au).level;for(const P of au)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 w=`vp09.${u}.${d}.${f}.${p}`;return w+=`.${h}.${y}.${v}.${b}`,w.endsWith(cx)&&(w=w.slice(0,-cx.length)),w}else if(e==="av1"){if(!s){const P=t.width*t.height;let _=si(au).level;for(const E of au)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,w=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+=`.${w.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 Br(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 Br(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 $o;(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"})($o||($o={}));var ai;(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"})(ai||(ai={}));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=(fu(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=(fu(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===$o.SPS?e.push(u):d===$o.PPS?r.push(u):d===$o.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=Ur(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,w=e.getUint8(r++);h.chromaFormat=y,h.bitDepthLumaMinus8=v,h.bitDepthChromaMinus8=b;const k=[];for(let S=0;S<w;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 Br(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();Je(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=Je(e),o===3&&(d=e.readBits(1)),s=Je(e),u=Je(e),e.skipBits(1),e.readBits(1))){for(let N=0;N<(o!==3?8:12);N++)if(e.readBits(1)){const H=N<6?16:64;let $=8,X=8;for(let Z=0;Z<H;Z++){if(X!==0){const ee=$s(e);X=($+ee+256)%256}$=X===0?$:X}}}Je(e);const f=Je(e);if(f===0)Je(e);else if(f===1){e.skipBits(1),$s(e),$s(e);const R=Je(e);for(let N=0;N<R;N++)$s(e)}Je(e),e.skipBits(1);const p=Je(e),h=Je(e),y=16*(p+1),v=16*(h+1);let b=y,w=v;const k=e.readBits(1);if(k||e.skipBits(1),e.skipBits(1),e.readBits(1)){const R=Je(e),N=Je(e),F=Je(e),H=Je(e);let $,X;if((d===0?o:0)===0)$=1,X=2-k;else{const ee=o===3?1:2,V=o===1?2:1;$=ee,X=V*(2-k)}b-=$*(R+N),w-=X*(F+H)}let P=2,_=2,E=2,A=0,T=null,I=null;if(e.readBits(1)){e.readBits(1)&&e.readBits(8)===255&&(e.skipBits(16),e.skipBits(16)),e.readBits(1)&&e.skipBits(1),e.readBits(1)&&(e.skipBits(3),A=e.readBits(1),e.readBits(1)&&(P=e.readBits(8),_=e.readBits(8),E=e.readBits(8))),e.readBits(1)&&(Je(e),Je(e)),e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.skipBits(1));const X=e.readBits(1);X&&dx(e);const Z=e.readBits(1);Z&&dx(e),(X||Z)&&e.skipBits(1),e.skipBits(1),e.readBits(1)&&(e.skipBits(1),Je(e),Je(e),Je(e),Je(e),T=Je(e),I=Je(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,F=h+1,H=(2-k)*F,$=e0.find(Z=>Z.level>=a)??si(e0),X=Math.min(Math.floor($.maxDpbMbs/(N*H)),16);T=X,I=X}}return pe(I!==null),{profileIdc:n,constraintFlags:i,levelIdc:a,frameMbsOnlyFlag:k,chromaFormatIdc:o,bitDepthLumaMinus8:s,bitDepthChromaMinus8:u,codedWidth:y,codedHeight:v,displayWidth:b,displayHeight:w,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=Je(t);t.skipBits(4),t.skipBits(4);for(let r=0;r<=e;r++)Je(t),Je(t),t.skipBits(1);t.skipBits(5),t.skipBits(5),t.skipBits(5),t.skipBits(5)},p8=(t,e)=>{if(e.description){const i=(fu(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 Br(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);Je(e);const f=Je(e);let p=0;f===3&&(p=e.readBits(1));const h=Je(e),y=Je(e);let v=h,b=y;if(e.readBits(1)){const N=Je(e),F=Je(e),H=Je(e),$=Je(e);let X=1,Z=1;const ee=p===0?f:0;ee===1?(X=2,Z=2):ee===2&&(X=2,Z=1),v-=(N+F)*X,b-=(H+$)*Z}const w=Je(e),k=Je(e);Je(e);const P=e.readBits(1)?0:r;let _=0;for(let N=P;N<=r;N++)Je(e),_=Je(e),Je(e);Je(e),Je(e),Je(e),Je(e),Je(e),Je(e),e.readBits(1)&&e.readBits(1)&&uR(e),e.skipBits(1),e.skipBits(1),e.readBits(1)&&(e.skipBits(4),e.skipBits(4),Je(e),Je(e),e.skipBits(1));const E=Je(e);if(cR(e,E),e.readBits(1)){const N=Je(e);for(let F=0;F<N;F++)Je(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:w,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===ai.VPS_NUT?e.push(f):p===ai.SPS_NUT?r.push(f):p===ai.PPS_NUT?n.push(f):(p===ai.PREFIX_SEI_NUT||p===ai.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 Br(D0(d));f.skipBits(16),Je(f),Je(f),f.skipBits(1),f.skipBits(1),f.skipBits(3),f.skipBits(1),f.skipBits(1),Je(f),Je(f),$s(f),f.skipBits(1),f.skipBits(1),f.readBits(1)&&Je(f),$s(f),$s(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:ai.VPS_NUT,nalUnits:e}]:[],...r.length?[{arrayCompleteness:1,nalUnitType:ai.SPS_NUT,nalUnits:r}]:[],...n.length?[{arrayCompleteness:1,nalUnitType:ai.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))Je(t);else{const i=Math.min(64,1<<4+(e<<1));e>1&&$s(t);for(let a=0;a<i;a++)$s(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=Je(t);o=e-(u+1)}else o=e-1;t.readBits(1),Je(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=Je(t),u=Je(t);for(let d=0;d<s;d++)Je(t),t.readBits(1);for(let d=0;d<u;d++)Je(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)&&(Je(t),Je(t)),t.readBits(1),t.readBits(1),t.readBits(1),t.readBits(1)&&(Je(t),Je(t),Je(t),Je(t)),t.readBits(1)&&(t.readBits(32),t.readBits(32),t.readBits(1)&&Je(t),t.readBits(1)&&hR(t,!0,e)),t.readBits(1)&&(t.readBits(1),t.readBits(1),t.readBits(1),o=Je(t),Je(t),Je(t),Je(t),Je(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?Je(t):d=t.readBits(1)===1;let f=1;d||(f=Je(t)+1),n&&hx(t,f,a),i&&hx(t,f,a)}},hx=(t,e,r)=>{for(let n=0;n<e;n++)Je(t),Je(t),r&&(Je(t),Je(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 Br(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,w=v+1,k=b*w;let S=si(au).level;for(const A of au)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 Br(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 Br(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 w=0;i!==1&&(w=n.readBits(1));let k=1,S=1,P=0;return w||(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:w,chromaSubsamplingX:k,chromaSubsamplingY:S,chromaSamplePosition:P}}return null},pR=t=>{const e=Ur(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 Br(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>=$o.NON_IDR_SLICE&&a<=$o.SLICE_DPC)return"delta";if(a===$o.IDR)return"key";if(a===$o.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 Br(s);h.pos=8*u;const y=Je(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<ai.BLA_W_LP)return"delta";if(i<=ai.RSV_IRAP_VCL23)return"key"}return"delta"}case"vp8":return(r[0]&1)===0?"key":"delta";case"vp9":{const n=new Br(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 Br(a);o.skipBits(4),n=!!o.readBits(1)}else if(i===3||i===6||i===7){if(n)return"key";const o=new Br(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=Ur(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=Ur(y),b=v.getUint32(0,!1),w=v.getUint32(4,!1),k=String.fromCharCode(...y.subarray(8,8+w)),S=v.getUint32(8+w,!1),P=La.decode(y.subarray(12+w,12+w+S)),_=v.getUint32(w+S+28),E=y.subarray(w+S+32,w+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 Eu{constructor(e){this.input=e}}const w8=[],x8=[],HL=[],$L=[];const ua=new Uint8Array(0);class _n{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===ua&&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===ua}get microsecondTimestamp(){return Math.trunc(iu*this.timestamp)}get microsecondDuration(){return Math.trunc(iu*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 _n(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 _n(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 VL=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},qL=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 ou{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(iu*this.timestamp)}get microsecondDuration(){return Math.trunc(iu*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=fu(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 ou(new VideoFrame(e,{timestamp:Math.trunc(r.timestamp*iu),duration:Math.trunc((r.duration??0)*iu)||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 ou(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?(pe(this._layout),new ou(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 ou(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),fu(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 fu(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,w=this.displayWidth,k=this.displayHeight;if(o!==void 0?(f=r,p=n,h=i,y=a,v=o,b=s,u!==void 0?(w=u,k=d):(w=h,k=y)):(v=r,b=n,i!==void 0&&(w=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(w)||w<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+w/2,_=b+k/2;e.translate(P,_),e.rotate(this.rotation*Math.PI/180);const E=this.rotation%180===0?1:w/k;e.scale(1/E,E),e.drawImage(S,f,p,h,y,-w/2,-k/2,w,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 w=a%180===0?1:f/p;e.translate(n/2,i/2),e.rotate(a*Math.PI/180),e.scale(1/w,w),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 su{get microsecondTimestamp(){return Math.trunc(iu*this.timestamp)}get microsecondDuration(){return Math.trunc(iu*this.duration)}constructor(e){if(this._closed=!1,Nh(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=ad(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=ad(u);if(v&&n>=f)throw new RangeError("planeIndex out of range");if(!v&&n!==0)throw new RangeError("planeIndex out of range");const w=(v?h:h*f)*y;if(e.byteLength<w)throw new RangeError("Destination buffer is too small");const k=Ur(e),S=E8(u);if(Nh(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,_=Ur(P),E=P8(s),A=pc(s),T=ad(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 F;T?F=(M*d+(I+p))*A:F=((I+p)*f+M)*A;const H=E(_,F);S(k,N,H)}}}clone(){if(this._closed)throw new Error("AudioSample is closed.");if(Nh(this._data)){const e=new su(this._data.clone());return e.setTimestamp(this.timestamp),e}else return new su({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data})}close(){this._closed||(Ap?.unregister(this),Nh(this._data)?this._data.close():this._data=new Uint8Array(0),this._closed=!0)}toAudioData(){if(this._closed)throw new Error("AudioSample is closed.");if(Nh(this._data)){if(this._data.timestamp===this.microsecondTimestamp)return this._data.clone();if(ad(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 su({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 su({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")}},ad=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)}},Nh=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=ad(r);if(ad(n))if(h){const v=new ArrayBuffer(s*f),b=Ur(v);t.copyTo(v,{planeIndex:a,frameOffset:o,frameCount:s,format:r});for(let w=0;w<s;w++){const k=w*f,S=w*p,P=u(b,k);d(e,S,P)}}else{const v=new ArrayBuffer(s*i*f),b=Ur(v);t.copyTo(v,{planeIndex:0,frameOffset:o,frameCount:s,format:r});for(let w=0;w<s;w++){const k=(w*i+a)*f,S=w*p,P=u(b,k);d(e,S,P)}}else if(h){const v=s*f,b=new ArrayBuffer(v),w=Ur(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(w,P);d(e,_,E)}}}else{const v=new ArrayBuffer(s*i*f),b=Ur(v);t.copyTo(v,{planeIndex:0,frameOffset:o,frameCount:s,format:r});for(let w=0;w<s;w++)for(let k=0;k<i;k++){const S=w*i+k,P=S*f,_=S*p,E=u(b,P);d(e,_,E)}}};const $f=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.")},Gs=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($f(e),this._track.input._disposed)throw new na;return av(this._track,this._track._backing.getFirstPacket(e),e)}getPacket(e,r={}){if(Gs(e),$f(r),this._track.input._disposed)throw new na;return av(this._track,this._track._backing.getPacket(e,r),r)}getNextPacket(e,r={}){if(!(e instanceof _n))throw new TypeError("packet must be an EncodedPacket.");if($f(r),this._track.input._disposed)throw new na;return av(this._track,this._track._backing.getNextPacket(e,r),r)}async getKeyPacket(e,r={}){if(Gs(e),$f(r),this._track.input._disposed)throw new na;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 _n))throw new TypeError("packet must be an EncodedPacket.");if($f(r),this._track.input._disposed)throw new na;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 _n))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 _n))throw new TypeError("endPacket must be an EncodedPacket.");if($f(n),this._track.input._disposed)throw new na;const i=[];let{promise:a,resolve:o}=ra(),{promise:s,resolve:u}=ra(),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}=ra()),await s;continue}i.push(b),o(),{promise:a,resolve:o}=ra(),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 na;if(f)return{value:void 0,done:!0};if(p)throw p;if(i.length>0){const b=i.shift(),w=performance.now();for(h.push(w);h.length>0&&w-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){Gs(e),Gs(r);const n=[];let i=!1,a=null,{promise:o,resolve:s}=ra(),{promise:u,resolve:d}=ra(),f=!1,p=!1,h=!1,y=null;(async()=>{const w=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}=ra())},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+w.getDecodeQueueSize()>A){({promise:u,resolve:d}=ra()),await u;continue}w.decode(P);const T=await E.next();if(T.done)break;P=T.value}await E.return(),!h&&!this._track.input._disposed&&await w.flush(),w.close(),!i&&a&&n.push(a),f=!0,s()})().catch(w=>{y||(y=w,s())});const v=this._track,b=()=>{a?.close();for(const w of n)w.close()};return{async next(){for(;;){if(v.input._disposed)throw b(),new na;if(h)return{value:void 0,done:!0};if(y)throw b(),y;if(n.length>0){const w=n.shift();return d(),{value:w,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(w){throw w},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e){$I(e);const r=HI(e),n=[],i=[];let{promise:a,resolve:o}=ra(),{promise:s,resolve:u}=ra(),d=!1,f=!1,p=null;const h=b=>{i.push(b),o(),{promise:a,resolve:o}=ra()};(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())}),w=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}=ra()),await s;if(f)break;const I=await w.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(Gs(A),f||this._track.input._disposed)break;const T=await w.getPacket(A),I=T&&await w.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 na;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 ou))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(fu(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 _n(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===ai.RASL_N||n===ai.RASL_R)return!0}return!1}sampleHandler(e){if(Eg()){if(this.sampleQueue.length>0&&e.timestamp>=si(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 ou(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 ou(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){Gs(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){Gs(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 su))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 su(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)=>VI(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=Ur(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 su({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 fo))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){Gs(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 fo))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){Gs(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 fo}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 _n))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 fo 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 _n))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 Yf=8,Kh=16,eu=t=>{let e=nt(t);const r=Qn(t,4);let n=8;e===1&&(e=to(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=_t(t);if(e|=n&127,(n&128)===0)break}return e},Bo=t=>{let e=Yn(t);return t.skip(2),e=Math.min(e,t.remainingLength),La.decode(It(t,e))},RR=t=>{const e=eu(t);if(!e||e.name!=="data"||t.remainingLength<8)return null;const r=nt(t);t.skip(4);const n=It(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 Eu{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,Yf,Kh);if(r instanceof Promise&&(r=await r),!r)break;const n=e,i=eu(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=nt(r),i=this.reader.fileSize-n;if(i>=0&&i<=this.reader.fileSize-Kh){let a=this.reader.requestSliceRange(i,Yf,Kh);if(a instanceof Promise&&(a=await a),a){const o=eu(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),w=r.sampleTimingEntries[b],k=cr(r.sampleTimingEntries,v,I=>I.startIndex),S=r.sampleTimingEntries[k],P=w.startDecodeTimestamp+(y-w.startIndex)*w.delta,E=S.startDecodeTimestamp+(v-S.startIndex)*S.delta-P,A=si(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,Yf,Kh);r instanceof Promise&&(r=await r),pe(r);const n=eu(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-Yf&&this.traverseBox(e););}*iterateContiguousBoxes(e){const r=e.filePos;for(;e.filePos-r<=e.length-Yf;){const n=e.filePos,i=eu(e);if(!i)break;yield{boxInfo:i,slice:e},e.filePos=n+i.totalSize}}traverseBox(e){const r=e.filePos,n=eu(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=_t(e);e.skip(3),o===1?(e.skip(16),this.movieTimescale=nt(e),this.movieDurationInTimescale=to(e)):(e.skip(8),this.movieTimescale=nt(e),this.movieDurationInTimescale=nt(e))}break;case"trak":{const o={id:-1,demuxer:this,inputTrack:null,disposition:{...Pu},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 fo(this.input,new NR(s)),this.tracks.push(o)}}this.currentTrack=null}break;case"tkhd":{const o=this.currentTrack;if(!o)break;const s=_t(e),d=!!(Jf(e)&1);if(o.disposition.default=d,s===0)e.skip(8),o.id=nt(e),e.skip(4),o.durationInMovieTimescale=nt(e);else if(s===1)e.skip(16),o.id=nt(e),e.skip(4),o.durationInMovieTimescale=to(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=_t(e);e.skip(3);let u=!1,d=0;const f=nt(e);for(let p=0;p<f;p++){const h=s===1?to(e):nt(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=_t(e);e.skip(3),s===0?(e.skip(8),o.timescale=nt(e),o.durationInMediaTimescale=nt(e)):s===1&&(e.skip(16),o.timescale=nt(e),o.durationInMediaTimescale=to(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=_t(e);e.skip(3);const u=nt(e);for(let d=0;d<u;d++){const f=e.filePos,p=eu(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 w=nt(e)/65536;if(s===0&&y>0){if(y===1)e.skip(4),b=8*nt(e),e.skip(8);else if(y===2){e.skip(4),w=U8(e),v=nt(e),e.skip(4),b=nt(e);const k=nt(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"&&(w=I0),o.info.numberOfChannels=v,o.info.sampleRate=w,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=It(e,n.contentSize)}break;case"hvcC":{const o=this.currentTrack;if(!o)break;pe(o.info),o.info.codecDescription=It(e,n.contentSize)}break;case"vpcC":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="video"),e.skip(4);const s=_t(e),u=_t(e),d=_t(e),f=d>>4,p=d>>1&7,h=d&1,y=_t(e),v=_t(e),b=_t(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=_t(e),u=s>>5,d=s&31,f=_t(e),p=f>>7,h=f>>6&1,y=f>>5&1,v=f>>4&1,b=f>>3&1,w=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:w,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=!!(_t(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=_t(e);pe(s===3),sv(e),e.skip(2);const u=_t(e),d=(u&128)!==0,f=(u&64)!==0,p=(u&32)!==0;if(d&&e.skip(2),f){const w=_t(e);e.skip(w)}p&&e.skip(2);const h=_t(e);pe(h===4);const y=sv(e),v=e.filePos,b=_t(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 w=_t(e);pe(w===5);const k=sv(e);if(o.info.codecDescription=It(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=!!(_t(e)&1),d=_t(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=_t(e),u=Yn(e),d=nt(e),f=c2(e),p=_t(e);let h;p!==0?h=It(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=_t(e),b=Jf(e);if((v&s)===pd.STREAMINFO){e.skip(10);const k=nt(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=It(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=nt(e);let u=0,d=0;for(let f=0;f<s;f++){const p=nt(e),h=nt(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=nt(e);let u=0;for(let d=0;d<s;d++){const f=nt(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=nt(e),u=nt(e);if(s===0)for(let d=0;d<u;d++){const f=nt(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=_t(e),u=nt(e),d=It(e,Math.ceil(u*s/8)),f=new Br(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=nt(e);for(let u=0;u<s;u++){const d=nt(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=nt(e);for(let d=0;d<s;d++){const f=nt(e)-1,p=nt(e),h=nt(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=nt(e);for(let u=0;u<s;u++){const d=nt(e);o.sampleTable.chunkOffsets.push(d)}}break;case"co64":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=nt(e);for(let u=0;u<s;u++){const d=to(e);o.sampleTable.chunkOffsets.push(d)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(i,n.contentSize));break;case"mehd":{const o=_t(e);e.skip(3);const s=o===1?to(e):nt(e);this.movieDurationInTimescale=s}break;case"trex":{e.skip(4);const o=nt(e),s=nt(e),u=nt(e),d=nt(e),f=nt(e);this.fragmentTrackDefaults.push({trackId:o,defaultSampleDescriptionIndex:s,defaultSampleDuration:u,defaultSampleSize:d,defaultSampleFlags:f})}break;case"tfra":{const o=_t(e);e.skip(3);const s=nt(e),u=this.tracks.find(S=>S.id===s);if(!u)break;const d=nt(e),f=(d&48)>>4,p=(d&12)>>2,h=d&3,y=[_t,Yn,Jf,nt],v=y[f],b=y[p],w=y[h],k=nt(e);for(let S=0;S<k;S++){const P=o===1?to(e):nt(e),_=o===1?to(e):nt(e);v(e),b(e),w(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=Jf(e),s=!!(o&1),u=!!(o&2),d=!!(o&8),f=!!(o&16),p=!!(o&32),h=!!(o&65536),y=!!(o&131072),v=nt(e),b=this.tracks.find(k=>k.id===v);if(!b)break;const w=this.fragmentTrackDefaults.find(k=>k.trackId===v);this.currentTrack=b,b.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:w?.defaultSampleDescriptionIndex??null,defaultSampleDuration:w?.defaultSampleDuration??null,defaultSampleSize:w?.defaultSampleSize??null,defaultSampleFlags:w?.defaultSampleFlags??null,startTimestamp:null},s?b.currentFragmentState.baseDataOffset=to(e):y&&(b.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),u&&(b.currentFragmentState.sampleDescriptionIndex=nt(e)),d&&(b.currentFragmentState.defaultSampleDuration=nt(e)),f&&(b.currentFragmentState.defaultSampleSize=nt(e)),p&&(b.currentFragmentState.defaultSampleFlags=nt(e)),h&&(b.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const o=this.currentTrack;if(!o)break;pe(o.currentFragmentState);const s=_t(e);e.skip(3);const u=s===0?nt(e):to(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=_t(e),u=Jf(e),d=!!(u&1),f=!!(u&4),p=!!(u&256),h=!!(u&512),y=!!(u&1024),v=!!(u&2048),b=nt(e);let w=o.currentFragmentState.baseDataOffset;d&&(w+=vc(e));let k=null;f&&(k=nt(e));let S=w;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=nt(e):(pe(o.currentFragmentState.defaultSampleDuration!==null),I=o.currentFragmentState.defaultSampleDuration);let M;h?M=nt(e):(pe(o.currentFragmentState.defaultSampleSize!==null),M=o.currentFragmentState.defaultSampleSize);let R;y?R=nt(e):(pe(o.currentFragmentState.defaultSampleFlags!==null),R=o.currentFragmentState.defaultSampleFlags),T===0&&k!==null&&(R=k);let N=0;v&&(s===0?N=nt(e):N=vc(e));const F=!(R&65536);_.samples.push({presentationTimestamp:P+N,duration:I,byteOffset:S,byteSize:M,isKeyFrame:F}),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[si(_.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]??=Bo(u):this.metadataTags.raw[s.name]??=It(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(It(u,s.contentSize)):this.metadataTags.title??=Bo(u);break;case"©des":this.currentTrack||(this.metadataTags.description??=Bo(u));break;case"©ART":this.currentTrack||(this.metadataTags.artist??=Bo(u));break;case"©alb":this.currentTrack||(this.metadataTags.album??=Bo(u));break;case"albr":this.currentTrack||(this.metadataTags.albumArtist??=Bo(u));break;case"©gen":this.currentTrack||(this.metadataTags.genre??=Bo(u));break;case"©day":if(!this.currentTrack){const d=new Date(Bo(u));Number.isNaN(d.getTime())||(this.metadataTags.date??=d)}break;case"©cmt":this.currentTrack||(this.metadataTags.comment??=Bo(u));break;case"©lyr":this.currentTrack||(this.metadataTags.lyrics??=Bo(u));break}}}break;case"meta":{if(this.currentTrack)break;const s=nt(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=nt(e);for(let s=0;s<o;s++){const u=nt(e);e.skip(4);const d=La.decode(It(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=Ur(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=Ur(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=ua;else{let d=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);d instanceof Promise&&(d=await d),pe(d),a=It(d,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,u=new _n(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=ua;else{let f=this.internalTrack.demuxer.reader.requestSlice(a.byteOffset,a.byteSize);f instanceof Promise&&(f=await f),pe(f),o=It(f,a.byteSize)}const s=(a.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,u=a.duration/this.internalTrack.timescale,d=new _n(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:w,correctSampleFound:k}=r(e);if(k)return this.fetchPacketInFragment(e,w,a);w!==-1&&(u=e,d=w)}const f=cr(this.internalTrack.fragmentLookupTable,n,w=>w.timestamp),p=f!==-1?this.internalTrack.fragmentLookupTable[f]:null,h=cr(this.internalTrack.fragmentPositionCache,n,w=>w.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 w=o.reader.requestSliceRange(b,Yf,Kh);if(w instanceof Promise&&(w=await w),!w)break;const k=b,S=eu(w);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 w=this.internalTrack.fragmentLookupTable[f-1];pe(!w||w.timestamp<p.timestamp);const k=w?.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(qp(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 w=n.delta;if(t.presentationTimestamps){const k=t.presentationTimestampIndexMap[e];pe(k!==void 0),k<t.presentationTimestamps.length-1&&(w=t.presentationTimestamps[k+1].presentationTimestamp-a)}return{presentationTimestamp:a,duration:w,sampleOffset:b,sampleSize:u,chunkOffset:h,chunkSize:v,isKeyFrame:t.keySampleIndices?qp(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 ze;(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"})(ze||(ze={}));const jR=[ze.EBML,ze.Segment],Ip=[ze.SeekHead,ze.Info,ze.Cluster,ze.Tracks,ze.Cues,ze.Attachments,ze.Chapters,ze.Tags],Tg=[...jR,...Ip],a2=8,Ta=2,js=2*a2,O8=t=>{if(t.remainingLength<1)return null;const e=_t(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},Qh=t=>{if(t.remainingLength<1)return null;const e=_t(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+=_t(t);return i},qt=(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+=_t(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(_t(t));return r},lb=t=>{const e=O8(t);return e===null||t.remainingLength<e?null:qt(t,e)},A8=t=>{if(t.remainingLength<1)return null;if(_t(t)===255)return;t.skip(-1);const r=Qh(t);if(r===null)return null;if(r!==72057594037927940)return r},Fs=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}},Kf=(t,e)=>{const r=It(t,e);let n=0;for(;n<e&&r[n]!==0;)n+=1;return String.fromCharCode(...r.subarray(0,n))},Lh=(t,e)=>{const r=It(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,js);if(o instanceof Promise&&(o=await o),!o)break;const s=Fs(o);if(!s)break;if(i.has(s.id))return{pos:a,found:!0};Jl(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},zo={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 Jl(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 Ms;(function(t){t[t.None=0]="None",t[t.Xiph=1]="Xiph",t[t.FixedSize=2]="FixedSize",t[t.Ebml=3]="Ebml"})(Ms||(Ms={}));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:ze.SeekHead,flag:"seekHeadSeen"},{id:ze.Info,flag:"infoSeen"},{id:ze.Tracks,flag:"tracksSeen"},{id:ze.Cues,flag:"cuesSeen"}],R8=10*2**20;class $R extends Eu{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,js);if(r instanceof Promise&&(r=await r),!r)break;const n=Fs(r);if(!n)break;const i=n.id;let a=n.size;const o=r.filePos;if(i===ze.EBML){Jl(a);let s=this.reader.requestSlice(o,a);if(s instanceof Promise&&(s=await s),!s)break;this.readContiguousElements(s)}else if(i===ze.Segment){if(await this.readSegment(o,a),a===void 0||this.reader.fileSize===null)break}else if(i===ze.Cluster){if(this.reader.fileSize===null)break;a===void 0&&(a=(await o2(this.reader,o,Tg,this.reader.fileSize)).pos-o);const s=si(this.segments);s&&(s.elementEndPos=o+a)}Jl(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,js);if(s instanceof Promise&&(s=await s),!s)break;const u=n,d=Fs(s);if(!d||!Ip.includes(d.id)&&d.id!==ze.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,Jl(p);let b=this.reader.requestSlice(h,p);b instanceof Promise&&(b=await b),b&&this.readContiguousElements(b)}else if(f===ze.Tags||f===ze.Attachments){f===ze.Tags?this.currentSegment.tagsSeen=!0:this.currentSegment.attachmentsSeen=!0,Jl(p);let v=this.reader.requestSlice(h,p);v instanceof Promise&&(v=await v),v&&this.readContiguousElements(v)}else if(f===ze.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,js);if(d instanceof Promise&&(d=await d),!d)continue;const f=Fs(d);if(!f)continue;const{id:p,size:h}=f;if(p!==u.id)continue;Jl(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,js);n instanceof Promise&&(n=await n),pe(n);const i=e,a=Fs(n);pe(a);const o=a.id;pe(o===ze.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!==Ms.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===Ms.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[si(p.presentationTimestamps).blockIndex];p.startTimestamp=v.timestamp,p.endTimestamp=b.timestamp+b.duration;const w=cr(h.clusterPositionCache,p.startTimestamp,k=>k.startTimestamp);(w===-1||h.clusterPositionCache[w].elementStartPos!==i)&&h.clusterPositionCache.splice(w+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===Ms.None)continue;i.decoded||(i.data=this.decodeBlockData(r,i.data),i.decoded=!0);const a=Zs.tempFromBytes(i.data),o=[],s=_t(a)+1;switch(i.lacing){case Ms.Xiph:{let d=0;for(let f=0;f<s-1;f++){let p=0;for(;a.bufferPos<a.length;){const h=_t(a);if(p+=h,h<255){o.push(p),d+=p;break}}}o.push(a.length-(a.bufferPos+d))}break;case Ms.FixedSize:{const d=a.length-1,f=Math.floor(d/s);for(let p=0;p<s;p++)o.push(f)}break;case Ms.Ebml:{const d=Qh(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=Qh(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=It(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:Ms.None,decoded:!0,mainAdditional:i.mainAdditional})}n+=s,n--}}async loadSegmentMetadata(e){for(const r of e.seekEntries){if(!(r.id===ze.Tags&&!e.tagsSeen)){if(!(r.id===ze.Attachments&&!e.attachmentsSeen))continue}let n=this.reader.requestSliceRange(e.dataStartPos+r.segmentPosition,Ta,js);if(n instanceof Promise&&(n=await n),!n)continue;const i=Fs(n);if(!i||i.id!==r.id)continue;const{size:a}=i;Jl(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===ze.Tags?e.tagsSeen=!0:r.id===ze.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=Fs(e);if(!n||r&&r.includes(n.id))return!1;const{id:i,size:a}=n,o=e.filePos;switch(Jl(a),i){case ze.DocType:this.isWebM=Kf(e,a)==="webm";break;case ze.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 ze.SeekID:{const s=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!s)break;s.id=qt(e,a)}break;case ze.SeekPosition:{const s=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!s)break;s.segmentPosition=qt(e,a)}break;case ze.TimestampScale:{if(!this.currentSegment)break;this.currentSegment.timestampScale=qt(e,a),this.currentSegment.timestampFactor=1e9/this.currentSegment.timestampScale}break;case ze.Duration:{if(!this.currentSegment)break;this.currentSegment.duration=uv(e,a)}break;case ze.TrackEntry:{if(!this.currentSegment||(this.currentTrack={id:-1,segment:this.currentSegment,demuxer:this,clusterPositionCache:[],cuePoints:[],disposition:{...Pu},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===zo.avc?(this.currentTrack.info.codec="avc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===zo.hevc?(this.currentTrack.info.codec="hevc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):u===zo.vp8?this.currentTrack.info.codec="vp8":u===zo.vp9?this.currentTrack.info.codec="vp9":u===zo.av1&&(this.currentTrack.info.codec="av1");const d=this.currentTrack,f=new Ld(this.input,new VR(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===zo.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===zo.mp3?this.currentTrack.info.codec="mp3":u===zo.opus?(this.currentTrack.info.codec="opus",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate,this.currentTrack.info.sampleRate=I0):u===zo.vorbis?(this.currentTrack.info.codec="vorbis",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):u===zo.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 fo(this.input,new qR(d));this.currentTrack.inputTrack=f,this.currentSegment.tracks.push(this.currentTrack)}}this.currentTrack=null}break;case ze.TrackNumber:{if(!this.currentTrack)break;this.currentTrack.id=qt(e,a)}break;case ze.TrackType:{if(!this.currentTrack)break;const s=qt(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 ze.FlagEnabled:{if(!this.currentTrack)break;qt(e,a)||(this.currentTrack=null)}break;case ze.FlagDefault:{if(!this.currentTrack)break;this.currentTrack.disposition.default=!!qt(e,a)}break;case ze.FlagForced:{if(!this.currentTrack)break;this.currentTrack.disposition.forced=!!qt(e,a)}break;case ze.FlagOriginal:{if(!this.currentTrack)break;this.currentTrack.disposition.original=!!qt(e,a)}break;case ze.FlagHearingImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.hearingImpaired=!!qt(e,a)}break;case ze.FlagVisualImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.visuallyImpaired=!!qt(e,a)}break;case ze.FlagCommentary:{if(!this.currentTrack)break;this.currentTrack.disposition.commentary=!!qt(e,a)}break;case ze.CodecID:{if(!this.currentTrack)break;this.currentTrack.codecId=Kf(e,a)}break;case ze.CodecPrivate:{if(!this.currentTrack)break;this.currentTrack.codecPrivate=It(e,a)}break;case ze.DefaultDuration:{if(!this.currentTrack)break;this.currentTrack.defaultDurationNs=qt(e,a)}break;case ze.Name:{if(!this.currentTrack)break;this.currentTrack.name=Lh(e,a)}break;case ze.Language:{if(!this.currentTrack||this.currentTrack.languageCode!==Da)break;this.currentTrack.languageCode=Kf(e,a),n8(this.currentTrack.languageCode)||(this.currentTrack.languageCode=Da)}break;case ze.LanguageBCP47:{if(!this.currentTrack)break;const u=Kf(e,a).split("-")[0];u?this.currentTrack.languageCode=u:this.currentTrack.languageCode=Da}break;case ze.Video:{if(this.currentTrack?.info?.type!=="video")break;this.readContiguousElements(e.slice(o,a))}break;case ze.PixelWidth:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.width=qt(e,a)}break;case ze.PixelHeight:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.height=qt(e,a)}break;case ze.AlphaMode:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.alphaMode=qt(e,a)===1}break;case ze.Colour:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.colorSpace={},this.readContiguousElements(e.slice(o,a))}break;case ze.MatrixCoefficients:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=qt(e,a),u=Zg[s]??null;this.currentTrack.info.colorSpace.matrix=u}break;case ze.Range:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;this.currentTrack.info.colorSpace.fullRange=qt(e,a)===2}break;case ze.TransferCharacteristics:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=qt(e,a),u=Qg[s]??null;this.currentTrack.info.colorSpace.transfer=u}break;case ze.Primaries:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=qt(e,a),u=Kg[s]??null;this.currentTrack.info.colorSpace.primaries=u}break;case ze.Projection:{if(this.currentTrack?.info?.type!=="video")break;this.readContiguousElements(e.slice(o,a))}break;case ze.ProjectionPoseRoll:{if(this.currentTrack?.info?.type!=="video")break;const u=-uv(e,a);try{this.currentTrack.info.rotation=Jk(u)}catch{}}break;case ze.Audio:{if(this.currentTrack?.info?.type!=="audio")break;this.readContiguousElements(e.slice(o,a))}break;case ze.SamplingFrequency:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.sampleRate=uv(e,a)}break;case ze.Channels:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.numberOfChannels=qt(e,a)}break;case ze.BitDepth:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.bitDepth=qt(e,a)}break;case ze.CuePoint:{if(!this.currentSegment)break;this.readContiguousElements(e.slice(o,a)),this.currentCueTime=null}break;case ze.CueTime:this.currentCueTime=qt(e,a);break;case ze.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 ze.CueTrack:{const s=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!s)break;s.trackId=qt(e,a)}break;case ze.CueClusterPosition:{const s=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!s)break;pe(this.currentSegment),s.clusterPosition=this.currentSegment.dataStartPos+qt(e,a)}break;case ze.Timestamp:{if(!this.currentCluster)break;this.currentCluster.timestamp=qt(e,a)}break;case ze.SimpleBlock:{if(!this.currentCluster)break;const s=Qh(e);if(s===null)break;const u=this.getTrackDataInCluster(this.currentCluster,s);if(!u)break;const d=c2(e),f=_t(e),p=f>>1&3;let h=!!(f&128);u.track.info?.type==="audio"&&u.track.info.codec&&(h=!0);const y=It(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 ze.BlockGroup:{if(!this.currentCluster)break;this.readContiguousElements(e.slice(o,a)),this.currentBlock=null}break;case ze.Block:{if(!this.currentCluster)break;const s=Qh(e);if(s===null)break;const u=this.getTrackDataInCluster(this.currentCluster,s);if(!u)break;const d=c2(e),p=_t(e)>>1&3,h=It(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 ze.BlockAdditions:this.readContiguousElements(e.slice(o,a));break;case ze.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 ze.BlockAdditional:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.data=It(e,a)}break;case ze.BlockAddID:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.addId=qt(e,a)}break;case ze.BlockDuration:{if(!this.currentBlock)break;this.currentBlock.duration=qt(e,a)}break;case ze.ReferenceBlock:{if(!this.currentBlock)break;this.currentBlock.isKeyFrame=!1}break;case ze.Tag:this.currentTagTargetIsMovie=!0,this.readContiguousElements(e.slice(o,a));break;case ze.Targets:this.readContiguousElements(e.slice(o,a));break;case ze.TargetTypeValue:qt(e,a)!==50&&(this.currentTagTargetIsMovie=!1);break;case ze.TagTrackUID:case ze.TagEditionUID:case ze.TagChapterUID:case ze.TagAttachmentUID:this.currentTagTargetIsMovie=!1;break;case ze.SimpleTag:{if(!this.currentTagTargetIsMovie)break;this.currentSimpleTagName=null,this.readContiguousElements(e.slice(o,a))}break;case ze.TagName:this.currentSimpleTagName=Lh(e,a);break;case ze.TagString:{if(!this.currentSimpleTagName)break;const s=Lh(e,a);this.processTagValue(this.currentSimpleTagName,s)}break;case ze.TagBinary:{if(!this.currentSimpleTagName)break;const s=It(e,a);this.processTagValue(this.currentSimpleTagName,s)}break;case ze.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 ze.FileUID:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileUid=UR(e,a)}break;case ze.FileName:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileName=Lh(e,a)}break;case ze.FileMediaType:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileMediaType=Kf(e,a)}break;case ze.FileData:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileData=It(e,a)}break;case ze.FileDescription:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileDescription=Lh(e,a)}break;case ze.ContentEncodings:{if(!this.currentTrack)break;this.readContiguousElements(e.slice(o,a)),this.currentTrack.decodingInstructions.sort((s,u)=>u.order-s.order)}break;case ze.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 ze.ContentEncodingOrder:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.order=qt(e,a)}break;case ze.ContentEncodingScope:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.scope=qt(e,a)}break;case ze.ContentCompression:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decompress",algorithm:fp.Zlib,settings:null},this.readContiguousElements(e.slice(o,a))}break;case ze.ContentCompAlgo:{if(this.currentDecodingInstruction?.data?.type!=="decompress")break;this.currentDecodingInstruction.data.algorithm=qt(e,a)}break;case ze.ContentCompSettings:{if(this.currentDecodingInstruction?.data?.type!=="decompress")break;this.currentDecodingInstruction.data.settings=It(e,a)}break;case ze.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?ua: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?ua:a.mainAdditional,d.alphaByteLength=a.mainAdditional.byteLength);const f=new _n(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 w;for(e?b===null||e.elementStartPos>=b?(w=e.elementEndPos,u=e):w=b:w=b??s.clusterSeekStartPos;s.elementEndPos===null||w<=s.elementEndPos-Ta;){if(u){const I=u.trackData.get(this.internalTrack.id);if(I&&I.startTimestamp>i)break}let k=o.reader.requestSliceRange(w,Ta,js);if(k instanceof Promise&&(k=await k),!k)break;const S=w,P=Fs(k);if(!P||!Ip.includes(P.id)&&P.id!==ze.Void){const I=await I8(o.reader,S,Ip,Math.min(s.elementEndPos??1/0,S+R8));if(I){w=I;continue}else break}const _=P.id;let E=P.size;const A=k.filePos;if(_===ze.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(_!==ze.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,js);if(I instanceof Promise&&(I=await I),!I)break;if(lb(I)===ze.Segment){s.elementEndPos=T;break}}w=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 VR 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 qR 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,w=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:w,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 od;(function(t){t[t.Unsynchronisation=128]="Unsynchronisation",t[t.ExtendedHeader=64]="ExtendedHeader",t[t.ExperimentalIndicator=32]="ExperimentalIndicator",t[t.Footer=16]="Footer"})(od||(od={}));var sd;(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"})(sd||(sd={}));const Cg=128,r0=10,ld=["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??=It(t,Cg-3),t.filePos=r;const n=Vf(t,30);n&&(e.title??=n);const i=Vf(t,30);i&&(e.artist??=i);const a=Vf(t,30);a&&(e.album??=a);const o=Vf(t,4),s=Number.parseInt(o,10);Number.isInteger(s)&&s>0&&(e.date??=new Date(s,0,1));const u=It(t,30);let d;if(u[28]===0&&u[29]!==0){const p=u[29];p>0&&(e.trackNumber??=p),t.skip(-30),d=Vf(t,28),t.skip(2)}else t.skip(-30),d=Vf(t,30);d&&(e.comment??=d);const f=_t(t);f<ld.length&&(e.genre??=ld[f])},Vf=(t,e)=>{const r=It(t,e),n=Xf(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=_t(t),i=_t(t),a=_t(t),o=nt(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=It(t,e.size),i=new JR(e,n);if(e.flags&od.Footer&&i.removeFooter(),e.flags&od.Unsynchronisation&&e.majorVersion===3&&i.ununsynchronizeAll(),e.flags&od.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&od.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(ld[y]!==void 0){r.genre??=ld[y];break}}if(h=/^\d+$/.exec(p),h){const y=Number.parseInt(h[0]);if(ld[y]!==void 0){r.genre??=ld[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 w=i.readAscii(3);h=w==="PNG"?"image/png":w==="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 w=i.readBytes(b);r.images||(r.images=[]),r.images.push({data:w,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 sd.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 sd.UTF_16_WITH_BOM:if(i[0]===255&&i[1]===254){const a=new TextDecoder("utf-16le"),o=Xf(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=Xf(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=Xf(i.findIndex(o=>o===0),i.length);return this.pos=n+Math.min(a+1,i.length),La.decode(i.subarray(0,a))}case sd.UTF_16_BE_NO_BOM:{const a=new TextDecoder("utf-16be"),o=Xf(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 sd.UTF_8:{const a=Xf(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=nt(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 Eu{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.metadataTags=null,this.tracks=[],this.readingMutex=new Vp,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 fo(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=nt(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{...Pu}}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=ua;else{let a=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(a instanceof Promise&&(a=await a),!a)return null;i=It(a,n.dataSize)}return new _n(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=qp(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=Ur(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<<qI(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(fd(t)!==N8)return null;t.skip(1);const n=_t(t),i=eD(t),a=fd(t),o=fd(t),s=fd(t),u=_t(t),d=new Uint8Array(u);for(let y=0;y<u;y++)d[y]=_t(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=fd(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 Eu{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 fo(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=Ur(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=It(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 Vp,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{...Pu}}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 _n(n.metadataOnly?ua: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 F=this.demuxer.reader.requestSlice(M.headerStartPos,M.totalSize);F instanceof Promise&&(F=await F),pe(F);const H=It(F,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:ua,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 w=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,w=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 w}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(si(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 Ds;(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"})(Ds||(Ds={}));class cM extends Eu{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=lu(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=lu(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 w=this.reader.requestSlice(b,v);if(w instanceof Promise&&(w=await w),!w)break;const k=Sx(w,n);d=Sx(w,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 fo(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=Fh(i,n);const o=Fh(i,n),s=lu(i,n);i.skip(4);const u=Fh(i,n);let d;if(r===14?d=8:d=Fh(i,n),r>=18&&a!==357){const f=Fh(i,n),p=r-18;if(Math.min(p,f)>=22&&a===Ds.EXTENSIBLE){i.skip(6);const y=It(i,16);a=y[0]|y[1]<<8}}(a===Ds.MULAW||a===Ds.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=lu(i,n),d=It(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===Ds.MULAW)return"ulaw";if(this.audioInfo.format===Ds.ALAW)return"alaw";if(this.audioInfo.format===Ds.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===Ds.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{...Pu}}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=ua;else{let u=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,i);u instanceof Promise&&(u=await u),pe(u),a=It(u,i)}const o=e*qf/this.demuxer.audioInfo.sampleRate,s=i/this.demuxer.audioInfo.blockSizeInBytes/this.demuxer.audioInfo.sampleRate;return this.demuxer.lastKnownPacketIndex=Math.max(e,o),new _n(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=It(t,9),n=new Br(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 Eu{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.tracks=[],this.readingMutex=new Vp,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 fo(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{...Pu}}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=ua;else{let a=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(a instanceof Promise&&(a=await a),!a)return null;i=It(a,n.dataSize)}return new _n(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=qp(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 Br(It(t,1));for(;r.readBits(1)===1;)e++;if(e===0)return r.readBits(7);const n=[],i=e-1,a=new Br(It(t,i)),o=8-e-1;for(let u=0;u<o;u++)n.unshift(r.readBits(1));for(let u=0;u<i;u++)for(let 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 _t(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"?_t(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 Eu{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 Vp,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=_t(r),i=Jf(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=It(s,34),d=new Br(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 w=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:w,minimumBlockSize:f,maximumBlockSize:p,minimumFrameSize:h,maximumFrameSize:y,description:k},this.track=new fo(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(It(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=nt(s),d=nt(s),f=La.decode(It(s,d)),p=nt(s),h=La.decode(It(s,p));s.skip(16);const y=nt(s),v=It(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(_t(o)===255){const d=o.filePos,f=_t(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=It(e,4),a=new Br(i);if(a.readBits(15)!==32764)return null;if(this.blockingBit===null){pe(r);const w=a.readBits(1);this.blockingBit=w}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=_t(e);e.skip(-y),e.skip(-1);const b=bM(It(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{...Pu}}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=ua;else{let s=this.demuxer.reader.requestSlice(n.byteOffset,n.byteSize);if(s instanceof Promise&&(s=await s),!s)return null;i=It(s,n.byteSize)}pe(this.demuxer.audioInfo);const a=n.blockOffset/this.demuxer.audioInfo.sampleRate,o=n.blockSize/this.demuxer.audioInfo.sampleRate;return new _n(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 Ns=9e4,ea=188,SM=t=>{let e="video/MP2T";const r=[...new Set(t.filter(Boolean))];return r.length>0&&(e+=`; codecs="${r.join(", ")}"`),e};const Qf="No PES packet found where one was expected.";class kM extends Eu{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=ea+16+1;let r=this.reader.requestSlice(0,e);r instanceof Promise&&(r=await r),pe(r);const n=It(r,e);if(n[0]===71&&n[ea]===71)this.packetOffset=0,this.packetStride=ea;else if(n[0]===71&&n[ea+16]===71)this.packetOffset=0,this.packetStride=ea+16;else if(n[4]===71&&n[4+ea]===71)this.packetOffset=4,this.packetStride=ea;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 Br(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 Br(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 w=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(w){case 3:case 4:case 15:P={type:"audio",codec:w===15?"aac":"mp3",aacCodecInfo:null,numberOfChannels:-1,sampleRate:-1};break;case 27:case 36:P={type:"video",codec:w===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:w,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=ud(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===ai.SPS_NUT).nalUnits[0];pe(b);const w=m8(b);h.info.width=w.displayWidth,h.info.height=w.displayHeight,h.info.colorSpace={primaries:Kg[w.colourPrimaries],transfer:Qg[w.transferCharacteristics],matrix:Zg[w.matrixCoefficients],fullRange:!!w.fullRangeFlag},h.info.reorderSize=w.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=nt(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 fo(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(qp(this.sectionEndPositions,i,w=>w)!==-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(_t(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=_t(r)>>4&3;return{payloadUnitStartIndicator:a,pid:o,adaptationFieldControl:u}}async readPacket(e){let r=this.reader.requestSlice(e,ea);if(r instanceof Promise&&(r=await r),!r)return null;const n=It(r,ea);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 Zf=t=>{const e=new Br(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}},ud=t=>{pe(t.endPos!==null);const e=Zf(t);if(!e)return null;const r=new Br(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 Vp}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 Pu}getTimeResolution(){return Ns}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 _n(n.metadataOnly?ua:e.data,this.getPacketType(e.data),e.pts/Ns,Math.max(r/Ns,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<Ns/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<Ns/2)return!1}}return this.referencePesPackets.splice(i+1,0,e),!0}async getFirstPacket(e){const r=this.elementaryStream.firstSection;pe(r);const n=ud(r);pe(n);const i=new cd(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=ud(o);pe(s);const u=new cd(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*Ns),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=Zf(S);pe(P),this.maybeInsertReferencePacket(P,!1,!1),pe(this.referencePesPackets.length===1)}let w=cr(this.referencePesPackets,i,S=>S.pts);if(w===-1)return null;if(o.fileSize!==null&&w===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=Zf(_);if(!E)throw new Error(Qf);this.maybeInsertReferencePacket(E,!0,!1),this.endReferencePesPacketAdded=!0}for(w=cr(this.referencePesPackets,i,S=>S.pts),pe(w!==-1);o.fileSize!==null;){const S=this.referencePesPackets[w],P=this.referencePesPackets[w+1];if(i-S.pts<Ns||!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=Zf(T);if(!I)throw new Error(Qf);if(!this.maybeInsertReferencePacket(I,!1,!1))break;I.pts<=i&&w++}u=this.referencePesPackets[w],pe(u.pts<=i)}finally{s()}s();e:for(;;){let w=u.sectionStartPos+a.packetStride;for(;;){const P=await a.readPacketHeader(w);if(!P)break e;if(P.pid===this.elementaryStream.pid&&P.payloadUnitStartIndicator===1)break;w+=a.packetStride}const k=await a.readSection(w,!1);if(!k)break;const S=Zf(k);if(!S)throw new Error(Qf);if(S.pts>i)break;u=S,o.fileSize===null&&this.maybeInsertReferencePacket(S,!1,!0)}const d=this.getReorderSize();for(let w=0;w<d;w++){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 _=Zf(P);if(!_)throw new Error(Qf);u=_;break}k-=a.packetStride}}const f=await a.readSection(u.sectionStartPos,!0);pe(f);const p=ud(f);pe(p);const h=new cd(this,p,!0),y=new mg(this,h);for(;!((si(y.presentationOrderPackets)?.pts??-1/0)>=i||!await y.readNextDecodeOrderPacket()););const v=eb(y.presentationOrderPackets,w=>w.pts<=i&&(!r||this.getPacketType(w.data)==="key"));if(v!==-1){const w=y.presentationOrderPackets[v],k=v===0?0:w.pts-y.presentationOrderPackets[v-1].pts;for(;y.decodeOrderPackets[0]!==w;)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 w=await a.readPacketHeader(b);if(!w)return null;if(w.pid!==this.elementaryStream.pid||w.payloadUnitStartIndicator!==1)continue;const k=await a.readSection(b,!0);pe(k);const S=ud(k);if(!S)throw new Error(Qf);const P=new cd(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,w=null;if(h===0&&y===0&&v===1?(b=4,w=s[d+4]):h===0&&y===1&&(b=3,w=v),b===0){d++;continue}const k=p;if(i===null){i=k,d+=b;continue}if(w!==null){const S=r==="avc"?M0(w):Op(w);if(r==="avc"?S===$o.AUD:S===ai.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*Ns/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=Ur(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*Ns/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 cd{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 cd(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=si(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=ud(a);if(!o)throw new Error(Qf);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,js);if(n instanceof Promise&&(n=await n),!n)return!1;const i=O8(n);if(i===null||i<1||i>8||qt(n,i)!==ze.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=Fs(s);if(!d)break;const{id:f,size:p}=d,h=s.filePos;if(p===void 0)return!1;switch(f){case ze.EBMLVersion:if(qt(s,p)!==1)return!1;break;case ze.EBMLReadVersion:if(qt(s,p)!==1)return!1;break;case ze.DocType:if(Kf(s,p)!==r)return!1;break;case ze.DocTypeVersion:if(qt(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=ea+16+1;let n=e._reader.requestSlice(0,r);if(n instanceof Promise&&(n=await n),!n)return!1;const i=It(n,r);return i[0]===71&&i[ea]===71||i[0]===71&&i[ea+16]===71?!0:i[4]===71&&i[4+ea]===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,VM=new DM,qM=[NM,LM,FM,BM,jM,UM,$M,zM,HM,VM];class cb{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){if(this._disposed)throw new na;return this._sizePromise??=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new na;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=fu(e),this._view=Ur(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:Ur(f),offset:e}),y.length===0)return pe(o),o;const{promise:v,resolve:b,reject:w}=ra(),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:w};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:Ur(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:Ur(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=Ur(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=Ur(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 na 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 na;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 na;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,Ur(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 $i=(t,e)=>{if(t.filePos<t.start||t.filePos+e>t.end)throw new RangeError(`Tried reading [${t.filePos}, ${t.filePos+e}), but slice is [${t.start}, ${t.end}). This is likely an internal error, please report it alongside the file that caused it.`)},It=(t,e)=>{$i(t,e);const r=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,r},_t=t=>($i(t,1),t.view.getUint8(t.bufferPos++)),Fh=(t,e)=>{$i(t,2);const r=t.view.getUint16(t.bufferPos,e);return t.bufferPos+=2,r},Yn=t=>{$i(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},Jf=t=>{$i(t,3);const e=O0(t.view,t.bufferPos,!1);return t.bufferPos+=3,e},c2=t=>{$i(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},lu=(t,e)=>{$i(t,4);const r=t.view.getUint32(t.bufferPos,e);return t.bufferPos+=4,r},nt=t=>{$i(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},fd=t=>{$i(t,4);const e=t.view.getUint32(t.bufferPos,!0);return t.bufferPos+=4,e},vc=t=>{$i(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},ZM=t=>{$i(t,4);const e=t.view.getInt32(t.bufferPos,!0);return t.bufferPos+=4,e},Sx=(t,e)=>{let r,n;return e?(r=lu(t,!0),n=lu(t,!0)):(n=lu(t,!1),r=lu(t,!1)),n*4294967296+r},to=t=>{const e=nt(t),r=nt(t);return e*4294967296+r},JM=t=>{const e=vc(t),r=nt(t);return e*4294967296+r},eD=t=>{const e=fd(t);return ZM(t)*4294967296+e},tD=t=>{$i(t,4);const e=t.view.getFloat32(t.bufferPos,!1);return t.bufferPos+=4,e},U8=t=>{$i(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},Qn=(t,e)=>{$i(t,e);let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t.bytes[t.bufferPos++]);return r},Wf=.05,rD=(t,e,r)=>{const[n,i]=G.useState({input:null,videoSink:null,duration:0,isReady:!1,error:null});G.useRef(n).current=n;const a=G.useRef(0),o=G.useRef(null),s=G.useRef(null),u=G.useRef(null),d=G.useRef(null),f=G.useRef(null),p=G.useRef(null),h=G.useRef(!1),y=G.useRef(null),v=G.useRef([]),b=G.useRef(null),w=G.useRef(!1),[,k]=G.useReducer(S=>S+1,0);return G.useEffect(()=>{if(!r)return;let S=!0;const P=++a.current;let _=null;return(async()=>{try{if(!S||P!==a.current)return;_=Xs(`mediabunny init ${t.id}`);const E=await(async function(N){if((function(F){return F.startsWith("data:")})(N)){const F=(function(H){const $=H.indexOf(",");if($===-1)throw new Error("Invalid data URL format");const X=H.slice($+1),Z=atob(X),ee=new Uint8Array(Z.length);for(let V=0;V<Z.length;V++)ee[V]=Z.charCodeAt(V);return ee.buffer})(N);return new xx(F)}if((function(F){return F.startsWith("file://")})(N))try{const F=await fetch(N),H=await F.arrayBuffer();return new xx(H)}catch(F){throw new Error(`Failed to load file URL: ${N}. File URLs may not be supported in this environment. Error: ${F}`)}return new GM(N)})(t.src);if(!S||P!==a.current)return void(_&&(_(),_=null));const A=new KM({source:E,formats:qM}),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]),G.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,w.current=!1,i({input:null,videoSink:null,duration:0,isReady:!1,error:null})},[r]),G.useEffect(()=>{if(!r||!n.isReady||!n.videoSink)return;const S=++a.current,P=typeof t.src=="string"?t.src.slice(0,120):String(t.src),_=(H,$={},X="debug")=>{let Z="";try{Z=JSON.stringify(Object.assign(Object.assign({},$),{timeCalc:p.current}))}catch(V){Z=`[unserializable extras: ${String(V)}]`}const ee=`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}`;X==="error"?console.error(ee):X==="warn"?console.warn(ee):console.debug(ee)},E=H=>{const $=n.duration||0;if(!$||!Number.isFinite($))return H;const X=$>Wf?$-Wf:$;return Math.max(0,Math.min(H,X))},A=H=>{const $=n.duration||0;return!(!$||!Number.isFinite($))&&$-H<=.050001000000000004},T=H=>{let $=u.current;$&&$.width===H.canvas.width&&$.height===H.canvas.height||($||($=document.createElement("canvas"),u.current=$),$.width=H.canvas.width,$.height=H.canvas.height);const X=$.getContext("2d");X&&(X.clearRect(0,0,$.width,$.height),X.drawImage(H.canvas,0,0)),d.current=H.timestamp},I=H=>{const $=s.current;$&&(w.current||(w.current=!0,b.current=(async()=>{try{for(;v.current.length<4&&H===a.current;){const X=await $.next();if(H!==a.current)return;if(X.done||!X.value)break;v.current.push({timestamp:X.value.timestamp,frame:X.value})}}catch{}finally{w.current=!1,b.current=null}})()))},M=H=>{const $=v.current;for(let X=0;X<$.length;X++)if(Math.abs($[X].timestamp-H)<Wf){const Z=$[X];return v.current=$.slice(X+1),Z}return null},R=()=>{v.current=[]},N=async(H,$,X=0)=>{const Z=E(H),ee=(V=>{const Q=d.current;return Q===null||V<Q-Wf||V>Q+.5})(Z)?"seek":"iterate";try{const V=n.videoSink,Q=d.current;if(Q!==null&&Math.abs(Q-Z)<Wf)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(),ee==="seek"){s.current&&(await s.current.return(),s.current=null);const L=V.canvases(Z);s.current=L;const q=await L.next();if($!==a.current)return void(s.current&&(await s.current.return(),s.current=null));if(q.done||!q.value){if(A(Z)||_("iterator_exhausted",{mode:ee,requestedTargetTime:H,clampedTargetTime:Z},"warn"),$===a.current&&!A(Z))try{s.current&&(await s.current.return(),s.current=null),R();const W=V.canvases(Z);s.current=W;const J=await W.next();!J.done&&J.value&&(T(J.value),I($),f.current=H,k())}catch{}return}T(q.value),I($)}else{const L=s.current;if(!L)return;let q=!1;for(;$===a.current;){const W=await L.next();if($!==a.current)break;if(W.done||!W.value){if(A(Z)||_("iterator_exhausted",{mode:ee,requestedTargetTime:H,clampedTargetTime:Z},"warn"),!q&&!A(Z)){q=!0;try{s.current&&(await s.current.return(),s.current=null),R();const te=V.canvases(Z);s.current=te;const K=await te.next();if($!==a.current||K.done||!K.value)break;T(K.value),I($);break}catch{break}}break}const J=W.value;if(T(J),Math.abs(J.timestamp-Z)<Wf){I($);break}if(J.timestamp>Z){I($);break}}}f.current=H,k()}catch(V){const Q=V instanceof Error?{name:V.name,message:V.message,stack:V.stack}:{message:String(V)},U=V instanceof Error?`${V.name}: ${V.message}`:String(V),L=U.includes("Unsupported configuration")||U.includes("isConfigSupported")||U.includes("OperationError");if(_("frame_process_failed",{mode:ee,requestedTargetTime:H,clampedTargetTime:Z,unsupportedConfigAttempt:X,isUnsupportedConfig:L,error:Q},"error"),L&&X<1)try{s.current&&(await s.current.return(),s.current=null),R(),b.current=null,w.current=!1,d.current=null,await N(H,$,X+1)}catch{}}},F=oo(()=>{const H=n.videoSink,$=n.duration;if(!H||!$)return;const X=t.startTime*$*1e3,Z=$*(t.endTime-t.startTime)*1e3,ee=((e.currentTime||t.page.startTime)-t.page.startTime)%Z+X,V=ee/1e3,Q=E(V);p.current={pageStartTime:t.page.startTime,storeCurrentTime:e.currentTime,offsetMs:X,durationMs:Z,restMs:ee,targetTime:V,clampedTargetTime:Q,startTime:t.startTime,endTime:t.endTime,videoDuration:$},((U,L)=>{h.current?y.current=U:(h.current=!0,o.current||(o.current=Xs(`mediabunny video frame ${t.id}`)),(async()=>{let q=U;for(;q!==null&&L===a.current;)await N(q,L),q=y.current,y.current=null;o.current&&(o.current(),o.current=null),h.current=!1})())})(Q,S)});return()=>{F(),a.current++,o.current&&(o.current(),o.current=null)}},[r,n.isReady,n.videoSink,n.duration,e,t]),r&&n.isReady?u.current:null};function 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 V8=(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&&hr.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=G.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 w=v.getContext("2d");if(!w)return;u&&(w.beginPath(),w.moveTo(u,0),w.lineTo(o-u,0),w.arc(o-u,u,u,3*Math.PI/2,0,!1),w.lineTo(o,s-u),w.arc(o-u,s-u,u,0,Math.PI/2,!1),w.lineTo(u,s),w.arc(u,s-u,u,Math.PI/2,Math.PI,!1),w.lineTo(0,u),w.arc(u,u,u,Math.PI,3*Math.PI/2,!1),w.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,F,H,$,X,Z,ee){for(var V=new ImageData(F,H),Q=new Int32Array(N.data.buffer),U=N.width,L=new Int32Array(V.data.buffer),q=V.width,W=F/Z,J=H/ee,te=Math.round(1/W),K=Math.round(1/J),ne=te*K,fe=0;fe<V.height;fe++)for(var oe=0;oe<q;oe++){for(var ue=0+Math.round(oe/W)+(0+Math.round(fe/J))*U,we=0,Re=0,Ne=0,He=0,$e=0;$e<K;$e++)for(var et=0;et<te;et++){var xe=Q[ue+et+$e*U];we+=xe<<24>>>24,Re+=xe<<16>>>24,Ne+=xe<<8>>>24,He+=xe>>>24}we=Math.round(we/ne),Re=Math.round(Re/ne),Ne=Math.round(Ne/ne),He=Math.round(He/ne),L[oe+fe*q]=He<<24|Ne<<16|Re<<8|we}return V})(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;w.drawImage(k,S.x,S.y,S.width,S.height,0,0,v.width,v.height)};return G.useLayoutEffect(()=>{b()},[v,t.width,t.height,r.x,r.y,r.width,r.height,i,n,a,t.page._exportingOrRendering,f]),G.useEffect(()=>()=>{v&&v.nodeName==="CANVAS"&&Pt.Util.releaseCanvas(v)},[v]),[v||e,b]},nD=yd(),iD=_r(({element:t})=>{const e=Math.min(30,t.width/4,t.height/4),r=G.useRef(null);return G.useEffect(()=>{const n=r.current;if(!n)return;const i=new Pt.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}}),G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},G.createElement(ur,{width:t.width,height:t.height,fill:"rgba(124, 173, 212, 0.8)"}),G.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=_r(({element:t})=>{const e=Math.max(10,Math.min(30,t.width/25));return G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},G.createElement(ur,{width:t.width,height:t.height,fill:"rgba(223, 102, 102, 0.8)"}),G.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=G.useRef("loading"),i=G.useRef(void 0),[a,o]=G.useState(0),s=G.useRef(),u=G.useRef(),d=G.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),G.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,w=f.buffered&&f.buffered.length>0&&f.buffered.end(f.buffered.length-1)/f.duration*100>=100;if(b&&w)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=G.useRef(),i=()=>{var a;(a=n.current)===null||a===void 0||a.call(n),n.current=void 0};G.useEffect(()=>i,[]),G.useLayoutEffect(()=>{const a=e.slice(0,200),o=`video with id ${r} url: ${a}`;t!=="loading"||n.current||(n.current=Xs(o)),t!=="loading"&&i(),t==="failed"&&Rd(o)},[t])},sD=_r(({element:t,store:e})=>{var r;const[n,i]=G.useState(!1),a=G.useRef(null),o=G.useRef(null),s=e.selectedShapes.indexOf(t)>=0&&t.selectable,[u,d]=G.useState(!1),[f,p]=oD(t.src,"anonymous"),[h,y]=G.useState(!1),v=e.activePage===t.page,b=t.page._exportingOrRendering&&p==="loaded",w=rD(t,e,b);_x(p,t.src,t.id),f&&(f.playsInline=!0);const k=((se,ge,Ce)=>{const ae=G.useMemo(()=>{var _e,Oe;const{flipX:Fe,flipY:ot}=se,ke=se.type==="svg"||se.src.indexOf("data:image/svg+xml")>=0||se.src.indexOf(".svg")>=0,me=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;if(!(Fe||ot||me&&ke))return ge;if(!ge)return null;const Ue=ge instanceof HTMLVideoElement?ge.videoWidth:ge?.width,be=ge instanceof HTMLVideoElement?ge.videoHeight:ge?.height;if(!Ue||!be)return null;const je=yd();let at=1;se.type==="svg"&&(at=Math.max(se.width/Ue*Ce,se.height/be*Ce)),je.width=Math.max(Ue*at,1),je.height=Math.max(be*at,1);let Et=Fe?-je.width:0,bt=ot?-je.height:0;return(_e=je.getContext("2d"))===null||_e===void 0||_e.scale(Fe?-1:1,ot?-1:1),(Oe=je.getContext("2d"))===null||Oe===void 0||Oe.drawImage(ge,Et,bt,je.width,je.height),je},[se.flipX,se.flipY,ge,se.width,se.height,Ce]);return G.useEffect(()=>()=>{ae&&ae.nodeName==="CANVAS"&&Pt.Util.releaseCanvas(ae)},[ae]),ae})(t,f,e._elementsPixelRatio),S=b&&w||k||nD;G.useEffect(()=>{f&&e.history.ignore(()=>{t.set({duration:1e3*f.duration})})},[f]),G.useEffect(()=>{var se;if(!f)return;const ge=e.animatedElementsIds,Ce=(!ge.length||ge.includes(t.id))&&e.isPlaying,ae=v&&(Ce||u);if(!ae)return void f.pause();ae&&(f.currentTime=t.startTime*f.duration,f.play());const _e=new Pt.Animation(()=>{te.current()},(se=a.current)===null||se===void 0?void 0:se.getLayer());_e.start();const Oe=()=>{d(!1),f.currentTime=t.startTime*f.duration},Fe=()=>{f.currentTime>=t.endTime*f.duration&&(f.pause(),f.currentTime=t.startTime*f.duration,d(!1))};return f.addEventListener("ended",Oe),f.addEventListener("timeupdate",Fe),()=>{f.pause(),_e.stop(),f.removeEventListener("ended",Oe),f.removeEventListener("timeupdate",Fe)}},[f,u,e.isPlaying,v]),G.useEffect(()=>{f&&(f.volume=t.volume)},[f,t.volume]);const P=G.useRef(null);G.useEffect(()=>{const se=oo(()=>{var ge,Ce;if(f){if(b&&w)return J(),void e.currentTime;const ae=e.animatedElementsIds;if(ae.length&&!ae.includes(t.id))return;const _e=e.currentTime>=t.page.startTime&&e.currentTime<t.page.startTime+t.page.duration,Oe=t.startTime*f.duration*1e3,Fe=f.duration*(t.endTime-t.startTime)*1e3;let ot=((e.currentTime||t.page.startTime)-t.page.startTime)%Fe+Oe;if(_e||(ot=0),Math.abs(1e3*f.currentTime-ot)>500||!e.isPlaying){const ke=ot/1e3;ke!==f.currentTime&&(f.currentTime=ke),!kx(f)&&!e.isPlaying&&!P.current&&(P.current=Xs(`video ${t.id}`))}te.current(),(Ce=(ge=a.current)===null||ge===void 0?void 0:ge.getLayer())===null||Ce===void 0||Ce.batchDraw()}});return()=>{se(),P.current&&(P.current(),P.current=null)}},[e,f,b,w]),G.useEffect(()=>{var se;if(!f)return;if(b)return(se=P.current)===null||se===void 0||se.call(P),void(P.current=null);const ge=()=>{var ae,_e;!kx(f)&&t.page._exportingOrRendering||P.current&&(te.current(),(_e=(ae=a.current)===null||ae===void 0?void 0:ae.getLayer())===null||_e===void 0||_e.batchDraw(),P.current(),P.current=null)};let Ce;return t.page._exportingOrRendering&&(Ce=setInterval(ge,20)),f.addEventListener("timeupdate",ge),f.addEventListener("canplay",ge),()=>{clearInterval(Ce),f.removeEventListener("timeupdate",ge),f.removeEventListener("canplay",ge)}},[t.page._exportingOrRendering,f,t.id,Xs,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,F=R*T,H=t.width/t.height;let $,X;const Z=N/F,ee=t.type==="svg";ee?($=N,X=F):H>=Z?($=N,X=N/H):($=F*H,X=F);const V={x:I*_,y:R*E,width:$,height:X},Q=(r=t.cornerRadius)!==null&&r!==void 0?r:0,[U,L]=V8(t,S,V,e._elementsPixelRatio,Q,!0);let[q,W]=((se,ge,Ce,ae)=>{const _e=(Ue=>{const[be,je]=G.useState(Ue);return G.useEffect(()=>{(async()=>{const at=await(async function(Et){if(!(Et.indexOf("data:image/svg+xml")>=0||Et.indexOf(".svg")>=0))return Et;const bt=await $p(Et),At=U2(bt);return nl(At)})(Ue);at!==be&&je(at)})()},[Ue]),be})(se.clipSrc||""),[Oe,Fe]=D2(_e,"anonymous"),ot=se.clipSrc?Fe:"loaded";_x(ot,se.clipSrc,se.id);const ke=G.useMemo(()=>{if(ge&&Oe)return yd()},[ge,Oe]);function me(){var Ue;if(!Oe)return;const be=ge instanceof HTMLVideoElement?ge.videoWidth:ge?.width,je=ge instanceof HTMLVideoElement?ge.videoHeight:ge?.height;if(!ge||!be||!je||!Oe||!Oe.width||!Oe.height||!ke)return;const at=yd(),Et=Math.max(se.width/Oe.width*Ce,se.height/Oe.height*Ce);at.width=Oe.width*Et,at.height=Oe.height*Et,(Ue=at.getContext("2d"))===null||Ue===void 0||Ue.drawImage(Oe,0,0,at.width,at.height),ke.width=Math.max(be,1),ke.height=Math.max(je,1);const bt=ke.getContext("2d");bt&&(bt.save(),bt.drawImage(at,0,0,be,je),Pt.Util.releaseCanvas(at),bt.globalCompositeOperation="source-in",bt.drawImage(ge,0,0,ke.width,ke.height),bt.restore())}return G.useLayoutEffect(()=>{me()},[ke,ge,Oe,se.width,se.height,Ce,...ae]),[se.clipSrc&&Oe?ke:ge,me]})(t,U,e._elementsPixelRatio,[V,Q,e._elementsPixelRatio]);function J(){var se,ge;L(),W(),(ge=(se=a.current)===null||se===void 0?void 0:se.getLayer())===null||ge===void 0||ge.batchDraw()}G.useEffect(()=>{J()});const te=G.useRef(J);te.current=J;const K=Math.max(t.width/$,t.height/X);G.useEffect(()=>{var se;if(!t._cropModeEnabled)return;const ge=(se=a.current)===null||se===void 0?void 0:se.getStage();function Ce(_e){t._cropModeEnabled&&_e.target!==o.current&&t.toggleCropMode(!1)}function ae(_e){t._cropModeEnabled&&_e.target.parentNode!==ge?.content&&t.toggleCropMode(!1)}return document.body.addEventListener("click",ae),ge?.on("click",Ce),ge?.on("tap",Ce),()=>{document.body.removeEventListener("click",ae),document.body.removeEventListener("touchstart",ae),ge?.off("click",Ce),ge?.off("click",Ce)}},[t._cropModeEnabled]),G.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled)return zi(a.current,t),oo(()=>{zi(a.current,t)},{delay:100})},[S,n,A,T,t._cropModeEnabled]),G.useLayoutEffect(()=>{var se;n||t._cropModeEnabled?(se=a.current)===null||se===void 0||se.clearCache():zi(a.current,t)},[n,t.width,t.height,t._cropModeEnabled]),G.useEffect(()=>{zi(a.current,t)},[t.shadowEnabled,t.shadowBlur,t.cornerRadius,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]);const ne=G.useRef(null),fe=G.useRef(null),oe=G.useRef(null);G.useLayoutEffect(()=>{t._cropModeEnabled&&(fe.current.nodes([ne.current]),oe.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 ge=se.target.width()*se.target.scaleX(),Ce=se.target.height()*se.target.scaleY(),ae=Math.min(1,$/ge),_e=Math.min(1,X/Ce),Oe=1-ae,Fe=Math.min(Oe,Math.max(0,Math.round(-se.target.x())/ge)),ot=1-_e,ke=Math.min(ot,Math.max(0,Math.round(-se.target.y())/Ce));se.target.setAttrs({x:-Fe*I,y:-ke*R,scaleX:1,scaleY:1}),t.set({cropX:Fe,cropY:ke,cropWidth:ae,cropHeight:_e})},we=()=>{t.type!=="svg"&&t.contentEditable&&setTimeout(()=>{t.toggleCropMode(!0)})},Re=p==="loading",Ne=p==="failed",He=!Re&&!Ne,$e=G.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),et=He?t.a.opacity:0;Up(a,et);const xe=t.selectable||e.role==="admin",he=ku();return G.createElement(G.Fragment,null,G.createElement(Kt,{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)},Re&&G.createElement(iD,{element:t}),Ne&&G.createElement(aD,{element:t}),G.createElement(Ho,{ref:a,name:"element",id:t.id,image:q,x:t.a.x,y:t.a.y,width:t.a.width||1,height:t.a.height||1,rotation:t.a.rotation,opacity:et,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,customCrop:V,listening:xe,draggable:he?t.draggable&&s:t.draggable,preventDefault:!he||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:we,onDblTap:we,onTransformStart:()=>{i(!0),$e.current={cropX:t.cropX,cropY:t.cropY,cropWidth:t.cropWidth,cropHeight:t.cropHeight}},onTransform:se=>{var ge;const Ce=se.currentTarget,ae=Math.abs(Ce.scaleX()-1)<1e-7?1:Ce.scaleX(),_e=Math.abs(Ce.scaleY()-1)<1e-7?1:Ce.scaleY();Ce.scaleX(1),Ce.scaleY(1);const Oe=(ge=se.target.getStage())===null||ge===void 0?void 0:ge.findOne("Transformer"),Fe=1-$/I,ot=Math.min(Fe,Math.max(0,t.cropX)),ke=1-X/R,me=Math.min(ke,Math.max(0,t.cropY)),Ue=Oe.getActiveAnchor(),be=!(Ue.indexOf("middle")>=0||Ue.indexOf("center")>=0),je=!be&&ae<1&&$e.current.cropHeight>X/R;let at=be?t.cropWidth:t.cropWidth*ae;je&&(at=t.cropWidth);const Et=!be&&_e<1&&$e.current.cropWidth>$/I;let bt=be?t.cropHeight:t.cropHeight*_e;Et&&(bt=t.cropHeight),ee&&(at=t.cropWidth,bt=t.cropHeight),t.set({cropX:ot,cropY:me,x:Ce.x(),y:Ce.y(),width:Ce.width()*ae,height:Ce.height()*_e,rotation:se.target.rotation(),cropWidth:Math.min(at,1-ot),cropHeight:Math.min(bt,1-me)})},onTransformEnd:se=>{const ge=se.currentTarget;t.set({width:ge.width(),height:ge.height(),x:ge.x(),y:ge.y(),rotation:se.target.rotation(),cropWidth:$/I,cropHeight:X/R}),i(!1)}}),G.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:et,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&&G.createElement(Ho,{image:u?h||he?$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&&G.createElement(N2,{selector:".page-abs-container",enabled:!0},G.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)"}),G.createElement(Ho,{listening:!1,image:q,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}),G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,scaleX:K,scaleY:K},G.createElement(Ho,{image:S,ref:o,width:I,height:R,opacity:.4,draggable:!0,x:-t.cropX*I,y:-t.cropY*R,onDragMove:ue,onTransform:ue}),G.createElement(wp,{ref:oe,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(se,ge)=>ge.width<5||ge.height<5?se:ge,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),G.createElement(ur,{width:$,height:X,ref:ne,listening:!1,onTransform:se=>{se.target.x()<-t.cropX*I-1e-9&&(se.target.x(-t.cropX*I),se.target.scaleX(1)),se.target.y()<-t.cropY*R-1e-9&&(se.target.y(-t.cropY*R),se.target.scaleY(1));const ge=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)),ae=se.target.width()*se.target.scaleX(),_e=se.target.height()*se.target.scaleY(),Oe=Math.min(1-ge,ae/I),Fe=Math.min(1-Ce,_e/R),ot=se.target.getAbsolutePosition(se.target.getParent().getParent());se.target.scale({x:1,y:1}),se.target.position({x:0,y:0}),t.set({x:ot.x,y:ot.y,cropX:ge,cropY:Ce,cropWidth:Oe,cropHeight:Fe,width:Math.min(ae*K,I*(1-ge)*K),height:Math.min(_e*K,R*(1-Ce)*K)})}}),G.createElement(wp,{ref:fe,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(se,ge)=>ge.width<5||ge.height<5?se:ge,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 ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({path:"M0 0H199V238L99.5 142.8L0 238V0Z",aspectRatio:{width:199,height:238},width:t,height:e}),butterfly:({width:t,height:e})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({path:"M0 0H240L200 88L240 176H0L40 88L0 0Z",aspectRatio:{width:240,height:176},width:t,height:e}),heart1:({width:t,height:e})=>ut({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})=>ut({path:"M0 62.143L95.5 0L191 62.143V195H0V62.143Z",aspectRatio:{width:191,height:195},width:t,height:e}),home2:({width:t,height:e})=>ut({path:"M206 94.076L103 0L0 94.076H31.2377V189H175.607V94.076H206Z",aspectRatio:{width:206,height:189},width:t,height:e}),hourglass:({width:t,height:e})=>ut({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})=>ut({path:"M0 92.367L95 0L190 92.367V223H0V92.367Z",aspectRatio:{width:190,height:223},width:t,height:e}),keyhole:({width:t,height:e})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({path:"M126 0H43L0 120.531H36L6 227L110 80.354H73L126 0Z",aspectRatio:{width:126,height:227},width:t,height:e}),magnet:({width:t,height:e})=>ut({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})=>ut({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})=>ut({path:"M69 0H0V69V138V207H69H138V138H69V69V0Z",aspectRatio:{width:138,height:207},width:t,height:e}),party:({width:t,height:e})=>ut({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})=>ut({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})=>ut({path:"M110 0L219.119 63V189L110 252L0.880798 189V63L110 0Z",aspectRatio:{width:220,height:252},width:t,height:e}),rainbow:({width:t,height:e})=>ut({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})=>ut({path:"M69 0H0V69V138H69V207H138V138V69H69V0Z",aspectRatio:{width:138,height:207},width:t,height:e}),shell:({width:t,height:e})=>ut({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})=>ut({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})=>ut({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})=>ut({path:"M85.9799 0H290L204.02 141H0L85.9799 0Z",aspectRatio:{width:290,height:141},width:t,height:e}),softFlower:({width:t,height:e})=>ut({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})=>ut({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})=>ut({path:"M0 0H67.667V67.667H135.333V135.333H203V203H0V0Z",aspectRatio:{width:203,height:203},width:t,height:e}),stairs2:({width:t,height:e})=>ut({path:"M50 0H0V200H200V150H150V100H100V50H50V0Z",aspectRatio:{width:200,height:200},width:t,height:e}),teewee:({width:t,height:e})=>ut({path:"M69 0H138V69H207V138H138H69H0V69H69V0Z",aspectRatio:{width:207,height:138},width:t,height:e}),blob1:({width:t,height:e})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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})=>ut({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 q8(t){return yD[t]||fb}function W8(t){const{subType:e}=t,r=t,n=q8(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 w=`clip-${i.id||Math.random()}`;return`
|
|
271
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${s}">
|
|
272
|
+
<defs>
|
|
273
|
+
<clipPath id="${w}">
|
|
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(#${w})" 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=_r(({element:t,store:e})=>{const r=G.useRef(null),n=t.selectable||e.role==="admin",i=ku(),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=Yo(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=Yo(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=q8(y),_r(({element:b,fillProps:w,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=G.useRef(null);return G.createElement(G.Fragment,null,G.createElement(ur,{width:b.width,height:b.height,fill:"transparent"}),G.createElement(bp,Object.assign({},w,{ref:E,data:S,scaleX:P,scaleY:_})),G.createElement(Kt,{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 F=N[0],H=N[1],$=N[2],X=N[3],Z=N[4],ee=N[5],V=N[6],Q=N[7],U=$>X?$:X,L=$>X?1:$/X,q=$>X?X/$:1;A.translate(F,H),A.rotate(V),A.scale(L,q),A.arc(0,0,U,Z,Z+ee,!Q),A.scale(1/L,1/q),A.rotate(-V),A.translate(-F,-H);break;case"z":A.closePath()}}}},scaleX:P,scaleY:_},G.createElement(bp,Object.assign({},k,{x:0,y:0,data:S,strokeWidth:2*k.strokeWidth,dash:k.dash.map(A=>A)}))))}))),fv[y]||Kt);var y,v;return G.createElement(G.Fragment,null,G.createElement(Kt,{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 w=b.target.scale();b.target.scaleX(1),b.target.scaleY(1),t.set({width:t.width*w.x,height:t.height*w.y,x:b.target.x(),y:b.target.y(),rotation:b.target.rotation()})}},G.createElement(h,{element:t,fillProps:d,strokeProps:p})))});var As={},dv={},Is={},Px;function G8(){if(Px)return Is;Px=1,Object.defineProperty(Is,"__esModule",{value:!0}),Is.loop=Is.conditional=Is.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};Is.parse=t;var e=function(i,a){return function(o,s,u,d){a(o,s,u)&&d(o,i,s,u)}};Is.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 Is.loop=r,Is}var ln={},Ex;function X8(){if(Ex)return ln;Ex=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.readBits=ln.readArray=ln.readUnsigned=ln.readString=ln.peekBytes=ln.readBytes=ln.peekByte=ln.readByte=ln.buildStream=void 0;var t=function(p){return{data:p,pos:0}};ln.buildStream=t;var e=function(){return function(p){return p.data[p.pos++]}};ln.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]}};ln.peekByte=r;var n=function(p){return function(h){return h.data.subarray(h.pos,h.pos+=p)}};ln.readBytes=n;var i=function(p){return function(h){return h.data.subarray(h.pos,h.pos+p)}};ln.peekBytes=i;var a=function(p){return function(h){return Array.from(n(p)(h)).map(function(y){return String.fromCharCode(y)}).join("")}};ln.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]}};ln.readUnsigned=o;var s=function(p,h){return function(y,v,b){for(var w=typeof h=="function"?h(y,v,b):h,k=n(p),S=new Array(w),P=0;P<w;P++)S[P]=k(y);return S}};ln.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(w,k){var S=p[k];return S.length?w[k]=u(v,S.index,S.length):w[k]=v[S.index],w},{})}};return ln.readBits=d,ln}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,w=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)),w+=S;break}v.push((0,r.readBytes)(k)(h)),w+=k}for(var P=new Uint8Array(w),_=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 Bh={},Cx;function wD(){if(Cx)return Bh;Cx=1,Object.defineProperty(Bh,"__esModule",{value:!0}),Bh.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 Bh.deinterlace=t,Bh}var zh={},Ox;function xD(){if(Ox)return zh;Ox=1,Object.defineProperty(zh,"__esModule",{value:!0}),zh.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,w,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,w=0;w<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],w++}for(w=R;w<s;w++)S[w]=0;return S};return zh.lzw=t,zh}var Ax;function SD(){if(Ax)return As;Ax=1,Object.defineProperty(As,"__esModule",{value:!0}),As.decompressFrames=As.decompressFrame=As.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)};As.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,w=p.pixels[v],k=p.colorTable[w]||[0,0,0];y[b]=k[0],y[b+1]=k[1],y[b+2]=k[2],y[b+3]=w!==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,w=(0,i.lzw)(v.data.minCodeSize,v.data.blocks,b);v.descriptor.lct.interlaced&&(w=(0,n.deinterlace)(w,v.descriptor.width));var k={pixels:w,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};As.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 As.decompressFrames=d,As}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=_r(({element:t})=>{const e=Math.min(30,t.width/4,t.height/4),r=G.useRef(null);return G.useEffect(()=>{const n=r.current;if(!n)return;const i=new Pt.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}},[]),G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},G.createElement(ur,{width:t.width,height:t.height,fill:"rgba(124, 173, 212, 0.8)"}),G.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=_r(({element:t})=>{const e=Math.max(10,Math.min(30,t.width/22));return G.createElement(Kt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},G.createElement(ur,{width:t.width,height:t.height,fill:"rgba(223, 102, 102, 0.8)"}),G.createElement(Na,{text:"Cannot load the GIF...",fontSize:e,width:t.width,height:t.height,align:"center",fill:"white",verticalAlign:"middle",padding:5}))}),PD=_r(({element:t,store:e})=>{var r;const[n,i]=G.useState(!1),a=e.selectedShapes.indexOf(t)>=0&&t.selectable,o=G.useRef(null),s=G.useRef(),[u,d,f,p]=(function(M){const[R,N]=G.useState([]),[F,H]=G.useState(0),[$,X]=G.useState("loading"),[Z,ee]=G.useState({width:0,height:0});return G.useEffect(()=>{(async()=>{try{const V=await fetch(M),Q=await V.arrayBuffer(),U=Ix.parseGIF(Q),L=Ix.decompressFrames(U,!0),q=U.lsd.width,W=U.lsd.height;ee({width:q,height:W});const J=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})),te=J.reduce((K,ne)=>K+ne.delay,0);N(J),H(te),X("loaded")}catch(V){console.error("Failed to load GIF:",V),X("failed")}})()},[M]),[R,F,Z,$]})(t.src);up(p,t.src,t.id),G.useEffect(()=>(s.current=document.createElement("canvas"),()=>{s.current&&Pt.Util.releaseCanvas(s.current)}),[]),G.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]),G.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 F=-1;hv(u[0],M,R),P(),F=0;const H=$=>{const X=(Z=>{const ee=Z%d;let V=0;for(let Q=0;Q<u.length;Q++)if(V+=u[Q].delay,V>ee)return Q;return 0})($);X!==F&&(hv(u[X],M,R),P(),o.current.getLayer().draw(),F=X)};if(e.isPlaying||t.page._exportingOrRendering)return oo(()=>{H(e.currentTime-t.page.startTime)});{const $=window.setInterval(()=>{H(e.currentTime||performance.now())},16);return()=>{clearInterval($)}}},[e.isPlaying,u,d,t.page._exportingOrRendering]),G.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 w={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]=V8(t,s.current,w,e._elementsPixelRatio,k,n||t._cropModeEnabled);G.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled&&o.current)return zi(o.current,t),oo(()=>{zi(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=ku();return G.createElement(G.Fragment,null,_&&G.createElement(kD,{element:t}),E&&G.createElement(_D,{element:t}),G.createElement(Ho,{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:w,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(),F=Math.abs(R.scaleY()-1)<1e-7?1:R.scaleY();R.scaleX(1),R.scaleY(1),t.set({x:R.x(),y:R.y(),width:R.width()*N,height:R.height()*F,rotation:R.rotation()})},onTransformEnd:()=>i(!1)}),G.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=_r(({element:t})=>G.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(ct);const CD=ct.model("UndoManager",{history:ct.array(ct.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=jo(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(w=>w.id),y=p.pages.map(w=>w.id),v=!pp(h,y),b=!pp(e.custom,p.custom);v?Yv(e.pages,p.pages):e.pages.forEach((w,k)=>{Yv(w,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(S=>setTimeout(S,10)),a&&f.addUndoState();let v=s();f.startTransaction();let b=o;try{await p()}catch(S){setTimeout(()=>{throw S})}const w=b!==o,k=!w;f.endTransaction(k),h||v||f.replaceState(),w||(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 jh=null;function OD(){var t;return!((t=window.jspdf)===null||t===void 0)&&t.jsPDF?Promise.resolve(window.jspdf.jsPDF):jh||(typeof window.__polotnoLoadJspdf=="function"?(jh=window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e),jh):(jh=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)}),jh))}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=Wt({value:!1}),K8=Wt({value:"v1"}),DD=()=>K8.value,Zh=Wt({value:0}),Og=()=>Zh.value,ND=()=>Y8.value,LD=Bt(()=>{Y8.value=!0});let Jh=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;Jh==="file://"&&FD&&(Jh="headless"),Jh==="file://"&&BD&&(Jh="electron");const zD=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${Jh}" 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.5"})});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(()=>{Zh.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(()=>{Zh.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(()=>{Zh.value===0&&(Zh.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},VD=(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 w=new Uint8Array(4+y.length);return w.set(pv,0),w.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})(w)),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],w=v+4,k=h.subarray(w,w+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}),qD=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 ta;(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"})(ta||(ta={}));function Z8(t,e){let r={filter:"",html:void 0};switch(t){case ta.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 ta.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 ta.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 ta.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 ta.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 ta.white:case ta.black:return null;case ta.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,w=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} ${w} ${k} 0 0
|
|
341
|
+
0 0 0 1 0" />
|
|
342
|
+
</filter>
|
|
343
|
+
</svg>
|
|
344
|
+
`,r}case ta.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,w=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} ${w} 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 rr=(t,e,...r)=>({type:t,props:e,children:r||[]});function J8(t){return un(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,w=f/p>t.width/t.height?t.height/p:t.width/f,k=y?t.width/f:w,S=y?t.height/p:w,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&&un(t.borderColor),I=T?Math.max(0,t.cornerRadius-t.borderSize):t.cornerRadius,M=rr("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?rr("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"?rr("polyline",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},i)):e==="triangle"?rr("polygon",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},n)):e==="bar"?rr("polyline",Object.assign({points:`0,${2*-t.height} 0,${2*t.height}`},i)):e==="circle"?rr("circle",Object.assign({cx:2*t.height,cy:0,r:2*t.height},n)):e==="square"?rr("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=un(t.fill),i=un(t.stroke);if(t.curveEnabled){const w=Tc(t.width,t.height,t.curvePower,t.fontSize),k=oi(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="${w}" fill="none" />`;if(n){const A=`curve-fill-grad-${t.id}`;S+=nd(t.fill,A)}if(i&&t.strokeWidth){const A=`curve-stroke-grad-${t.id}`;S+=nd(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&&rr("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=rr("div",{style:{width:"100%",height:"100%",position:"absolute",top:0,left:0},innerHTML:S});return rr("div",{style:{position:"relative",width:"100%",height:"100%"}},_,E)}const a=w=>({backgroundImage:w,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=rr("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 w=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({},w),a(t.stroke)),{WebkitTextStroke:`${t.strokeWidth}px transparent`}):Object.assign(Object.assign({},w),{color:"transparent",WebkitTextStroke:`${t.strokeWidth}px ${t.stroke}`}),S=n?Object.assign(Object.assign({},w),a(t.fill)):Object.assign(Object.assign({},w),{color:t.fill}),P="el-"+t.id,_=d?`<style>#${P} {${Ep}}</style>`:"",E=rr("div",{style:Object.assign(Object.assign({},k),{position:"absolute",top:0,left:0,pointerEvents:"none"}),"aria-hidden":"true",innerHTML:d?`${_}${f}`:f}),A=rr("div",Object.assign(Object.assign({style:Object.assign(Object.assign({},S),{position:"relative"})},d?{id:P}:{}),{innerHTML:d?`${_}${f}`:f}));return rr("div",{style:{position:"relative",width:"100%",height:"100%"}},u,rr("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=rr("div",Object.assign(Object.assign({style:p},y),{innerHTML:d?`${v}${f}`:f}));return rr("div",{style:{position:"relative",width:"100%",height:"100%"}},u,b)},line:async({element:t,page:e,store:r})=>rr("svg",{style:{width:"100%",height:"100%",contain:"layout style size",overflow:"visible"}},rr("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}),rr("g",{transform:`translate(0 ${t.height/2})`},Lx({element:t,type:t.startHead})),rr("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&&un(t.stroke)){const o=`figure-stroke-grad-${t.id}`,s=nd(t.stroke,o);i=i.replace(new RegExp(`stroke="${t.stroke.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"`,"g"),`stroke="url(#${o})"`),i=i.replace("</defs>",`${s}</defs>`)}if(un(t.fill)){const o=`figure-fill-grad-${t.id}`,s=nd(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=rr("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=rr("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,w=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(w*S)+"px",top:-Math.round(k*S)+"px",objectFit:"fill"},_=`video-${t.id}`,E=t.borderSize&&un(t.borderColor),A=E?Math.max(0,t.cornerRadius-t.borderSize):t.cornerRadius,T=rr("div",{style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",borderRadius:A+"px",border:t.borderSize&&!E?`${t.borderSize}px solid ${t.borderColor}`:"none"}},rr("video",{id:_,src:t.src,style:P,controls:!0,playsInline:!0,muted:!0,volume:t.volume}));if(E){const I=rr("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=()=>rr("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(ta[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=Pt.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=rr("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 rr("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=[];Fr({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 rr("style",{},s)}return rr("link",{href:G5(a),rel:"stylesheet"})});return rr("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(!un(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 W=await $p(n);n=H2(W,new Map(Object.entries(t.colorsReplace)))}else n=await mv(n);let i,a,o,s,u="";if(t.flipX||t.flipY){const W=t.flipX?-1:1,J=t.flipY?-1:1,te=t.width/2,K=t.height/2;u=`translate(${te}, ${K}) scale(${W}, ${J}) translate(${-te}, ${-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,w=typeof t.stretchEnabled=="boolean"&&t.stretchEnabled||t.type==="svg";w?(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,_=w?t.width/y:P,E=w?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,F=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:F},H))));let X=F;const Z={};o&&s&&(X=s.replace(/&/g,"&"),Z.mask=`url(#${o})`);const ee={};i&&(ee.mask=`url(#${i})`);const V=t.borderSize||0,Q=V>0&&un(t.borderColor),U=Q?`border-grad-${t.id}`:null;if(Q){const W=hc(t.borderColor,U);W&&$.push(W)}const L=V>0?wt("rect",{x:V/2,y:V/2,width:Math.max(0,t.width-V),height:Math.max(0,t.height-V),fill:"none",stroke:Q?`url(#${U})`:t.borderColor,"stroke-width":V,rx:Math.max(0,N-V)||void 0,ry:Math.max(0,N-V)||void 0}):null,q=wt("g",{},wt("defs",{},...$),wt("image",Object.assign(Object.assign({href:X},H),Z)),L);return wt("g",ee,u?wt("g",{transform:u},q):q)},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=un(t.fill),i=un(t.stroke);if(t.curveEnabled){const P=Tc(t.width,t.height,t.curvePower,t.fontSize),_=`curve-path-${t.id}`,E=oi(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,F=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),F,$)}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 F=N.split(" ");let H="";for(let $=0;$<F.length;$++){const X=H+F[$]+" ";a(X,E,A,T,I,M)>_+.5&&$>0?(R.push(H.trim()),H=F[$]+" "):H=X}R.push(H.trim())}),R};let s=oi(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),w=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",{},w,k.length>0?wt("defs",{},...k):null,E,T)}return wt("g",{},w,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&&un(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(un(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(ta[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 w=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",{},w.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=ct.model("Page",{id:ct.identifier,children:ct.array(ct.late(()=>d6)),width:ct.optional(ct.union(ct.number,ct.literal("auto")),"auto"),height:ct.optional(ct.union(ct.number,ct.literal("auto")),"auto"),background:"white",bleed:0,custom:ct.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(jo(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),Fr(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)&&Fr(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;Fr(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),w=t.computedWidth-2*h,k=t.computedHeight-2*b,S=r/w,P=n/k,_=Math.min(S,P),E=(r-w*_)/2-h*_,A=(n-k*_)/2-b*_;Fr(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=ct.model("Audio",{id:ct.identifier,src:"",duration:0,startTime:0,endTime:1,volume:1,delay:0,custom:ct.frozen()}).actions(t=>({toJSON:()=>Object.assign({},jo(t))})).actions(t=>({set(e){Object.assign(t,e)}}));var Uh=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=ct.model("Font",{fontFamily:ct.string,url:ct.optional(ct.string,""),styles:ct.frozen()}).preProcessSnapshot(t=>Object.assign(Object.assign({},t),{fontFamily:t.fontFamily||t.name})),kc=ct.model("Store",{role:"",pages:ct.array(mp),fonts:ct.array(iN),audios:ct.array(zx),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:ct.optional(ct.enumeration("UnitType",["pt","mm","cm","in","px"]),"px"),dpi:72,schemaVersion:2,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,openedSidePanel:"",previousOpenedSidePanel:"",custom:ct.frozen(),tool:ct.optional(ct.enumeration("Tool",["selection","draw","pan","text","eraser"]),"selection"),toolOptions:ct.optional(ct.model({brushType:ct.optional(ct.enumeration("BrushType",["brush","highlighter"]),"brush"),strokeWidth:ct.optional(ct.number,5),stroke:ct.optional(ct.string,"#000000"),opacity:ct.optional(ct.number,1)}),{}),selectedElementsIds:ct.array(ct.string),animatedElementsIds:ct.array(ct.string),history:ct.optional(CD,{targetPath:"../pages"}),_elementsPixelRatio:Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),_activePageId:"",_selectedPagesIds:ct.array(ct.string),_forceShowCredit:!1,_key:"",_validated:!1}).views(t=>{const e=Ac(()=>{const r={};return Fr({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 Fr({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 Fr({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(V=>V.id===s);if(!b)throw new Error(`No page for export with id ${s}`);const w=t._elementsPixelRatio;v>t._elementsPixelRatio&&i.setElementsPixelRatio(v),p?b?.set({_forceMount:!0}):b?.set({_exporting:!0});const k=await WD(()=>{const V=Pt.stages.filter(Q=>Q.getAttr("pageId")===s);return V.length===0?null:V});if(!k)throw b?.set({_forceMount:!1,_exporting:!1}),i.setElementsPixelRatio(w),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(w),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(V=>{V.setAttr("oldVisible",V.visible()),V.visible(!1)}),P.find(".page-background").forEach(V=>V.shadowEnabled(!1)),P.find(".page-background").forEach(V=>V.strokeEnabled(!1)),P.find(".highlighter").forEach(V=>V.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(V=>!V.visible()&&V.getAttr("editModeEnabled")&&!V.getAttr("hideInExport"));M.forEach(V=>{V.setAttr("oldVisible",V.visible()),V.show()});const R=P.find(V=>V.getAttr("hideInExport"));R.forEach(V=>{V.setAttr("oldVisible",V.visible()),V.hide()}),o&&P.find(".page-background").forEach(V=>V.hide());const N=d?b.bleed:0;let F=N;!t.bleedVisible&&d||(t.bleedVisible||d?t.bleedVisible&&d?F=0:t.bleedVisible&&!d&&(F=-b.bleed):F=0);const H=b.computedWidth+2*N,$=b.computedHeight+2*N,X=P.scale();P.scale({x:1,y:1});const Z=yA(P,{x:P.x()-F,y:P.y()-F,width:H,height:$,pixelRatio:v,sceneCanvas:h?.sceneCanvas,bufferCanvas:h?.bufferCanvas});P.scale(X);const ee=Z._canvas;if(u==="image/jpeg"){const V=ee.getContext("2d");V.save(),V.globalCompositeOperation="destination-over",V.fillStyle="white",V.fillRect(0,0,ee.width,ee.height),V.restore()}return o&&P.find(".page-background").forEach(V=>V.show()),R.forEach(V=>{V.visible(V.getAttr("oldVisible"))}),M.forEach(V=>{V.visible(V.getAttr("oldVisible"))}),P.find(".page-background").forEach(V=>V.shadowEnabled(!0)),P.find(".page-background").forEach(V=>V.strokeEnabled(!0)),S.find("Transformer").forEach(V=>{V.visible(V.getAttr("oldVisible"))}),P.find(".highlighter").forEach(V=>V.visible(!0)),E.clip(A),T.clip(I),S.position(_),b?.set({_exporting:!1,_forceMount:!1}),await Promise.resolve(),i.setElementsPixelRatio(w),ee},async toDataURL(a={}){var{mimeType:o,quality:s,dpi:u,dpiMetadata:d="auto"}=a,f=Uh(a,["mimeType","quality","dpi","dpiMetadata"]);const p=await i._toCanvas(Object.assign({mimeType:o},f)),h=o||"image/png",y=p.toDataURL(h,s);Pt.Util.releaseCanvas(p);const v=u??t.dpi;return h!=="image/png"&&h!=="image/jpeg"||d==="never"||d==="auto"&&v===72?y:VD(y,h,v)},async toBlob(a={}){var{mimeType:o,quality:s}=a,u=Uh(a,["mimeType","quality"]);const d=await i._toCanvas(Object.assign({mimeType:o},u)),f=await new Promise(p=>{d.toBlob(p,o,s)});return Pt.Util.releaseCanvas(d),f},async saveAsImage(a={}){var{fileName:o}=a,s=Uh(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),w=p[0]||{},k=a.includeBleed?w.bleed:0,S=y(w.computedWidth+2*k+2*b),P=y(w.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,F=M.computedHeight+2*R+2*v,H=y(N),$=y(F);let X=0,Z=d;for(;X<10;){X+=1;const ee=await i.toDataURL(Object.assign(Object.assign({},a),{pageId:M.id,pixelRatio:Z,dpiMetadata:"never"}));if(ee.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:ee,width:H,height:$,widthPx:N,heightPx:F};Z*=.8}});(await Promise.all(I)).filter(M=>M!==void 0).forEach(({url:M,width:R,height:N,widthPx:F,heightPx:H})=>{_.addPage([R,N],R>N?"landscape":"portrait");const $=_.getCurrentPageInfo();var X;switch(u){case"pt":X=1;break;case"mm":X=72/25.4;break;case"cm":X=72/2.54;break;case"in":X=72;break;case"px":X=.75;break;default:throw"Invalid unit: "+u}if($.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:R*X,topRightY:N*X},$.pageContext.artBox={bottomLeftX:y(v+k)*X,bottomLeftY:y(v+k)*X,topRightX:y(F-v-k)*X,topRightY:y(H-v-k)*X},$.pageContext.bleedBox={bottomLeftX:y(v+k)*X,bottomLeftY:y(v+k)*X,topRightX:y(F-v-k)*X,topRightY:y(H-v-k)*X},b){_.setLineWidth(y(1));const Z=b+y(k);_.line(Z,0,Z,b),_.line(0,Z,b,Z),_.line(R-Z,0,R-Z,b),_.line(R,Z,R-b,Z),_.line(0,N-Z,b,N-Z),_.line(Z,N,Z,N-b),_.line(R,N-Z,R-b,N-Z),_.line(R-Z,N,R-Z,N-b)}_.addImage(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=Uh(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=Uh(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:jo(t.fonts),pages:jo(t.pages),audios:jo(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&&hr.htmlRenderEnabled&&Fr({children:u.pages},y=>{if(y.type==="text"){const b=y.letterSpacing*16;y.letterSpacing=b/y.fontSize}}),d<2&&Fr({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({},jo(t));Object.assign(h,u),h.history=o?jo(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=""){const s=t.fonts.find(d=>d.fontFamily===a)||L2.find(d=>d.fontFamily===a);let u=[{fontStyle:"normal",fontWeight:"normal"},{fontStyle:"normal",fontWeight:"bold"}];return s?(s.styles&&(u=s.styles.map(d=>({fontStyle:d.fontStyle||"normal",fontWeight:d.fontWeight||"normal"}))),cC(s)):uC(a),Promise.all(u.map(d=>sC(a,d.fontStyle,d.fontWeight,o)))},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=ct.model("Node",{id:ct.identifier,type:"none",name:"",opacity:1,custom:ct.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,dd))return e;e=dc(e,dd)}},get parent(){if(dg(t,dd)){const e=dc(t,dd);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({},jo(t))})).actions(t=>({clone(e={},{skipSelect:r=!1}={}){const n=JSON.parse(JSON.stringify(t.toJSON()));return e.id=e.id||Ma(10),Fr(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 w=y[b],k=v[b];if(r.type==="exit"){const P=w;w=k,k=P}const S=k-w;i[b]=w+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,w=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-(w+S):w;I=Math.min(M,Math.abs(d))*u.cropY}return r.type==="enter"?(E=u.cropX?b+T*(1-v):b,A=u.cropY?w+I*(1-v):w):(E=u.cropX?b+T*v:b,A=u.cropY?w+I*v:w),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=ct.model("Animation",{delay:0,duration:500,enabled:!0,type:ct.enumeration("Type",["enter","exit","loop"]),name:"none",data:ct.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=ct.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:ct.array(sN),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:ct.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=Wt(d),p=Bt(v=>{for(const b in v)f[b]=v[b]}),h=Bt(v=>{Object.assign(f,v)}),y=Bt(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 w=v-t.page.startTime;if(w>t.page.duration||w<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&&w<S.delay;P&&h({opacity:0});const _=S?.enabled&&w>=S.delay&&w<=S.delay+S.duration;if(_){const T=w-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&&w>=t.page.duration-E.duration-E.delay&&w<=t.page.duration-E.delay){const T=w-(t.page.duration-E.duration-E.delay),I=yv({element:t,animation:E,dTime:T}),M=vv(t,I);y(M)}E?.enabled&&w>=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:w}),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:ct.optional(ct.union(ct.number,ct.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:"#7ED321",backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5,curveEnabled:!1,curvePower:.5}).preProcessSnapshot(t=>Object.assign({},t)).actions(t=>({toggleEditMode(e){t._editModeEnabled=e??!t._editModeEnabled,t._editModeEnabled?t.store.history.startTransaction():t.store.history.endTransaction()}})),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=Wt.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:ct.array(ct.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:ct.map(ct.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:ct.array(ct.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 Fr=(t,e)=>{if(t.children)for(const r of t.children){if(e(r)===!0)break;Fr(r,e)}},cN=[...new Array(20)].map((t,e)=>ct.late(()=>fN[e])),d6=ct.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,ct.late(()=>dd),...cN),dd=a6.named("Group").props({type:"group",children:ct.array(d6)}).views(t=>({get draggable(){let e=!0;return Fr(t,r=>{r.draggable||(e=!1)}),e},get resizable(){let e=!0;return Fr(t,r=>{r.resizable||(e=!1)}),e},get contentEditable(){let e=!0;return Fr(t,r=>{r.contentEditable||(e=!1)}),e},get styleEditable(){let e=!0;return Fr(t,r=>{r.styleEditable||(e=!1)}),e},get locked(){let e=!0;return Fr(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&&Fr(t,s=>{s.set({draggable:r})}),n!==void 0&&Fr(t,s=>{s.set({contentEditable:n})}),i!==void 0&&Fr(t,s=>{s.set({styleEditable:i})}),a!==void 0&&Fr(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){Fr(t,n=>{n.setAnimation(e,r)})}})),fN=[],db={svg:u6,text:o6,image:L0,group:dd,line:l6,video:s6,figure:c6,gif:f6},dN={text:oA,image:z3,svg:z3,line:UI,video:sD,figure:vD,group:_r(t=>{const{element:e,store:r}=t,{children:n}=e,i=e.selectable||r.role==="admin";return G.createElement(Kt,{opacity:e.opacity,listening:i,hideInExport:!e.showInExport,id:e.id},n.map(a=>G.createElement(h6,Object.assign({},t,{key:a.id,store:r,element:a}))))}),gif:PD},hN=(t,e)=>{const r=[];Fr(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 Pt.Transform;h.translate(f.x,f.y),h.rotate(Pt.Util.degToRad(f.rotation)),p.forEach(y=>{const v=h.point(y);n.push(v)})});const i=new Pt.Transform;i.rotate(-Pt.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=_r(t=>{var e;const{element:r,store:n}=t,[i,a]=G.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]=G.useState();return G.useEffect(()=>{const v=setTimeout(()=>{const b=p.page.id,w=Pt.stages.find(k=>k.getAttr("pageId")===b);w||console.error("No stage is found for element",p.id),y(w)});return()=>clearTimeout(v)},[p.id]),h})(r),d=u?.findOne("Transformer");G.useEffect(()=>{if(u){const p=y=>{const v=y.target.findAncestor(".element",!0),b=n.getElementById(v?.id()),w=b?.top,k=w?.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"&&hr.htmlRenderEnabled&&(f=RI),t.element.visible?f?G.createElement(Kt,{name:"element-container"},G.createElement(f,Object.assign({},t)),i&&!o&&!s&&G.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=_r(({store:t,page:e,width:r,height:n,scale:i,xPadding:a,yPadding:o,bleed:s})=>{const[u,d]=G.useState(!1),[f,p]=G.useState([]),h=G.useRef(null),y=t.tool==="draw",{strokeWidth:v,stroke:b,opacity:w,brushType:k}=t.toolOptions,S=G.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=G.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]),_=G.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:w},{skipSelect:!0})}),t.selectElements(T)}catch(A){console.error("Error creating path SVG:",A)}p([])}},[y,u,f,b,v,w,e,t.history,t]),E=G.useMemo(()=>f.flatMap(A=>[A.x,A.y]),[f]);return G.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="${w}" 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,w,i]),y?G.createElement(Kt,{ref:h,listening:y,x:a+s*i,y:o+s*i,scaleX:i,scaleY:i},G.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&&G.createElement(Hs,{points:E,stroke:b,strokeWidth:v,lineCap:"round",lineJoin:"round",opacity:w,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=Pt.DD._drag;window.removeEventListener("mousemove",$x),Pt.DD._drag=function(t){Ca(()=>{$x.call(this,t)})},window.addEventListener("mousemove",Pt.DD._drag);const f2=new Pt.Group,uu=20;f2.add(new Pt.Rect({width:uu,height:uu,fill:"white"})),f2.add(new Pt.Path({scaleX:uu/24,scaleY:uu/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:uu,height:uu}),Us={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/uu/2,fillPatternScaleY:20/uu/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=>G.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"),G.createElement(Ho,Object.assign({image:n},r,a))},kN=t=>{const e=Yo({a:{width:t.width,height:t.height},width:t.width,height:t.height},t.fill);return G.createElement(ur,Object.assign({},t,e))},_N=t=>{const{background:e,scale:r,borderColor:n}=t,i=p6(t,["background","scale","borderColor"]),a=G.useMemo(()=>!!Pt.Util.colorToRGBA(e)||un(e),[e]),o=G.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 G.createElement(G.Fragment,null,G.createElement(ur,Object.assign({fillPatternImage:o},i,{opacity:.1,hideInExport:!0})),a?G.createElement(kN,Object.assign({fill:e},i)):G.createElement(SN,Object.assign({url:e},i)))},PN=_r(({selection:t,fill:e="rgba(0, 161, 255, 0.3)",stroke:r="rgb(0, 161, 255)",strokeWidth:n=1})=>t.visible?G.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=_r(({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:Pt.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 G.createElement(G.Fragment,null,G.createElement(Hg,{x:(d.minX+d.maxX)/2+f,y:(d.minY+d.maxY)/2+p,offsetX:14,offsetY:14,visible:a==="rotater"},G.createElement($g,{cornerRadius:5,fill:s||"rgb(0, 161, 255)"}),G.createElement(Na,{align:"center",verticalAlign:"middle",fill:u||"white",padding:8,text:EN(i).toString()+"°"})),G.createElement(Hg,{x:(d.minX+d.maxX)/2,y:d.maxY+20,visible:a!=="rotater"},G.createElement($g,{cornerRadius:5,fill:s||"rgb(0, 161, 255)",pointerDirection:"up",pointerHeight:0,pointerWidth:0}),G.createElement(Na,{align:"center",verticalAlign:"middle",fill:u||"white",padding:8,text:h})))}),CN=_r(({elements:t,store:e})=>{const r=t.filter(i=>i.alwaysOnTop),n=t.filter(i=>!i.alwaysOnTop).concat(r);return G.createElement(G.Fragment,null,n.map(i=>G.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]=G.useState(!1),[n,i]=G.useState({x:0,y:0});return{open:G.useCallback(o=>{r(!0),i(o)},[]),close:G.useCallback(()=>{r(!1)},[]),props:{isOpen:e,offset:n,setIsOpen:r}}},AN=atob("UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4="),d2=atob("I2MwMzkyYg=="),IN=atob("djAuOS4y"),RN=t=>G.createElement(G.Fragment,null,G.createElement(Hg,{fill:d2,height:200},G.createElement($g,{fill:d2}),G.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=="),Vx=t=>{const e=Og()===1,r=e?DN:MN,n=e?230:195;return G.createElement(Kt,Object.assign({},t,{listening:!1}),G.createElement(ur,{fill:d2,width:n,height:24,cornerRadius:2}),G.createElement(Na,{text:r,fill:"white",fontSize:13,fontFamily:"monospace",width:n,align:"center",y:5,listening:!1}),e&&G.createElement(Na,{text:NN,fill:"rgba(0,0,0,0.6)",fontSize:14,y:30,listening:!1}))},LN=_r(({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:w,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,F=e.computedHeight+2*R,H=(r-N*t.scale)/2,$=(n-F*t.scale)/2,X=G.useRef(null),Z=G.useRef(null),ee=G.useRef(null),V=i==null||i,[Q,U]=G.useState(null),[L,q]=G.useState({}),[W,J]=G.useState(0),te=ON({store:t}),K=t.selectedElements.find(ke=>ke._cropModeEnabled),ne=t.selectedElements.find(ke=>ke.curveEnabled),fe=t.selectedShapes.filter(ke=>!ke.resizable).length>0,oe=t.selectedShapes.filter(ke=>!ke.draggable).length>0,ue=t.selectedElements.filter(ke=>!ke.visible).length>0;G.useLayoutEffect(()=>{var ke,me,Ue;if(!X.current)return;const be=X.current.getStage(),je=t.selectedShapes.map(bt=>bt._cropModeEnabled?null:be.findOne("#"+bt.id)).filter(bt=>!!bt),at=t.selectedElements.length===1,Et=at&&((ke=t.selectedElements[0])===null||ke===void 0?void 0:ke.type)||"many";yg[Et]?(X.current.setAttrs(Object.assign(Object.assign({},Us),yg[Et])),Et!=="svg"&&Et!=="image"&&Et!=="gif"||t.selectedElements[0].keepRatio||X.current.setAttrs({enabledAnchors:Us.enabledAnchors}),Et==="text"&&hr.textVerticalResizeEnabled&&X.current.setAttrs({enabledAnchors:(me=yg.text.enabledAnchors)===null||me===void 0?void 0:me.concat(["bottom-center"])}),Et==="text"&&at&&t.selectedElements[0].curveEnabled&&X.current.setAttrs({enabledAnchors:yg.many.enabledAnchors})):X.current.setAttrs(Us),fe&&X.current.enabledAnchors([]),oe&&X.current.rotateEnabled(!1),je.find(bt=>bt?.isDragging())&&je.forEach(bt=>{bt.isDragging()||bt==null||bt.startDrag()}),X.current.nodes(je),Zk(),(Ue=X.current.getLayer())===null||Ue===void 0||Ue.batchDraw()},[t.selectedShapes,K,fe,ue,oe,ne]);const we=()=>{var ke,me;const Ue=X.current;if(!Ue)return;if(!Ue.isTransforming())return void q({});if(!Ue.nodes().length||!Ue.isTransforming())return;const be=Ue.__getNodeRect(),je=Ue?.getActiveAnchor(),at=Ue.getStage();q({anchor:je,x:be.x-((ke=at?.x())!==null&&ke!==void 0?ke:0),y:be.y-((me=at?.y())!==null&&me!==void 0?me:0),rotation:be.rotation,width:be.width,height:be.height})},Re=G.useCallback(()=>{var ke;if(!((ke=X.current)===null||ke===void 0)&&ke.isTransforming())return;const me=X.current;if(!me||!me.nodes().length)return void J(0);const Ue=me.getClientRect();if(!me.getStage())return;const be=(function(je,at,Et,bt=0){const At=je.x+je.width/2,le=je.y+je.height/2,ye=je.width/2,it=je.height/2,pt=bt*Math.PI/180,yt=Nt=>{const Nr=Nt*Math.PI/180,Gt=(Nt%360+360)%360;let fr;fr=Gt===0||Gt===180?it:ye;const ir=Math.sin(Nr)*(fr+Et),er=-Math.cos(Nr)*(fr+Et),ar=ir*Math.cos(pt)-er*Math.sin(pt),En=ir*Math.sin(pt)+er*Math.cos(pt);return{x:At+ar,y:le+En}},ft=Nt=>Nt.x>=at.left&&Nt.x<=at.right&&Nt.y>=at.top&&Nt.y<=at.bottom;if(ft(yt(0)))return 0;for(const Nt of[180,270,90])if(ft(yt(Nt)))return Nt;return 0})(Ue,{top:M?.top||0,bottom:n-(M?.bottom||0),left:M?.left||0,right:r-(M?.right||0)},Us.rotateAnchorOffset||30,me.rotation());J(be)},[M,r,n]);G.useEffect(()=>{var ke;(ke=X.current)===null||ke===void 0||ke.update(),we(),Re()},[t.scale,Re]),G.useEffect(()=>{Re()},[t.selectedShapes,Re]);const Ne=sP(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),He=G.useRef(!1),$e=ku(),et=Bt(ke=>{var me,Ue,be,je,at,Et,bt;if($e)return;He.current=!1;const At=ke.target.findAncestor(".elements-container"),le=ke.target.findAncestor("Transformer"),ye=ke.target.findAncestor(".page-abs-container");if(At||le||ye)return;const it=(me=ke.target.getStage())===null||me===void 0?void 0:me.getPointerPosition();it&&(it.x-=(be=(Ue=ke.target.getStage())===null||Ue===void 0?void 0:Ue.x())!==null&&be!==void 0?be:0,it.y-=(at=(je=ke.target.getStage())===null||je===void 0?void 0:je.y())!==null&&at!==void 0?at:0,Ne.visible=!0,Ne.x1=it.x,Ne.y1=it.y,Ne.x2=it.x,Ne.y2=it.y,((bt=(Et=ke.target.getStage())===null||Et===void 0?void 0:Et.getPointersPositions().length)!==null&&bt!==void 0?bt:0)>=2&&(Ne.visible=!1))});(({stageRef:ke,containerRef:me,viewportSize:Ue})=>{G.useEffect(()=>{var be;const je=(be=me.current)===null||be===void 0?void 0:be.closest(".polotno-workspace-inner");function at(){var Et;if(!ke.current)return;const bt=(Et=me.current)===null||Et===void 0?void 0:Et.getBoundingClientRect(),At=je?.getBoundingClientRect();if(!bt||!At)return;const le=Math.max(0,At.left-bt.left-100),ye=Math.max(0,At.top-bt.top-100);ke.current.position({x:-le,y:-ye}),ke.current.container().style.transform=`translate(${le}px, ${ye}px)`}return at(),je?.addEventListener("scroll",at),()=>{je?.removeEventListener("scroll",at)}},[Ue.width,Ue.height])})({stageRef:Z,containerRef:ee,viewportSize:p}),G.useEffect(()=>{const ke=Bt(Ue=>{var be,je,at,Et,bt,At;if(!Ne.visible)return;(be=Z.current)===null||be===void 0||be.setPointersPositions(Ue);let le=(je=Z.current)===null||je===void 0?void 0:je.getPointerPosition();le?(le.x-=(Et=(at=Z.current)===null||at===void 0?void 0:at.x())!==null&&Et!==void 0?Et:0,le.y-=(At=(bt=Z.current)===null||bt===void 0?void 0:bt.y())!==null&&At!==void 0?At:0):le={x:Ne.x2,y:Ne.y2},Ne.x2=le.x,Ne.y2=le.y}),me=Bt(()=>{if(!Ne.visible||!Z.current)return;const Ue=Z.current.findOne(".selection"),be=Ue?Ue.getClientRect({skipStroke:!0}):{width:0,height:0,x:0,y:0};if(be.width&&be.height){const je=[];Z.current.find(".element").forEach(Et=>{const bt=Et.getClientRect(),At=t.getElementById(Et.id()),le=At?.draggable,ye=At?.selectable;Pt.Util.haveIntersection(be,bt)&&le&&ye&&je.push(At.top.id)});const at=[...new Set(je)];He.current=!0,t.selectElements(at)}Ne.visible=!1});return window.addEventListener("mousemove",ke),window.addEventListener("touchmove",ke),window.addEventListener("mouseup",me,{capture:!0}),window.addEventListener("touchend",me,{capture:!0}),()=>{window.removeEventListener("mousemove",ke),window.removeEventListener("touchmove",ke),window.removeEventListener("mouseup",me),window.removeEventListener("touchend",me)}},[]);const xe=G.useCallback(ke=>{if(!t.selectedElements[0]||ke&&t.selectedElementsIds.includes(ke))return;const me=T0(t.selectedShapes),Ue=ke?t.getElementById(ke):{x:0,y:0,width:e.computedWidth,height:e.computedHeight,rotation:0},be=Nd(Ue),je=[];me.minX>be.maxX&&je.push({distance:me.minX-be.maxX,box1:me,box2:be,points:[{x:me.minX,y:me.minY+me.height/2},{x:be.maxX,y:me.minY+me.height/2},{x:be.maxX,y:be.minY+be.height/2}]}),me.maxX<be.minX&&je.push({distance:be.minX-me.maxX,box1:me,box2:be,points:[{x:me.maxX,y:me.minY+me.height/2},{x:be.minX,y:me.minY+me.height/2},{x:be.minX,y:be.minY+be.height/2}]}),me.minY>be.maxY&&je.push({box1:me,box2:be,distance:me.minY-be.maxY,points:[{x:me.minX+me.width/2,y:me.minY},{x:me.minX+me.width/2,y:be.maxY},{x:be.minX+be.width/2,y:be.maxY}]}),me.maxY<be.minY&&je.push({box1:me,box2:be,distance:be.minY-me.maxY,points:[{x:me.minX+me.width/2,y:me.maxY},{x:me.minX+me.width/2,y:be.minY},{x:be.minX+be.width/2,y:be.minY}]});const at=me.minX>=be.minX&&me.maxX<=be.maxX&&me.minY>=be.minY&&me.maxY<=be.maxY;if(at&&(je.push({distance:me.minX-be.minX,box1:me,box2:be,points:[{x:me.minX,y:me.minY+me.height/2},{x:be.minX,y:me.minY+me.height/2},{x:be.minX,y:be.minY+be.height/2}]}),je.push({distance:be.maxX-me.maxX,box1:me,box2:be,points:[{x:me.maxX,y:me.minY+me.height/2},{x:be.maxX,y:me.minY+me.height/2},{x:be.maxX,y:be.minY+be.height/2}]}),je.push({box1:me,box2:be,distance:me.minY-be.minY,points:[{x:me.minX+me.width/2,y:me.minY},{x:me.minX+me.width/2,y:be.minY},{x:be.minX+be.width/2,y:be.minY}]}),je.push({box1:me,box2:be,distance:be.maxY-me.maxY,points:[{x:me.minX+me.width/2,y:me.maxY},{x:me.minX+me.width/2,y:be.maxY},{x:be.minX+be.width/2,y:be.maxY}]})),je.length===0&&!at){const Et=me.minX<be.maxX&&me.maxX>be.minX,bt=me.minY<be.maxY&&me.maxY>be.minY;if(Et&&bt){const At=(Math.max(me.minY,be.minY)+Math.min(me.maxY,be.maxY))/2,le=(Math.max(me.minX,be.minX)+Math.min(me.maxX,be.maxX))/2;me.minX<be.minX?je.push({distance:be.minX-me.minX,box1:me,box2:be,points:[{x:me.minX,y:At},{x:be.minX,y:At},{x:be.minX,y:At}]}):je.push({distance:me.minX-be.minX,box1:me,box2:be,points:[{x:me.minX,y:At},{x:be.minX,y:At},{x:be.minX,y:At}]}),me.maxX>be.maxX?je.push({distance:me.maxX-be.maxX,box1:me,box2:be,points:[{x:be.maxX,y:At},{x:me.maxX,y:At},{x:be.maxX,y:At}]}):je.push({distance:be.maxX-me.maxX,box1:me,box2:be,points:[{x:me.maxX,y:At},{x:be.maxX,y:At},{x:be.maxX,y:At}]}),me.minY<be.minY?je.push({box1:me,box2:be,distance:be.minY-me.minY,points:[{x:le,y:me.minY},{x:le,y:be.minY},{x:le,y:be.minY}]}):je.push({box1:me,box2:be,distance:me.minY-be.minY,points:[{x:le,y:me.minY},{x:le,y:be.minY},{x:le,y:be.minY}]}),me.maxY>be.maxY?je.push({box1:me,box2:be,distance:me.maxY-be.maxY,points:[{x:le,y:be.maxY},{x:le,y:me.maxY},{x:le,y:be.maxY}]}):je.push({box1:me,box2:be,distance:be.maxY-me.maxY,points:[{x:le,y:me.maxY},{x:le,y:be.maxY},{x:le,y:be.maxY}]})}}JSON.stringify(Q)!==JSON.stringify(je)&&U(je)},[t,e]);G.useEffect(()=>{t.distanceGuidesVisible?xe():Q&&U(null)},[t.distanceGuidesVisible,xe,t.selectedShapes.map(ke=>`${ke.x},${ke.y},${ke.width},${ke.height},${ke.rotation}`).join("|")]);const he=G.useRef(!1);G.useEffect(()=>{var ke;let me;const Ue=(ke=ee.current)===null||ke===void 0?void 0:ke.closest(".polotno-workspace-inner"),be=()=>{he.current=!0,clearTimeout(me),me=setTimeout(()=>{he.current=!1},300)};return Ue?.addEventListener("scroll",be),()=>{clearTimeout(me),Ue?.removeEventListener("scroll",be)}},[]);const se=ke=>{if(t.activePage!==e&&e.select(),he.current||He.current)return;const me=ke.evt.ctrlKey||ke.evt.metaKey||ke.evt.shiftKey,Ue=ke.target.findAncestor(".elements-container"),be=ke.target.findAncestor(".page-abs-container"),je=ke.target.findAncestor("Transformer");if(!(me||Ue||je||be||Ne.visible))return void t.selectElements([]);const at=ke.target.findAncestor(".element-container",!0),Et=at?.findOne(".element")||ke.target.findAncestor(".element",!0),bt=t.getElementById(Et?.id()),At=bt?.top,le=At?.id,ye=t.selectedElementsIds.indexOf(le)>=0,it=ke.target.findAncestor(".page-container",!0);le&&me&&!ye?t.selectElements(t.selectedElementsIds.concat([le])):le&&me&&ye?t.selectElements(t.selectedElementsIds.filter(pt=>pt!==le)):!le||me||ye?it?t.selectPages([e.id]):t.selectPages([]):t.selectElements([le])};BI(X,t,{stroke:b,strokeWidth:w,dash:k});const ge=t.activePage===e,Ce=t._selectedPagesIds.includes(e.id),ae=u?.PageControls,_e=u?.Tooltip,Oe=u?.ContextMenu,Fe=1/t.scale,ot=0/t.scale;return G.createElement("div",{ref:ee,onDragOver:ke=>ke.preventDefault(),onDrop:ke=>{if(ke.preventDefault(),!Z.current)return;Z.current.setPointersPositions(ke);const me=Z.current.findOne(".elements-container");me?.getRelativePointerPosition();const Ue=Z.current.getPointerPosition(),be=Z.current.getAllIntersections(Ue).map(at=>at.findAncestor(".element",!0)).filter(Boolean);[...new Set(be.reverse())].map(at=>t.getElementById(at.id())).filter(at=>!!at)[0]},style:{position:"relative",width:r+"px",height:n+"px",overflow:"hidden",flexShrink:0},className:"polotno-page-container"+(ge?" active-page":"")},G.createElement(LT,{ref:Z,width:Math.min(r,p.width+200),height:Math.min(p.height+200,n),onClick:se,onTap:se,onContextMenu:ke=>{ke.evt.preventDefault();const me=ke.target.findAncestor(".element",!0),Ue=t.getElementById(me?.id()),be=Ue?.top,je=be?.id;je?t.selectedElementsIds.indexOf(je)>=0||t.selectElements([je]):t.selectElements([]),te.open({x:ke.evt.clientX,y:ke.evt.clientY})},onMouseDown:et,onMouseMove:ke=>{if(!t.distanceGuidesVisible&&!ke.evt.altKey)return void(Q&&U(null));const me=ke.target.findAncestor(".element",!0),Ue=me?.id();xe(Ue)},onDragStart:ke=>{var me;const Ue=ke.target.findAncestor(".element",!0);if(Ue){const be=t.getElementById(Ue?.id()),je=be?.top,at=je?.id;!(t.selectedElementsIds.indexOf(at)>=0)&&at&&(t.selectElements([at]),ke.target.stopDrag(),ke.target.startDrag(ke),(me=X.current)===null||me===void 0||me.startDrag(ke))}Q&&U(null)},pageId:e.id,style:{position:"absolute",overflow:"hidden",top:0,left:0}},G.createElement(MT,null,G.createElement(xN,{width:r,height:n,fill:a}),G.createElement(Kt,{x:H,y:$,scaleX:t.scale,scaleY:t.scale,name:"page-container"},G.createElement(Kt,{name:"page-container-2"},G.createElement(Kt,{name:"page-background-group",x:R,y:R},G.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})),G.createElement(Kt,{x:R,y:R,name:"elements-container",listening:!t.isPlaying},G.createElement(ur,{name:"elements-area",width:e.computedWidth,height:e.computedHeight,listening:!1}),G.createElement(CN,{elements:e.children,store:t})),G.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&&G.createElement(RN,{name:"hit-detection",x:-Fe/2-ot,y:-Fe/2-ot,width:N+Fe+2*ot,height:F+Fe+2*ot}))),G.createElement(Hs,{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}),G.createElement(Kt,{x:H,y:$,scaleX:t.scale,scaleY:t.scale},G.createElement(ur,{name:"page-highlight",hideInExport:!0,x:-Fe/2-ot,y:-Fe/2-ot,width:N+Fe+2*ot,height:F+Fe+2*ot,stroke:Ce?s:o,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})),G.createElement(Kt,{x:H+R*t.scale,y:$+R*t.scale,scaleX:t.scale,scaleY:t.scale,name:"page-abs-container"},G.createElement(wp,{ref:X,rotateAnchorAngle:W,onDragStart:ke=>{var me;!((me=ke.evt)===null||me===void 0)&&me.altKey&&f&&t.selectedElements.forEach(Ue=>{const be=Ue.clone({},{skipSelect:!0}),je=e.children.indexOf(Ue);e.setElementZIndex(be.id,je)}),t.history.startTransaction()},onDragEnd:()=>{t.history.endTransaction(),Re()},onTransformStart:()=>{t.history.startTransaction(),U(null)},boundBoxFunc:(ke,me)=>{const Ue=Math.abs(me.width)<1||Math.abs(me.height)<1,be=Math.abs(ke.width)<1||Math.abs(ke.height)<1;return Ue&&!be?ke:me},onTransform:ke=>{const me=X.current.nodes(),Ue=me[me.length-1];ke.target===Ue&&setTimeout(()=>{we()},0)},onTransformEnd:ke=>{q({}),t.history.endTransaction(),Re()},visible:!t.isPlaying}),Q&&Q.map(({points:ke,distance:me,box1:Ue,box2:be},je)=>G.createElement(Kt,{name:"distances-container",hideInExport:!0,key:je,listening:!1},G.createElement(ur,Object.assign({},Ue,{stroke:_,strokeWidth:1,strokeScaleEnabled:!1})),G.createElement(ur,Object.assign({},be,{stroke:_,strokeWidth:1,strokeScaleEnabled:!1})),G.createElement(Hs,{points:[ke[0].x,ke[0].y,ke[1].x,ke[1].y],stroke:_,strokeWidth:1,strokeScaleEnabled:!1}),G.createElement(Hs,{points:[ke[1].x,ke[1].y,ke[2].x,ke[2].y],stroke:_,strokeWidth:1,strokeScaleEnabled:!1}),G.createElement(Hg,{x:(ke[0].x+ke[1].x)/2,y:(ke[0].y+ke[1].y)/2,offsetY:-10,scaleX:1/t.scale,scaleY:1/t.scale},G.createElement($g,{cornerRadius:5,fill:E,pointerDirection:"down"}),G.createElement(Na,{align:"center",verticalAlign:"middle",fill:A,padding:5,text:qD({unit:t.unit,dpi:t.dpi,px:me})})))),e._rendering&&G.createElement(Kt,null,G.createElement(ur,{width:N,height:F,fill:"rgba(255,255,255,0.9)"}),G.createElement(Na,{text:"Rendering...",fontSize:60,width:N,height:F,align:"center",verticalAlign:"middle"})),_e&&G.createElement(_e,{components:u,store:t,page:e,stageRef:Z,tooltipSafeArea:I}),Oe&&G.createElement(Vg,null,G.createElement(Oe,Object.assign({components:u,store:t},te.props)))),G.createElement(vN,{store:t,page:e,width:r,height:n,scale:t.scale,xPadding:H,yPadding:$,bleed:R}),G.createElement(TN,Object.assign({},L,{store:t,tagFill:S,textFill:P})),G.createElement(PN,{selection:Ne,fill:h,stroke:y,strokeWidth:v}),Og()>0&&G.createElement(Kt,{hideInExport:!0},G.createElement(Vx,{name:"cache-bounds",x:r-(Og()===1?250:210),y:n-(Og()===1?95:45)}),G.createElement(Vx,{name:"cache-bounds-t",x:10,y:10})),ND()&&G.createElement(Na,{text:"Powered by polotno.com",fontSize:14,fill:"rgba(0,0,0,0.6)",x:r-170,y:n-18,onMouseEnter:ke=>{ke.target.getStage().container().style.cursor="pointer"},onMouseLeave:ke=>{ke.target.getStage().container().style.cursor=""},onTouchStart:ke=>{ke.cancelBubble=!0},onMouseDown:ke=>{ke.cancelBubble=!0},onClick:()=>{window.open("https://polotno.com")},onTap:()=>{window.open("https://polotno.com")}}),G.createElement(Kt,{name:"line-guides"}))),V&&ae&&G.createElement(ae,{store:t,page:e,xPadding:H,yPadding:$,layout:T}))}),FN=Dd("div",G.forwardRef)`
|
|
404
|
+
position: absolute;
|
|
405
|
+
top: 0;
|
|
406
|
+
left: 0;
|
|
407
|
+
pointer-events: none;
|
|
408
|
+
`,qx=Dd("div",G.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",G.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",G.forwardRef)`
|
|
430
|
+
position: absolute;
|
|
431
|
+
border-left: 1px solid grey;
|
|
432
|
+
padding-left: 2px;
|
|
433
|
+
`,Xx=Dd("div",G.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=_r(({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=G.useRef(null);if(!t.activePage)return null;const y=i==="horizontal",v=t.activePage,b=(t.bleedVisible&&v.bleed,v.computedWidth*t.scale),w=v.computedHeight*t.scale,k=(e-b)/2,S=(r-w)/2,P=(_=X=>Nx({unitVal:X,dpi:t.dpi,unit:t.unit})*t.scale,BN.find(X=>_(X)>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(w/E)+1,I=T0(t.selectedShapes),M=o||"#e8e8e8",R=s||"grey",N=u||"grey",F=d??1,H=f||"grey",$=p??1;return G.createElement(FN,{ref:h,className:"polotno-rulers",style:{display:"flex",flexDirection:"column"}},y?G.createElement(G.Fragment,null,G.createElement("div",{style:{display:"flex",flexDirection:"row",position:"sticky",top:0,zIndex:1}},G.createElement("div",{className:"polotno-ruler-corner",style:{width:"14px",height:"14px",flexShrink:0,backgroundColor:M,borderRight:`${F}px solid ${N}`,borderBottom:`${F}px solid ${N}`,position:"sticky",left:0,zIndex:2}}),(a?[t.activePage]:t.pages).map((X,Z)=>{var ee;if(!X)return null;const V=n?n[Z]:e,Q=(V-X.computedWidth*t.scale)/2;return G.createElement(qx,{key:X.id,style:{width:V+"px",flexShrink:0,position:"relative",backgroundColor:M,color:R,borderBottom:`${F}px solid ${N}`},className:"polotno-x-ruler"},[...Array(A)].map((U,L)=>G.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))),((ee=t.selectedShapes[0])===null||ee===void 0?void 0:ee.page)===X&&G.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)"}}))})),G.createElement(Wx,{style:{height:r+"px",position:"sticky",left:0,marginTop:"-14px",backgroundColor:M,color:R,borderRight:`${F}px solid ${N}`},className:"polotno-y-ruler"},[...Array(T)].map((X,Z)=>G.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&&G.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)"}}))):G.createElement(G.Fragment,null,G.createElement(qx,{style:{width:e+"px",backgroundColor:M,color:R,borderBottom:`${F}px solid ${N}`},className:"polotno-x-ruler"},[...Array(A)].map((X,Z)=>G.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&&G.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((X,Z)=>{var ee;if(!X)return null;const V=n?n[Z]:r,Q=(V-X.computedHeight*t.scale)/2,U=Z===0?14:0;return G.createElement(Wx,{key:X.id,style:{height:V-U+"px",backgroundColor:M,color:R,borderRight:`${F}px solid ${N}`},className:"polotno-y-ruler"},[...Array(T)].map((L,q)=>G.createElement(Xx,{key:q,className:"polotno-ruler-tick",style:{top:Q+q*E-U+"px",width:E+"px",borderLeft:`${$}px solid ${H}`}},t.unit==="px"||P>=1?Math.round(P*q):(P*q).toFixed(1))),((ee=t.selectedShapes[0])===null||ee===void 0?void 0:ee.page)===X&&G.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=_r(({audio:t,store:e})=>{const[r]=(function(n){const[i,a]=G.useState(null),[o,s]=G.useState("loading");return G.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 G.useEffect(()=>{r&&e.history.ignore(()=>{t.set({duration:1e3*r.duration})})},[r,t,e.history]),G.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=oo(()=>{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)},VN=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=[];Fr({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=[];Fr({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 qN(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 li=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=li(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-li(t).x,i=r-li(t).y;t.children.forEach(a=>{const o=li(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,li(n).x)}),t.selectedElements.length===1&&(r=0),t.selectedElements.forEach(n=>{const i=li(n);zc(n,i.x-i.x+r,i.y)})}function GN(t){var e;let r=0;t.selectedElements.forEach(n=>{const i=li(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=li(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,li(n).y)}),t.selectedElements.length===1&&(r=0),t.selectedElements.forEach(n=>{const i=li(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=li(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=li(o);zc(o,s.x,a-s.height/2)})}function KN(t){var e;let r=0;t.selectedElements.forEach(n=>{const i=li(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=li(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=li(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=li(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,w,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(),VN(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(),qN(e.selectedElements,e)),t.code==="KeyT"&&!A){t.preventDefault();const M=30,R=e.width/2,N=e.width/2-R/2,F=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:F,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?(w=e.activePage)===null||w===void 0||w.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=Wt({toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",curvedText:"Curved text",curvePower:"Power",temperature:"Temperature",saturation:"Saturation",contrast:"Contrast",shadows:"Shadows",white:"White",black:"Black",vibrance:"Vibrance",textBackground:"Background",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",textStroke:"Text Stroke",shadow:"Shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",uppercase:"Uppercase",position:"Position",layering:"Layering",toForward:"To Front",up:"Forward",down:"Backward",toBottom:"To back",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",strength:"Strength",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",strokeSettings:"Stroke settings",spacing:"Spacing",volume:"Volume",lineStyle:"Line style",lineStartHead:"Line start",lineEndHead:"Line end",textDirection:"Text direction",fontSize:"Font size",fontFamily:"Font family",textAlign:"Text align",verticalAlign:"Vertical align",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",listFormat:"List",colorPicker:{solid:"Solid",linear:"Linear",angle:"Angle"},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down",moveLeft:"Move left",moveRight:"Move right"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",lines:"Lines",draw:"Draw",upload:"Upload",uploadImage:"Add file",uploadTip:"Upload your assets",background:"Background",resize:"Resize",layers:"Layers",animate:"Animate",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",clipImage:"Mask image",width:"Width",height:"Height",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio",duplicateAudio:"Duplicate audio",muteAudio:"Mute",unmuteAudio:"Unmute",volume:"Volume"},contextMenu:{duplicate:"Duplicate",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}}),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}'`)})}Bt((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})=>G.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"}},G.createElement("p",null,Kx("workspace.noPages")),G.createElement("button",{onClick:()=>{t.addPage()}},Kx("workspace.addPage"))),eL=({width:t,height:e,xPadding:r,yPadding:n,backgroundColor:i})=>G.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}},G.createElement("div",{style:{width:" 100%",height:"100%",backgroundColor:"white"}})),tL=[4,6],rL=_r(({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:w,distanceLabelTextFill:k,rulerBackgroundColor:S,rulerTextColor:P,rulerBorderColor:_,rulerBorderSize:E,rulerTickColor:A,rulerTickSize:T,components:I,onKeyDown:M,paddingX:R,paddingY:N,pageGap:F,altCloneEnabled:H=!0,visiblePagesOffset:$,renderOnlyActivePage:X,tooltipSafeArea:Z})=>{var ee;const V=e==="horizontal",Q=R??20,U=N??55,[L,q]=G.useState({width:100,height:100}),W=G.useRef(L),J=G.useRef(null),te=G.useRef(null),K=G.useRef(0),ne=t.bleedVisible?Math.max(0,...t.pages.map(le=>le.bleed)):0,fe=Math.max(...t.pages.map(le=>le.computedWidth)),oe=Math.max(...t.pages.map(le=>le.computedHeight)),ue=((ee=t.activePage)===null||ee===void 0?void 0:ee.computedHeight)||0,we=fe+2*ne,Re=(X?ue:oe)+2*ne,Ne=async({skipTimeout:le}={skipTimeout:!1})=>{if(le||await new Promise(er=>setTimeout(er,50)),J.current===null)return;const ye=J.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(J.current));const it=te.current.clientWidth||ye.width,pt={width:it,height:ye.height};(W.current.width!==pt.width||W.current.height!==pt.height)&&(q(pt),W.current=pt);const yt=(it-2*Q)/we,ft=t.pages.length>1?3.1:2,Nt=(ye.height-U*ft)/Re,Nr=t.pages.length>1?3.1:2,Gt=(it-Q*Nr)/we,fr=(ye.height-2*U)/Re,ir=t.pages.length?Math.max(Math.min(V?Gt:yt,V?fr:Nt),.01):1;t.scaleToFit!==ir&&(t.setScale(ir),t._setScaleToFit(ir))};G.useLayoutEffect(()=>{Ne({skipTimeout:!0})},[]),G.useEffect(()=>{Ne()},[we,Re,N,R]),G.useLayoutEffect(()=>{Ne({skipTimeout:!0})},[t.openedSidePanel]),G.useEffect(()=>{t.__()},[]),G.useEffect(()=>{const le=J.current;if(window.ResizeObserver){const ye=new ResizeObserver(()=>{Ne({skipTimeout:!0})});return ye.observe(le),()=>ye.unobserve(le)}{const ye=setInterval(()=>{Ne({skipTimeout:!0})},100);return()=>clearInterval(ye)}},[we,Re]);const He=X?1:t.pages.length;let $e,et;if(V){const le=we*t.scale*He;$e=Math.max(Q,(L.width-le)/He/2),et=Math.max(U,(L.height-Re*t.scale)/2)}else{$e=Math.max(Q,(L.width-we*t.scale)/2);const le=Re*t.scale*He;et=Math.max(U,(L.height-le)/He/2)}Number.isNaN($e)&&($e=Q),Number.isNaN(et)&&(et=U),G.useEffect(()=>{const le=ye=>{(M||ZN)(ye,t)};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[]),G.useEffect(()=>{const le=it=>{if(it.ctrlKey||it.metaKey){it.preventDefault();const pt=Math.max(5,t.scaleToFit);let yt=Math.min(.1,t.scaleToFit);V&&we>0&&Number.isFinite(we)&&(yt=Math.max(yt,300/we)),yt=Math.max(yt,.01);const ft=.03,Nt=Qx(it.deltaY<0?t.scale*(1+ft):t.scale/(1+ft),yt,pt);return void t.setScale(Nt)}},ye=te.current;return ye?.addEventListener("wheel",le),()=>ye?.removeEventListener("wheel",le)},[V,we,t]),G.useEffect(()=>{const le=te.current;if(!le)return;const ye=yt=>{yt.touches.length===2&&(K.current=Zx(yt.touches[0],yt.touches[1]))},it=yt=>{if(yt.touches.length===2&&K.current>0){yt.preventDefault();const ft=Zx(yt.touches[0],yt.touches[1]),Nt=ft/K.current,Nr=Math.max(5,t.scaleToFit);let Gt=Math.min(.1,t.scaleToFit);V&&we>0&&Number.isFinite(we)&&(Gt=Math.max(Gt,300/we)),Gt=Math.max(Gt,.01);const fr=t.scale,ir=Qx(fr*Nt,Gt,Nr),er=ir/fr,ar=le.getBoundingClientRect(),En=(yt.touches[0].clientX+yt.touches[1].clientX)/2-ar.left,Hr=(yt.touches[0].clientY+yt.touches[1].clientY)/2-ar.top,Tn=le.scrollLeft+En,Xr=le.scrollTop+Hr;Ce.current=!0,t.setScale(ir),le.scrollLeft=Tn*er-En,le.scrollTop=Xr*er-Hr,K.current=ft}},pt=()=>{K.current=0};return le.addEventListener("touchstart",ye,{passive:!0}),le.addEventListener("touchmove",it,{passive:!1}),le.addEventListener("touchend",pt,{passive:!0}),()=>{le.removeEventListener("touchstart",ye),le.removeEventListener("touchmove",it),le.removeEventListener("touchend",pt)}},[V,we,t]);const xe=F!==void 0,he=G.useMemo(()=>t.pages.map(le=>{if(V){const ye=(le.computedWidth+2*ne)*t.scale;return xe?ye+F:ye+2*$e}{const ye=(le.computedHeight+2*ne)*t.scale;return xe?ye+F:ye+2*et}}),[t.pages,t.scale,ne,$e,et,F,V,xe]),se=G.useMemo(()=>{const le=[];let ye=xe?V?$e:et:0;for(let it=0;it<he.length;it++)le.push(ye),ye+=he[it];return le},[he,xe,V,$e,et]),ge=G.useMemo(()=>{const le=he.reduce((ye,it)=>ye+it,0);return xe?le+(V?2*$e:2*et):le},[he,xe,V,$e,et]),Ce=G.useRef(!1),[,ae]=G.useReducer(le=>le+1,0);((le,ye,it,pt,yt,ft)=>{const Nt=G.useRef(ye),Nr=G.useRef(0),Gt=G.useRef(!1),fr=G.useRef(pt.pages.length);Gt.current=fr.current!==pt.pages.length,fr.current=pt.pages.length,G.useEffect(()=>{const ir=le.current,er=ar=>{Nr.current=ft?ir.scrollLeft:ir.scrollTop};return ir.addEventListener("scroll",er),()=>{ir.removeEventListener("scroll",er)}},[ft]),G.useLayoutEffect(()=>{if(!le.current||Gt.current)return;const ir=le.current,er=ft?ir.offsetWidth:ir.offsetHeight,ar=(Nr.current+er/2)/Nt.current;yt.current=!0;const En=ar*ye-er/2;ft?ir.scrollLeft=En:ir.scrollTop=En,Nt.current=ye},[it,ye,ft])})(te,ge,t.scale,t,Ce,V);const{handleScroll:_e}=((le,ye,it,pt,yt,ft,Nt,Nr,Gt)=>{const fr=G.useRef(!1),ir=G.useRef(null),er=G.useRef(!1),ar=Nr==="horizontal";G.useEffect(()=>{const Hr=le.current,Tn=()=>{ft.current};return Hr.addEventListener("scroll",Tn),()=>{Hr.removeEventListener("scroll",Tn)}},[]);const En=pt.pages.indexOf(pt.activePage);return G.useLayoutEffect(()=>{if(Nt||!pt.activePage||!le.current||fr.current)return;const Hr=le.current,Tn=pt.pages.indexOf(pt.activePage),Xr=ye[Tn]||0,Pi=ar?Hr.scrollLeft:Hr.scrollTop,Jr=it[Tn]||it[0]||0;let Vi=()=>{};return(Math.abs(Xr-Pi)>.5*Jr||er.current)&&(er.current=!0,Vi=(({element:Bn,scrollTop:Ei,scrollLeft:al,duration:Ba=300,onFinish:ol=()=>{}})=>{const Cn=Ei!==void 0,ho=Cn?Bn.scrollTop:Bn.scrollLeft,po=Cn?Ei:al,Jo=po-ho;let ui=0,fa=!1;if(Ba===0)return Cn?Bn.scrollTop=po:Bn.scrollLeft=po,()=>{};const es=()=>{if(fa)return;ui+=20;const da=ts(ui,ho,Jo,Ba);Cn?Bn.scrollTop=da:Bn.scrollLeft=da,ui<Ba?setTimeout(es,20):ol()},ts=(da,jc,Er,Tu)=>(da/=Tu/2)<1?Er/2*da*da+jc:-Er/2*(--da*(da-2)-1)+jc;return es(),()=>{fa=!0}})(Object.assign(Object.assign({element:Hr},ar?{scrollLeft:Xr}:{scrollTop:Xr}),{onFinish:()=>{er.current=!1,Gt?.()},duration:pt.isPlaying?0:300}))),Vi},[pt.activePage,En,pt.isPlaying,Nt,Nr,ye,it]),{handleScroll:Hr=>{if(Nt||er.current)return;fr.current=!0,clearTimeout(ir.current),ir.current=setTimeout(()=>{fr.current=!1},300);const Tn=(ar?Hr.currentTarget.scrollLeft:Hr.currentTarget.scrollTop)+(ar?yt.width:yt.height)/3;let Xr=0;for(let Jr=ye.length-1;Jr>=0;Jr--)if(Tn>=ye[Jr]){Xr=Jr;break}const Pi=pt.pages[Xr];Pi&&pt.activePage!==Pi&&Pi.select()}}})(te,se,he,t,L,Ce,X,e,ae),Oe=L.width>=we*t.scale+2*$e,Fe=L.height>=Re*t.scale+2*et,ot=n||"rgba(232, 232, 232, 0.9)",ke=I?.NoPages||JN,me=V?L.width:L.height,Ue=te.current?V?te.current.scrollLeft:te.current.scrollTop:0,be=le=>{for(let ye=se.length-1;ye>=0;ye--)if(le>=se[ye])return ye;return 0},je=Math.max(0,be(Ue)),at=Math.min(t.pages.length-1,be(Ue+me)),Et=$??1,bt=Math.max(0,je-Et),At=Math.min(t.pages.length-1,at+Et);return G.createElement("div",{ref:J,style:{width:"100%",height:"100%",position:"relative",outline:"none",flex:1,backgroundColor:ot,overflow:"hidden"},tabIndex:0,className:"polotno-workspace-container"},G.createElement("div",{ref:te,onScroll:_e,style:Object.assign({position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",flexDirection:V?"row":"column",overflow:"auto",overflowX:V?"auto":Oe?"hidden":"auto",overflowY:V&&Fe?"hidden":"auto"},xe&&{paddingTop:V?0:et,paddingBottom:V?0:et,paddingLeft:V?$e:0,paddingRight:V?$e:0,boxSizing:"border-box"}),className:"polotno-workspace-inner"},t.pages.map((le,ye)=>{const it=le===t.activePage;if(X&&!it&&!le._exportingOrRendering&&!le._forceMount)return null;const pt=it||ye>=bt&&ye<=At||le._exportingOrRendering||le._forceMount,yt=V?he[ye]:we*t.scale+2*$e,ft=V?Re*t.scale+2*et:he[ye];if(!pt)return G.createElement("div",{key:le.id,style:{flexShrink:0}},G.createElement(eL,{width:yt,height:ft,backgroundColor:ot,xPadding:$e,yPadding:et}));const Nt=G.createElement(LN,{key:le.id,page:le,xPadding:$e,yPadding:et,width:yt,height:ft,store:t,pageControlsEnabled:r,backColor:ot,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:w||"rgb(0, 161, 255)",distanceLabelTextFill:k||"white",components:I,viewportSize:L,layout:e,tooltipSafeArea:Z});return(le._exportingOrRendering||le._forceMount)&&!it&&X?G.createElement("div",{style:{display:"none",flexShrink:0},key:le.id},Nt):Nt}),t.rulesVisible&&G.createElement(zN,{store:t,xPadding:$e,yPadding:et,width:we*t.scale+2*$e,height:Re*t.scale+2*et,pageSizes:he,layout:e,renderOnlyActivePage:X,rulerBackgroundColor:S,rulerTextColor:P,rulerBorderColor:_,rulerBorderSize:E,rulerTickColor:A,rulerTickSize:T}),t.pages.length===0&&G.createElement(ke,{store:t}),t.audios.map(le=>G.createElement(jN,{key:le.id,audio:le,store:t}))))});Qe.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-C-wxpZSs.js").then(t=>t.j),[],import.meta.url)),await wv);let xv=null;window.__polotnoLoadVideoExport=async()=>(xv||(xv=Jx(()=>import("./index-DJgsd6rb.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(G.createElement(rL,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:v6,components:{PageControls:()=>null,Tooltip:()=>null}}));export{su as $,Vp as A,iR as B,Q2 as C,u2 as D,gd as E,Zs as F,Kh as G,Yf 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,ou as Z,Jx as _,pe as a,i8 as a0,_n as a1,l8 as a2,hd as a3,t8 as a4,SL as a5,VL as a6,qL as a7,PL as a8,n8 as a9,EL as aa,vL as ab,WL as ac,KM as ad,qM as ae,GM as af,xx as ag,Ig as ah,Oc as ai,Tp as b,xL as c,fu as d,pR as e,ra as f,IL as g,IR as h,bL as i,h8 as j,_L as k,si 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};
|