@3rtools/tyts-mcp 1.15.0 → 1.17.1

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.
@@ -1,232 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function e(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=e(i);fetch(i.href,s)}})();var m9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wk(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var L1={exports:{}},Oh={};var cv;function $6(){if(cv)return Oh;cv=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function e(r,i,s){var l=null;if(s!==void 0&&(l=""+s),i.key!==void 0&&(l=""+i.key),"key"in i){s={};for(var c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:n,type:r,key:l,ref:i!==void 0?i:null,props:s}}return Oh.Fragment=t,Oh.jsx=e,Oh.jsxs=e,Oh}var uv;function V6(){return uv||(uv=1,L1.exports=$6()),L1.exports}var T=V6(),R1={exports:{}},Hn={};var fv;function W6(){if(fv)return Hn;fv=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function y(K){return K===null||typeof K!="object"?null:(K=b&&K[b]||K["@@iterator"],typeof K=="function"?K:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function L(K,P,X){this.props=K,this.context=P,this.refs=D,this.updater=X||M}L.prototype.isReactComponent={},L.prototype.setState=function(K,P){if(typeof K!="object"&&typeof K!="function"&&K!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,K,P,"setState")},L.prototype.forceUpdate=function(K){this.updater.enqueueForceUpdate(this,K,"forceUpdate")};function H(){}H.prototype=L.prototype;function Y(K,P,X){this.props=K,this.context=P,this.refs=D,this.updater=X||M}var W=Y.prototype=new H;W.constructor=Y,C(W,L.prototype),W.isPureReactComponent=!0;var St=Array.isArray;function _t(){}var Ct={H:null,A:null,T:null,S:null},bt=Object.prototype.hasOwnProperty;function ot(K,P,X){var tt=X.ref;return{$$typeof:n,type:K,key:P,ref:tt!==void 0?tt:null,props:X}}function jt(K,P){return ot(K.type,P,K.props)}function Z(K){return typeof K=="object"&&K!==null&&K.$$typeof===n}function ct(K){var P={"=":"=0",":":"=2"};return"$"+K.replace(/[=:]/g,function(X){return P[X]})}var V=/\/+/g;function xt(K,P){return typeof K=="object"&&K!==null&&K.key!=null?ct(""+K.key):P.toString(36)}function Lt(K){switch(K.status){case"fulfilled":return K.value;case"rejected":throw K.reason;default:switch(typeof K.status=="string"?K.then(_t,_t):(K.status="pending",K.then(function(P){K.status==="pending"&&(K.status="fulfilled",K.value=P)},function(P){K.status==="pending"&&(K.status="rejected",K.reason=P)})),K.status){case"fulfilled":return K.value;case"rejected":throw K.reason}}throw K}function dt(K,P,X,tt,gt){var vt=typeof K;(vt==="undefined"||vt==="boolean")&&(K=null);var kt=!1;if(K===null)kt=!0;else switch(vt){case"bigint":case"string":case"number":kt=!0;break;case"object":switch(K.$$typeof){case n:case t:kt=!0;break;case p:return kt=K._init,dt(kt(K._payload),P,X,tt,gt)}}if(kt)return gt=gt(K),kt=tt===""?"."+xt(K,0):tt,St(gt)?(X="",kt!=null&&(X=kt.replace(V,"$&/")+"/"),dt(gt,P,X,"",function(Zt){return Zt})):gt!=null&&(Z(gt)&&(gt=jt(gt,X+(gt.key==null||K&&K.key===gt.key?"":(""+gt.key).replace(V,"$&/")+"/")+kt)),P.push(gt)),1;kt=0;var qt=tt===""?".":tt+":";if(St(K))for(var Rt=0;Rt<K.length;Rt++)tt=K[Rt],vt=qt+xt(tt,Rt),kt+=dt(tt,P,X,vt,gt);else if(Rt=y(K),typeof Rt=="function")for(K=Rt.call(K),Rt=0;!(tt=K.next()).done;)tt=tt.value,vt=qt+xt(tt,Rt++),kt+=dt(tt,P,X,vt,gt);else if(vt==="object"){if(typeof K.then=="function")return dt(Lt(K),P,X,tt,gt);throw P=String(K),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(K).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return kt}function st(K,P,X){if(K==null)return K;var tt=[],gt=0;return dt(K,tt,"","",function(vt){return P.call(X,vt,gt++)}),tt}function lt(K){if(K._status===-1){var P=K._result;P=P(),P.then(function(X){(K._status===0||K._status===-1)&&(K._status=1,K._result=X)},function(X){(K._status===0||K._status===-1)&&(K._status=2,K._result=X)}),K._status===-1&&(K._status=0,K._result=P)}if(K._status===1)return K._result.default;throw K._result}var zt=typeof reportError=="function"?reportError:function(K){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof K=="object"&&K!==null&&typeof K.message=="string"?String(K.message):String(K),error:K});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",K);return}console.error(K)},At={map:st,forEach:function(K,P,X){st(K,function(){P.apply(this,arguments)},X)},count:function(K){var P=0;return st(K,function(){P++}),P},toArray:function(K){return st(K,function(P){return P})||[]},only:function(K){if(!Z(K))throw Error("React.Children.only expected to receive a single React element child.");return K}};return Hn.Activity=g,Hn.Children=At,Hn.Component=L,Hn.Fragment=e,Hn.Profiler=i,Hn.PureComponent=Y,Hn.StrictMode=r,Hn.Suspense=f,Hn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ct,Hn.__COMPILER_RUNTIME={__proto__:null,c:function(K){return Ct.H.useMemoCache(K)}},Hn.cache=function(K){return function(){return K.apply(null,arguments)}},Hn.cacheSignal=function(){return null},Hn.cloneElement=function(K,P,X){if(K==null)throw Error("The argument must be a React element, but you passed "+K+".");var tt=C({},K.props),gt=K.key;if(P!=null)for(vt in P.key!==void 0&&(gt=""+P.key),P)!bt.call(P,vt)||vt==="key"||vt==="__self"||vt==="__source"||vt==="ref"&&P.ref===void 0||(tt[vt]=P[vt]);var vt=arguments.length-2;if(vt===1)tt.children=X;else if(1<vt){for(var kt=Array(vt),qt=0;qt<vt;qt++)kt[qt]=arguments[qt+2];tt.children=kt}return ot(K.type,gt,tt)},Hn.createContext=function(K){return K={$$typeof:l,_currentValue:K,_currentValue2:K,_threadCount:0,Provider:null,Consumer:null},K.Provider=K,K.Consumer={$$typeof:s,_context:K},K},Hn.createElement=function(K,P,X){var tt,gt={},vt=null;if(P!=null)for(tt in P.key!==void 0&&(vt=""+P.key),P)bt.call(P,tt)&&tt!=="key"&&tt!=="__self"&&tt!=="__source"&&(gt[tt]=P[tt]);var kt=arguments.length-2;if(kt===1)gt.children=X;else if(1<kt){for(var qt=Array(kt),Rt=0;Rt<kt;Rt++)qt[Rt]=arguments[Rt+2];gt.children=qt}if(K&&K.defaultProps)for(tt in kt=K.defaultProps,kt)gt[tt]===void 0&&(gt[tt]=kt[tt]);return ot(K,vt,gt)},Hn.createRef=function(){return{current:null}},Hn.forwardRef=function(K){return{$$typeof:c,render:K}},Hn.isValidElement=Z,Hn.lazy=function(K){return{$$typeof:p,_payload:{_status:-1,_result:K},_init:lt}},Hn.memo=function(K,P){return{$$typeof:d,type:K,compare:P===void 0?null:P}},Hn.startTransition=function(K){var P=Ct.T,X={};Ct.T=X;try{var tt=K(),gt=Ct.S;gt!==null&&gt(X,tt),typeof tt=="object"&&tt!==null&&typeof tt.then=="function"&&tt.then(_t,zt)}catch(vt){zt(vt)}finally{P!==null&&X.types!==null&&(P.types=X.types),Ct.T=P}},Hn.unstable_useCacheRefresh=function(){return Ct.H.useCacheRefresh()},Hn.use=function(K){return Ct.H.use(K)},Hn.useActionState=function(K,P,X){return Ct.H.useActionState(K,P,X)},Hn.useCallback=function(K,P){return Ct.H.useCallback(K,P)},Hn.useContext=function(K){return Ct.H.useContext(K)},Hn.useDebugValue=function(){},Hn.useDeferredValue=function(K,P){return Ct.H.useDeferredValue(K,P)},Hn.useEffect=function(K,P){return Ct.H.useEffect(K,P)},Hn.useEffectEvent=function(K){return Ct.H.useEffectEvent(K)},Hn.useId=function(){return Ct.H.useId()},Hn.useImperativeHandle=function(K,P,X){return Ct.H.useImperativeHandle(K,P,X)},Hn.useInsertionEffect=function(K,P){return Ct.H.useInsertionEffect(K,P)},Hn.useLayoutEffect=function(K,P){return Ct.H.useLayoutEffect(K,P)},Hn.useMemo=function(K,P){return Ct.H.useMemo(K,P)},Hn.useOptimistic=function(K,P){return Ct.H.useOptimistic(K,P)},Hn.useReducer=function(K,P,X){return Ct.H.useReducer(K,P,X)},Hn.useRef=function(K){return Ct.H.useRef(K)},Hn.useState=function(K){return Ct.H.useState(K)},Hn.useSyncExternalStore=function(K,P,X){return Ct.H.useSyncExternalStore(K,P,X)},Hn.useTransition=function(){return Ct.H.useTransition()},Hn.version="19.2.4",Hn}var dv;function Cp(){return dv||(dv=1,R1.exports=W6()),R1.exports}var U=Cp();const Cu=wk(U);var O1={exports:{}},Ph={},P1={exports:{}},I1={};var hv;function X6(){return hv||(hv=1,(function(n){function t(dt,st){var lt=dt.length;dt.push(st);t:for(;0<lt;){var zt=lt-1>>>1,At=dt[zt];if(0<i(At,st))dt[zt]=st,dt[lt]=At,lt=zt;else break t}}function e(dt){return dt.length===0?null:dt[0]}function r(dt){if(dt.length===0)return null;var st=dt[0],lt=dt.pop();if(lt!==st){dt[0]=lt;t:for(var zt=0,At=dt.length,K=At>>>1;zt<K;){var P=2*(zt+1)-1,X=dt[P],tt=P+1,gt=dt[tt];if(0>i(X,lt))tt<At&&0>i(gt,X)?(dt[zt]=gt,dt[tt]=lt,zt=tt):(dt[zt]=X,dt[P]=lt,zt=P);else if(tt<At&&0>i(gt,lt))dt[zt]=gt,dt[tt]=lt,zt=tt;else break t}}return st}function i(dt,st){var lt=dt.sortIndex-st.sortIndex;return lt!==0?lt:dt.id-st.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();n.unstable_now=function(){return l.now()-c}}var f=[],d=[],p=1,g=null,b=3,y=!1,M=!1,C=!1,D=!1,L=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,Y=typeof setImmediate<"u"?setImmediate:null;function W(dt){for(var st=e(d);st!==null;){if(st.callback===null)r(d);else if(st.startTime<=dt)r(d),st.sortIndex=st.expirationTime,t(f,st);else break;st=e(d)}}function St(dt){if(C=!1,W(dt),!M)if(e(f)!==null)M=!0,_t||(_t=!0,ct());else{var st=e(d);st!==null&&Lt(St,st.startTime-dt)}}var _t=!1,Ct=-1,bt=5,ot=-1;function jt(){return D?!0:!(n.unstable_now()-ot<bt)}function Z(){if(D=!1,_t){var dt=n.unstable_now();ot=dt;var st=!0;try{t:{M=!1,C&&(C=!1,H(Ct),Ct=-1),y=!0;var lt=b;try{e:{for(W(dt),g=e(f);g!==null&&!(g.expirationTime>dt&&jt());){var zt=g.callback;if(typeof zt=="function"){g.callback=null,b=g.priorityLevel;var At=zt(g.expirationTime<=dt);if(dt=n.unstable_now(),typeof At=="function"){g.callback=At,W(dt),st=!0;break e}g===e(f)&&r(f),W(dt)}else r(f);g=e(f)}if(g!==null)st=!0;else{var K=e(d);K!==null&&Lt(St,K.startTime-dt),st=!1}}break t}finally{g=null,b=lt,y=!1}st=void 0}}finally{st?ct():_t=!1}}}var ct;if(typeof Y=="function")ct=function(){Y(Z)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,xt=V.port2;V.port1.onmessage=Z,ct=function(){xt.postMessage(null)}}else ct=function(){L(Z,0)};function Lt(dt,st){Ct=L(function(){dt(n.unstable_now())},st)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(dt){dt.callback=null},n.unstable_forceFrameRate=function(dt){0>dt||125<dt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bt=0<dt?Math.floor(1e3/dt):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(dt){switch(b){case 1:case 2:case 3:var st=3;break;default:st=b}var lt=b;b=st;try{return dt()}finally{b=lt}},n.unstable_requestPaint=function(){D=!0},n.unstable_runWithPriority=function(dt,st){switch(dt){case 1:case 2:case 3:case 4:case 5:break;default:dt=3}var lt=b;b=dt;try{return st()}finally{b=lt}},n.unstable_scheduleCallback=function(dt,st,lt){var zt=n.unstable_now();switch(typeof lt=="object"&&lt!==null?(lt=lt.delay,lt=typeof lt=="number"&&0<lt?zt+lt:zt):lt=zt,dt){case 1:var At=-1;break;case 2:At=250;break;case 5:At=1073741823;break;case 4:At=1e4;break;default:At=5e3}return At=lt+At,dt={id:p++,callback:st,priorityLevel:dt,startTime:lt,expirationTime:At,sortIndex:-1},lt>zt?(dt.sortIndex=lt,t(d,dt),e(f)===null&&dt===e(d)&&(C?(H(Ct),Ct=-1):C=!0,Lt(St,lt-zt))):(dt.sortIndex=At,t(f,dt),M||y||(M=!0,_t||(_t=!0,ct()))),dt},n.unstable_shouldYield=jt,n.unstable_wrapCallback=function(dt){var st=b;return function(){var lt=b;b=st;try{return dt.apply(this,arguments)}finally{b=lt}}}})(I1)),I1}var pv;function G6(){return pv||(pv=1,P1.exports=X6()),P1.exports}var j1={exports:{}},Ps={};var mv;function K6(){if(mv)return Ps;mv=1;var n=Cp();function t(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function e(){}var r={d:{f:e,r:function(){throw Error(t(522))},D:e,C:e,L:e,m:e,X:e,S:e,M:e},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:f,containerInfo:d,implementation:p}}var l=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ps.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ps.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return s(f,d,null,p)},Ps.flushSync=function(f){var d=l.T,p=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=d,r.p=p,r.d.f()}},Ps.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(f,d))},Ps.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Ps.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:y}):p==="script"&&r.d.X(f,{crossOrigin:g,integrity:b,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ps.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);r.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(f)},Ps.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin);r.d.L(f,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Ps.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=c(d.as,d.crossOrigin);r.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(f)},Ps.requestFormReset=function(f){r.d.r(f)},Ps.unstable_batchedUpdates=function(f,d){return f(d)},Ps.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},Ps.useFormStatus=function(){return l.H.useHostTransitionStatus()},Ps.version="19.2.4",Ps}var gv;function Sk(){if(gv)return j1.exports;gv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),j1.exports=K6(),j1.exports}var yv;function J6(){if(yv)return Ph;yv=1;var n=G6(),t=Cp(),e=Sk();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,u=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(u=a.return),o=a.return;while(o)}return a.tag===3?u:null}function l(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function c(o){if(o.tag===31){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function f(o){if(s(o)!==o)throw Error(r(188))}function d(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var u=o,h=a;;){var x=u.return;if(x===null)break;var S=x.alternate;if(S===null){if(h=x.return,h!==null){u=h;continue}break}if(x.child===S.child){for(S=x.child;S;){if(S===u)return f(x),o;if(S===h)return f(x),a;S=S.sibling}throw Error(r(188))}if(u.return!==h.return)u=x,h=S;else{for(var O=!1,et=x.child;et;){if(et===u){O=!0,u=x,h=S;break}if(et===h){O=!0,h=x,u=S;break}et=et.sibling}if(!O){for(et=S.child;et;){if(et===u){O=!0,u=S,h=x;break}if(et===h){O=!0,h=S,u=x;break}et=et.sibling}if(!O)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?o:a}function p(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=p(o),a!==null)return a;o=o.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),St=Symbol.for("react.suspense"),_t=Symbol.for("react.suspense_list"),Ct=Symbol.for("react.memo"),bt=Symbol.for("react.lazy"),ot=Symbol.for("react.activity"),jt=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function ct(o){return o===null||typeof o!="object"?null:(o=Z&&o[Z]||o["@@iterator"],typeof o=="function"?o:null)}var V=Symbol.for("react.client.reference");function xt(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===V?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case C:return"Fragment";case L:return"Profiler";case D:return"StrictMode";case St:return"Suspense";case _t:return"SuspenseList";case ot:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case M:return"Portal";case Y:return o.displayName||"Context";case H:return(o._context.displayName||"Context")+".Consumer";case W:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case Ct:return a=o.displayName||null,a!==null?a:xt(o.type)||"Memo";case bt:a=o._payload,o=o._init;try{return xt(o(a))}catch{}}return null}var Lt=Array.isArray,dt=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,st=e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,lt={pending:!1,data:null,method:null,action:null},zt=[],At=-1;function K(o){return{current:o}}function P(o){0>At||(o.current=zt[At],zt[At]=null,At--)}function X(o,a){At++,zt[At]=o.current,o.current=a}var tt=K(null),gt=K(null),vt=K(null),kt=K(null);function qt(o,a){switch(X(vt,a),X(gt,o),X(tt,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?Lx(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Lx(a),o=Rx(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}P(tt),X(tt,o)}function Rt(){P(tt),P(gt),P(vt)}function Zt(o){o.memoizedState!==null&&X(kt,o);var a=tt.current,u=Rx(a,o.type);a!==u&&(X(gt,o),X(tt,u))}function Ae(o){gt.current===o&&(P(tt),P(gt)),kt.current===o&&(P(kt),_h._currentValue=lt)}var le,Ie;function Ue(o){if(le===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);le=a&&a[1]||"",Ie=-1<u.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+le+o+Ie}var ft=!1;function Re(o,a){if(!o||ft)return"";ft=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(ee){var Jt=ee}Reflect.construct(o,[],ye)}else{try{ye.call()}catch(ee){Jt=ee}o.call(ye.prototype)}}else{try{throw Error()}catch(ee){Jt=ee}(ye=o())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(ee){if(ee&&Jt&&typeof ee.stack=="string")return[ee.stack,Jt.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=h.DetermineComponentFrameRoot(),O=S[0],et=S[1];if(O&&et){var Nt=O.split(`
4
- `),Kt=et.split(`
5
- `);for(x=h=0;h<Nt.length&&!Nt[h].includes("DetermineComponentFrameRoot");)h++;for(;x<Kt.length&&!Kt[x].includes("DetermineComponentFrameRoot");)x++;if(h===Nt.length||x===Kt.length)for(h=Nt.length-1,x=Kt.length-1;1<=h&&0<=x&&Nt[h]!==Kt[x];)x--;for(;1<=h&&0<=x;h--,x--)if(Nt[h]!==Kt[x]){if(h!==1||x!==1)do if(h--,x--,0>x||Nt[h]!==Kt[x]){var ae=`
6
- `+Nt[h].replace(" at new "," at ");return o.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",o.displayName)),ae}while(1<=h&&0<=x);break}}}finally{ft=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Ue(u):""}function rn(o,a){switch(o.tag){case 26:case 27:case 5:return Ue(o.type);case 16:return Ue("Lazy");case 13:return o.child!==a&&a!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return Re(o.type,!1);case 11:return Re(o.type.render,!1);case 1:return Re(o.type,!0);case 31:return Ue("Activity");default:return""}}function on(o){try{var a="",u=null;do a+=rn(o,u),u=o,o=o.return;while(o);return a}catch(h){return`
7
- Error generating stack: `+h.message+`
8
- `+h.stack}}var be=Object.prototype.hasOwnProperty,_e=n.unstable_scheduleCallback,Te=n.unstable_cancelCallback,Le=n.unstable_shouldYield,Ye=n.unstable_requestPaint,hn=n.unstable_now,Pn=n.unstable_getCurrentPriorityLevel,wn=n.unstable_ImmediatePriority,Nn=n.unstable_UserBlockingPriority,Sn=n.unstable_NormalPriority,Be=n.unstable_LowPriority,tn=n.unstable_IdlePriority,je=n.log,ur=n.unstable_setDisableYieldValue,bn=null,cn=null;function pn(o){if(typeof je=="function"&&ur(o),cn&&typeof cn.setStrictMode=="function")try{cn.setStrictMode(bn,o)}catch{}}var $n=Math.clz32?Math.clz32:ve,en=Math.log,Qt=Math.LN2;function ve(o){return o>>>=0,o===0?32:31-(en(o)/Qt|0)|0}var me=256,We=262144,He=4194304;function Pe(o){var a=o&42;if(a!==0)return a;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Vn(o,a,u){var h=o.pendingLanes;if(h===0)return 0;var x=0,S=o.suspendedLanes,O=o.pingedLanes;o=o.warmLanes;var et=h&134217727;return et!==0?(h=et&~S,h!==0?x=Pe(h):(O&=et,O!==0?x=Pe(O):u||(u=et&~o,u!==0&&(x=Pe(u))))):(et=h&~S,et!==0?x=Pe(et):O!==0?x=Pe(O):u||(u=h&~o,u!==0&&(x=Pe(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function Xo(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function ui(o,a){switch(o){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32: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 a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Hi(){var o=He;return He<<=1,(He&62914560)===0&&(He=4194304),o}function Go(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function Je(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Ss(o,a,u,h,x,S){var O=o.pendingLanes;o.pendingLanes=u,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=u,o.entangledLanes&=u,o.errorRecoveryDisabledLanes&=u,o.shellSuspendCounter=0;var et=o.entanglements,Nt=o.expirationTimes,Kt=o.hiddenUpdates;for(u=O&~u;0<u;){var ae=31-$n(u),ye=1<<ae;et[ae]=0,Nt[ae]=-1;var Jt=Kt[ae];if(Jt!==null)for(Kt[ae]=null,ae=0;ae<Jt.length;ae++){var ee=Jt[ae];ee!==null&&(ee.lane&=-536870913)}u&=~ye}h!==0&&to(o,h,0),S!==0&&x===0&&o.tag!==0&&(o.suspendedLanes|=S&~(O&~a))}function to(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-$n(a);o.entangledLanes|=a,o.entanglements[h]=o.entanglements[h]|1073741824|u&261930}function Xt(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var h=31-$n(u),x=1<<h;x&a|o[h]&a&&(o[h]|=a),u&=~x}}function Ei(o,a){var u=a&-a;return u=(u&42)!==0?1:Xn(u),(u&(o.suspendedLanes|a))!==0?0:u}function Xn(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function fi(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Ti(){var o=st.p;return o!==0?o:(o=window.event,o===void 0?32:nv(o.type))}function Ko(o,a){var u=st.p;try{return st.p=o,a()}finally{st.p=u}}var gi=Math.random().toString(36).slice(2),Ar="__reactFiber$"+gi,ir="__reactProps$"+gi,Gn="__reactContainer$"+gi,Jo="__reactEvents$"+gi,ks="__reactListeners$"+gi,Oa="__reactHandles$"+gi,Zo="__reactResources$"+gi,To="__reactMarker$"+gi;function Ll(o){delete o[Ar],delete o[ir],delete o[Jo],delete o[ks],delete o[Oa]}function ca(o){var a=o[Ar];if(a)return a;for(var u=o.parentNode;u;){if(a=u[Gn]||u[Ar]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=Fx(o);o!==null;){if(u=o[Ar])return u;o=Fx(o)}return a}o=u,u=o.parentNode}return null}function As(o){if(o=o[Ar]||o[Gn]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function Qa(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function Qo(o){var a=o[Zo];return a||(a=o[Zo]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function di(o){o[To]=!0}var tl=new Set,Pi={};function qr(o,a){Ms(o,a),Ms(o+"Capture",a)}function Ms(o,a){for(Pi[o]=a,o=0;o<a.length;o++)tl.add(a[o])}var Rl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ac={},Bc={};function zc(o){return be.call(Bc,o)?!0:be.call(ac,o)?!1:Rl.test(o)?Bc[o]=!0:(ac[o]=!0,!1)}function eo(o,a,u){if(zc(a))if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+u)}}function yi(o,a,u){if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+u)}}function Ni(o,a,u,h){if(h===null)o.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttributeNS(a,u,""+h)}}function Fn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Po(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function fr(o,a,u){var h=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var x=h.get,S=h.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return x.call(this)},set:function(O){u=""+O,S.call(this,O)}}),Object.defineProperty(o,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(O){u=""+O},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function go(o){if(!o._valueTracker){var a=Po(o)?"checked":"value";o._valueTracker=fr(o,a,""+o[a])}}function qi(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=Po(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function Yr(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var dr=/[\n"\\]/g;function Ir(o){return o.replace(dr,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function hi(o,a,u,h,x,S,O,et){o.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?o.type=O:o.removeAttribute("type"),a!=null?O==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+Fn(a)):o.value!==""+Fn(a)&&(o.value=""+Fn(a)):O!=="submit"&&O!=="reset"||o.removeAttribute("value"),a!=null?te(o,O,Fn(a)):u!=null?te(o,O,Fn(u)):h!=null&&o.removeAttribute("value"),x==null&&S!=null&&(o.defaultChecked=!!S),x!=null&&(o.checked=x&&typeof x!="function"&&typeof x!="symbol"),et!=null&&typeof et!="function"&&typeof et!="symbol"&&typeof et!="boolean"?o.name=""+Fn(et):o.removeAttribute("name")}function Ys(o,a,u,h,x,S,O,et){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(o.type=S),a!=null||u!=null){if(!(S!=="submit"&&S!=="reset"||a!=null)){go(o);return}u=u!=null?""+Fn(u):"",a=a!=null?""+Fn(a):u,et||a===o.value||(o.value=a),o.defaultValue=a}h=h??x,h=typeof h!="function"&&typeof h!="symbol"&&!!h,o.checked=et?o.checked:!!h,o.defaultChecked=!!h,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(o.name=O),go(o)}function te(o,a,u){a==="number"&&Yr(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function el(o,a,u,h){if(o=o.options,a){a={};for(var x=0;x<u.length;x++)a["$"+u[x]]=!0;for(u=0;u<o.length;u++)x=a.hasOwnProperty("$"+o[u].value),o[u].selected!==x&&(o[u].selected=x),x&&h&&(o[u].defaultSelected=!0)}else{for(u=""+Fn(u),a=null,x=0;x<o.length;x++){if(o[x].value===u){o[x].selected=!0,h&&(o[x].defaultSelected=!0);return}a!==null||o[x].disabled||(a=o[x])}a!==null&&(a.selected=!0)}}function Pa(o,a,u){if(a!=null&&(a=""+Fn(a),a!==o.value&&(o.value=a),u==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=u!=null?""+Fn(u):""}function $s(o,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(Lt(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=Fn(a),o.defaultValue=u,h=o.textContent,h===u&&h!==""&&h!==null&&(o.value=h),go(o)}function Io(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var Ol=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Pl(o,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":h?o.setProperty(a,u):typeof u!="number"||u===0||Ol.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function lc(o,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?o.setProperty(h,""):h==="float"?o.cssFloat="":o[h]="");for(var x in a)h=a[x],a.hasOwnProperty(x)&&u[x]!==h&&Pl(o,x,h)}else for(var S in a)a.hasOwnProperty(S)&&Pl(o,S,a[S])}function cc(o){if(o.indexOf("-")===-1)return!1;switch(o){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 Tu=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),uc=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function jo(o){return uc.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Bo(){}var ts=null;function fc(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var es=null,vn=null;function dc(o){var a=As(o);if(a&&(o=a.stateNode)){var u=o[ir]||null;t:switch(o=a.stateNode,a.type){case"input":if(hi(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ir(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var x=h[ir]||null;if(!x)throw Error(r(90));hi(h,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===o.form&&qi(h)}break t;case"textarea":Pa(o,u.value,u.defaultValue);break t;case"select":a=u.value,a!=null&&el(o,!!u.multiple,a,!1)}}}var xr=!1;function hc(o,a,u){if(xr)return o(a,u);xr=!0;try{var h=o(a);return h}finally{if(xr=!1,(es!==null||vn!==null)&&(Gp(),es&&(a=es,o=vn,vn=es=null,dc(a),o)))for(a=0;a<o.length;a++)dc(o[a])}}function ua(o,a){var u=o.stateNode;if(u===null)return null;var h=u[ir]||null;if(h===null)return null;u=h[a];t:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(o=o.type,h=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!h;break t;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var zo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fo=!1;if(zo)try{var Yi={};Object.defineProperty(Yi,"passive",{get:function(){Fo=!0}}),window.addEventListener("test",Yi,Yi),window.removeEventListener("test",Yi,Yi)}catch{Fo=!1}var No=null,nl=null,Cs=null;function Ia(){if(Cs)return Cs;var o,a=nl,u=a.length,h,x="value"in No?No.value:No.textContent,S=x.length;for(o=0;o<u&&a[o]===x[o];o++);var O=u-o;for(h=1;h<=O&&a[u-h]===x[S-h];h++);return Cs=x.slice(o,1<h?1-h:void 0)}function no(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function ja(){return!0}function fa(){return!1}function Ii(o){function a(u,h,x,S,O){this._reactName=u,this._targetInst=x,this.type=h,this.nativeEvent=S,this.target=O,this.currentTarget=null;for(var et in o)o.hasOwnProperty(et)&&(u=o[et],this[et]=u?u(S):S[et]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?ja:fa,this.isPropagationStopped=fa,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=ja)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=ja)},persist:function(){},isPersistent:ja}),a}var _o={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uo=Ii(_o),Es=g({},_o,{view:0,detail:0}),da=Ii(Es),ha,Vs,Ts,Ns=g({},Es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ge,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Ts&&(Ts&&o.type==="mousemove"?(ha=o.screenX-Ts.screenX,Vs=o.screenY-Ts.screenY):Vs=ha=0,Ts=o),ha)},movementY:function(o){return"movementY"in o?o.movementY:Vs}}),rl=Ii(Ns),ns=g({},Ns,{dataTransfer:0}),_s=Ii(ns),Il=g({},Es,{relatedTarget:0}),Ba=Ii(Il),jl=g({},_o,{animationName:0,elapsedTime:0,pseudoElement:0}),pa=Ii(jl),Bl=g({},_o,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),A=Ii(Bl),B=g({},_o,{data:0}),ht=Ii(B),Tt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bt={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"},ne={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xe(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=ne[o])?!!a[o]:!1}function Ge(){return xe}var un=g({},Es,{key:function(o){if(o.key){var a=Tt[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=no(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Bt[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ge,charCode:function(o){return o.type==="keypress"?no(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?no(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),In=Ii(un),Bn=g({},Ns,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),or=Ii(Bn),$i=g({},Es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ge}),ue=Ii($i),Sr=g({},_o,{propertyName:0,elapsedTime:0,pseudoElement:0}),$r=Ii(Sr),sn=g({},Ns,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),an=Ii(sn),Do=g({},_o,{newState:0,oldState:0}),Ws=Ii(Do),Fc=[9,13,27,32],gr=zo&&"CompositionEvent"in window,yo=null;zo&&"documentMode"in document&&(yo=document.documentMode);var il=zo&&"TextEvent"in window&&!yo,Xs=zo&&(!gr||yo&&8<yo&&11>=yo),zl=" ",za=!1;function Vi(o,a){switch(o){case"keyup":return Fc.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gs(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var rs=!1;function pc(o,a){switch(o){case"compositionend":return Gs(a);case"keypress":return a.which!==32?null:(za=!0,zl);case"textInput":return o=a.data,o===zl&&za?null:o;default:return null}}function Ks(o,a){if(rs)return o==="compositionend"||!gr&&Vi(o,a)?(o=Ia(),Cs=nl=No=null,rs=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Xs&&a.locale!=="ko"?null:a.data;default:return null}}var bo={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 mc(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!bo[o.type]:a==="textarea"}function ol(o,a,u,h){es?vn?vn.push(h):vn=[h]:es=h,a=nm(a,"onChange"),0<a.length&&(u=new Uo("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var Js=null,pi=null;function sl(o){Cx(o,0)}function ma(o){var a=Qa(o);if(qi(a))return o}function al(o,a){if(o==="change")return a}var xo=!1;if(zo){var ji;if(zo){var _i="oninput"in document;if(!_i){var Qr=document.createElement("div");Qr.setAttribute("oninput","return;"),_i=typeof Qr.oninput=="function"}ji=_i}else ji=!1;xo=ji&&(!document.documentMode||9<document.documentMode)}function Fa(){Js&&(Js.detachEvent("onpropertychange",ga),pi=Js=null)}function ga(o){if(o.propertyName==="value"&&ma(pi)){var a=[];ol(a,pi,o,fc(o)),hc(sl,a)}}function ya(o,a,u){o==="focusin"?(Fa(),Js=a,pi=u,Js.attachEvent("onpropertychange",ga)):o==="focusout"&&Fa()}function Me(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return ma(pi)}function Wi(o,a){if(o==="click")return ma(a)}function bi(o,a){if(o==="input"||o==="change")return ma(a)}function Uc(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var mi=typeof Object.is=="function"?Object.is:Uc;function ro(o,a){if(mi(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var u=Object.keys(o),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var x=u[h];if(!be.call(a,x)||!mi(o[x],a[x]))return!1}return!0}function ll(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Fl(o,a){var u=ll(o);o=0;for(var h;u;){if(u.nodeType===3){if(h=o+u.textContent.length,o<=a&&h>=a)return{node:u,offset:a-o};o=h}t:{for(;u;){if(u.nextSibling){u=u.nextSibling;break t}u=u.parentNode}u=void 0}u=ll(u)}}function gc(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?gc(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function Ul(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Yr(o.document);a instanceof o.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)o=a.contentWindow;else break;a=Yr(o.document)}return a}function ba(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}var cl=zo&&"documentMode"in document&&11>=document.documentMode,is=null,Ds=null,io=null,Zs=!1;function oo(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Zs||is==null||is!==Yr(h)||(h=is,"selectionStart"in h&&ba(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),io&&ro(io,h)||(io=h,h=nm(Ds,"onSelect"),0<h.length&&(a=new Uo("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=is)))}function so(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var yr={animationend:so("Animation","AnimationEnd"),animationiteration:so("Animation","AnimationIteration"),animationstart:so("Animation","AnimationStart"),transitionrun:so("Transition","TransitionRun"),transitionstart:so("Transition","TransitionStart"),transitioncancel:so("Transition","TransitionCancel"),transitionend:so("Transition","TransitionEnd")},Mr={},ti={};zo&&(ti=document.createElement("div").style,"AnimationEvent"in window||(delete yr.animationend.animation,delete yr.animationiteration.animation,delete yr.animationstart.animation),"TransitionEvent"in window||delete yr.transitionend.transition);function Dr(o){if(Mr[o])return Mr[o];if(!yr[o])return o;var a=yr[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in ti)return Mr[o]=a[u];return o}var ss=Dr("animationend"),Hl=Dr("animationiteration"),ul=Dr("animationstart"),Hc=Dr("transitionrun"),wf=Dr("transitionstart"),cd=Dr("transitioncancel"),Nu=Dr("transitionend"),Sf=new Map,fl="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");fl.push("scrollEnd");function as(o,a){Sf.set(o,a),qr(a,[o])}var yc=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Ho=[],dl=0,qc=0;function bc(){for(var o=dl,a=qc=dl=0;a<o;){var u=Ho[a];Ho[a++]=null;var h=Ho[a];Ho[a++]=null;var x=Ho[a];Ho[a++]=null;var S=Ho[a];if(Ho[a++]=null,h!==null&&x!==null){var O=h.pending;O===null?x.next=x:(x.next=O.next,O.next=x),h.pending=x}S!==0&&vc(u,x,S)}}function xc(o,a,u,h){Ho[dl++]=o,Ho[dl++]=a,Ho[dl++]=u,Ho[dl++]=h,qc|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function Yc(o,a,u,h){return xc(o,a,u,h),ao(o)}function xa(o,a){return xc(o,null,null,a),ao(o)}function vc(o,a,u){o.lanes|=u;var h=o.alternate;h!==null&&(h.lanes|=u);for(var x=!1,S=o.return;S!==null;)S.childLanes|=u,h=S.alternate,h!==null&&(h.childLanes|=u),S.tag===22&&(o=S.stateNode,o===null||o._visibility&1||(x=!0)),o=S,S=S.return;return o.tag===3?(S=o.stateNode,x&&a!==null&&(x=31-$n(u),o=S.hiddenUpdates,h=o[x],h===null?o[x]=[a]:h.push(a),a.lane=u|536870912),S):null}function ao(o){if(50<kh)throw kh=0,n1=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Xi={};function $c(o,a,u,h){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vo(o,a,u,h){return new $c(o,a,u,h)}function Vc(o){return o=o.prototype,!(!o||!o.isReactComponent)}function ls(o,a){var u=o.alternate;return u===null?(u=vo(o.tag,a,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=a,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&65011712,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,a=o.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u.refCleanup=o.refCleanup,u}function wc(o,a){o.flags&=65011714;var u=o.alternate;return u===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=u.childLanes,o.lanes=u.lanes,o.child=u.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=u.memoizedProps,o.memoizedState=u.memoizedState,o.updateQueue=u.updateQueue,o.type=u.type,a=u.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function Qs(o,a,u,h,x,S){var O=0;if(h=o,typeof o=="function")Vc(o)&&(O=1);else if(typeof o=="string")O=R6(o,u,tt.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case ot:return o=vo(31,u,a,x),o.elementType=ot,o.lanes=S,o;case C:return Ua(u.children,x,S,a);case D:O=8,x|=24;break;case L:return o=vo(12,u,a,x|2),o.elementType=L,o.lanes=S,o;case St:return o=vo(13,u,a,x),o.elementType=St,o.lanes=S,o;case _t:return o=vo(19,u,a,x),o.elementType=_t,o.lanes=S,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case Y:O=10;break t;case H:O=9;break t;case W:O=11;break t;case Ct:O=14;break t;case bt:O=16,h=null;break t}O=29,u=Error(r(130,o===null?"null":typeof o,"")),h=null}return a=vo(O,u,a,x),a.elementType=o,a.type=h,a.lanes=S,a}function Ua(o,a,u,h){return o=vo(7,o,h,a),o.lanes=u,o}function Sc(o,a,u){return o=vo(6,o,null,a),o.lanes=u,o}function Wc(o){var a=vo(18,null,null,0);return a.stateNode=o,a}function ql(o,a,u){return a=vo(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var Yl=new WeakMap;function wo(o,a){if(typeof o=="object"&&o!==null){var u=Yl.get(o);return u!==void 0?u:(a={value:o,source:a,stack:on(a)},Yl.set(o,a),a)}return{value:o,source:a,stack:on(a)}}var $l=[],Ls=0,Xc=null,kc=0,cs=[],us=0,Ha=null,fs=1,ds="";function xi(o,a){$l[Ls++]=kc,$l[Ls++]=Xc,Xc=o,kc=a}function Gc(o,a,u){cs[us++]=fs,cs[us++]=ds,cs[us++]=Ha,Ha=o;var h=fs;o=ds;var x=32-$n(h)-1;h&=~(1<<x),u+=1;var S=32-$n(a)+x;if(30<S){var O=x-x%5;S=(h&(1<<O)-1).toString(32),h>>=O,x-=O,fs=1<<32-$n(a)+x|u<<x|h,ds=S+o}else fs=1<<S|u<<x|h,ds=o}function ta(o){o.return!==null&&(xi(o,1),Gc(o,1,0))}function Vl(o){for(;o===Xc;)Xc=$l[--Ls],$l[Ls]=null,kc=$l[--Ls],$l[Ls]=null;for(;o===Ha;)Ha=cs[--us],cs[us]=null,ds=cs[--us],cs[us]=null,fs=cs[--us],cs[us]=null}function ud(o,a){cs[us++]=fs,cs[us++]=ds,cs[us++]=Ha,fs=a.id,ds=a.overflow,Ha=o}var lo=null,Lr=null,tr=!1,Lo=null,ei=!1,ea=Error(r(519));function na(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ac(wo(a,o)),ea}function hl(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[Ar]=o,a[ir]=h,u){case"dialog":lr("cancel",a),lr("close",a);break;case"iframe":case"object":case"embed":lr("load",a);break;case"video":case"audio":for(u=0;u<Mh.length;u++)lr(Mh[u],a);break;case"source":lr("error",a);break;case"img":case"image":case"link":lr("error",a),lr("load",a);break;case"details":lr("toggle",a);break;case"input":lr("invalid",a),Ys(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":lr("invalid",a);break;case"textarea":lr("invalid",a),$s(a,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||h.suppressHydrationWarning===!0||_x(a.textContent,u)?(h.popover!=null&&(lr("beforetoggle",a),lr("toggle",a)),h.onScroll!=null&&lr("scroll",a),h.onScrollEnd!=null&&lr("scrollend",a),h.onClick!=null&&(a.onclick=Bo),a=!0):a=!1,a||na(o,!0)}function ra(o){for(lo=o.return;lo;)switch(lo.tag){case 5:case 31:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:lo=lo.return}}function Bi(o){if(o!==lo)return!1;if(!tr)return ra(o),tr=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||y1(o.type,o.memoizedProps)),u=!u),u&&Lr&&na(o),ra(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Lr=zx(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Lr=zx(o)}else a===27?(a=Lr,Fu(o.type)?(o=S1,S1=null,Lr=o):Lr=a):Lr=lo?xl(o.stateNode.nextSibling):null;return!0}function va(){Lr=lo=null,tr=!1}function kf(){var o=Lo;return o!==null&&(Ta===null?Ta=o:Ta.push.apply(Ta,o),Lo=null),o}function Ac(o){Lo===null?Lo=[o]:Lo.push(o)}var Kc=K(null),qa=null,wa=null;function hs(o,a,u){X(Kc,a._currentValue),a._currentValue=u}function Rs(o){o._currentValue=Kc.current,P(Kc)}function Wl(o,a,u){for(;o!==null;){var h=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),o===u)break;o=o.return}}function Gi(o,a,u,h){var x=o.child;for(x!==null&&(x.return=o);x!==null;){var S=x.dependencies;if(S!==null){var O=x.child;S=S.firstContext;t:for(;S!==null;){var et=S;S=x;for(var Nt=0;Nt<a.length;Nt++)if(et.context===a[Nt]){S.lanes|=u,et=S.alternate,et!==null&&(et.lanes|=u),Wl(S.return,u,o),h||(O=null);break t}S=et.next}}else if(x.tag===18){if(O=x.return,O===null)throw Error(r(341));O.lanes|=u,S=O.alternate,S!==null&&(S.lanes|=u),Wl(O,u,o),O=null}else O=x.child;if(O!==null)O.return=x;else for(O=x;O!==null;){if(O===o){O=null;break}if(x=O.sibling,x!==null){x.return=O.return,O=x;break}O=O.return}x=O}}function Sa(o,a,u,h){o=null;for(var x=a,S=!1;x!==null;){if(!S){if((x.flags&524288)!==0)S=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var O=x.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var et=x.type;mi(x.pendingProps.value,O.value)||(o!==null?o.push(et):o=[et])}}else if(x===kt.current){if(O=x.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(o!==null?o.push(_h):o=[_h])}x=x.return}o!==null&&Gi(a,o,u,h),a.flags|=262144}function Jc(o){for(o=o.firstContext;o!==null;){if(!mi(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function pl(o){qa=o,wa=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Di(o){return _u(qa,o)}function Mc(o,a){return qa===null&&pl(o),_u(o,a)}function _u(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},wa===null){if(o===null)throw Error(r(308));wa=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else wa=wa.next=a;return u}var ah=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(u,h){o.push(h)}};this.abort=function(){a.aborted=!0,o.forEach(function(u){return u()})}},Cc=n.unstable_scheduleCallback,fd=n.unstable_NormalPriority,Vr={$$typeof:Y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ka(){return{controller:new ah,data:new Map,refCount:0}}function ml(o){o.refCount--,o.refCount===0&&Cc(fd,function(){o.controller.abort()})}var Xl=null,Zc=0,m=0,v=null;function E(o,a){if(Xl===null){var u=Xl=[];Zc=0,m=l1(),v={status:"pending",value:void 0,then:function(h){u.push(h)}}}return Zc++,a.then(R,R),a}function R(){if(--Zc===0&&Xl!==null){v!==null&&(v.status="fulfilled");var o=Xl;Xl=null,m=0,v=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function F(o,a){var u=[],h={status:"pending",value:null,reason:null,then:function(x){u.push(x)}};return o.then(function(){h.status="fulfilled",h.value=a;for(var x=0;x<u.length;x++)(0,u[x])(a)},function(x){for(h.status="rejected",h.reason=x,x=0;x<u.length;x++)(0,u[x])(void 0)}),h}var q=dt.S;dt.S=function(o,a){tx=hn(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&E(o,a),q!==null&&q(o,a)};var $=K(null);function Q(){var o=$.current;return o!==null?o:si.pooledCache}function at(o,a){a===null?X($,$.current):X($,a.pool)}function mt(){var o=Q();return o===null?null:{parent:Vr._currentValue,pool:o}}var Dt=Error(r(460)),Wt=Error(r(474)),pt=Error(r(542)),Ot={then:function(){}};function Ht(o){return o=o.status,o==="fulfilled"||o==="rejected"}function ie(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then(Bo,Bo),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,Se(o),o;default:if(typeof a.status=="string")a.then(Bo,Bo);else{if(o=si,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(h){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=h}},function(h){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,Se(o),o}throw re=a,Dt}}function $t(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(re=u,Dt):u}}var re=null;function ce(){if(re===null)throw Error(r(459));var o=re;return re=null,o}function Se(o){if(o===Dt||o===pt)throw Error(r(483))}var ge=null,Ze=0;function $e(o){var a=Ze;return Ze+=1,ge===null&&(ge=[]),ie(ge,o,a)}function Dn(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function nn(o,a){throw a.$$typeof===b?Error(r(525)):(o=Object.prototype.toString.call(a),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o)))}function Jn(o){function a(Ut,Pt){if(o){var Gt=Ut.deletions;Gt===null?(Ut.deletions=[Pt],Ut.flags|=16):Gt.push(Pt)}}function u(Ut,Pt){if(!o)return null;for(;Pt!==null;)a(Ut,Pt),Pt=Pt.sibling;return null}function h(Ut){for(var Pt=new Map;Ut!==null;)Ut.key!==null?Pt.set(Ut.key,Ut):Pt.set(Ut.index,Ut),Ut=Ut.sibling;return Pt}function x(Ut,Pt){return Ut=ls(Ut,Pt),Ut.index=0,Ut.sibling=null,Ut}function S(Ut,Pt,Gt){return Ut.index=Gt,o?(Gt=Ut.alternate,Gt!==null?(Gt=Gt.index,Gt<Pt?(Ut.flags|=67108866,Pt):Gt):(Ut.flags|=67108866,Pt)):(Ut.flags|=1048576,Pt)}function O(Ut){return o&&Ut.alternate===null&&(Ut.flags|=67108866),Ut}function et(Ut,Pt,Gt,he){return Pt===null||Pt.tag!==6?(Pt=Sc(Gt,Ut.mode,he),Pt.return=Ut,Pt):(Pt=x(Pt,Gt),Pt.return=Ut,Pt)}function Nt(Ut,Pt,Gt,he){var An=Gt.type;return An===C?ae(Ut,Pt,Gt.props.children,he,Gt.key):Pt!==null&&(Pt.elementType===An||typeof An=="object"&&An!==null&&An.$$typeof===bt&&$t(An)===Pt.type)?(Pt=x(Pt,Gt.props),Dn(Pt,Gt),Pt.return=Ut,Pt):(Pt=Qs(Gt.type,Gt.key,Gt.props,null,Ut.mode,he),Dn(Pt,Gt),Pt.return=Ut,Pt)}function Kt(Ut,Pt,Gt,he){return Pt===null||Pt.tag!==4||Pt.stateNode.containerInfo!==Gt.containerInfo||Pt.stateNode.implementation!==Gt.implementation?(Pt=ql(Gt,Ut.mode,he),Pt.return=Ut,Pt):(Pt=x(Pt,Gt.children||[]),Pt.return=Ut,Pt)}function ae(Ut,Pt,Gt,he,An){return Pt===null||Pt.tag!==7?(Pt=Ua(Gt,Ut.mode,he,An),Pt.return=Ut,Pt):(Pt=x(Pt,Gt),Pt.return=Ut,Pt)}function ye(Ut,Pt,Gt){if(typeof Pt=="string"&&Pt!==""||typeof Pt=="number"||typeof Pt=="bigint")return Pt=Sc(""+Pt,Ut.mode,Gt),Pt.return=Ut,Pt;if(typeof Pt=="object"&&Pt!==null){switch(Pt.$$typeof){case y:return Gt=Qs(Pt.type,Pt.key,Pt.props,null,Ut.mode,Gt),Dn(Gt,Pt),Gt.return=Ut,Gt;case M:return Pt=ql(Pt,Ut.mode,Gt),Pt.return=Ut,Pt;case bt:return Pt=$t(Pt),ye(Ut,Pt,Gt)}if(Lt(Pt)||ct(Pt))return Pt=Ua(Pt,Ut.mode,Gt,null),Pt.return=Ut,Pt;if(typeof Pt.then=="function")return ye(Ut,$e(Pt),Gt);if(Pt.$$typeof===Y)return ye(Ut,Mc(Ut,Pt),Gt);nn(Ut,Pt)}return null}function Jt(Ut,Pt,Gt,he){var An=Pt!==null?Pt.key:null;if(typeof Gt=="string"&&Gt!==""||typeof Gt=="number"||typeof Gt=="bigint")return An!==null?null:et(Ut,Pt,""+Gt,he);if(typeof Gt=="object"&&Gt!==null){switch(Gt.$$typeof){case y:return Gt.key===An?Nt(Ut,Pt,Gt,he):null;case M:return Gt.key===An?Kt(Ut,Pt,Gt,he):null;case bt:return Gt=$t(Gt),Jt(Ut,Pt,Gt,he)}if(Lt(Gt)||ct(Gt))return An!==null?null:ae(Ut,Pt,Gt,he,null);if(typeof Gt.then=="function")return Jt(Ut,Pt,$e(Gt),he);if(Gt.$$typeof===Y)return Jt(Ut,Pt,Mc(Ut,Gt),he);nn(Ut,Gt)}return null}function ee(Ut,Pt,Gt,he,An){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Ut=Ut.get(Gt)||null,et(Pt,Ut,""+he,An);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case y:return Ut=Ut.get(he.key===null?Gt:he.key)||null,Nt(Pt,Ut,he,An);case M:return Ut=Ut.get(he.key===null?Gt:he.key)||null,Kt(Pt,Ut,he,An);case bt:return he=$t(he),ee(Ut,Pt,Gt,he,An)}if(Lt(he)||ct(he))return Ut=Ut.get(Gt)||null,ae(Pt,Ut,he,An,null);if(typeof he.then=="function")return ee(Ut,Pt,Gt,$e(he),An);if(he.$$typeof===Y)return ee(Ut,Pt,Gt,Mc(Pt,he),An);nn(Pt,he)}return null}function ln(Ut,Pt,Gt,he){for(var An=null,Er=null,gn=Pt,Kn=Pt=0,mr=null;gn!==null&&Kn<Gt.length;Kn++){gn.index>Kn?(mr=gn,gn=null):mr=gn.sibling;var Tr=Jt(Ut,gn,Gt[Kn],he);if(Tr===null){gn===null&&(gn=mr);break}o&&gn&&Tr.alternate===null&&a(Ut,gn),Pt=S(Tr,Pt,Kn),Er===null?An=Tr:Er.sibling=Tr,Er=Tr,gn=mr}if(Kn===Gt.length)return u(Ut,gn),tr&&xi(Ut,Kn),An;if(gn===null){for(;Kn<Gt.length;Kn++)gn=ye(Ut,Gt[Kn],he),gn!==null&&(Pt=S(gn,Pt,Kn),Er===null?An=gn:Er.sibling=gn,Er=gn);return tr&&xi(Ut,Kn),An}for(gn=h(gn);Kn<Gt.length;Kn++)mr=ee(gn,Ut,Kn,Gt[Kn],he),mr!==null&&(o&&mr.alternate!==null&&gn.delete(mr.key===null?Kn:mr.key),Pt=S(mr,Pt,Kn),Er===null?An=mr:Er.sibling=mr,Er=mr);return o&&gn.forEach(function($u){return a(Ut,$u)}),tr&&xi(Ut,Kn),An}function Ln(Ut,Pt,Gt,he){if(Gt==null)throw Error(r(151));for(var An=null,Er=null,gn=Pt,Kn=Pt=0,mr=null,Tr=Gt.next();gn!==null&&!Tr.done;Kn++,Tr=Gt.next()){gn.index>Kn?(mr=gn,gn=null):mr=gn.sibling;var $u=Jt(Ut,gn,Tr.value,he);if($u===null){gn===null&&(gn=mr);break}o&&gn&&$u.alternate===null&&a(Ut,gn),Pt=S($u,Pt,Kn),Er===null?An=$u:Er.sibling=$u,Er=$u,gn=mr}if(Tr.done)return u(Ut,gn),tr&&xi(Ut,Kn),An;if(gn===null){for(;!Tr.done;Kn++,Tr=Gt.next())Tr=ye(Ut,Tr.value,he),Tr!==null&&(Pt=S(Tr,Pt,Kn),Er===null?An=Tr:Er.sibling=Tr,Er=Tr);return tr&&xi(Ut,Kn),An}for(gn=h(gn);!Tr.done;Kn++,Tr=Gt.next())Tr=ee(gn,Ut,Kn,Tr.value,he),Tr!==null&&(o&&Tr.alternate!==null&&gn.delete(Tr.key===null?Kn:Tr.key),Pt=S(Tr,Pt,Kn),Er===null?An=Tr:Er.sibling=Tr,Er=Tr);return o&&gn.forEach(function(Y6){return a(Ut,Y6)}),tr&&xi(Ut,Kn),An}function Kr(Ut,Pt,Gt,he){if(typeof Gt=="object"&&Gt!==null&&Gt.type===C&&Gt.key===null&&(Gt=Gt.props.children),typeof Gt=="object"&&Gt!==null){switch(Gt.$$typeof){case y:t:{for(var An=Gt.key;Pt!==null;){if(Pt.key===An){if(An=Gt.type,An===C){if(Pt.tag===7){u(Ut,Pt.sibling),he=x(Pt,Gt.props.children),he.return=Ut,Ut=he;break t}}else if(Pt.elementType===An||typeof An=="object"&&An!==null&&An.$$typeof===bt&&$t(An)===Pt.type){u(Ut,Pt.sibling),he=x(Pt,Gt.props),Dn(he,Gt),he.return=Ut,Ut=he;break t}u(Ut,Pt);break}else a(Ut,Pt);Pt=Pt.sibling}Gt.type===C?(he=Ua(Gt.props.children,Ut.mode,he,Gt.key),he.return=Ut,Ut=he):(he=Qs(Gt.type,Gt.key,Gt.props,null,Ut.mode,he),Dn(he,Gt),he.return=Ut,Ut=he)}return O(Ut);case M:t:{for(An=Gt.key;Pt!==null;){if(Pt.key===An)if(Pt.tag===4&&Pt.stateNode.containerInfo===Gt.containerInfo&&Pt.stateNode.implementation===Gt.implementation){u(Ut,Pt.sibling),he=x(Pt,Gt.children||[]),he.return=Ut,Ut=he;break t}else{u(Ut,Pt);break}else a(Ut,Pt);Pt=Pt.sibling}he=ql(Gt,Ut.mode,he),he.return=Ut,Ut=he}return O(Ut);case bt:return Gt=$t(Gt),Kr(Ut,Pt,Gt,he)}if(Lt(Gt))return ln(Ut,Pt,Gt,he);if(ct(Gt)){if(An=ct(Gt),typeof An!="function")throw Error(r(150));return Gt=An.call(Gt),Ln(Ut,Pt,Gt,he)}if(typeof Gt.then=="function")return Kr(Ut,Pt,$e(Gt),he);if(Gt.$$typeof===Y)return Kr(Ut,Pt,Mc(Ut,Gt),he);nn(Ut,Gt)}return typeof Gt=="string"&&Gt!==""||typeof Gt=="number"||typeof Gt=="bigint"?(Gt=""+Gt,Pt!==null&&Pt.tag===6?(u(Ut,Pt.sibling),he=x(Pt,Gt),he.return=Ut,Ut=he):(u(Ut,Pt),he=Sc(Gt,Ut.mode,he),he.return=Ut,Ut=he),O(Ut)):u(Ut,Pt)}return function(Ut,Pt,Gt,he){try{Ze=0;var An=Kr(Ut,Pt,Gt,he);return ge=null,An}catch(gn){if(gn===Dt||gn===pt)throw gn;var Er=vo(29,gn,null,Ut.mode);return Er.lanes=he,Er.return=Ut,Er}}}var jr=Jn(!0),zn=Jn(!1),Ve=!1;function Oe(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ni(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Mn(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function jn(o,a,u){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(_r&2)!==0){var x=h.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),h.pending=a,a=ao(o),vc(o,null,u),a}return xc(o,h,a,u),ao(o)}function kr(o,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,Xt(o,u)}}function zi(o,a){var u=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var x=null,S=null;if(u=u.firstBaseUpdate,u!==null){do{var O={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};S===null?x=S=O:S=S.next=O,u=u.next}while(u!==null);S===null?x=S=a:S=S.next=a}else x=S=a;u={baseState:h.baseState,firstBaseUpdate:x,lastBaseUpdate:S,shared:h.shared,callbacks:h.callbacks},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=a:o.next=a,u.lastBaseUpdate=a}var Fi=!1;function Rr(){if(Fi){var o=v;if(o!==null)throw o}}function ri(o,a,u,h){Fi=!1;var x=o.updateQueue;Ve=!1;var S=x.firstBaseUpdate,O=x.lastBaseUpdate,et=x.shared.pending;if(et!==null){x.shared.pending=null;var Nt=et,Kt=Nt.next;Nt.next=null,O===null?S=Kt:O.next=Kt,O=Nt;var ae=o.alternate;ae!==null&&(ae=ae.updateQueue,et=ae.lastBaseUpdate,et!==O&&(et===null?ae.firstBaseUpdate=Kt:et.next=Kt,ae.lastBaseUpdate=Nt))}if(S!==null){var ye=x.baseState;O=0,ae=Kt=Nt=null,et=S;do{var Jt=et.lane&-536870913,ee=Jt!==et.lane;if(ee?(pr&Jt)===Jt:(h&Jt)===Jt){Jt!==0&&Jt===m&&(Fi=!0),ae!==null&&(ae=ae.next={lane:0,tag:et.tag,payload:et.payload,callback:null,next:null});t:{var ln=o,Ln=et;Jt=a;var Kr=u;switch(Ln.tag){case 1:if(ln=Ln.payload,typeof ln=="function"){ye=ln.call(Kr,ye,Jt);break t}ye=ln;break t;case 3:ln.flags=ln.flags&-65537|128;case 0:if(ln=Ln.payload,Jt=typeof ln=="function"?ln.call(Kr,ye,Jt):ln,Jt==null)break t;ye=g({},ye,Jt);break t;case 2:Ve=!0}}Jt=et.callback,Jt!==null&&(o.flags|=64,ee&&(o.flags|=8192),ee=x.callbacks,ee===null?x.callbacks=[Jt]:ee.push(Jt))}else ee={lane:Jt,tag:et.tag,payload:et.payload,callback:et.callback,next:null},ae===null?(Kt=ae=ee,Nt=ye):ae=ae.next=ee,O|=Jt;if(et=et.next,et===null){if(et=x.shared.pending,et===null)break;ee=et,et=ee.next,ee.next=null,x.lastBaseUpdate=ee,x.shared.pending=null}}while(!0);ae===null&&(Nt=ye),x.baseState=Nt,x.firstBaseUpdate=Kt,x.lastBaseUpdate=ae,S===null&&(x.shared.lanes=0),Pu|=O,o.lanes=O,o.memoizedState=ye}}function Ui(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function ii(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)Ui(u[o],a)}var Un=K(null),kn=K(0);function Nr(o,a){o=uu,X(kn,o),X(Un,a),uu=o|a.baseLanes}function er(){X(kn,uu),X(Un,Un.current)}function w(){uu=kn.current,P(Un),P(kn)}var k=K(null),_=null;function N(o){var a=o.alternate;X(J,J.current&1),X(k,o),_===null&&(a===null||Un.current!==null||a.memoizedState!==null)&&(_=o)}function j(o){X(J,J.current),X(k,o),_===null&&(_=o)}function G(o){o.tag===22?(X(J,J.current),X(k,o),_===null&&(_=o)):nt()}function nt(){X(J,J.current),X(k,k.current)}function z(o){P(k),_===o&&(_=null),P(J)}var J=K(0);function ut(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||v1(u)||w1(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var it=0,rt=null,I=null,Mt=null,It=!1,wt=!1,Et=!1,yt=0,Ft=0,Vt=null,pe=0;function se(){throw Error(r(321))}function Ee(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!mi(o[u],a[u]))return!1;return!0}function Qe(o,a,u,h,x,S){return it=S,rt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,dt.H=o===null||o.memoizedState===null?fb:D0,Et=!1,S=u(h,x),Et=!1,wt&&(S=fe(a,u,h,x)),En(o),S}function En(o){dt.H=ph;var a=I!==null&&I.next!==null;if(it=0,Mt=I=rt=null,It=!1,Ft=0,Vt=null,a)throw Error(r(300));o===null||ko||(o=o.dependencies,o!==null&&Jc(o)&&(ko=!0))}function fe(o,a,u,h){rt=o;var x=0;do{if(wt&&(Vt=null),Ft=0,wt=!1,25<=x)throw Error(r(301));if(x+=1,Mt=I=null,o.updateQueue!=null){var S=o.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}dt.H=db,S=a(u,h)}while(wt);return S}function Xe(){var o=dt.H,a=o.useState()[0];return a=typeof a.then=="function"?ke(a):a,o=o.useState()[0],(I!==null?I.memoizedState:null)!==o&&(rt.flags|=1024),a}function we(){var o=yt!==0;return yt=0,o}function Tn(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function Yt(o){if(It){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}It=!1}it=0,Mt=I=rt=null,wt=!1,Ft=yt=0,Vt=null}function De(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?rt.memoizedState=Mt=o:Mt=Mt.next=o,Mt}function ze(){if(I===null){var o=rt.alternate;o=o!==null?o.memoizedState:null}else o=I.next;var a=Mt===null?rt.memoizedState:Mt.next;if(a!==null)Mt=a,I=o;else{if(o===null)throw rt.alternate===null?Error(r(467)):Error(r(310));I=o,o={memoizedState:I.memoizedState,baseState:I.baseState,baseQueue:I.baseQueue,queue:I.queue,next:null},Mt===null?rt.memoizedState=Mt=o:Mt=Mt.next=o}return Mt}function Fe(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ke(o){var a=Ft;return Ft+=1,Vt===null&&(Vt=[]),o=ie(Vt,o,a),a=rt,(Mt===null?a.memoizedState:Mt.next)===null&&(a=a.alternate,dt.H=a===null||a.memoizedState===null?fb:D0),o}function _n(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return ke(o);if(o.$$typeof===Y)return Di(o)}throw Error(r(438,String(o)))}function qe(o){var a=null,u=rt.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=rt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=Fe(),rt.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(o),h=0;h<o;h++)u[h]=jt;return a.index++,u}function nr(o,a){return typeof a=="function"?a(o):a}function sr(o){var a=ze();return br(a,I,o)}function br(o,a,u){var h=o.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var x=o.baseQueue,S=h.pending;if(S!==null){if(x!==null){var O=x.next;x.next=S.next,S.next=O}a.baseQueue=x=S,h.pending=null}if(S=o.baseState,x===null)o.memoizedState=S;else{a=x.next;var et=O=null,Nt=null,Kt=a,ae=!1;do{var ye=Kt.lane&-536870913;if(ye!==Kt.lane?(pr&ye)===ye:(it&ye)===ye){var Jt=Kt.revertLane;if(Jt===0)Nt!==null&&(Nt=Nt.next={lane:0,revertLane:0,gesture:null,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null}),ye===m&&(ae=!0);else if((it&Jt)===Jt){Kt=Kt.next,Jt===m&&(ae=!0);continue}else ye={lane:0,revertLane:Kt.revertLane,gesture:null,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null},Nt===null?(et=Nt=ye,O=S):Nt=Nt.next=ye,rt.lanes|=Jt,Pu|=Jt;ye=Kt.action,Et&&u(S,ye),S=Kt.hasEagerState?Kt.eagerState:u(S,ye)}else Jt={lane:ye,revertLane:Kt.revertLane,gesture:Kt.gesture,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null},Nt===null?(et=Nt=Jt,O=S):Nt=Nt.next=Jt,rt.lanes|=ye,Pu|=ye;Kt=Kt.next}while(Kt!==null&&Kt!==a);if(Nt===null?O=S:Nt.next=et,!mi(S,o.memoizedState)&&(ko=!0,ae&&(u=v,u!==null)))throw u;o.memoizedState=S,o.baseState=O,o.baseQueue=Nt,h.lastRenderedState=S}return x===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function oi(o){var a=ze(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var h=u.dispatch,x=u.pending,S=a.memoizedState;if(x!==null){u.pending=null;var O=x=x.next;do S=o(S,O.action),O=O.next;while(O!==x);mi(S,a.memoizedState)||(ko=!0),a.memoizedState=S,a.baseQueue===null&&(a.baseState=S),u.lastRenderedState=S}return[S,h]}function Wr(o,a,u){var h=rt,x=ze(),S=tr;if(S){if(u===void 0)throw Error(r(407));u=u()}else u=a();var O=!mi((I||x).memoizedState,u);if(O&&(x.memoizedState=u,ko=!0),x=x.queue,vr(vi.bind(null,h,x,o),[o]),x.getSnapshot!==a||O||Mt!==null&&Mt.memoizedState.tag&1){if(h.flags|=2048,co(9,{destroy:void 0},Cr.bind(null,h,x,u,a),null),si===null)throw Error(r(349));S||(it&127)!==0||hr(h,a,u)}return u}function hr(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=rt.updateQueue,a===null?(a=Fe(),rt.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function Cr(o,a,u,h){a.value=u,a.getSnapshot=h,So(a)&&Qc(o)}function vi(o,a,u){return u(function(){So(a)&&Qc(o)})}function So(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!mi(o,u)}catch{return!0}}function Qc(o){var a=xa(o,2);a!==null&&Na(a,o,2)}function ia(o){var a=De();if(typeof o=="function"){var u=o;if(o=u(),Et){pn(!0);try{u()}finally{pn(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nr,lastRenderedState:o},a}function Af(o,a,u,h){return o.baseState=u,br(o,I,typeof h=="function"?h:nr)}function Du(o,a,u,h,x){if(jp(o))throw Error(r(485));if(o=a.action,o!==null){var S={payload:x,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){S.listeners.push(O)}};dt.T!==null?u(!0):S.isTransition=!1,h(S),u=a.pending,u===null?(S.next=a.pending=S,Gl(a,S)):(S.next=u.next,a.pending=u.next=S)}}function Gl(o,a){var u=a.action,h=a.payload,x=o.state;if(a.isTransition){var S=dt.T,O={};dt.T=O;try{var et=u(x,h),Nt=dt.S;Nt!==null&&Nt(O,et),tu(o,a,et)}catch(Kt){gl(o,a,Kt)}finally{S!==null&&O.types!==null&&(S.types=O.types),dt.T=S}}else try{S=u(x,h),tu(o,a,S)}catch(Kt){gl(o,a,Kt)}}function tu(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){Lu(o,a,h)},function(h){return gl(o,a,h)}):Lu(o,a,u)}function Lu(o,a,u){a.status="fulfilled",a.value=u,eu(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,Gl(o,u)))}function gl(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,eu(a),a=a.next;while(a!==h)}o.action=null}function eu(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function nu(o,a){return a}function Xr(o,a){if(tr){var u=si.formState;if(u!==null){t:{var h=rt;if(tr){if(Lr){e:{for(var x=Lr,S=ei;x.nodeType!==8;){if(!S){x=null;break e}if(x=xl(x.nextSibling),x===null){x=null;break e}}S=x.data,x=S==="F!"||S==="F"?x:null}if(x){Lr=xl(x.nextSibling),h=x.data==="F!";break t}}na(h)}h=!1}h&&(a=u[0])}}return u=De(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nu,lastRenderedState:a},u.queue=h,u=lb.bind(null,rt,h),h.dispatch=u,h=ia(!1),S=_0.bind(null,rt,!1,h.queue),h=De(),x={state:a,dispatch:null,action:o,pending:null},h.queue=x,u=Du.bind(null,rt,x,S,u),x.dispatch=u,h.memoizedState=o,[a,u,!1]}function qo(o){var a=ze();return Br(a,I,o)}function Br(o,a,u){if(a=br(o,a,nu)[0],o=sr(nr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=ke(a)}catch(O){throw O===Dt?pt:O}else h=a;a=ze();var x=a.queue,S=x.dispatch;return u!==a.memoizedState&&(rt.flags|=2048,co(9,{destroy:void 0},Ro.bind(null,x,u),null)),[h,S,o]}function Ro(o,a){o.action=a}function Os(o){var a=ze(),u=I;if(u!==null)return Br(a,u,o);ze(),a=a.memoizedState,u=ze();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function co(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=rt.updateQueue,a===null&&(a=Fe(),rt.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=o.next=o:(h=u.next,u.next=o,o.next=h,a.lastEffect=o),o}function Or(){return ze().memoizedState}function zr(o,a,u,h){var x=De();rt.flags|=o,x.memoizedState=co(1|a,{destroy:void 0},u,h===void 0?null:h)}function Aa(o,a,u,h){var x=ze();h=h===void 0?null:h;var S=x.memoizedState.inst;I!==null&&h!==null&&Ee(h,I.memoizedState.deps)?x.memoizedState=co(a,S,u,h):(rt.flags|=o,x.memoizedState=co(1|a,S,u,h))}function ru(o,a){zr(8390656,8,o,a)}function vr(o,a){Aa(2048,8,o,a)}function ps(o){rt.flags|=4;var a=rt.updateQueue;if(a===null)a=Fe(),rt.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function yl(o){var a=ze().memoizedState;return ps({ref:a,nextImpl:o}),function(){if((_r&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Mf(o,a){return Aa(4,2,o,a)}function lh(o,a){return Aa(4,4,o,a)}function ch(o,a){if(typeof a=="function"){o=o();var u=a(o);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function bl(o,a,u){u=u!=null?u.concat([o]):null,Aa(4,4,ch.bind(null,a,o),u)}function oa(){}function Op(o,a){var u=ze();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&Ee(a,h[1])?h[0]:(u.memoizedState=[o,a],o)}function Pp(o,a){var u=ze();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&Ee(a,h[1]))return h[0];if(h=o(),Et){pn(!0);try{o()}finally{pn(!1)}}return u.memoizedState=[h,a],h}function uh(o,a,u){return u===void 0||(it&1073741824)!==0&&(pr&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=nx(),rt.lanes|=o,Pu|=o,u)}function Ip(o,a,u,h){return mi(u,a)?u:Un.current!==null?(o=uh(o,u,h),mi(o,a)||(ko=!0),o):(it&42)===0||(it&1073741824)!==0&&(pr&261930)===0?(ko=!0,o.memoizedState=u):(o=nx(),rt.lanes|=o,Pu|=o,a)}function fh(o,a,u,h,x){var S=st.p;st.p=S!==0&&8>S?S:8;var O=dt.T,et={};dt.T=et,_0(o,!1,a,u);try{var Nt=x(),Kt=dt.S;if(Kt!==null&&Kt(et,Nt),Nt!==null&&typeof Nt=="object"&&typeof Nt.then=="function"){var ae=F(Nt,h);hh(o,a,ae,Va(o))}else hh(o,a,h,Va(o))}catch(ye){hh(o,a,{then:function(){},status:"rejected",reason:ye},Va())}finally{st.p=S,O!==null&&et.types!==null&&(O.types=et.types),dt.T=O}}function T0(){}function dh(o,a,u,h){if(o.tag!==5)throw Error(r(476));var x=ib(o).queue;fh(o,x,a,lt,u===null?T0:function(){return ob(o),u(h)})}function ib(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:lt,baseState:lt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nr,lastRenderedState:lt},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nr,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function ob(o){var a=ib(o);a.next===null&&(a=o.alternate.memoizedState),hh(o,a.next.queue,{},Va())}function N0(){return Di(_h)}function sb(){return ze().memoizedState}function ab(){return ze().memoizedState}function FC(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=Va();o=Mn(u);var h=jn(a,o,u);h!==null&&(Na(h,a,u),kr(h,a,u)),a={cache:ka()},o.payload=a;return}a=a.return}}function UC(o,a,u){var h=Va();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},jp(o)?cb(a,u):(u=Yc(o,a,u,h),u!==null&&(Na(u,o,h),ub(u,a,h)))}function lb(o,a,u){var h=Va();hh(o,a,u,h)}function hh(o,a,u,h){var x={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(jp(o))cb(a,x);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var O=a.lastRenderedState,et=S(O,u);if(x.hasEagerState=!0,x.eagerState=et,mi(et,O))return xc(o,a,x,0),si===null&&bc(),!1}catch{}if(u=Yc(o,a,x,h),u!==null)return Na(u,o,h),ub(u,a,h),!0}return!1}function _0(o,a,u,h){if(h={lane:2,revertLane:l1(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},jp(o)){if(a)throw Error(r(479))}else a=Yc(o,u,h,2),a!==null&&Na(a,o,2)}function jp(o){var a=o.alternate;return o===rt||a!==null&&a===rt}function cb(o,a){wt=It=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function ub(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,Xt(o,u)}}var ph={readContext:Di,use:_n,useCallback:se,useContext:se,useEffect:se,useImperativeHandle:se,useLayoutEffect:se,useInsertionEffect:se,useMemo:se,useReducer:se,useRef:se,useState:se,useDebugValue:se,useDeferredValue:se,useTransition:se,useSyncExternalStore:se,useId:se,useHostTransitionStatus:se,useFormState:se,useActionState:se,useOptimistic:se,useMemoCache:se,useCacheRefresh:se};ph.useEffectEvent=se;var fb={readContext:Di,use:_n,useCallback:function(o,a){return De().memoizedState=[o,a===void 0?null:a],o},useContext:Di,useEffect:ru,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,zr(4194308,4,ch.bind(null,a,o),u)},useLayoutEffect:function(o,a){return zr(4194308,4,o,a)},useInsertionEffect:function(o,a){zr(4,2,o,a)},useMemo:function(o,a){var u=De();a=a===void 0?null:a;var h=o();if(Et){pn(!0);try{o()}finally{pn(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=De();if(u!==void 0){var x=u(a);if(Et){pn(!0);try{u(a)}finally{pn(!1)}}}else x=a;return h.memoizedState=h.baseState=x,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:x},h.queue=o,o=o.dispatch=UC.bind(null,rt,o),[h.memoizedState,o]},useRef:function(o){var a=De();return o={current:o},a.memoizedState=o},useState:function(o){o=ia(o);var a=o.queue,u=lb.bind(null,rt,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:oa,useDeferredValue:function(o,a){var u=De();return uh(u,o,a)},useTransition:function(){var o=ia(!1);return o=fh.bind(null,rt,o.queue,!0,!1),De().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=rt,x=De();if(tr){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),si===null)throw Error(r(349));(pr&127)!==0||hr(h,a,u)}x.memoizedState=u;var S={value:u,getSnapshot:a};return x.queue=S,ru(vi.bind(null,h,S,o),[o]),h.flags|=2048,co(9,{destroy:void 0},Cr.bind(null,h,S,u,a),null),u},useId:function(){var o=De(),a=si.identifierPrefix;if(tr){var u=ds,h=fs;u=(h&~(1<<32-$n(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=yt++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=pe++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:N0,useFormState:Xr,useActionState:Xr,useOptimistic:function(o){var a=De();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=_0.bind(null,rt,!0,u),u.dispatch=a,[o,a]},useMemoCache:qe,useCacheRefresh:function(){return De().memoizedState=FC.bind(null,rt)},useEffectEvent:function(o){var a=De(),u={impl:o};return a.memoizedState=u,function(){if((_r&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},D0={readContext:Di,use:_n,useCallback:Op,useContext:Di,useEffect:vr,useImperativeHandle:bl,useInsertionEffect:Mf,useLayoutEffect:lh,useMemo:Pp,useReducer:sr,useRef:Or,useState:function(){return sr(nr)},useDebugValue:oa,useDeferredValue:function(o,a){var u=ze();return Ip(u,I.memoizedState,o,a)},useTransition:function(){var o=sr(nr)[0],a=ze().memoizedState;return[typeof o=="boolean"?o:ke(o),a]},useSyncExternalStore:Wr,useId:sb,useHostTransitionStatus:N0,useFormState:qo,useActionState:qo,useOptimistic:function(o,a){var u=ze();return Af(u,I,o,a)},useMemoCache:qe,useCacheRefresh:ab};D0.useEffectEvent=yl;var db={readContext:Di,use:_n,useCallback:Op,useContext:Di,useEffect:vr,useImperativeHandle:bl,useInsertionEffect:Mf,useLayoutEffect:lh,useMemo:Pp,useReducer:oi,useRef:Or,useState:function(){return oi(nr)},useDebugValue:oa,useDeferredValue:function(o,a){var u=ze();return I===null?uh(u,o,a):Ip(u,I.memoizedState,o,a)},useTransition:function(){var o=oi(nr)[0],a=ze().memoizedState;return[typeof o=="boolean"?o:ke(o),a]},useSyncExternalStore:Wr,useId:sb,useHostTransitionStatus:N0,useFormState:Os,useActionState:Os,useOptimistic:function(o,a){var u=ze();return I!==null?Af(u,I,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:qe,useCacheRefresh:ab};db.useEffectEvent=yl;function L0(o,a,u,h){a=o.memoizedState,u=u(h,a),u=u==null?a:g({},a,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var R0={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=Va(),x=Mn(h);x.payload=a,u!=null&&(x.callback=u),a=jn(o,x,h),a!==null&&(Na(a,o,h),kr(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=Va(),x=Mn(h);x.tag=1,x.payload=a,u!=null&&(x.callback=u),a=jn(o,x,h),a!==null&&(Na(a,o,h),kr(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=Va(),h=Mn(u);h.tag=2,a!=null&&(h.callback=a),a=jn(o,h,u),a!==null&&(Na(a,o,u),kr(a,o,u))}};function hb(o,a,u,h,x,S,O){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,S,O):a.prototype&&a.prototype.isPureReactComponent?!ro(u,h)||!ro(x,S):!0}function pb(o,a,u,h){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==o&&R0.enqueueReplaceState(a,a.state,null)}function Cf(o,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(o=o.defaultProps){u===a&&(u=g({},u));for(var x in o)u[x]===void 0&&(u[x]=o[x])}return u}function mb(o){yc(o)}function gb(o){console.error(o)}function yb(o){yc(o)}function Bp(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function bb(o,a,u){try{var h=o.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function O0(o,a,u){return u=Mn(u),u.tag=3,u.payload={element:null},u.callback=function(){Bp(o,a)},u}function xb(o){return o=Mn(o),o.tag=3,o}function vb(o,a,u,h){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=h.value;o.payload=function(){return x(S)},o.callback=function(){bb(a,u,h)}}var O=u.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(o.callback=function(){bb(a,u,h),typeof x!="function"&&(Iu===null?Iu=new Set([this]):Iu.add(this));var et=h.stack;this.componentDidCatch(h.value,{componentStack:et!==null?et:""})})}function HC(o,a,u,h,x){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&Sa(a,u,x,!0),u=k.current,u!==null){switch(u.tag){case 31:case 13:return _===null?Kp():u.alternate===null&&Ki===0&&(Ki=3),u.flags&=-257,u.flags|=65536,u.lanes=x,h===Ot?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),o1(o,h,x)),!1;case 22:return u.flags|=65536,h===Ot?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([h]):u.add(h)),o1(o,h,x)),!1}throw Error(r(435,u.tag))}return o1(o,h,x),Kp(),!1}if(tr)return a=k.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,h!==ea&&(o=Error(r(422),{cause:h}),Ac(wo(o,u)))):(h!==ea&&(a=Error(r(423),{cause:h}),Ac(wo(a,u))),o=o.current.alternate,o.flags|=65536,x&=-x,o.lanes|=x,h=wo(h,u),x=O0(o.stateNode,h,x),zi(o,x),Ki!==4&&(Ki=2)),!1;var S=Error(r(520),{cause:h});if(S=wo(S,u),Sh===null?Sh=[S]:Sh.push(S),Ki!==4&&(Ki=2),a===null)return!0;h=wo(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=x&-x,u.lanes|=o,o=O0(u.stateNode,h,o),zi(u,o),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Iu===null||!Iu.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=xb(x),vb(x,o,u,h),zi(u,x),!1}u=u.return}while(u!==null);return!1}var P0=Error(r(461)),ko=!1;function ms(o,a,u,h){a.child=o===null?zn(a,null,u,h):jr(a,o.child,u,h)}function wb(o,a,u,h,x){u=u.render;var S=a.ref;if("ref"in h){var O={};for(var et in h)et!=="ref"&&(O[et]=h[et])}else O=h;return pl(a),h=Qe(o,a,u,O,S,x),et=we(),o!==null&&!ko?(Tn(o,a,x),iu(o,a,x)):(tr&&et&&ta(a),a.flags|=1,ms(o,a,h,x),a.child)}function Sb(o,a,u,h,x){if(o===null){var S=u.type;return typeof S=="function"&&!Vc(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,kb(o,a,S,h,x)):(o=Qs(u.type,null,h,a,a.mode,x),o.ref=a.ref,o.return=a,a.child=o)}if(S=o.child,!q0(o,x)){var O=S.memoizedProps;if(u=u.compare,u=u!==null?u:ro,u(O,h)&&o.ref===a.ref)return iu(o,a,x)}return a.flags|=1,o=ls(S,h),o.ref=a.ref,o.return=a,a.child=o}function kb(o,a,u,h,x){if(o!==null){var S=o.memoizedProps;if(ro(S,h)&&o.ref===a.ref)if(ko=!1,a.pendingProps=h=S,q0(o,x))(o.flags&131072)!==0&&(ko=!0);else return a.lanes=o.lanes,iu(o,a,x)}return I0(o,a,u,h,x)}function Ab(o,a,u,h){var x=h.children,S=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,o!==null){for(h=a.child=o.child,x=0;h!==null;)x=x|h.lanes|h.childLanes,h=h.sibling;h=x&~S}else h=0,a.child=null;return Mb(o,a,S,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&at(a,S!==null?S.cachePool:null),S!==null?Nr(a,S):er(),G(a);else return h=a.lanes=536870912,Mb(o,a,S!==null?S.baseLanes|u:u,u,h)}else S!==null?(at(a,S.cachePool),Nr(a,S),nt(),a.memoizedState=null):(o!==null&&at(a,null),er(),nt());return ms(o,a,x,u),a.child}function mh(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Mb(o,a,u,h,x){var S=Q();return S=S===null?null:{parent:Vr._currentValue,pool:S},a.memoizedState={baseLanes:u,cachePool:S},o!==null&&at(a,null),er(),G(a),o!==null&&Sa(o,a,h,!0),a.childLanes=x,null}function zp(o,a){return a=Up({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Cb(o,a,u){return jr(a,o.child,null,u),o=zp(a,a.pendingProps),o.flags|=2,z(a),a.memoizedState=null,o}function qC(o,a,u){var h=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(tr){if(h.mode==="hidden")return o=zp(a,h),a.lanes=536870912,mh(null,o);if(j(a),(o=Lr)?(o=Bx(o,ei),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Ha!==null?{id:fs,overflow:ds}:null,retryLane:536870912,hydrationErrors:null},u=Wc(o),u.return=a,a.child=u,lo=a,Lr=null)):o=null,o===null)throw na(a);return a.lanes=536870912,null}return zp(a,h)}var S=o.memoizedState;if(S!==null){var O=S.dehydrated;if(j(a),x)if(a.flags&256)a.flags&=-257,a=Cb(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(ko||Sa(o,a,u,!1),x=(u&o.childLanes)!==0,ko||x){if(h=si,h!==null&&(O=Ei(h,u),O!==0&&O!==S.retryLane))throw S.retryLane=O,xa(o,O),Na(h,o,O),P0;Kp(),a=Cb(o,a,u)}else o=S.treeContext,Lr=xl(O.nextSibling),lo=a,tr=!0,Lo=null,ei=!1,o!==null&&ud(a,o),a=zp(a,h),a.flags|=4096;return a}return o=ls(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function Fp(o,a){var u=a.ref;if(u===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(o===null||o.ref!==u)&&(a.flags|=4194816)}}function I0(o,a,u,h,x){return pl(a),u=Qe(o,a,u,h,void 0,x),h=we(),o!==null&&!ko?(Tn(o,a,x),iu(o,a,x)):(tr&&h&&ta(a),a.flags|=1,ms(o,a,u,x),a.child)}function Eb(o,a,u,h,x,S){return pl(a),a.updateQueue=null,u=fe(a,h,u,x),En(o),h=we(),o!==null&&!ko?(Tn(o,a,S),iu(o,a,S)):(tr&&h&&ta(a),a.flags|=1,ms(o,a,u,S),a.child)}function Tb(o,a,u,h,x){if(pl(a),a.stateNode===null){var S=Xi,O=u.contextType;typeof O=="object"&&O!==null&&(S=Di(O)),S=new u(h,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=R0,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=h,S.state=a.memoizedState,S.refs={},Oe(a),O=u.contextType,S.context=typeof O=="object"&&O!==null?Di(O):Xi,S.state=a.memoizedState,O=u.getDerivedStateFromProps,typeof O=="function"&&(L0(a,u,O,h),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(O=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),O!==S.state&&R0.enqueueReplaceState(S,S.state,null),ri(a,h,S,x),Rr(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){S=a.stateNode;var et=a.memoizedProps,Nt=Cf(u,et);S.props=Nt;var Kt=S.context,ae=u.contextType;O=Xi,typeof ae=="object"&&ae!==null&&(O=Di(ae));var ye=u.getDerivedStateFromProps;ae=typeof ye=="function"||typeof S.getSnapshotBeforeUpdate=="function",et=a.pendingProps!==et,ae||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(et||Kt!==O)&&pb(a,S,h,O),Ve=!1;var Jt=a.memoizedState;S.state=Jt,ri(a,h,S,x),Rr(),Kt=a.memoizedState,et||Jt!==Kt||Ve?(typeof ye=="function"&&(L0(a,u,ye,h),Kt=a.memoizedState),(Nt=Ve||hb(a,u,Nt,h,Jt,Kt,O))?(ae||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=Kt),S.props=h,S.state=Kt,S.context=O,h=Nt):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{S=a.stateNode,ni(o,a),O=a.memoizedProps,ae=Cf(u,O),S.props=ae,ye=a.pendingProps,Jt=S.context,Kt=u.contextType,Nt=Xi,typeof Kt=="object"&&Kt!==null&&(Nt=Di(Kt)),et=u.getDerivedStateFromProps,(Kt=typeof et=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(O!==ye||Jt!==Nt)&&pb(a,S,h,Nt),Ve=!1,Jt=a.memoizedState,S.state=Jt,ri(a,h,S,x),Rr();var ee=a.memoizedState;O!==ye||Jt!==ee||Ve||o!==null&&o.dependencies!==null&&Jc(o.dependencies)?(typeof et=="function"&&(L0(a,u,et,h),ee=a.memoizedState),(ae=Ve||hb(a,u,ae,h,Jt,ee,Nt)||o!==null&&o.dependencies!==null&&Jc(o.dependencies))?(Kt||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(h,ee,Nt),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(h,ee,Nt)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||O===o.memoizedProps&&Jt===o.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&Jt===o.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ee),S.props=h,S.state=ee,S.context=Nt,h=ae):(typeof S.componentDidUpdate!="function"||O===o.memoizedProps&&Jt===o.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&Jt===o.memoizedState||(a.flags|=1024),h=!1)}return S=h,Fp(o,a),h=(a.flags&128)!==0,S||h?(S=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,o!==null&&h?(a.child=jr(a,o.child,null,x),a.child=jr(a,null,u,x)):ms(o,a,u,x),a.memoizedState=S.state,o=a.child):o=iu(o,a,x),o}function Nb(o,a,u,h){return va(),a.flags|=256,ms(o,a,u,h),a.child}var j0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function B0(o){return{baseLanes:o,cachePool:mt()}}function z0(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=$a),o}function _b(o,a,u){var h=a.pendingProps,x=!1,S=(a.flags&128)!==0,O;if((O=S)||(O=o!==null&&o.memoizedState===null?!1:(J.current&2)!==0),O&&(x=!0,a.flags&=-129),O=(a.flags&32)!==0,a.flags&=-33,o===null){if(tr){if(x?N(a):nt(),(o=Lr)?(o=Bx(o,ei),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Ha!==null?{id:fs,overflow:ds}:null,retryLane:536870912,hydrationErrors:null},u=Wc(o),u.return=a,a.child=u,lo=a,Lr=null)):o=null,o===null)throw na(a);return w1(o)?a.lanes=32:a.lanes=536870912,null}var et=h.children;return h=h.fallback,x?(nt(),x=a.mode,et=Up({mode:"hidden",children:et},x),h=Ua(h,x,u,null),et.return=a,h.return=a,et.sibling=h,a.child=et,h=a.child,h.memoizedState=B0(u),h.childLanes=z0(o,O,u),a.memoizedState=j0,mh(null,h)):(N(a),F0(a,et))}var Nt=o.memoizedState;if(Nt!==null&&(et=Nt.dehydrated,et!==null)){if(S)a.flags&256?(N(a),a.flags&=-257,a=U0(o,a,u)):a.memoizedState!==null?(nt(),a.child=o.child,a.flags|=128,a=null):(nt(),et=h.fallback,x=a.mode,h=Up({mode:"visible",children:h.children},x),et=Ua(et,x,u,null),et.flags|=2,h.return=a,et.return=a,h.sibling=et,a.child=h,jr(a,o.child,null,u),h=a.child,h.memoizedState=B0(u),h.childLanes=z0(o,O,u),a.memoizedState=j0,a=mh(null,h));else if(N(a),w1(et)){if(O=et.nextSibling&&et.nextSibling.dataset,O)var Kt=O.dgst;O=Kt,h=Error(r(419)),h.stack="",h.digest=O,Ac({value:h,source:null,stack:null}),a=U0(o,a,u)}else if(ko||Sa(o,a,u,!1),O=(u&o.childLanes)!==0,ko||O){if(O=si,O!==null&&(h=Ei(O,u),h!==0&&h!==Nt.retryLane))throw Nt.retryLane=h,xa(o,h),Na(O,o,h),P0;v1(et)||Kp(),a=U0(o,a,u)}else v1(et)?(a.flags|=192,a.child=o.child,a=null):(o=Nt.treeContext,Lr=xl(et.nextSibling),lo=a,tr=!0,Lo=null,ei=!1,o!==null&&ud(a,o),a=F0(a,h.children),a.flags|=4096);return a}return x?(nt(),et=h.fallback,x=a.mode,Nt=o.child,Kt=Nt.sibling,h=ls(Nt,{mode:"hidden",children:h.children}),h.subtreeFlags=Nt.subtreeFlags&65011712,Kt!==null?et=ls(Kt,et):(et=Ua(et,x,u,null),et.flags|=2),et.return=a,h.return=a,h.sibling=et,a.child=h,mh(null,h),h=a.child,et=o.child.memoizedState,et===null?et=B0(u):(x=et.cachePool,x!==null?(Nt=Vr._currentValue,x=x.parent!==Nt?{parent:Nt,pool:Nt}:x):x=mt(),et={baseLanes:et.baseLanes|u,cachePool:x}),h.memoizedState=et,h.childLanes=z0(o,O,u),a.memoizedState=j0,mh(o.child,h)):(N(a),u=o.child,o=u.sibling,u=ls(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,o!==null&&(O=a.deletions,O===null?(a.deletions=[o],a.flags|=16):O.push(o)),a.child=u,a.memoizedState=null,u)}function F0(o,a){return a=Up({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function Up(o,a){return o=vo(22,o,null,a),o.lanes=0,o}function U0(o,a,u){return jr(a,o.child,null,u),o=F0(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Db(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),Wl(o.return,a,u)}function H0(o,a,u,h,x,S){var O=o.memoizedState;O===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:x,treeForkCount:S}:(O.isBackwards=a,O.rendering=null,O.renderingStartTime=0,O.last=h,O.tail=u,O.tailMode=x,O.treeForkCount=S)}function Lb(o,a,u){var h=a.pendingProps,x=h.revealOrder,S=h.tail;h=h.children;var O=J.current,et=(O&2)!==0;if(et?(O=O&1|2,a.flags|=128):O&=1,X(J,O),ms(o,a,h,u),h=tr?kc:0,!et&&o!==null&&(o.flags&128)!==0)t:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Db(o,u,a);else if(o.tag===19)Db(o,u,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break t;for(;o.sibling===null;){if(o.return===null||o.return===a)break t;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)o=u.alternate,o!==null&&ut(o)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),H0(a,!1,x,u,S,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(o=x.alternate,o!==null&&ut(o)===null){a.child=x;break}o=x.sibling,x.sibling=u,u=x,x=o}H0(a,!0,u,null,S,h);break;case"together":H0(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function iu(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),Pu|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(Sa(o,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(r(153));if(a.child!==null){for(o=a.child,u=ls(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=ls(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function q0(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&Jc(o)))}function YC(o,a,u){switch(a.tag){case 3:qt(a,a.stateNode.containerInfo),hs(a,Vr,o.memoizedState.cache),va();break;case 27:case 5:Zt(a);break;case 4:qt(a,a.stateNode.containerInfo);break;case 10:hs(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,j(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(N(a),a.flags|=128,null):(u&a.child.childLanes)!==0?_b(o,a,u):(N(a),o=iu(o,a,u),o!==null?o.sibling:null);N(a);break;case 19:var x=(o.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Sa(o,a,u,!1),h=(u&a.childLanes)!==0),x){if(h)return Lb(o,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),X(J,J.current),h)break;return null;case 22:return a.lanes=0,Ab(o,a,u,a.pendingProps);case 24:hs(a,Vr,o.memoizedState.cache)}return iu(o,a,u)}function Rb(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)ko=!0;else{if(!q0(o,u)&&(a.flags&128)===0)return ko=!1,YC(o,a,u);ko=(o.flags&131072)!==0}else ko=!1,tr&&(a.flags&1048576)!==0&&Gc(a,kc,a.index);switch(a.lanes=0,a.tag){case 16:t:{var h=a.pendingProps;if(o=$t(a.elementType),a.type=o,typeof o=="function")Vc(o)?(h=Cf(o,h),a.tag=1,a=Tb(null,a,o,h,u)):(a.tag=0,a=I0(null,a,o,h,u));else{if(o!=null){var x=o.$$typeof;if(x===W){a.tag=11,a=wb(null,a,o,h,u);break t}else if(x===Ct){a.tag=14,a=Sb(null,a,o,h,u);break t}}throw a=xt(o)||o,Error(r(306,a,""))}}return a;case 0:return I0(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,x=Cf(h,a.pendingProps),Tb(o,a,h,x,u);case 3:t:{if(qt(a,a.stateNode.containerInfo),o===null)throw Error(r(387));h=a.pendingProps;var S=a.memoizedState;x=S.element,ni(o,a),ri(a,h,null,u);var O=a.memoizedState;if(h=O.cache,hs(a,Vr,h),h!==S.cache&&Gi(a,[Vr],u,!0),Rr(),h=O.element,S.isDehydrated)if(S={element:h,isDehydrated:!1,cache:O.cache},a.updateQueue.baseState=S,a.memoizedState=S,a.flags&256){a=Nb(o,a,h,u);break t}else if(h!==x){x=wo(Error(r(424)),a),Ac(x),a=Nb(o,a,h,u);break t}else for(o=a.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,Lr=xl(o.firstChild),lo=a,tr=!0,Lo=null,ei=!0,u=zn(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(va(),h===x){a=iu(o,a,u);break t}ms(o,a,h,u)}a=a.child}return a;case 26:return Fp(o,a),o===null?(u=Yx(a.type,null,a.pendingProps,null))?a.memoizedState=u:tr||(u=a.type,o=a.pendingProps,h=rm(vt.current).createElement(u),h[Ar]=a,h[ir]=o,gs(h,u,o),di(h),a.stateNode=h):a.memoizedState=Yx(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Zt(a),o===null&&tr&&(h=a.stateNode=Ux(a.type,a.pendingProps,vt.current),lo=a,ei=!0,x=Lr,Fu(a.type)?(S1=x,Lr=xl(h.firstChild)):Lr=x),ms(o,a,a.pendingProps.children,u),Fp(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&tr&&((x=h=Lr)&&(h=v6(h,a.type,a.pendingProps,ei),h!==null?(a.stateNode=h,lo=a,Lr=xl(h.firstChild),ei=!1,x=!0):x=!1),x||na(a)),Zt(a),x=a.type,S=a.pendingProps,O=o!==null?o.memoizedProps:null,h=S.children,y1(x,S)?h=null:O!==null&&y1(x,O)&&(a.flags|=32),a.memoizedState!==null&&(x=Qe(o,a,Xe,null,null,u),_h._currentValue=x),Fp(o,a),ms(o,a,h,u),a.child;case 6:return o===null&&tr&&((o=u=Lr)&&(u=w6(u,a.pendingProps,ei),u!==null?(a.stateNode=u,lo=a,Lr=null,o=!0):o=!1),o||na(a)),null;case 13:return _b(o,a,u);case 4:return qt(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=jr(a,null,h,u):ms(o,a,h,u),a.child;case 11:return wb(o,a,a.type,a.pendingProps,u);case 7:return ms(o,a,a.pendingProps,u),a.child;case 8:return ms(o,a,a.pendingProps.children,u),a.child;case 12:return ms(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,hs(a,a.type,h.value),ms(o,a,h.children,u),a.child;case 9:return x=a.type._context,h=a.pendingProps.children,pl(a),x=Di(x),h=h(x),a.flags|=1,ms(o,a,h,u),a.child;case 14:return Sb(o,a,a.type,a.pendingProps,u);case 15:return kb(o,a,a.type,a.pendingProps,u);case 19:return Lb(o,a,u);case 31:return qC(o,a,u);case 22:return Ab(o,a,u,a.pendingProps);case 24:return pl(a),h=Di(Vr),o===null?(x=Q(),x===null&&(x=si,S=ka(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:h,cache:x},Oe(a),hs(a,Vr,x)):((o.lanes&u)!==0&&(ni(o,a),ri(a,null,null,u),Rr()),x=o.memoizedState,S=a.memoizedState,x.parent!==h?(x={parent:h,cache:h},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),hs(a,Vr,h)):(h=S.cache,hs(a,Vr,h),h!==x.cache&&Gi(a,[Vr],u,!0))),ms(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function ou(o){o.flags|=4}function Y0(o,a,u,h,x){if((a=(o.mode&32)!==0)&&(a=!1),a){if(o.flags|=16777216,(x&335544128)===x)if(o.stateNode.complete)o.flags|=8192;else if(sx())o.flags|=8192;else throw re=Ot,Wt}else o.flags&=-16777217}function Ob(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Gx(a))if(sx())o.flags|=8192;else throw re=Ot,Wt}function Hp(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?Hi():536870912,o.lanes|=a,md|=a)}function gh(o,a){if(!tr)switch(o.tailMode){case"hidden":a=o.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:h.sibling=null}}function wi(o){var a=o.alternate!==null&&o.alternate.child===o.child,u=0,h=0;if(a)for(var x=o.child;x!==null;)u|=x.lanes|x.childLanes,h|=x.subtreeFlags&65011712,h|=x.flags&65011712,x.return=o,x=x.sibling;else for(x=o.child;x!==null;)u|=x.lanes|x.childLanes,h|=x.subtreeFlags,h|=x.flags,x.return=o,x=x.sibling;return o.subtreeFlags|=h,o.childLanes=u,a}function $C(o,a,u){var h=a.pendingProps;switch(Vl(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wi(a),null;case 1:return wi(a),null;case 3:return u=a.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Rs(Vr),Rt(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(Bi(a)?ou(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,kf())),wi(a),null;case 26:var x=a.type,S=a.memoizedState;return o===null?(ou(a),S!==null?(wi(a),Ob(a,S)):(wi(a),Y0(a,x,null,h,u))):S?S!==o.memoizedState?(ou(a),wi(a),Ob(a,S)):(wi(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&ou(a),wi(a),Y0(a,x,o,h,u)),null;case 27:if(Ae(a),u=vt.current,x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&ou(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return wi(a),null}o=tt.current,Bi(a)?hl(a):(o=Ux(x,h,u),a.stateNode=o,ou(a))}return wi(a),null;case 5:if(Ae(a),x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&ou(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return wi(a),null}if(S=tt.current,Bi(a))hl(a);else{var O=rm(vt.current);switch(S){case 1:S=O.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:S=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":S=O.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":S=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":S=O.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof h.is=="string"?O.createElement("select",{is:h.is}):O.createElement("select"),h.multiple?S.multiple=!0:h.size&&(S.size=h.size);break;default:S=typeof h.is=="string"?O.createElement(x,{is:h.is}):O.createElement(x)}}S[Ar]=a,S[ir]=h;t:for(O=a.child;O!==null;){if(O.tag===5||O.tag===6)S.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===a)break t;for(;O.sibling===null;){if(O.return===null||O.return===a)break t;O=O.return}O.sibling.return=O.return,O=O.sibling}a.stateNode=S;t:switch(gs(S,x,h),x){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break t;case"img":h=!0;break t;default:h=!1}h&&ou(a)}}return wi(a),Y0(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&ou(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=vt.current,Bi(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,x=lo,x!==null)switch(x.tag){case 27:case 5:h=x.memoizedProps}o[Ar]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||_x(o.nodeValue,u)),o||na(a,!0)}else o=rm(o).createTextNode(h),o[Ar]=a,a.stateNode=o}return wi(a),null;case 31:if(u=a.memoizedState,o===null||o.memoizedState!==null){if(h=Bi(a),u!==null){if(o===null){if(!h)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Ar]=a}else va(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;wi(a),o=!1}else u=kf(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return a.flags&256?(z(a),a):(z(a),null);if((a.flags&128)!==0)throw Error(r(558))}return wi(a),null;case 13:if(h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=Bi(a),h!==null&&h.dehydrated!==null){if(o===null){if(!x)throw Error(r(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[Ar]=a}else va(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;wi(a),x=!1}else x=kf(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(z(a),a):(z(a),null)}return z(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,o=o!==null&&o.memoizedState!==null,u&&(h=a.child,x=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(x=h.alternate.memoizedState.cachePool.pool),S=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(S=h.memoizedState.cachePool.pool),S!==x&&(h.flags|=2048)),u!==o&&u&&(a.child.flags|=8192),Hp(a,a.updateQueue),wi(a),null);case 4:return Rt(),o===null&&d1(a.stateNode.containerInfo),wi(a),null;case 10:return Rs(a.type),wi(a),null;case 19:if(P(J),h=a.memoizedState,h===null)return wi(a),null;if(x=(a.flags&128)!==0,S=h.rendering,S===null)if(x)gh(h,!1);else{if(Ki!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(S=ut(o),S!==null){for(a.flags|=128,gh(h,!1),o=S.updateQueue,a.updateQueue=o,Hp(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)wc(u,o),u=u.sibling;return X(J,J.current&1|2),tr&&xi(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&hn()>Wp&&(a.flags|=128,x=!0,gh(h,!1),a.lanes=4194304)}else{if(!x)if(o=ut(S),o!==null){if(a.flags|=128,x=!0,o=o.updateQueue,a.updateQueue=o,Hp(a,o),gh(h,!0),h.tail===null&&h.tailMode==="hidden"&&!S.alternate&&!tr)return wi(a),null}else 2*hn()-h.renderingStartTime>Wp&&u!==536870912&&(a.flags|=128,x=!0,gh(h,!1),a.lanes=4194304);h.isBackwards?(S.sibling=a.child,a.child=S):(o=h.last,o!==null?o.sibling=S:a.child=S,h.last=S)}return h.tail!==null?(o=h.tail,h.rendering=o,h.tail=o.sibling,h.renderingStartTime=hn(),o.sibling=null,u=J.current,X(J,x?u&1|2:u&1),tr&&xi(a,h.treeForkCount),o):(wi(a),null);case 22:case 23:return z(a),w(),h=a.memoizedState!==null,o!==null?o.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(wi(a),a.subtreeFlags&6&&(a.flags|=8192)):wi(a),u=a.updateQueue,u!==null&&Hp(a,u.retryQueue),u=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),o!==null&&P($),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Rs(Vr),wi(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function VC(o,a){switch(Vl(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Rs(Vr),Rt(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return Ae(a),null;case 31:if(a.memoizedState!==null){if(z(a),a.alternate===null)throw Error(r(340));va()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(z(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));va()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return P(J),null;case 4:return Rt(),null;case 10:return Rs(a.type),null;case 22:case 23:return z(a),w(),o!==null&&P($),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Rs(Vr),null;case 25:return null;default:return null}}function Pb(o,a){switch(Vl(a),a.tag){case 3:Rs(Vr),Rt();break;case 26:case 27:case 5:Ae(a);break;case 4:Rt();break;case 31:a.memoizedState!==null&&z(a);break;case 13:z(a);break;case 19:P(J);break;case 10:Rs(a.type);break;case 22:case 23:z(a),w(),o!==null&&P($);break;case 24:Rs(Vr)}}function yh(o,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var x=h.next;u=x;do{if((u.tag&o)===o){h=void 0;var S=u.create,O=u.inst;h=S(),O.destroy=h}u=u.next}while(u!==x)}}catch(et){Ur(a,a.return,et)}}function Ru(o,a,u){try{var h=a.updateQueue,x=h!==null?h.lastEffect:null;if(x!==null){var S=x.next;h=S;do{if((h.tag&o)===o){var O=h.inst,et=O.destroy;if(et!==void 0){O.destroy=void 0,x=a;var Nt=u,Kt=et;try{Kt()}catch(ae){Ur(x,Nt,ae)}}}h=h.next}while(h!==S)}}catch(ae){Ur(a,a.return,ae)}}function Ib(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{ii(a,u)}catch(h){Ur(o,o.return,h)}}}function jb(o,a,u){u.props=Cf(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){Ur(o,a,h)}}function bh(o,a){try{var u=o.ref;if(u!==null){switch(o.tag){case 26:case 27:case 5:var h=o.stateNode;break;case 30:h=o.stateNode;break;default:h=o.stateNode}typeof u=="function"?o.refCleanup=u(h):u.current=h}}catch(x){Ur(o,a,x)}}function Ec(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(x){Ur(o,a,x)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){Ur(o,a,x)}else u.current=null}function Bb(o){var a=o.type,u=o.memoizedProps,h=o.stateNode;try{t:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break t;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(x){Ur(o,o.return,x)}}function $0(o,a,u){try{var h=o.stateNode;p6(h,o.type,u,a),h[ir]=a}catch(x){Ur(o,o.return,x)}}function zb(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Fu(o.type)||o.tag===4}function V0(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||zb(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Fu(o.type)||o.flags&2||o.child===null||o.tag===4)continue t;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function W0(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(o,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(o),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Bo));else if(h!==4&&(h===27&&Fu(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(W0(o,a,u),o=o.sibling;o!==null;)W0(o,a,u),o=o.sibling}function qp(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?u.insertBefore(o,a):u.appendChild(o);else if(h!==4&&(h===27&&Fu(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(qp(o,a,u),o=o.sibling;o!==null;)qp(o,a,u),o=o.sibling}function Fb(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);gs(a,h,u),a[Ar]=o,a[ir]=u}catch(S){Ur(o,o.return,S)}}var su=!1,Ao=!1,X0=!1,Ub=typeof WeakSet=="function"?WeakSet:Set,Yo=null;function WC(o,a){if(o=o.containerInfo,m1=um,o=Ul(o),ba(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else t:{u=(u=o.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var x=h.anchorOffset,S=h.focusNode;h=h.focusOffset;try{u.nodeType,S.nodeType}catch{u=null;break t}var O=0,et=-1,Nt=-1,Kt=0,ae=0,ye=o,Jt=null;e:for(;;){for(var ee;ye!==u||x!==0&&ye.nodeType!==3||(et=O+x),ye!==S||h!==0&&ye.nodeType!==3||(Nt=O+h),ye.nodeType===3&&(O+=ye.nodeValue.length),(ee=ye.firstChild)!==null;)Jt=ye,ye=ee;for(;;){if(ye===o)break e;if(Jt===u&&++Kt===x&&(et=O),Jt===S&&++ae===h&&(Nt=O),(ee=ye.nextSibling)!==null)break;ye=Jt,Jt=ye.parentNode}ye=ee}u=et===-1||Nt===-1?null:{start:et,end:Nt}}else u=null}u=u||{start:0,end:0}}else u=null;for(g1={focusedElem:o,selectionRange:u},um=!1,Yo=a;Yo!==null;)if(a=Yo,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Yo=o;else for(;Yo!==null;){switch(a=Yo,S=a.alternate,o=a.flags,a.tag){case 0:if((o&4)!==0&&(o=a.updateQueue,o=o!==null?o.events:null,o!==null))for(u=0;u<o.length;u++)x=o[u],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&S!==null){o=void 0,u=a,x=S.memoizedProps,S=S.memoizedState,h=u.stateNode;try{var ln=Cf(u.type,x);o=h.getSnapshotBeforeUpdate(ln,S),h.__reactInternalSnapshotBeforeUpdate=o}catch(Ln){Ur(u,u.return,Ln)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)x1(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":x1(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=a.sibling,o!==null){o.return=a.return,Yo=o;break}Yo=a.return}}function Hb(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:lu(o,u),h&4&&yh(5,u);break;case 1:if(lu(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(O){Ur(u,u.return,O)}else{var x=Cf(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(x,a,o.__reactInternalSnapshotBeforeUpdate)}catch(O){Ur(u,u.return,O)}}h&64&&Ib(u),h&512&&bh(u,u.return);break;case 3:if(lu(o,u),h&64&&(o=u.updateQueue,o!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{ii(o,a)}catch(O){Ur(u,u.return,O)}}break;case 27:a===null&&h&4&&Fb(u);case 26:case 5:lu(o,u),a===null&&h&4&&Bb(u),h&512&&bh(u,u.return);break;case 12:lu(o,u);break;case 31:lu(o,u),h&4&&$b(o,u);break;case 13:lu(o,u),h&4&&Vb(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=n6.bind(null,u),S6(o,u))));break;case 22:if(h=u.memoizedState!==null||su,!h){a=a!==null&&a.memoizedState!==null||Ao,x=su;var S=Ao;su=h,(Ao=a)&&!S?cu(o,u,(u.subtreeFlags&8772)!==0):lu(o,u),su=x,Ao=S}break;case 30:break;default:lu(o,u)}}function qb(o){var a=o.alternate;a!==null&&(o.alternate=null,qb(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Ll(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Li=null,Ma=!1;function au(o,a,u){for(u=u.child;u!==null;)Yb(o,a,u),u=u.sibling}function Yb(o,a,u){if(cn&&typeof cn.onCommitFiberUnmount=="function")try{cn.onCommitFiberUnmount(bn,u)}catch{}switch(u.tag){case 26:Ao||Ec(u,a),au(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Ao||Ec(u,a);var h=Li,x=Ma;Fu(u.type)&&(Li=u.stateNode,Ma=!1),au(o,a,u),Eh(u.stateNode),Li=h,Ma=x;break;case 5:Ao||Ec(u,a);case 6:if(h=Li,x=Ma,Li=null,au(o,a,u),Li=h,Ma=x,Li!==null)if(Ma)try{(Li.nodeType===9?Li.body:Li.nodeName==="HTML"?Li.ownerDocument.body:Li).removeChild(u.stateNode)}catch(S){Ur(u,a,S)}else try{Li.removeChild(u.stateNode)}catch(S){Ur(u,a,S)}break;case 18:Li!==null&&(Ma?(o=Li,Ix(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),kd(o)):Ix(Li,u.stateNode));break;case 4:h=Li,x=Ma,Li=u.stateNode.containerInfo,Ma=!0,au(o,a,u),Li=h,Ma=x;break;case 0:case 11:case 14:case 15:Ru(2,u,a),Ao||Ru(4,u,a),au(o,a,u);break;case 1:Ao||(Ec(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&jb(u,a,h)),au(o,a,u);break;case 21:au(o,a,u);break;case 22:Ao=(h=Ao)||u.memoizedState!==null,au(o,a,u),Ao=h;break;default:au(o,a,u)}}function $b(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{kd(o)}catch(u){Ur(a,a.return,u)}}}function Vb(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{kd(o)}catch(u){Ur(a,a.return,u)}}function XC(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Ub),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Ub),a;default:throw Error(r(435,o.tag))}}function Yp(o,a){var u=XC(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var x=r6.bind(null,o,h);h.then(x,x)}})}function Ca(o,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var x=u[h],S=o,O=a,et=O;t:for(;et!==null;){switch(et.tag){case 27:if(Fu(et.type)){Li=et.stateNode,Ma=!1;break t}break;case 5:Li=et.stateNode,Ma=!1;break t;case 3:case 4:Li=et.stateNode.containerInfo,Ma=!0;break t}et=et.return}if(Li===null)throw Error(r(160));Yb(S,O,x),Li=null,Ma=!1,S=x.alternate,S!==null&&(S.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Wb(a,o),a=a.sibling}var Kl=null;function Wb(o,a){var u=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Ca(a,o),Ea(o),h&4&&(Ru(3,o,o.return),yh(3,o),Ru(5,o,o.return));break;case 1:Ca(a,o),Ea(o),h&512&&(Ao||u===null||Ec(u,u.return)),h&64&&su&&(o=o.updateQueue,o!==null&&(h=o.callbacks,h!==null&&(u=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var x=Kl;if(Ca(a,o),Ea(o),h&512&&(Ao||u===null||Ec(u,u.return)),h&4){var S=u!==null?u.memoizedState:null;if(h=o.memoizedState,u===null)if(h===null)if(o.stateNode===null){t:{h=o.type,u=o.memoizedProps,x=x.ownerDocument||x;e:switch(h){case"title":S=x.getElementsByTagName("title")[0],(!S||S[To]||S[Ar]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=x.createElement(h),x.head.insertBefore(S,x.querySelector("head > title"))),gs(S,h,u),S[Ar]=o,di(S),h=S;break t;case"link":var O=Wx("link","href",x).get(h+(u.href||""));if(O){for(var et=0;et<O.length;et++)if(S=O[et],S.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&S.getAttribute("rel")===(u.rel==null?null:u.rel)&&S.getAttribute("title")===(u.title==null?null:u.title)&&S.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){O.splice(et,1);break e}}S=x.createElement(h),gs(S,h,u),x.head.appendChild(S);break;case"meta":if(O=Wx("meta","content",x).get(h+(u.content||""))){for(et=0;et<O.length;et++)if(S=O[et],S.getAttribute("content")===(u.content==null?null:""+u.content)&&S.getAttribute("name")===(u.name==null?null:u.name)&&S.getAttribute("property")===(u.property==null?null:u.property)&&S.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&S.getAttribute("charset")===(u.charSet==null?null:u.charSet)){O.splice(et,1);break e}}S=x.createElement(h),gs(S,h,u),x.head.appendChild(S);break;default:throw Error(r(468,h))}S[Ar]=o,di(S),h=S}o.stateNode=h}else Xx(x,o.type,o.stateNode);else o.stateNode=Vx(x,h,o.memoizedProps);else S!==h?(S===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):S.count--,h===null?Xx(x,o.type,o.stateNode):Vx(x,h,o.memoizedProps)):h===null&&o.stateNode!==null&&$0(o,o.memoizedProps,u.memoizedProps)}break;case 27:Ca(a,o),Ea(o),h&512&&(Ao||u===null||Ec(u,u.return)),u!==null&&h&4&&$0(o,o.memoizedProps,u.memoizedProps);break;case 5:if(Ca(a,o),Ea(o),h&512&&(Ao||u===null||Ec(u,u.return)),o.flags&32){x=o.stateNode;try{Io(x,"")}catch(ln){Ur(o,o.return,ln)}}h&4&&o.stateNode!=null&&(x=o.memoizedProps,$0(o,x,u!==null?u.memoizedProps:x)),h&1024&&(X0=!0);break;case 6:if(Ca(a,o),Ea(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,u=o.stateNode;try{u.nodeValue=h}catch(ln){Ur(o,o.return,ln)}}break;case 3:if(sm=null,x=Kl,Kl=im(a.containerInfo),Ca(a,o),Kl=x,Ea(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{kd(a.containerInfo)}catch(ln){Ur(o,o.return,ln)}X0&&(X0=!1,Xb(o));break;case 4:h=Kl,Kl=im(o.stateNode.containerInfo),Ca(a,o),Ea(o),Kl=h;break;case 12:Ca(a,o),Ea(o);break;case 31:Ca(a,o),Ea(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,Yp(o,h)));break;case 13:Ca(a,o),Ea(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Vp=hn()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,Yp(o,h)));break;case 22:x=o.memoizedState!==null;var Nt=u!==null&&u.memoizedState!==null,Kt=su,ae=Ao;if(su=Kt||x,Ao=ae||Nt,Ca(a,o),Ao=ae,su=Kt,Ea(o),h&8192)t:for(a=o.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(u===null||Nt||su||Ao||Ef(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){Nt=u=a;try{if(S=Nt.stateNode,x)O=S.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{et=Nt.stateNode;var ye=Nt.memoizedProps.style,Jt=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;et.style.display=Jt==null||typeof Jt=="boolean"?"":(""+Jt).trim()}}catch(ln){Ur(Nt,Nt.return,ln)}}}else if(a.tag===6){if(u===null){Nt=a;try{Nt.stateNode.nodeValue=x?"":Nt.memoizedProps}catch(ln){Ur(Nt,Nt.return,ln)}}}else if(a.tag===18){if(u===null){Nt=a;try{var ee=Nt.stateNode;x?jx(ee,!0):jx(Nt.stateNode,!1)}catch(ln){Ur(Nt,Nt.return,ln)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break t;for(;a.sibling===null;){if(a.return===null||a.return===o)break t;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=o.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,Yp(o,u))));break;case 19:Ca(a,o),Ea(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,Yp(o,h)));break;case 30:break;case 21:break;default:Ca(a,o),Ea(o)}}function Ea(o){var a=o.flags;if(a&2){try{for(var u,h=o.return;h!==null;){if(zb(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var x=u.stateNode,S=V0(o);qp(o,S,x);break;case 5:var O=u.stateNode;u.flags&32&&(Io(O,""),u.flags&=-33);var et=V0(o);qp(o,et,O);break;case 3:case 4:var Nt=u.stateNode.containerInfo,Kt=V0(o);W0(o,Kt,Nt);break;default:throw Error(r(161))}}catch(ae){Ur(o,o.return,ae)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Xb(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Xb(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function lu(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Hb(o,a.alternate,a),a=a.sibling}function Ef(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:Ru(4,a,a.return),Ef(a);break;case 1:Ec(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&jb(a,a.return,u),Ef(a);break;case 27:Eh(a.stateNode);case 26:case 5:Ec(a,a.return),Ef(a);break;case 22:a.memoizedState===null&&Ef(a);break;case 30:Ef(a);break;default:Ef(a)}o=o.sibling}}function cu(o,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,x=o,S=a,O=S.flags;switch(S.tag){case 0:case 11:case 15:cu(x,S,u),yh(4,S);break;case 1:if(cu(x,S,u),h=S,x=h.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(Kt){Ur(h,h.return,Kt)}if(h=S,x=h.updateQueue,x!==null){var et=h.stateNode;try{var Nt=x.shared.hiddenCallbacks;if(Nt!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Nt.length;x++)Ui(Nt[x],et)}catch(Kt){Ur(h,h.return,Kt)}}u&&O&64&&Ib(S),bh(S,S.return);break;case 27:Fb(S);case 26:case 5:cu(x,S,u),u&&h===null&&O&4&&Bb(S),bh(S,S.return);break;case 12:cu(x,S,u);break;case 31:cu(x,S,u),u&&O&4&&$b(x,S);break;case 13:cu(x,S,u),u&&O&4&&Vb(x,S);break;case 22:S.memoizedState===null&&cu(x,S,u),bh(S,S.return);break;case 30:break;default:cu(x,S,u)}a=a.sibling}}function G0(o,a){var u=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==u&&(o!=null&&o.refCount++,u!=null&&ml(u))}function K0(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&ml(o))}function Jl(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Gb(o,a,u,h),a=a.sibling}function Gb(o,a,u,h){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Jl(o,a,u,h),x&2048&&yh(9,a);break;case 1:Jl(o,a,u,h);break;case 3:Jl(o,a,u,h),x&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&ml(o)));break;case 12:if(x&2048){Jl(o,a,u,h),o=a.stateNode;try{var S=a.memoizedProps,O=S.id,et=S.onPostCommit;typeof et=="function"&&et(O,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Nt){Ur(a,a.return,Nt)}}else Jl(o,a,u,h);break;case 31:Jl(o,a,u,h);break;case 13:Jl(o,a,u,h);break;case 23:break;case 22:S=a.stateNode,O=a.alternate,a.memoizedState!==null?S._visibility&2?Jl(o,a,u,h):xh(o,a):S._visibility&2?Jl(o,a,u,h):(S._visibility|=2,dd(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),x&2048&&G0(O,a);break;case 24:Jl(o,a,u,h),x&2048&&K0(a.alternate,a);break;default:Jl(o,a,u,h)}}function dd(o,a,u,h,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var S=o,O=a,et=u,Nt=h,Kt=O.flags;switch(O.tag){case 0:case 11:case 15:dd(S,O,et,Nt,x),yh(8,O);break;case 23:break;case 22:var ae=O.stateNode;O.memoizedState!==null?ae._visibility&2?dd(S,O,et,Nt,x):xh(S,O):(ae._visibility|=2,dd(S,O,et,Nt,x)),x&&Kt&2048&&G0(O.alternate,O);break;case 24:dd(S,O,et,Nt,x),x&&Kt&2048&&K0(O.alternate,O);break;default:dd(S,O,et,Nt,x)}a=a.sibling}}function xh(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=o,h=a,x=h.flags;switch(h.tag){case 22:xh(u,h),x&2048&&G0(h.alternate,h);break;case 24:xh(u,h),x&2048&&K0(h.alternate,h);break;default:xh(u,h)}a=a.sibling}}var vh=8192;function hd(o,a,u){if(o.subtreeFlags&vh)for(o=o.child;o!==null;)Kb(o,a,u),o=o.sibling}function Kb(o,a,u){switch(o.tag){case 26:hd(o,a,u),o.flags&vh&&o.memoizedState!==null&&O6(u,Kl,o.memoizedState,o.memoizedProps);break;case 5:hd(o,a,u);break;case 3:case 4:var h=Kl;Kl=im(o.stateNode.containerInfo),hd(o,a,u),Kl=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=vh,vh=16777216,hd(o,a,u),vh=h):hd(o,a,u));break;default:hd(o,a,u)}}function Jb(o){var a=o.alternate;if(a!==null&&(o=a.child,o!==null)){a.child=null;do a=o.sibling,o.sibling=null,o=a;while(o!==null)}}function wh(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];Yo=h,Qb(h,o)}Jb(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Zb(o),o=o.sibling}function Zb(o){switch(o.tag){case 0:case 11:case 15:wh(o),o.flags&2048&&Ru(9,o,o.return);break;case 3:wh(o);break;case 12:wh(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,$p(o)):wh(o);break;default:wh(o)}}function $p(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];Yo=h,Qb(h,o)}Jb(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Ru(8,a,a.return),$p(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,$p(a));break;default:$p(a)}o=o.sibling}}function Qb(o,a){for(;Yo!==null;){var u=Yo;switch(u.tag){case 0:case 11:case 15:Ru(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:ml(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,Yo=h;else t:for(u=o;Yo!==null;){h=Yo;var x=h.sibling,S=h.return;if(qb(h),h===u){Yo=null;break t}if(x!==null){x.return=S,Yo=x;break t}Yo=S}}}var GC={getCacheForType:function(o){var a=Di(Vr),u=a.data.get(o);return u===void 0&&(u=o(),a.data.set(o,u)),u},cacheSignal:function(){return Di(Vr).controller.signal}},KC=typeof WeakMap=="function"?WeakMap:Map,_r=0,si=null,ar=null,pr=0,Fr=0,Ya=null,Ou=!1,pd=!1,J0=!1,uu=0,Ki=0,Pu=0,Tf=0,Z0=0,$a=0,md=0,Sh=null,Ta=null,Q0=!1,Vp=0,tx=0,Wp=1/0,Xp=null,Iu=null,Oo=0,ju=null,gd=null,fu=0,t1=0,e1=null,ex=null,kh=0,n1=null;function Va(){return(_r&2)!==0&&pr!==0?pr&-pr:dt.T!==null?l1():Ti()}function nx(){if($a===0)if((pr&536870912)===0||tr){var o=We;We<<=1,(We&3932160)===0&&(We=262144),$a=o}else $a=536870912;return o=k.current,o!==null&&(o.flags|=32),$a}function Na(o,a,u){(o===si&&(Fr===2||Fr===9)||o.cancelPendingCommit!==null)&&(yd(o,0),Bu(o,pr,$a,!1)),Je(o,u),((_r&2)===0||o!==si)&&(o===si&&((_r&2)===0&&(Tf|=u),Ki===4&&Bu(o,pr,$a,!1)),Tc(o))}function rx(o,a,u){if((_r&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||Xo(o,a),x=h?QC(o,a):i1(o,a,!0),S=h;do{if(x===0){pd&&!h&&Bu(o,a,0,!1);break}else{if(u=o.current.alternate,S&&!JC(u)){x=i1(o,a,!1),S=!1;continue}if(x===2){if(S=a,o.errorRecoveryDisabledLanes&S)var O=0;else O=o.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){a=O;t:{var et=o;x=Sh;var Nt=et.current.memoizedState.isDehydrated;if(Nt&&(yd(et,O).flags|=256),O=i1(et,O,!1),O!==2){if(J0&&!Nt){et.errorRecoveryDisabledLanes|=S,Tf|=S,x=4;break t}S=Ta,Ta=x,S!==null&&(Ta===null?Ta=S:Ta.push.apply(Ta,S))}x=O}if(S=!1,x!==2)continue}}if(x===1){yd(o,0),Bu(o,a,0,!0);break}t:{switch(h=o,S=x,S){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Bu(h,a,$a,!Ou);break t;case 2:Ta=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(x=Vp+300-hn(),10<x)){if(Bu(h,a,$a,!Ou),Vn(h,0,!0)!==0)break t;fu=a,h.timeoutHandle=Ox(ix.bind(null,h,u,Ta,Xp,Q0,a,$a,Tf,md,Ou,S,"Throttled",-0,0),x);break t}ix(h,u,Ta,Xp,Q0,a,$a,Tf,md,Ou,S,null,-0,0)}}break}while(!0);Tc(o)}function ix(o,a,u,h,x,S,O,et,Nt,Kt,ae,ye,Jt,ee){if(o.timeoutHandle=-1,ye=a.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bo},Kb(a,S,ye);var ln=(S&62914560)===S?Vp-hn():(S&4194048)===S?tx-hn():0;if(ln=P6(ye,ln),ln!==null){fu=S,o.cancelPendingCommit=ln(dx.bind(null,o,a,S,u,h,x,O,et,Nt,ae,ye,null,Jt,ee)),Bu(o,S,O,!Kt);return}}dx(o,a,S,u,h,x,O,et,Nt)}function JC(o){for(var a=o;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var x=u[h],S=x.getSnapshot;x=x.value;try{if(!mi(S(),x))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Bu(o,a,u,h){a&=~Z0,a&=~Tf,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var x=a;0<x;){var S=31-$n(x),O=1<<S;h[S]=-1,x&=~O}u!==0&&to(o,u,a)}function Gp(){return(_r&6)===0?(Ah(0),!1):!0}function r1(){if(ar!==null){if(Fr===0)var o=ar.return;else o=ar,wa=qa=null,Yt(o),ge=null,Ze=0,o=ar;for(;o!==null;)Pb(o.alternate,o),o=o.return;ar=null}}function yd(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,y6(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),fu=0,r1(),si=o,ar=u=ls(o.current,null),pr=a,Fr=0,Ya=null,Ou=!1,pd=Xo(o,a),J0=!1,md=$a=Z0=Tf=Pu=Ki=0,Ta=Sh=null,Q0=!1,(a&8)!==0&&(a|=a&32);var h=o.entangledLanes;if(h!==0)for(o=o.entanglements,h&=a;0<h;){var x=31-$n(h),S=1<<x;a|=o[x],h&=~S}return uu=a,bc(),u}function ox(o,a){rt=null,dt.H=ph,a===Dt||a===pt?(a=ce(),Fr=3):a===Wt?(a=ce(),Fr=4):Fr=a===P0?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ya=a,ar===null&&(Ki=1,Bp(o,wo(a,o.current)))}function sx(){var o=k.current;return o===null?!0:(pr&4194048)===pr?_===null:(pr&62914560)===pr||(pr&536870912)!==0?o===_:!1}function ax(){var o=dt.H;return dt.H=ph,o===null?ph:o}function lx(){var o=dt.A;return dt.A=GC,o}function Kp(){Ki=4,Ou||(pr&4194048)!==pr&&k.current!==null||(pd=!0),(Pu&134217727)===0&&(Tf&134217727)===0||si===null||Bu(si,pr,$a,!1)}function i1(o,a,u){var h=_r;_r|=2;var x=ax(),S=lx();(si!==o||pr!==a)&&(Xp=null,yd(o,a)),a=!1;var O=Ki;t:do try{if(Fr!==0&&ar!==null){var et=ar,Nt=Ya;switch(Fr){case 8:r1(),O=6;break t;case 3:case 2:case 9:case 6:k.current===null&&(a=!0);var Kt=Fr;if(Fr=0,Ya=null,bd(o,et,Nt,Kt),u&&pd){O=0;break t}break;default:Kt=Fr,Fr=0,Ya=null,bd(o,et,Nt,Kt)}}ZC(),O=Ki;break}catch(ae){ox(o,ae)}while(!0);return a&&o.shellSuspendCounter++,wa=qa=null,_r=h,dt.H=x,dt.A=S,ar===null&&(si=null,pr=0,bc()),O}function ZC(){for(;ar!==null;)cx(ar)}function QC(o,a){var u=_r;_r|=2;var h=ax(),x=lx();si!==o||pr!==a?(Xp=null,Wp=hn()+500,yd(o,a)):pd=Xo(o,a);t:do try{if(Fr!==0&&ar!==null){a=ar;var S=Ya;e:switch(Fr){case 1:Fr=0,Ya=null,bd(o,a,S,1);break;case 2:case 9:if(Ht(S)){Fr=0,Ya=null,ux(a);break}a=function(){Fr!==2&&Fr!==9||si!==o||(Fr=7),Tc(o)},S.then(a,a);break t;case 3:Fr=7;break t;case 4:Fr=5;break t;case 7:Ht(S)?(Fr=0,Ya=null,ux(a)):(Fr=0,Ya=null,bd(o,a,S,7));break;case 5:var O=null;switch(ar.tag){case 26:O=ar.memoizedState;case 5:case 27:var et=ar;if(O?Gx(O):et.stateNode.complete){Fr=0,Ya=null;var Nt=et.sibling;if(Nt!==null)ar=Nt;else{var Kt=et.return;Kt!==null?(ar=Kt,Jp(Kt)):ar=null}break e}}Fr=0,Ya=null,bd(o,a,S,5);break;case 6:Fr=0,Ya=null,bd(o,a,S,6);break;case 8:r1(),Ki=6;break t;default:throw Error(r(462))}}t6();break}catch(ae){ox(o,ae)}while(!0);return wa=qa=null,dt.H=h,dt.A=x,_r=u,ar!==null?0:(si=null,pr=0,bc(),Ki)}function t6(){for(;ar!==null&&!Le();)cx(ar)}function cx(o){var a=Rb(o.alternate,o,uu);o.memoizedProps=o.pendingProps,a===null?Jp(o):ar=a}function ux(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=Eb(u,a,a.pendingProps,a.type,void 0,pr);break;case 11:a=Eb(u,a,a.pendingProps,a.type.render,a.ref,pr);break;case 5:Yt(a);default:Pb(u,a),a=ar=wc(a,uu),a=Rb(u,a,uu)}o.memoizedProps=o.pendingProps,a===null?Jp(o):ar=a}function bd(o,a,u,h){wa=qa=null,Yt(a),ge=null,Ze=0;var x=a.return;try{if(HC(o,x,a,u,pr)){Ki=1,Bp(o,wo(u,o.current)),ar=null;return}}catch(S){if(x!==null)throw ar=x,S;Ki=1,Bp(o,wo(u,o.current)),ar=null;return}a.flags&32768?(tr||h===1?o=!0:pd||(pr&536870912)!==0?o=!1:(Ou=o=!0,(h===2||h===9||h===3||h===6)&&(h=k.current,h!==null&&h.tag===13&&(h.flags|=16384))),fx(a,o)):Jp(a)}function Jp(o){var a=o;do{if((a.flags&32768)!==0){fx(a,Ou);return}o=a.return;var u=$C(a.alternate,a,uu);if(u!==null){ar=u;return}if(a=a.sibling,a!==null){ar=a;return}ar=a=o}while(a!==null);Ki===0&&(Ki=5)}function fx(o,a){do{var u=VC(o.alternate,o);if(u!==null){u.flags&=32767,ar=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){ar=o;return}ar=o=u}while(o!==null);Ki=6,ar=null}function dx(o,a,u,h,x,S,O,et,Nt){o.cancelPendingCommit=null;do Zp();while(Oo!==0);if((_r&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(S=a.lanes|a.childLanes,S|=qc,Ss(o,u,S,O,et,Nt),o===si&&(ar=si=null,pr=0),gd=a,ju=o,fu=u,t1=S,e1=x,ex=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,i6(Sn,function(){return yx(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=dt.T,dt.T=null,x=st.p,st.p=2,O=_r,_r|=4;try{WC(o,a,u)}finally{_r=O,st.p=x,dt.T=h}}Oo=1,hx(),px(),mx()}}function hx(){if(Oo===1){Oo=0;var o=ju,a=gd,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=dt.T,dt.T=null;var h=st.p;st.p=2;var x=_r;_r|=4;try{Wb(a,o);var S=g1,O=Ul(o.containerInfo),et=S.focusedElem,Nt=S.selectionRange;if(O!==et&&et&&et.ownerDocument&&gc(et.ownerDocument.documentElement,et)){if(Nt!==null&&ba(et)){var Kt=Nt.start,ae=Nt.end;if(ae===void 0&&(ae=Kt),"selectionStart"in et)et.selectionStart=Kt,et.selectionEnd=Math.min(ae,et.value.length);else{var ye=et.ownerDocument||document,Jt=ye&&ye.defaultView||window;if(Jt.getSelection){var ee=Jt.getSelection(),ln=et.textContent.length,Ln=Math.min(Nt.start,ln),Kr=Nt.end===void 0?Ln:Math.min(Nt.end,ln);!ee.extend&&Ln>Kr&&(O=Kr,Kr=Ln,Ln=O);var Ut=Fl(et,Ln),Pt=Fl(et,Kr);if(Ut&&Pt&&(ee.rangeCount!==1||ee.anchorNode!==Ut.node||ee.anchorOffset!==Ut.offset||ee.focusNode!==Pt.node||ee.focusOffset!==Pt.offset)){var Gt=ye.createRange();Gt.setStart(Ut.node,Ut.offset),ee.removeAllRanges(),Ln>Kr?(ee.addRange(Gt),ee.extend(Pt.node,Pt.offset)):(Gt.setEnd(Pt.node,Pt.offset),ee.addRange(Gt))}}}}for(ye=[],ee=et;ee=ee.parentNode;)ee.nodeType===1&&ye.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof et.focus=="function"&&et.focus(),et=0;et<ye.length;et++){var he=ye[et];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}um=!!m1,g1=m1=null}finally{_r=x,st.p=h,dt.T=u}}o.current=a,Oo=2}}function px(){if(Oo===2){Oo=0;var o=ju,a=gd,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=dt.T,dt.T=null;var h=st.p;st.p=2;var x=_r;_r|=4;try{Hb(o,a.alternate,a)}finally{_r=x,st.p=h,dt.T=u}}Oo=3}}function mx(){if(Oo===4||Oo===3){Oo=0,Ye();var o=ju,a=gd,u=fu,h=ex;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Oo=5:(Oo=0,gd=ju=null,gx(o,o.pendingLanes));var x=o.pendingLanes;if(x===0&&(Iu=null),fi(u),a=a.stateNode,cn&&typeof cn.onCommitFiberRoot=="function")try{cn.onCommitFiberRoot(bn,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=dt.T,x=st.p,st.p=2,dt.T=null;try{for(var S=o.onRecoverableError,O=0;O<h.length;O++){var et=h[O];S(et.value,{componentStack:et.stack})}}finally{dt.T=a,st.p=x}}(fu&3)!==0&&Zp(),Tc(o),x=o.pendingLanes,(u&261930)!==0&&(x&42)!==0?o===n1?kh++:(kh=0,n1=o):kh=0,Ah(0)}}function gx(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,ml(a)))}function Zp(){return hx(),px(),mx(),yx()}function yx(){if(Oo!==5)return!1;var o=ju,a=t1;t1=0;var u=fi(fu),h=dt.T,x=st.p;try{st.p=32>u?32:u,dt.T=null,u=e1,e1=null;var S=ju,O=fu;if(Oo=0,gd=ju=null,fu=0,(_r&6)!==0)throw Error(r(331));var et=_r;if(_r|=4,Zb(S.current),Gb(S,S.current,O,u),_r=et,Ah(0,!1),cn&&typeof cn.onPostCommitFiberRoot=="function")try{cn.onPostCommitFiberRoot(bn,S)}catch{}return!0}finally{st.p=x,dt.T=h,gx(o,a)}}function bx(o,a,u){a=wo(u,a),a=O0(o.stateNode,a,2),o=jn(o,a,2),o!==null&&(Je(o,2),Tc(o))}function Ur(o,a,u){if(o.tag===3)bx(o,o,u);else for(;a!==null;){if(a.tag===3){bx(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Iu===null||!Iu.has(h))){o=wo(u,o),u=xb(2),h=jn(a,u,2),h!==null&&(vb(u,h,a,o),Je(h,2),Tc(h));break}}a=a.return}}function o1(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new KC;var x=new Set;h.set(a,x)}else x=h.get(a),x===void 0&&(x=new Set,h.set(a,x));x.has(u)||(J0=!0,x.add(u),o=e6.bind(null,o,a,u),a.then(o,o))}function e6(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,si===o&&(pr&u)===u&&(Ki===4||Ki===3&&(pr&62914560)===pr&&300>hn()-Vp?(_r&2)===0&&yd(o,0):Z0|=u,md===pr&&(md=0)),Tc(o)}function xx(o,a){a===0&&(a=Hi()),o=xa(o,a),o!==null&&(Je(o,a),Tc(o))}function n6(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),xx(o,u)}function r6(o,a){var u=0;switch(o.tag){case 31:case 13:var h=o.stateNode,x=o.memoizedState;x!==null&&(u=x.retryLane);break;case 19:h=o.stateNode;break;case 22:h=o.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(a),xx(o,u)}function i6(o,a){return _e(o,a)}var Qp=null,xd=null,s1=!1,tm=!1,a1=!1,zu=0;function Tc(o){o!==xd&&o.next===null&&(xd===null?Qp=xd=o:xd=xd.next=o),tm=!0,s1||(s1=!0,s6())}function Ah(o,a){if(!a1&&tm){a1=!0;do for(var u=!1,h=Qp;h!==null;){if(o!==0){var x=h.pendingLanes;if(x===0)var S=0;else{var O=h.suspendedLanes,et=h.pingedLanes;S=(1<<31-$n(42|o)+1)-1,S&=x&~(O&~et),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(u=!0,kx(h,S))}else S=pr,S=Vn(h,h===si?S:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(S&3)===0||Xo(h,S)||(u=!0,kx(h,S));h=h.next}while(u);a1=!1}}function o6(){vx()}function vx(){tm=s1=!1;var o=0;zu!==0&&g6()&&(o=zu);for(var a=hn(),u=null,h=Qp;h!==null;){var x=h.next,S=wx(h,a);S===0?(h.next=null,u===null?Qp=x:u.next=x,x===null&&(xd=u)):(u=h,(o!==0||(S&3)!==0)&&(tm=!0)),h=x}Oo!==0&&Oo!==5||Ah(o),zu!==0&&(zu=0)}function wx(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,x=o.expirationTimes,S=o.pendingLanes&-62914561;0<S;){var O=31-$n(S),et=1<<O,Nt=x[O];Nt===-1?((et&u)===0||(et&h)!==0)&&(x[O]=ui(et,a)):Nt<=a&&(o.expiredLanes|=et),S&=~et}if(a=si,u=pr,u=Vn(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(Fr===2||Fr===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Te(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||Xo(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Te(h),fi(u)){case 2:case 8:u=Nn;break;case 32:u=Sn;break;case 268435456:u=tn;break;default:u=Sn}return h=Sx.bind(null,o),u=_e(u,h),o.callbackPriority=a,o.callbackNode=u,a}return h!==null&&h!==null&&Te(h),o.callbackPriority=2,o.callbackNode=null,2}function Sx(o,a){if(Oo!==0&&Oo!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(Zp()&&o.callbackNode!==u)return null;var h=pr;return h=Vn(o,o===si?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(rx(o,h,a),wx(o,hn()),o.callbackNode!=null&&o.callbackNode===u?Sx.bind(null,o):null)}function kx(o,a){if(Zp())return null;rx(o,a,!0)}function s6(){b6(function(){(_r&6)!==0?_e(wn,o6):vx()})}function l1(){if(zu===0){var o=m;o===0&&(o=me,me<<=1,(me&261888)===0&&(me=256)),zu=o}return zu}function Ax(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:jo(""+o)}function Mx(o,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,o.id&&u.setAttribute("form",o.id),a.parentNode.insertBefore(u,a),o=new FormData(o),u.parentNode.removeChild(u),o}function a6(o,a,u,h,x){if(a==="submit"&&u&&u.stateNode===x){var S=Ax((x[ir]||null).action),O=h.submitter;O&&(a=(a=O[ir]||null)?Ax(a.formAction):O.getAttribute("formAction"),a!==null&&(S=a,O=null));var et=new Uo("action","action",null,h,x);o.push({event:et,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(zu!==0){var Nt=O?Mx(x,O):new FormData(x);dh(u,{pending:!0,data:Nt,method:x.method,action:S},null,Nt)}}else typeof S=="function"&&(et.preventDefault(),Nt=O?Mx(x,O):new FormData(x),dh(u,{pending:!0,data:Nt,method:x.method,action:S},S,Nt))},currentTarget:x}]})}}for(var c1=0;c1<fl.length;c1++){var u1=fl[c1],l6=u1.toLowerCase(),c6=u1[0].toUpperCase()+u1.slice(1);as(l6,"on"+c6)}as(ss,"onAnimationEnd"),as(Hl,"onAnimationIteration"),as(ul,"onAnimationStart"),as("dblclick","onDoubleClick"),as("focusin","onFocus"),as("focusout","onBlur"),as(Hc,"onTransitionRun"),as(wf,"onTransitionStart"),as(cd,"onTransitionCancel"),as(Nu,"onTransitionEnd"),Ms("onMouseEnter",["mouseout","mouseover"]),Ms("onMouseLeave",["mouseout","mouseover"]),Ms("onPointerEnter",["pointerout","pointerover"]),Ms("onPointerLeave",["pointerout","pointerover"]),qr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qr("onBeforeInput",["compositionend","keypress","textInput","paste"]),qr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mh="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(" "),u6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Mh));function Cx(o,a){a=(a&4)!==0;for(var u=0;u<o.length;u++){var h=o[u],x=h.event;h=h.listeners;t:{var S=void 0;if(a)for(var O=h.length-1;0<=O;O--){var et=h[O],Nt=et.instance,Kt=et.currentTarget;if(et=et.listener,Nt!==S&&x.isPropagationStopped())break t;S=et,x.currentTarget=Kt;try{S(x)}catch(ae){yc(ae)}x.currentTarget=null,S=Nt}else for(O=0;O<h.length;O++){if(et=h[O],Nt=et.instance,Kt=et.currentTarget,et=et.listener,Nt!==S&&x.isPropagationStopped())break t;S=et,x.currentTarget=Kt;try{S(x)}catch(ae){yc(ae)}x.currentTarget=null,S=Nt}}}}function lr(o,a){var u=a[Jo];u===void 0&&(u=a[Jo]=new Set);var h=o+"__bubble";u.has(h)||(Ex(a,o,2,!1),u.add(h))}function f1(o,a,u){var h=0;a&&(h|=4),Ex(u,o,h,a)}var em="_reactListening"+Math.random().toString(36).slice(2);function d1(o){if(!o[em]){o[em]=!0,tl.forEach(function(u){u!=="selectionchange"&&(u6.has(u)||f1(u,!1,o),f1(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[em]||(a[em]=!0,f1("selectionchange",!1,a))}}function Ex(o,a,u,h){switch(nv(a)){case 2:var x=B6;break;case 8:x=z6;break;default:x=E1}u=x.bind(null,a,u,o),x=void 0,!Fo||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),h?x!==void 0?o.addEventListener(a,u,{capture:!0,passive:x}):o.addEventListener(a,u,!0):x!==void 0?o.addEventListener(a,u,{passive:x}):o.addEventListener(a,u,!1)}function h1(o,a,u,h,x){var S=h;if((a&1)===0&&(a&2)===0&&h!==null)t:for(;;){if(h===null)return;var O=h.tag;if(O===3||O===4){var et=h.stateNode.containerInfo;if(et===x)break;if(O===4)for(O=h.return;O!==null;){var Nt=O.tag;if((Nt===3||Nt===4)&&O.stateNode.containerInfo===x)return;O=O.return}for(;et!==null;){if(O=ca(et),O===null)return;if(Nt=O.tag,Nt===5||Nt===6||Nt===26||Nt===27){h=S=O;continue t}et=et.parentNode}}h=h.return}hc(function(){var Kt=S,ae=fc(u),ye=[];t:{var Jt=Sf.get(o);if(Jt!==void 0){var ee=Uo,ln=o;switch(o){case"keypress":if(no(u)===0)break t;case"keydown":case"keyup":ee=In;break;case"focusin":ln="focus",ee=Ba;break;case"focusout":ln="blur",ee=Ba;break;case"beforeblur":case"afterblur":ee=Ba;break;case"click":if(u.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=rl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=_s;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=ue;break;case ss:case Hl:case ul:ee=pa;break;case Nu:ee=$r;break;case"scroll":case"scrollend":ee=da;break;case"wheel":ee=an;break;case"copy":case"cut":case"paste":ee=A;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=or;break;case"toggle":case"beforetoggle":ee=Ws}var Ln=(a&4)!==0,Kr=!Ln&&(o==="scroll"||o==="scrollend"),Ut=Ln?Jt!==null?Jt+"Capture":null:Jt;Ln=[];for(var Pt=Kt,Gt;Pt!==null;){var he=Pt;if(Gt=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||Gt===null||Ut===null||(he=ua(Pt,Ut),he!=null&&Ln.push(Ch(Pt,he,Gt))),Kr)break;Pt=Pt.return}0<Ln.length&&(Jt=new ee(Jt,ln,null,u,ae),ye.push({event:Jt,listeners:Ln}))}}if((a&7)===0){t:{if(Jt=o==="mouseover"||o==="pointerover",ee=o==="mouseout"||o==="pointerout",Jt&&u!==ts&&(ln=u.relatedTarget||u.fromElement)&&(ca(ln)||ln[Gn]))break t;if((ee||Jt)&&(Jt=ae.window===ae?ae:(Jt=ae.ownerDocument)?Jt.defaultView||Jt.parentWindow:window,ee?(ln=u.relatedTarget||u.toElement,ee=Kt,ln=ln?ca(ln):null,ln!==null&&(Kr=s(ln),Ln=ln.tag,ln!==Kr||Ln!==5&&Ln!==27&&Ln!==6)&&(ln=null)):(ee=null,ln=Kt),ee!==ln)){if(Ln=rl,he="onMouseLeave",Ut="onMouseEnter",Pt="mouse",(o==="pointerout"||o==="pointerover")&&(Ln=or,he="onPointerLeave",Ut="onPointerEnter",Pt="pointer"),Kr=ee==null?Jt:Qa(ee),Gt=ln==null?Jt:Qa(ln),Jt=new Ln(he,Pt+"leave",ee,u,ae),Jt.target=Kr,Jt.relatedTarget=Gt,he=null,ca(ae)===Kt&&(Ln=new Ln(Ut,Pt+"enter",ln,u,ae),Ln.target=Gt,Ln.relatedTarget=Kr,he=Ln),Kr=he,ee&&ln)e:{for(Ln=f6,Ut=ee,Pt=ln,Gt=0,he=Ut;he;he=Ln(he))Gt++;he=0;for(var An=Pt;An;An=Ln(An))he++;for(;0<Gt-he;)Ut=Ln(Ut),Gt--;for(;0<he-Gt;)Pt=Ln(Pt),he--;for(;Gt--;){if(Ut===Pt||Pt!==null&&Ut===Pt.alternate){Ln=Ut;break e}Ut=Ln(Ut),Pt=Ln(Pt)}Ln=null}else Ln=null;ee!==null&&Tx(ye,Jt,ee,Ln,!1),ln!==null&&Kr!==null&&Tx(ye,Kr,ln,Ln,!0)}}t:{if(Jt=Kt?Qa(Kt):window,ee=Jt.nodeName&&Jt.nodeName.toLowerCase(),ee==="select"||ee==="input"&&Jt.type==="file")var Er=al;else if(mc(Jt))if(xo)Er=bi;else{Er=Me;var gn=ya}else ee=Jt.nodeName,!ee||ee.toLowerCase()!=="input"||Jt.type!=="checkbox"&&Jt.type!=="radio"?Kt&&cc(Kt.elementType)&&(Er=al):Er=Wi;if(Er&&(Er=Er(o,Kt))){ol(ye,Er,u,ae);break t}gn&&gn(o,Jt,Kt),o==="focusout"&&Kt&&Jt.type==="number"&&Kt.memoizedProps.value!=null&&te(Jt,"number",Jt.value)}switch(gn=Kt?Qa(Kt):window,o){case"focusin":(mc(gn)||gn.contentEditable==="true")&&(is=gn,Ds=Kt,io=null);break;case"focusout":io=Ds=is=null;break;case"mousedown":Zs=!0;break;case"contextmenu":case"mouseup":case"dragend":Zs=!1,oo(ye,u,ae);break;case"selectionchange":if(cl)break;case"keydown":case"keyup":oo(ye,u,ae)}var Kn;if(gr)t:{switch(o){case"compositionstart":var mr="onCompositionStart";break t;case"compositionend":mr="onCompositionEnd";break t;case"compositionupdate":mr="onCompositionUpdate";break t}mr=void 0}else rs?Vi(o,u)&&(mr="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(mr="onCompositionStart");mr&&(Xs&&u.locale!=="ko"&&(rs||mr!=="onCompositionStart"?mr==="onCompositionEnd"&&rs&&(Kn=Ia()):(No=ae,nl="value"in No?No.value:No.textContent,rs=!0)),gn=nm(Kt,mr),0<gn.length&&(mr=new ht(mr,o,null,u,ae),ye.push({event:mr,listeners:gn}),Kn?mr.data=Kn:(Kn=Gs(u),Kn!==null&&(mr.data=Kn)))),(Kn=il?pc(o,u):Ks(o,u))&&(mr=nm(Kt,"onBeforeInput"),0<mr.length&&(gn=new ht("onBeforeInput","beforeinput",null,u,ae),ye.push({event:gn,listeners:mr}),gn.data=Kn)),a6(ye,o,Kt,u,ae)}Cx(ye,a)})}function Ch(o,a,u){return{instance:o,listener:a,currentTarget:u}}function nm(o,a){for(var u=a+"Capture",h=[];o!==null;){var x=o,S=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||S===null||(x=ua(o,u),x!=null&&h.unshift(Ch(o,x,S)),x=ua(o,a),x!=null&&h.push(Ch(o,x,S))),o.tag===3)return h;o=o.return}return[]}function f6(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Tx(o,a,u,h,x){for(var S=a._reactName,O=[];u!==null&&u!==h;){var et=u,Nt=et.alternate,Kt=et.stateNode;if(et=et.tag,Nt!==null&&Nt===h)break;et!==5&&et!==26&&et!==27||Kt===null||(Nt=Kt,x?(Kt=ua(u,S),Kt!=null&&O.unshift(Ch(u,Kt,Nt))):x||(Kt=ua(u,S),Kt!=null&&O.push(Ch(u,Kt,Nt)))),u=u.return}O.length!==0&&o.push({event:a,listeners:O})}var d6=/\r\n?/g,h6=/\u0000|\uFFFD/g;function Nx(o){return(typeof o=="string"?o:""+o).replace(d6,`
9
- `).replace(h6,"")}function _x(o,a){return a=Nx(a),Nx(o)===a}function Gr(o,a,u,h,x,S){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Io(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Io(o,""+h);break;case"className":yi(o,"class",h);break;case"tabIndex":yi(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":yi(o,u,h);break;case"style":lc(o,h,S);break;case"data":if(a!=="object"){yi(o,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){o.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=jo(""+h),o.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){o.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(u==="formAction"?(a!=="input"&&Gr(o,a,"name",x.name,x,null),Gr(o,a,"formEncType",x.formEncType,x,null),Gr(o,a,"formMethod",x.formMethod,x,null),Gr(o,a,"formTarget",x.formTarget,x,null)):(Gr(o,a,"encType",x.encType,x,null),Gr(o,a,"method",x.method,x,null),Gr(o,a,"target",x.target,x,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=jo(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=Bo);break;case"onScroll":h!=null&&lr("scroll",o);break;case"onScrollEnd":h!=null&&lr("scrollend",o);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"multiple":o.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":o.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){o.removeAttribute("xlink:href");break}u=jo(""+h),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""+h):o.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":h===!0?o.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,h):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?o.setAttribute(u,h):o.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?o.removeAttribute(u):o.setAttribute(u,h);break;case"popover":lr("beforetoggle",o),lr("toggle",o),eo(o,"popover",h);break;case"xlinkActuate":Ni(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Ni(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Ni(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Ni(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Ni(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Ni(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Ni(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Ni(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Ni(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":eo(o,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=Tu.get(u)||u,eo(o,u,h))}}function p1(o,a,u,h,x,S){switch(u){case"style":lc(o,h,S);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"children":typeof h=="string"?Io(o,h):(typeof h=="number"||typeof h=="bigint")&&Io(o,""+h);break;case"onScroll":h!=null&&lr("scroll",o);break;case"onScrollEnd":h!=null&&lr("scrollend",o);break;case"onClick":h!=null&&(o.onclick=Bo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pi.hasOwnProperty(u))t:{if(u[0]==="o"&&u[1]==="n"&&(x=u.endsWith("Capture"),a=u.slice(2,x?u.length-7:void 0),S=o[ir]||null,S=S!=null?S[u]:null,typeof S=="function"&&o.removeEventListener(a,S,x),typeof h=="function")){typeof S!="function"&&S!==null&&(u in o?o[u]=null:o.hasAttribute(u)&&o.removeAttribute(u)),o.addEventListener(a,h,x);break t}u in o?o[u]=h:h===!0?o.setAttribute(u,""):eo(o,u,h)}}}function gs(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lr("error",o),lr("load",o);var h=!1,x=!1,S;for(S in u)if(u.hasOwnProperty(S)){var O=u[S];if(O!=null)switch(S){case"src":h=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Gr(o,a,S,O,u,null)}}x&&Gr(o,a,"srcSet",u.srcSet,u,null),h&&Gr(o,a,"src",u.src,u,null);return;case"input":lr("invalid",o);var et=S=O=x=null,Nt=null,Kt=null;for(h in u)if(u.hasOwnProperty(h)){var ae=u[h];if(ae!=null)switch(h){case"name":x=ae;break;case"type":O=ae;break;case"checked":Nt=ae;break;case"defaultChecked":Kt=ae;break;case"value":S=ae;break;case"defaultValue":et=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,a));break;default:Gr(o,a,h,ae,u,null)}}Ys(o,S,et,Nt,Kt,O,x,!1);return;case"select":lr("invalid",o),h=O=S=null;for(x in u)if(u.hasOwnProperty(x)&&(et=u[x],et!=null))switch(x){case"value":S=et;break;case"defaultValue":O=et;break;case"multiple":h=et;default:Gr(o,a,x,et,u,null)}a=S,u=O,o.multiple=!!h,a!=null?el(o,!!h,a,!1):u!=null&&el(o,!!h,u,!0);return;case"textarea":lr("invalid",o),S=x=h=null;for(O in u)if(u.hasOwnProperty(O)&&(et=u[O],et!=null))switch(O){case"value":h=et;break;case"defaultValue":x=et;break;case"children":S=et;break;case"dangerouslySetInnerHTML":if(et!=null)throw Error(r(91));break;default:Gr(o,a,O,et,u,null)}$s(o,h,x,S);return;case"option":for(Nt in u)u.hasOwnProperty(Nt)&&(h=u[Nt],h!=null)&&(Nt==="selected"?o.selected=h&&typeof h!="function"&&typeof h!="symbol":Gr(o,a,Nt,h,u,null));return;case"dialog":lr("beforetoggle",o),lr("toggle",o),lr("cancel",o),lr("close",o);break;case"iframe":case"object":lr("load",o);break;case"video":case"audio":for(h=0;h<Mh.length;h++)lr(Mh[h],o);break;case"image":lr("error",o),lr("load",o);break;case"details":lr("toggle",o);break;case"embed":case"source":case"link":lr("error",o),lr("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Kt in u)if(u.hasOwnProperty(Kt)&&(h=u[Kt],h!=null))switch(Kt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Gr(o,a,Kt,h,u,null)}return;default:if(cc(a)){for(ae in u)u.hasOwnProperty(ae)&&(h=u[ae],h!==void 0&&p1(o,a,ae,h,u,void 0));return}}for(et in u)u.hasOwnProperty(et)&&(h=u[et],h!=null&&Gr(o,a,et,h,u,null))}function p6(o,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,S=null,O=null,et=null,Nt=null,Kt=null,ae=null;for(ee in u){var ye=u[ee];if(u.hasOwnProperty(ee)&&ye!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":Nt=ye;default:h.hasOwnProperty(ee)||Gr(o,a,ee,null,h,ye)}}for(var Jt in h){var ee=h[Jt];if(ye=u[Jt],h.hasOwnProperty(Jt)&&(ee!=null||ye!=null))switch(Jt){case"type":S=ee;break;case"name":x=ee;break;case"checked":Kt=ee;break;case"defaultChecked":ae=ee;break;case"value":O=ee;break;case"defaultValue":et=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,a));break;default:ee!==ye&&Gr(o,a,Jt,ee,h,ye)}}hi(o,O,et,Nt,Kt,ae,S,x);return;case"select":ee=O=et=Jt=null;for(S in u)if(Nt=u[S],u.hasOwnProperty(S)&&Nt!=null)switch(S){case"value":break;case"multiple":ee=Nt;default:h.hasOwnProperty(S)||Gr(o,a,S,null,h,Nt)}for(x in h)if(S=h[x],Nt=u[x],h.hasOwnProperty(x)&&(S!=null||Nt!=null))switch(x){case"value":Jt=S;break;case"defaultValue":et=S;break;case"multiple":O=S;default:S!==Nt&&Gr(o,a,x,S,h,Nt)}a=et,u=O,h=ee,Jt!=null?el(o,!!u,Jt,!1):!!h!=!!u&&(a!=null?el(o,!!u,a,!0):el(o,!!u,u?[]:"",!1));return;case"textarea":ee=Jt=null;for(et in u)if(x=u[et],u.hasOwnProperty(et)&&x!=null&&!h.hasOwnProperty(et))switch(et){case"value":break;case"children":break;default:Gr(o,a,et,null,h,x)}for(O in h)if(x=h[O],S=u[O],h.hasOwnProperty(O)&&(x!=null||S!=null))switch(O){case"value":Jt=x;break;case"defaultValue":ee=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==S&&Gr(o,a,O,x,h,S)}Pa(o,Jt,ee);return;case"option":for(var ln in u)Jt=u[ln],u.hasOwnProperty(ln)&&Jt!=null&&!h.hasOwnProperty(ln)&&(ln==="selected"?o.selected=!1:Gr(o,a,ln,null,h,Jt));for(Nt in h)Jt=h[Nt],ee=u[Nt],h.hasOwnProperty(Nt)&&Jt!==ee&&(Jt!=null||ee!=null)&&(Nt==="selected"?o.selected=Jt&&typeof Jt!="function"&&typeof Jt!="symbol":Gr(o,a,Nt,Jt,h,ee));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ln in u)Jt=u[Ln],u.hasOwnProperty(Ln)&&Jt!=null&&!h.hasOwnProperty(Ln)&&Gr(o,a,Ln,null,h,Jt);for(Kt in h)if(Jt=h[Kt],ee=u[Kt],h.hasOwnProperty(Kt)&&Jt!==ee&&(Jt!=null||ee!=null))switch(Kt){case"children":case"dangerouslySetInnerHTML":if(Jt!=null)throw Error(r(137,a));break;default:Gr(o,a,Kt,Jt,h,ee)}return;default:if(cc(a)){for(var Kr in u)Jt=u[Kr],u.hasOwnProperty(Kr)&&Jt!==void 0&&!h.hasOwnProperty(Kr)&&p1(o,a,Kr,void 0,h,Jt);for(ae in h)Jt=h[ae],ee=u[ae],!h.hasOwnProperty(ae)||Jt===ee||Jt===void 0&&ee===void 0||p1(o,a,ae,Jt,h,ee);return}}for(var Ut in u)Jt=u[Ut],u.hasOwnProperty(Ut)&&Jt!=null&&!h.hasOwnProperty(Ut)&&Gr(o,a,Ut,null,h,Jt);for(ye in h)Jt=h[ye],ee=u[ye],!h.hasOwnProperty(ye)||Jt===ee||Jt==null&&ee==null||Gr(o,a,ye,Jt,h,ee)}function Dx(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function m6(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var x=u[h],S=x.transferSize,O=x.initiatorType,et=x.duration;if(S&&et&&Dx(O)){for(O=0,et=x.responseEnd,h+=1;h<u.length;h++){var Nt=u[h],Kt=Nt.startTime;if(Kt>et)break;var ae=Nt.transferSize,ye=Nt.initiatorType;ae&&Dx(ye)&&(Nt=Nt.responseEnd,O+=ae*(Nt<et?1:(et-Kt)/(Nt-Kt)))}if(--h,a+=8*(S+O)/(x.duration/1e3),o++,10<o)break}}if(0<o)return a/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var m1=null,g1=null;function rm(o){return o.nodeType===9?o:o.ownerDocument}function Lx(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Rx(o,a){if(o===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&a==="foreignObject"?0:o}function y1(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var b1=null;function g6(){var o=window.event;return o&&o.type==="popstate"?o===b1?!1:(b1=o,!0):(b1=null,!1)}var Ox=typeof setTimeout=="function"?setTimeout:void 0,y6=typeof clearTimeout=="function"?clearTimeout:void 0,Px=typeof Promise=="function"?Promise:void 0,b6=typeof queueMicrotask=="function"?queueMicrotask:typeof Px<"u"?function(o){return Px.resolve(null).then(o).catch(x6)}:Ox;function x6(o){setTimeout(function(){throw o})}function Fu(o){return o==="head"}function Ix(o,a){var u=a,h=0;do{var x=u.nextSibling;if(o.removeChild(u),x&&x.nodeType===8)if(u=x.data,u==="/$"||u==="/&"){if(h===0){o.removeChild(x),kd(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Eh(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,Eh(u);for(var S=u.firstChild;S;){var O=S.nextSibling,et=S.nodeName;S[To]||et==="SCRIPT"||et==="STYLE"||et==="LINK"&&S.rel.toLowerCase()==="stylesheet"||u.removeChild(S),S=O}}else u==="body"&&Eh(o.ownerDocument.body);u=x}while(u);kd(a)}function jx(o,a){var u=o;o=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(o===0)break;o--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||o++;u=h}while(u)}function x1(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":x1(u),Ll(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function v6(o,a,u,h){for(;o.nodeType===1;){var x=u;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(h){if(!o[To])switch(a){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(S=o.getAttribute("rel"),S==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(S!==x.rel||o.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||o.getAttribute("title")!==(x.title==null?null:x.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(S=o.getAttribute("src"),(S!==(x.src==null?null:x.src)||o.getAttribute("type")!==(x.type==null?null:x.type)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&S&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var S=x.name==null?null:""+x.name;if(x.type==="hidden"&&o.getAttribute("name")===S)return o}else return o;if(o=xl(o.nextSibling),o===null)break}return null}function w6(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=xl(o.nextSibling),o===null))return null;return o}function Bx(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=xl(o.nextSibling),o===null))return null;return o}function v1(o){return o.data==="$?"||o.data==="$~"}function w1(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function S6(o,a){var u=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),o._reactRetry=h}}function xl(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return o}var S1=null;function zx(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(a===0)return xl(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function Fx(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return o;a--}else u!=="/$"&&u!=="/&"||a++}o=o.previousSibling}return null}function Ux(o,a,u){switch(a=rm(u),o){case"html":if(o=a.documentElement,!o)throw Error(r(452));return o;case"head":if(o=a.head,!o)throw Error(r(453));return o;case"body":if(o=a.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Eh(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);Ll(o)}var vl=new Map,Hx=new Set;function im(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var du=st.d;st.d={f:k6,r:A6,D:M6,C:C6,L:E6,m:T6,X:_6,S:N6,M:D6};function k6(){var o=du.f(),a=Gp();return o||a}function A6(o){var a=As(o);a!==null&&a.tag===5&&a.type==="form"?ob(a):du.r(o)}var vd=typeof document>"u"?null:document;function qx(o,a,u){var h=vd;if(h&&typeof a=="string"&&a){var x=Ir(a);x='link[rel="'+o+'"][href="'+x+'"]',typeof u=="string"&&(x+='[crossorigin="'+u+'"]'),Hx.has(x)||(Hx.add(x),o={rel:o,crossOrigin:u,href:a},h.querySelector(x)===null&&(a=h.createElement("link"),gs(a,"link",o),di(a),h.head.appendChild(a)))}}function M6(o){du.D(o),qx("dns-prefetch",o,null)}function C6(o,a){du.C(o,a),qx("preconnect",o,a)}function E6(o,a,u){du.L(o,a,u);var h=vd;if(h&&o&&a){var x='link[rel="preload"][as="'+Ir(a)+'"]';a==="image"&&u&&u.imageSrcSet?(x+='[imagesrcset="'+Ir(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(x+='[imagesizes="'+Ir(u.imageSizes)+'"]')):x+='[href="'+Ir(o)+'"]';var S=x;switch(a){case"style":S=wd(o);break;case"script":S=Sd(o)}vl.has(S)||(o=g({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),vl.set(S,o),h.querySelector(x)!==null||a==="style"&&h.querySelector(Th(S))||a==="script"&&h.querySelector(Nh(S))||(a=h.createElement("link"),gs(a,"link",o),di(a),h.head.appendChild(a)))}}function T6(o,a){du.m(o,a);var u=vd;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+Ir(h)+'"][href="'+Ir(o)+'"]',S=x;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Sd(o)}if(!vl.has(S)&&(o=g({rel:"modulepreload",href:o},a),vl.set(S,o),u.querySelector(x)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Nh(S)))return}h=u.createElement("link"),gs(h,"link",o),di(h),u.head.appendChild(h)}}}function N6(o,a,u){du.S(o,a,u);var h=vd;if(h&&o){var x=Qo(h).hoistableStyles,S=wd(o);a=a||"default";var O=x.get(S);if(!O){var et={loading:0,preload:null};if(O=h.querySelector(Th(S)))et.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":a},u),(u=vl.get(S))&&k1(o,u);var Nt=O=h.createElement("link");di(Nt),gs(Nt,"link",o),Nt._p=new Promise(function(Kt,ae){Nt.onload=Kt,Nt.onerror=ae}),Nt.addEventListener("load",function(){et.loading|=1}),Nt.addEventListener("error",function(){et.loading|=2}),et.loading|=4,om(O,a,h)}O={type:"stylesheet",instance:O,count:1,state:et},x.set(S,O)}}}function _6(o,a){du.X(o,a);var u=vd;if(u&&o){var h=Qo(u).hoistableScripts,x=Sd(o),S=h.get(x);S||(S=u.querySelector(Nh(x)),S||(o=g({src:o,async:!0},a),(a=vl.get(x))&&A1(o,a),S=u.createElement("script"),di(S),gs(S,"link",o),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function D6(o,a){du.M(o,a);var u=vd;if(u&&o){var h=Qo(u).hoistableScripts,x=Sd(o),S=h.get(x);S||(S=u.querySelector(Nh(x)),S||(o=g({src:o,async:!0,type:"module"},a),(a=vl.get(x))&&A1(o,a),S=u.createElement("script"),di(S),gs(S,"link",o),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function Yx(o,a,u,h){var x=(x=vt.current)?im(x):null;if(!x)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=wd(u.href),u=Qo(x).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){o=wd(u.href);var S=Qo(x).hoistableStyles,O=S.get(o);if(O||(x=x.ownerDocument||x,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(o,O),(S=x.querySelector(Th(o)))&&!S._p&&(O.instance=S,O.state.loading=5),vl.has(o)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},vl.set(o,u),S||L6(x,o,u,O.state))),a&&h===null)throw Error(r(528,""));return O}if(a&&h!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Sd(u),u=Qo(x).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function wd(o){return'href="'+Ir(o)+'"'}function Th(o){return'link[rel="stylesheet"]['+o+"]"}function $x(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function L6(o,a,u,h){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=o.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),gs(a,"link",u),di(a),o.head.appendChild(a))}function Sd(o){return'[src="'+Ir(o)+'"]'}function Nh(o){return"script[async]"+o}function Vx(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+Ir(u.href)+'"]');if(h)return a.instance=h,di(h),h;var x=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(o.ownerDocument||o).createElement("style"),di(h),gs(h,"style",x),om(h,u.precedence,o),a.instance=h;case"stylesheet":x=wd(u.href);var S=o.querySelector(Th(x));if(S)return a.state.loading|=4,a.instance=S,di(S),S;h=$x(u),(x=vl.get(x))&&k1(h,x),S=(o.ownerDocument||o).createElement("link"),di(S);var O=S;return O._p=new Promise(function(et,Nt){O.onload=et,O.onerror=Nt}),gs(S,"link",h),a.state.loading|=4,om(S,u.precedence,o),a.instance=S;case"script":return S=Sd(u.src),(x=o.querySelector(Nh(S)))?(a.instance=x,di(x),x):(h=u,(x=vl.get(S))&&(h=g({},u),A1(h,x)),o=o.ownerDocument||o,x=o.createElement("script"),di(x),gs(x,"link",h),o.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,om(h,u.precedence,o));return a.instance}function om(o,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=h.length?h[h.length-1]:null,S=x,O=0;O<h.length;O++){var et=h[O];if(et.dataset.precedence===a)S=et;else if(S!==x)break}S?S.parentNode.insertBefore(o,S.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(o,a.firstChild))}function k1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function A1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var sm=null;function Wx(o,a,u){if(sm===null){var h=new Map,x=sm=new Map;x.set(u,h)}else x=sm,h=x.get(u),h||(h=new Map,x.set(u,h));if(h.has(o))return h;for(h.set(o,null),u=u.getElementsByTagName(o),x=0;x<u.length;x++){var S=u[x];if(!(S[To]||S[Ar]||o==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var O=S.getAttribute(a)||"";O=o+O;var et=h.get(O);et?et.push(S):h.set(O,[S])}}return h}function Xx(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function R6(o,a,u){if(u===1||a.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(o=a.disabled,typeof a.precedence=="string"&&o==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Gx(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function O6(o,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var x=wd(h.href),S=a.querySelector(Th(x));if(S){a=S._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=am.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=S,di(S);return}S=a.ownerDocument||a,h=$x(h),(x=vl.get(x))&&k1(h,x),S=S.createElement("link"),di(S);var O=S;O._p=new Promise(function(et,Nt){O.onload=et,O.onerror=Nt}),gs(S,"link",h),u.instance=S}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=am.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var M1=0;function P6(o,a){return o.stylesheets&&o.count===0&&cm(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&cm(o,o.stylesheets),o.unsuspend){var S=o.unsuspend;o.unsuspend=null,S()}},6e4+a);0<o.imgBytes&&M1===0&&(M1=62500*m6());var x=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&cm(o,o.stylesheets),o.unsuspend)){var S=o.unsuspend;o.unsuspend=null,S()}},(o.imgBytes>M1?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(x)}}:null}function am(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var lm=null;function cm(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,lm=new Map,a.forEach(I6,o),lm=null,am.call(o))}function I6(o,a){if(!(a.state.loading&4)){var u=lm.get(o);if(u)var h=u.get(null);else{u=new Map,lm.set(o,u);for(var x=o.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<x.length;S++){var O=x[S];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(u.set(O.dataset.precedence,O),h=O)}h&&u.set(null,h)}x=a.instance,O=x.getAttribute("data-precedence"),S=u.get(O)||h,S===h&&u.set(null,x),u.set(O,x),this.count++,h=am.bind(this),x.addEventListener("load",h),x.addEventListener("error",h),S?S.parentNode.insertBefore(x,S.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(x,o.firstChild)),a.state.loading|=4}}var _h={$$typeof:Y,Provider:null,Consumer:null,_currentValue:lt,_currentValue2:lt,_threadCount:0};function j6(o,a,u,h,x,S,O,et,Nt){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Go(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Go(0),this.hiddenUpdates=Go(null),this.identifierPrefix=h,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Nt,this.incompleteTransitions=new Map}function Kx(o,a,u,h,x,S,O,et,Nt,Kt,ae,ye){return o=new j6(o,a,u,O,Nt,Kt,ae,ye,et),a=1,S===!0&&(a|=24),S=vo(3,null,null,a),o.current=S,S.stateNode=o,a=ka(),a.refCount++,o.pooledCache=a,a.refCount++,S.memoizedState={element:h,isDehydrated:u,cache:a},Oe(S),o}function Jx(o){return o?(o=Xi,o):Xi}function Zx(o,a,u,h,x,S){x=Jx(x),h.context===null?h.context=x:h.pendingContext=x,h=Mn(a),h.payload={element:u},S=S===void 0?null:S,S!==null&&(h.callback=S),u=jn(o,h,a),u!==null&&(Na(u,o,a),kr(u,o,a))}function Qx(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function C1(o,a){Qx(o,a),(o=o.alternate)&&Qx(o,a)}function tv(o){if(o.tag===13||o.tag===31){var a=xa(o,67108864);a!==null&&Na(a,o,67108864),C1(o,67108864)}}function ev(o){if(o.tag===13||o.tag===31){var a=Va();a=Xn(a);var u=xa(o,a);u!==null&&Na(u,o,a),C1(o,a)}}var um=!0;function B6(o,a,u,h){var x=dt.T;dt.T=null;var S=st.p;try{st.p=2,E1(o,a,u,h)}finally{st.p=S,dt.T=x}}function z6(o,a,u,h){var x=dt.T;dt.T=null;var S=st.p;try{st.p=8,E1(o,a,u,h)}finally{st.p=S,dt.T=x}}function E1(o,a,u,h){if(um){var x=T1(h);if(x===null)h1(o,a,h,fm,u),rv(o,h);else if(U6(x,o,a,u,h))h.stopPropagation();else if(rv(o,h),a&4&&-1<F6.indexOf(o)){for(;x!==null;){var S=As(x);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var O=Pe(S.pendingLanes);if(O!==0){var et=S;for(et.pendingLanes|=2,et.entangledLanes|=2;O;){var Nt=1<<31-$n(O);et.entanglements[1]|=Nt,O&=~Nt}Tc(S),(_r&6)===0&&(Wp=hn()+500,Ah(0))}}break;case 31:case 13:et=xa(S,2),et!==null&&Na(et,S,2),Gp(),C1(S,2)}if(S=T1(h),S===null&&h1(o,a,h,fm,u),S===x)break;x=S}x!==null&&h.stopPropagation()}else h1(o,a,h,null,u)}}function T1(o){return o=fc(o),N1(o)}var fm=null;function N1(o){if(fm=null,o=ca(o),o!==null){var a=s(o);if(a===null)o=null;else{var u=a.tag;if(u===13){if(o=l(a),o!==null)return o;o=null}else if(u===31){if(o=c(a),o!==null)return o;o=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return fm=o,null}function nv(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Pn()){case wn:return 2;case Nn:return 8;case Sn:case Be:return 32;case tn:return 268435456;default:return 32}default:return 32}}var _1=!1,Uu=null,Hu=null,qu=null,Dh=new Map,Lh=new Map,Yu=[],F6="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function rv(o,a){switch(o){case"focusin":case"focusout":Uu=null;break;case"dragenter":case"dragleave":Hu=null;break;case"mouseover":case"mouseout":qu=null;break;case"pointerover":case"pointerout":Dh.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lh.delete(a.pointerId)}}function Rh(o,a,u,h,x,S){return o===null||o.nativeEvent!==S?(o={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:S,targetContainers:[x]},a!==null&&(a=As(a),a!==null&&tv(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),o)}function U6(o,a,u,h,x){switch(a){case"focusin":return Uu=Rh(Uu,o,a,u,h,x),!0;case"dragenter":return Hu=Rh(Hu,o,a,u,h,x),!0;case"mouseover":return qu=Rh(qu,o,a,u,h,x),!0;case"pointerover":var S=x.pointerId;return Dh.set(S,Rh(Dh.get(S)||null,o,a,u,h,x)),!0;case"gotpointercapture":return S=x.pointerId,Lh.set(S,Rh(Lh.get(S)||null,o,a,u,h,x)),!0}return!1}function iv(o){var a=ca(o.target);if(a!==null){var u=s(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){o.blockedOn=a,Ko(o.priority,function(){ev(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,Ko(o.priority,function(){ev(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function dm(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=T1(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);ts=h,u.target.dispatchEvent(h),ts=null}else return a=As(u),a!==null&&tv(a),o.blockedOn=u,!1;a.shift()}return!0}function ov(o,a,u){dm(o)&&u.delete(a)}function H6(){_1=!1,Uu!==null&&dm(Uu)&&(Uu=null),Hu!==null&&dm(Hu)&&(Hu=null),qu!==null&&dm(qu)&&(qu=null),Dh.forEach(ov),Lh.forEach(ov)}function hm(o,a){o.blockedOn===a&&(o.blockedOn=null,_1||(_1=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,H6)))}var pm=null;function sv(o){pm!==o&&(pm=o,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){pm===o&&(pm=null);for(var a=0;a<o.length;a+=3){var u=o[a],h=o[a+1],x=o[a+2];if(typeof h!="function"){if(N1(h||u)===null)continue;break}var S=As(u);S!==null&&(o.splice(a,3),a-=3,dh(S,{pending:!0,data:x,method:u.method,action:h},h,x))}}))}function kd(o){function a(Nt){return hm(Nt,o)}Uu!==null&&hm(Uu,o),Hu!==null&&hm(Hu,o),qu!==null&&hm(qu,o),Dh.forEach(a),Lh.forEach(a);for(var u=0;u<Yu.length;u++){var h=Yu[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Yu.length&&(u=Yu[0],u.blockedOn===null);)iv(u),u.blockedOn===null&&Yu.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var x=u[h],S=u[h+1],O=x[ir]||null;if(typeof S=="function")O||sv(u);else if(O){var et=null;if(S&&S.hasAttribute("formAction")){if(x=S,O=S[ir]||null)et=O.formAction;else if(N1(x)!==null)continue}else et=O.action;typeof et=="function"?u[h+1]=et:(u.splice(h,3),h-=3),sv(u)}}}function av(){function o(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(O){return x=O})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,x=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function D1(o){this._internalRoot=o}mm.prototype.render=D1.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=Va();Zx(u,h,o,a,null,null)},mm.prototype.unmount=D1.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Zx(o.current,2,null,o,null,null),Gp(),a[Gn]=null}};function mm(o){this._internalRoot=o}mm.prototype.unstable_scheduleHydration=function(o){if(o){var a=Ti();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Yu.length&&a!==0&&a<Yu[u].priority;u++);Yu.splice(u,0,o),u===0&&iv(o)}};var lv=t.version;if(lv!=="19.2.4")throw Error(r(527,lv,"19.2.4"));st.findDOMNode=function(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=d(a),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var q6={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:dt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var gm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!gm.isDisabled&&gm.supportsFiber)try{bn=gm.inject(q6),cn=gm}catch{}}return Ph.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",x=mb,S=gb,O=yb;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(S=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError)),a=Kx(o,1,!1,null,null,u,h,null,x,S,O,av),o[Gn]=a.current,d1(o),new D1(a)},Ph.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,x="",S=mb,O=gb,et=yb,Nt=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onUncaughtError!==void 0&&(S=u.onUncaughtError),u.onCaughtError!==void 0&&(O=u.onCaughtError),u.onRecoverableError!==void 0&&(et=u.onRecoverableError),u.formState!==void 0&&(Nt=u.formState)),a=Kx(o,1,!0,a,u??null,h,x,Nt,S,O,et,av),a.context=Jx(null),u=a.current,h=Va(),h=Xn(h),x=Mn(h),x.callback=null,jn(u,x,h),u=h,a.current.lanes=u,Je(a,u),Tc(a),o[Gn]=a.current,d1(o),new mm(a)},Ph.version="19.2.4",Ph}var bv;function Z6(){if(bv)return O1.exports;bv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),O1.exports=J6(),O1.exports}var Q6=Z6();const ys=[];for(let n=0;n<256;++n)ys.push((n+256).toString(16).slice(1));function tE(n,t=0){return(ys[n[t+0]]+ys[n[t+1]]+ys[n[t+2]]+ys[n[t+3]]+"-"+ys[n[t+4]]+ys[n[t+5]]+"-"+ys[n[t+6]]+ys[n[t+7]]+"-"+ys[n[t+8]]+ys[n[t+9]]+"-"+ys[n[t+10]]+ys[n[t+11]]+ys[n[t+12]]+ys[n[t+13]]+ys[n[t+14]]+ys[n[t+15]]).toLowerCase()}let B1;const eE=new Uint8Array(16);function nE(){if(!B1){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");B1=crypto.getRandomValues.bind(crypto)}return B1(eE)}const rE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xv={randomUUID:rE};function iE(n,t,e){n=n||{};const r=n.random??n.rng?.()??nE();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,tE(r)}function wl(n,t,e){return xv.randomUUID&&!n?xv.randomUUID():iE(n)}const oE="modulepreload",sE=function(n,t){return new URL(n,t).href},vv={},z1=function(t,e,r){let i=Promise.resolve();if(e&&e.length>0){let d=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};const l=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");i=d(e.map(p=>{if(p=sE(p,r),p in vv)return;vv[p]=!0;const g=p.endsWith(".css"),b=g?'[rel="stylesheet"]':"";if(r)for(let M=l.length-1;M>=0;M--){const C=l[M];if(C.href===p&&(!g||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${b}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":oE,g||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((M,C)=>{y.addEventListener("load",M),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};function Hr(n){"@babel/helpers - typeof";return Hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hr(n)}var ic=Uint8Array,Ka=Uint16Array,o5=Int32Array,s5=new ic([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a5=new ic([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wv=new ic([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kk=function(n,t){for(var e=new Ka(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var i=new o5(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)i[s]=s-e[r]<<5|r;return{b:e,r:i}},Ak=kk(s5,2),aE=Ak.b,Qy=Ak.r;aE[28]=258,Qy[258]=28;var lE=kk(a5,0),Sv=lE.r,t2=new Ka(32768);for(var Ci=0;Ci<32768;++Ci){var Vu=(Ci&43690)>>1|(Ci&21845)<<1;Vu=(Vu&52428)>>2|(Vu&13107)<<2,Vu=(Vu&61680)>>4|(Vu&3855)<<4,t2[Ci]=((Vu&65280)>>8|(Vu&255)<<8)>>1}var Jh=(function(n,t,e){for(var r=n.length,i=0,s=new Ka(t);i<r;++i)n[i]&&++s[n[i]-1];var l=new Ka(t);for(i=1;i<t;++i)l[i]=l[i-1]+s[i-1]<<1;var c;if(e){c=new Ka(1<<t);var f=15-t;for(i=0;i<r;++i)if(n[i])for(var d=i<<4|n[i],p=t-n[i],g=l[n[i]-1]++<<p,b=g|(1<<p)-1;g<=b;++g)c[t2[g]>>f]=d}else for(c=new Ka(r),i=0;i<r;++i)n[i]&&(c[i]=t2[l[n[i]-1]++]>>15-n[i]);return c}),Kf=new ic(288);for(var Ci=0;Ci<144;++Ci)Kf[Ci]=8;for(var Ci=144;Ci<256;++Ci)Kf[Ci]=9;for(var Ci=256;Ci<280;++Ci)Kf[Ci]=7;for(var Ci=280;Ci<288;++Ci)Kf[Ci]=8;var ug=new ic(32);for(var Ci=0;Ci<32;++Ci)ug[Ci]=5;var cE=Jh(Kf,9,0),uE=Jh(ug,5,0),Mk=function(n){return(n+7)/8|0},fE=function(n,t,e){return(e==null||e>n.length)&&(e=n.length),new ic(n.subarray(t,e))},hu=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8},Ih=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8,n[r+2]|=e>>16},F1=function(n,t){for(var e=[],r=0;r<n.length;++r)n[r]&&e.push({s:r,f:n[r]});var i=e.length,s=e.slice();if(!i)return{t:Ek,l:0};if(i==1){var l=new ic(e[0].s+1);return l[e[0].s]=1,{t:l,l:1}}e.sort(function(St,_t){return St.f-_t.f}),e.push({s:-1,f:25001});var c=e[0],f=e[1],d=0,p=1,g=2;for(e[0]={s:-1,f:c.f+f.f,l:c,r:f};p!=i-1;)c=e[e[d].f<e[g].f?d++:g++],f=e[d!=p&&e[d].f<e[g].f?d++:g++],e[p++]={s:-1,f:c.f+f.f,l:c,r:f};for(var b=s[0].s,r=1;r<i;++r)s[r].s>b&&(b=s[r].s);var y=new Ka(b+1),M=e2(e[p-1],y,0);if(M>t){var r=0,C=0,D=M-t,L=1<<D;for(s.sort(function(_t,Ct){return y[Ct.s]-y[_t.s]||_t.f-Ct.f});r<i;++r){var H=s[r].s;if(y[H]>t)C+=L-(1<<M-y[H]),y[H]=t;else break}for(C>>=D;C>0;){var Y=s[r].s;y[Y]<t?C-=1<<t-y[Y]++-1:++r}for(;r>=0&&C;--r){var W=s[r].s;y[W]==t&&(--y[W],++C)}M=t}return{t:new ic(y),l:M}},e2=function(n,t,e){return n.s==-1?Math.max(e2(n.l,t,e+1),e2(n.r,t,e+1)):t[n.s]=e},kv=function(n){for(var t=n.length;t&&!n[--t];);for(var e=new Ka(++t),r=0,i=n[0],s=1,l=function(f){e[r++]=f},c=1;c<=t;++c)if(n[c]==i&&c!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)l(32754);s>2&&(l(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(l(i),--s;s>6;s-=6)l(8304);s>2&&(l(s-3<<5|8208),s=0)}for(;s--;)l(i);s=1,i=n[c]}return{c:e.subarray(0,r),n:t}},jh=function(n,t){for(var e=0,r=0;r<t.length;++r)e+=n[r]*t[r];return e},Ck=function(n,t,e){var r=e.length,i=Mk(t+2);n[i]=r&255,n[i+1]=r>>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var s=0;s<r;++s)n[i+s+4]=e[s];return(i+4+r)*8},Av=function(n,t,e,r,i,s,l,c,f,d,p){hu(t,p++,e),++i[256];for(var g=F1(i,15),b=g.t,y=g.l,M=F1(s,15),C=M.t,D=M.l,L=kv(b),H=L.c,Y=L.n,W=kv(C),St=W.c,_t=W.n,Ct=new Ka(19),bt=0;bt<H.length;++bt)++Ct[H[bt]&31];for(var bt=0;bt<St.length;++bt)++Ct[St[bt]&31];for(var ot=F1(Ct,7),jt=ot.t,Z=ot.l,ct=19;ct>4&&!jt[wv[ct-1]];--ct);var V=d+5<<3,xt=jh(i,Kf)+jh(s,ug)+l,Lt=jh(i,b)+jh(s,C)+l+14+3*ct+jh(Ct,jt)+2*Ct[16]+3*Ct[17]+7*Ct[18];if(f>=0&&V<=xt&&V<=Lt)return Ck(t,p,n.subarray(f,f+d));var dt,st,lt,zt;if(hu(t,p,1+(Lt<xt)),p+=2,Lt<xt){dt=Jh(b,y,0),st=b,lt=Jh(C,D,0),zt=C;var At=Jh(jt,Z,0);hu(t,p,Y-257),hu(t,p+5,_t-1),hu(t,p+10,ct-4),p+=14;for(var bt=0;bt<ct;++bt)hu(t,p+3*bt,jt[wv[bt]]);p+=3*ct;for(var K=[H,St],P=0;P<2;++P)for(var X=K[P],bt=0;bt<X.length;++bt){var tt=X[bt]&31;hu(t,p,At[tt]),p+=jt[tt],tt>15&&(hu(t,p,X[bt]>>5&127),p+=X[bt]>>12)}}else dt=cE,st=Kf,lt=uE,zt=ug;for(var bt=0;bt<c;++bt){var gt=r[bt];if(gt>255){var tt=gt>>18&31;Ih(t,p,dt[tt+257]),p+=st[tt+257],tt>7&&(hu(t,p,gt>>23&31),p+=s5[tt]);var vt=gt&31;Ih(t,p,lt[vt]),p+=zt[vt],vt>3&&(Ih(t,p,gt>>5&8191),p+=a5[vt])}else Ih(t,p,dt[gt]),p+=st[gt]}return Ih(t,p,dt[256]),p+st[256]},dE=new o5([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ek=new ic(0),hE=function(n,t,e,r,i,s){var l=s.z||n.length,c=new ic(r+l+5*(1+Math.ceil(l/7e3))+i),f=c.subarray(r,c.length-i),d=s.l,p=(s.r||0)&7;if(t){p&&(f[0]=s.r>>3);for(var g=dE[t-1],b=g>>13,y=g&8191,M=(1<<e)-1,C=s.p||new Ka(32768),D=s.h||new Ka(M+1),L=Math.ceil(e/3),H=2*L,Y=function(Ue){return(n[Ue]^n[Ue+1]<<L^n[Ue+2]<<H)&M},W=new o5(25e3),St=new Ka(288),_t=new Ka(32),Ct=0,bt=0,ot=s.i||0,jt=0,Z=s.w||0,ct=0;ot+2<l;++ot){var V=Y(ot),xt=ot&32767,Lt=D[V];if(C[xt]=Lt,D[V]=xt,Z<=ot){var dt=l-ot;if((Ct>7e3||jt>24576)&&(dt>423||!d)){p=Av(n,f,0,W,St,_t,bt,jt,ct,ot-ct,p),jt=Ct=bt=0,ct=ot;for(var st=0;st<286;++st)St[st]=0;for(var st=0;st<30;++st)_t[st]=0}var lt=2,zt=0,At=y,K=xt-Lt&32767;if(dt>2&&V==Y(ot-K))for(var P=Math.min(b,dt)-1,X=Math.min(32767,ot),tt=Math.min(258,dt);K<=X&&--At&&xt!=Lt;){if(n[ot+lt]==n[ot+lt-K]){for(var gt=0;gt<tt&&n[ot+gt]==n[ot+gt-K];++gt);if(gt>lt){if(lt=gt,zt=K,gt>P)break;for(var vt=Math.min(K,gt-2),kt=0,st=0;st<vt;++st){var qt=ot-K+st&32767,Rt=C[qt],Zt=qt-Rt&32767;Zt>kt&&(kt=Zt,Lt=qt)}}}xt=Lt,Lt=C[xt],K+=xt-Lt&32767}if(zt){W[jt++]=268435456|Qy[lt]<<18|Sv[zt];var Ae=Qy[lt]&31,le=Sv[zt]&31;bt+=s5[Ae]+a5[le],++St[257+Ae],++_t[le],Z=ot+lt,++Ct}else W[jt++]=n[ot],++St[n[ot]]}}for(ot=Math.max(ot,Z);ot<l;++ot)W[jt++]=n[ot],++St[n[ot]];p=Av(n,f,d,W,St,_t,bt,jt,ct,ot-ct,p),d||(s.r=p&7|f[p/8|0]<<3,p-=7,s.h=D,s.p=C,s.i=ot,s.w=Z)}else{for(var ot=s.w||0;ot<l+d;ot+=65535){var Ie=ot+65535;Ie>=l&&(f[p/8|0]=d,Ie=l),p=Ck(f,p+1,n.subarray(ot,Ie))}s.i=l}return fE(c,0,r+Mk(p)+i)},Tk=function(){var n=1,t=0;return{p:function(e){for(var r=n,i=t,s=e.length|0,l=0;l!=s;){for(var c=Math.min(l+2655,s);l<c;++l)i+=r+=e[l];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}n=r,t=i},d:function(){return n%=65521,t%=65521,(n&255)<<24|(n&65280)<<8|(t&255)<<8|t>>8}}},pE=function(n,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),l=new ic(s.length+n.length);l.set(s),l.set(n,s.length),n=l,i.w=s.length}return hE(n,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+t.mem,e,r,i)},Nk=function(n,t,e){for(;e;++t)n[t]=e,e>>>=8},mE=function(n,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(n[0]=120,n[1]=r<<6|(t.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,t.dictionary){var i=Tk();i.p(t.dictionary),Nk(n,2,i.d())}};function n2(n,t){t||(t={});var e=Tk();e.p(n);var r=pE(n,t,t.dictionary?6:2,4);return mE(r,t),Nk(r,r.length-4,e.d()),r}var gE=typeof TextDecoder<"u"&&new TextDecoder,yE=0;try{gE.decode(Ek,{stream:!0}),yE=1}catch{}function bE(n){if(Array.isArray(n))return n}function xE(n,t){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var r,i,s,l,c=[],f=!0,d=!1;try{if(s=(e=e.call(n)).next,t!==0)for(;!(f=(r=s.call(e)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(p){d=!0,i=p}finally{try{if(!f&&e.return!=null&&(l=e.return(),Object(l)!==l))return}finally{if(d)throw i}}return c}}function Mv(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,r=Array(t);e<t;e++)r[e]=n[e];return r}function vE(n,t){if(n){if(typeof n=="string")return Mv(n,t);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Mv(n,t):void 0}}function wE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
10
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cv(n,t){return bE(n)||xE(n,t)||vE(n,t)||wE()}function Ev(n,t="utf8"){return new TextDecoder(t).decode(n)}const SE=new TextEncoder;function kE(n){return SE.encode(n)}const AE=1024*8,ME=(()=>{const n=new Uint8Array(4),t=new Uint32Array(n.buffer);return!((t[0]=1)&n[0])})(),U1={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class l5{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=AE,e={}){let r=!1;typeof t=="number"?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);const i=e.offset?e.offset>>>0:0,s=t.byteLength-i;let l=i;(ArrayBuffer.isView(t)||t instanceof l5)&&(t.byteLength!==t.buffer.byteLength&&(l=t.byteOffset+i),t=t.buffer),r?this.lastWrittenByte=s:this.lastWrittenByte=0,this.buffer=t,this.length=s,this.byteLength=s,this.byteOffset=l,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,l,s),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const r=(this.offset+t)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=r,this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,e){const r=U1[e].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,s=this.buffer.slice(i,i+r);if(this.littleEndian===ME&&e!=="uint8"&&e!=="int8"){const c=new Uint8Array(this.buffer.slice(i,i+r));c.reverse();const f=new U1[e](c.buffer);return this.offset+=r,f.reverse(),f}const l=new U1[e](s);return this.offset+=r,l}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let e="";for(let r=0;r<t;r++)e+=this.readChar();return e}readUtf8(t=1){return Ev(this.readBytes(t))}decodeText(t=1,e="utf8"){return Ev(this.readBytes(t),e)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let e=0;e<t.length;e++)this._data.setUint8(this.offset++,t[e]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let e=0;e<t.length;e++)this.writeUint8(t.charCodeAt(e));return this}writeUtf8(t){return this.writeBytes(kE(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function ih(n){let t=n.length;for(;--t>=0;)n[t]=0}const CE=3,EE=258,_k=29,TE=256,NE=TE+1+_k,Dk=30,_E=512,DE=new Array((NE+2)*2);ih(DE);const LE=new Array(Dk*2);ih(LE);const RE=new Array(_E);ih(RE);const OE=new Array(EE-CE+1);ih(OE);const PE=new Array(_k);ih(PE);const IE=new Array(Dk);ih(IE);const jE=(n,t,e,r)=>{let i=n&65535|0,s=n>>>16&65535|0,l=0;for(;e!==0;){l=e>2e3?2e3:e,e-=l;do i=i+t[r++]|0,s=s+i|0;while(--l);i%=65521,s%=65521}return i|s<<16|0};var r2=jE;const BE=()=>{let n,t=[];for(var e=0;e<256;e++){n=e;for(var r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n}return t},zE=new Uint32Array(BE()),FE=(n,t,e,r)=>{const i=zE,s=r+e;n^=-1;for(let l=r;l<s;l++)n=n>>>8^i[(n^t[l])&255];return n^-1};var Nc=FE,i2={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Lk={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const UE=(n,t)=>Object.prototype.hasOwnProperty.call(n,t);var HE=function(n){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const r in e)UE(e,r)&&(n[r]=e[r])}}return n},qE=n=>{let t=0;for(let r=0,i=n.length;r<i;r++)t+=n[r].length;const e=new Uint8Array(t);for(let r=0,i=0,s=n.length;r<s;r++){let l=n[r];e.set(l,i),i+=l.length}return e},Rk={assign:HE,flattenChunks:qE};let Ok=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ok=!1}const hp=new Uint8Array(256);for(let n=0;n<256;n++)hp[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;hp[254]=hp[254]=1;var YE=n=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(n);let t,e,r,i,s,l=n.length,c=0;for(i=0;i<l;i++)e=n.charCodeAt(i),(e&64512)===55296&&i+1<l&&(r=n.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),c+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(c),s=0,i=0;s<c;i++)e=n.charCodeAt(i),(e&64512)===55296&&i+1<l&&(r=n.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),e<128?t[s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|e&63):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|e&63):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|e&63);return t};const $E=(n,t)=>{if(t<65534&&n.subarray&&Ok)return String.fromCharCode.apply(null,n.length===t?n:n.subarray(0,t));let e="";for(let r=0;r<t;r++)e+=String.fromCharCode(n[r]);return e};var VE=(n,t)=>{const e=t||n.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(n.subarray(0,t));let r,i;const s=new Array(e*2);for(i=0,r=0;r<e;){let l=n[r++];if(l<128){s[i++]=l;continue}let c=hp[l];if(c>4){s[i++]=65533,r+=c-1;continue}for(l&=c===2?31:c===3?15:7;c>1&&r<e;)l=l<<6|n[r++]&63,c--;if(c>1){s[i++]=65533;continue}l<65536?s[i++]=l:(l-=65536,s[i++]=55296|l>>10&1023,s[i++]=56320|l&1023)}return $E(s,i)},WE=(n,t)=>{t=t||n.length,t>n.length&&(t=n.length);let e=t-1;for(;e>=0&&(n[e]&192)===128;)e--;return e<0||e===0?t:e+hp[n[e]]>t?e:t},o2={string2buf:YE,buf2string:VE,utf8border:WE};function XE(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var GE=XE;const ym=16209,KE=16191;var JE=function(t,e){let r,i,s,l,c,f,d,p,g,b,y,M,C,D,L,H,Y,W,St,_t,Ct,bt,ot,jt;const Z=t.state;r=t.next_in,ot=t.input,i=r+(t.avail_in-5),s=t.next_out,jt=t.output,l=s-(e-t.avail_out),c=s+(t.avail_out-257),f=Z.dmax,d=Z.wsize,p=Z.whave,g=Z.wnext,b=Z.window,y=Z.hold,M=Z.bits,C=Z.lencode,D=Z.distcode,L=(1<<Z.lenbits)-1,H=(1<<Z.distbits)-1;t:do{M<15&&(y+=ot[r++]<<M,M+=8,y+=ot[r++]<<M,M+=8),Y=C[y&L];e:for(;;){if(W=Y>>>24,y>>>=W,M-=W,W=Y>>>16&255,W===0)jt[s++]=Y&65535;else if(W&16){St=Y&65535,W&=15,W&&(M<W&&(y+=ot[r++]<<M,M+=8),St+=y&(1<<W)-1,y>>>=W,M-=W),M<15&&(y+=ot[r++]<<M,M+=8,y+=ot[r++]<<M,M+=8),Y=D[y&H];n:for(;;){if(W=Y>>>24,y>>>=W,M-=W,W=Y>>>16&255,W&16){if(_t=Y&65535,W&=15,M<W&&(y+=ot[r++]<<M,M+=8,M<W&&(y+=ot[r++]<<M,M+=8)),_t+=y&(1<<W)-1,_t>f){t.msg="invalid distance too far back",Z.mode=ym;break t}if(y>>>=W,M-=W,W=s-l,_t>W){if(W=_t-W,W>p&&Z.sane){t.msg="invalid distance too far back",Z.mode=ym;break t}if(Ct=0,bt=b,g===0){if(Ct+=d-W,W<St){St-=W;do jt[s++]=b[Ct++];while(--W);Ct=s-_t,bt=jt}}else if(g<W){if(Ct+=d+g-W,W-=g,W<St){St-=W;do jt[s++]=b[Ct++];while(--W);if(Ct=0,g<St){W=g,St-=W;do jt[s++]=b[Ct++];while(--W);Ct=s-_t,bt=jt}}}else if(Ct+=g-W,W<St){St-=W;do jt[s++]=b[Ct++];while(--W);Ct=s-_t,bt=jt}for(;St>2;)jt[s++]=bt[Ct++],jt[s++]=bt[Ct++],jt[s++]=bt[Ct++],St-=3;St&&(jt[s++]=bt[Ct++],St>1&&(jt[s++]=bt[Ct++]))}else{Ct=s-_t;do jt[s++]=jt[Ct++],jt[s++]=jt[Ct++],jt[s++]=jt[Ct++],St-=3;while(St>2);St&&(jt[s++]=jt[Ct++],St>1&&(jt[s++]=jt[Ct++]))}}else if((W&64)===0){Y=D[(Y&65535)+(y&(1<<W)-1)];continue n}else{t.msg="invalid distance code",Z.mode=ym;break t}break}}else if((W&64)===0){Y=C[(Y&65535)+(y&(1<<W)-1)];continue e}else if(W&32){Z.mode=KE;break t}else{t.msg="invalid literal/length code",Z.mode=ym;break t}break}}while(r<i&&s<c);St=M>>3,r-=St,M-=St<<3,y&=(1<<M)-1,t.next_in=r,t.next_out=s,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=s<c?257+(c-s):257-(s-c),Z.hold=y,Z.bits=M};const Ad=15,Tv=852,Nv=592,_v=0,H1=1,Dv=2,ZE=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),QE=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),tT=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),eT=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),nT=(n,t,e,r,i,s,l,c)=>{const f=c.bits;let d=0,p=0,g=0,b=0,y=0,M=0,C=0,D=0,L=0,H=0,Y,W,St,_t,Ct,bt=null,ot;const jt=new Uint16Array(Ad+1),Z=new Uint16Array(Ad+1);let ct=null,V,xt,Lt;for(d=0;d<=Ad;d++)jt[d]=0;for(p=0;p<r;p++)jt[t[e+p]]++;for(y=f,b=Ad;b>=1&&jt[b]===0;b--);if(y>b&&(y=b),b===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,c.bits=1,0;for(g=1;g<b&&jt[g]===0;g++);for(y<g&&(y=g),D=1,d=1;d<=Ad;d++)if(D<<=1,D-=jt[d],D<0)return-1;if(D>0&&(n===_v||b!==1))return-1;for(Z[1]=0,d=1;d<Ad;d++)Z[d+1]=Z[d]+jt[d];for(p=0;p<r;p++)t[e+p]!==0&&(l[Z[t[e+p]]++]=p);if(n===_v?(bt=ct=l,ot=20):n===H1?(bt=ZE,ct=QE,ot=257):(bt=tT,ct=eT,ot=0),H=0,p=0,d=g,Ct=s,M=y,C=0,St=-1,L=1<<y,_t=L-1,n===H1&&L>Tv||n===Dv&&L>Nv)return 1;for(;;){V=d-C,l[p]+1<ot?(xt=0,Lt=l[p]):l[p]>=ot?(xt=ct[l[p]-ot],Lt=bt[l[p]-ot]):(xt=96,Lt=0),Y=1<<d-C,W=1<<M,g=W;do W-=Y,i[Ct+(H>>C)+W]=V<<24|xt<<16|Lt|0;while(W!==0);for(Y=1<<d-1;H&Y;)Y>>=1;if(Y!==0?(H&=Y-1,H+=Y):H=0,p++,--jt[d]===0){if(d===b)break;d=t[e+l[p]]}if(d>y&&(H&_t)!==St){for(C===0&&(C=y),Ct+=g,M=d-C,D=1<<M;M+C<b&&(D-=jt[M+C],!(D<=0));)M++,D<<=1;if(L+=1<<M,n===H1&&L>Tv||n===Dv&&L>Nv)return 1;St=H&_t,i[St]=y<<24|M<<16|Ct-s|0}}return H!==0&&(i[Ct+H]=d-C<<24|64<<16|0),c.bits=y,0};var Zh=nT;const rT=0,Pk=1,Ik=2,{Z_FINISH:Lv,Z_BLOCK:iT,Z_TREES:bm,Z_OK:Jf,Z_STREAM_END:oT,Z_NEED_DICT:sT,Z_STREAM_ERROR:Dl,Z_DATA_ERROR:jk,Z_MEM_ERROR:Bk,Z_BUF_ERROR:aT,Z_DEFLATED:Rv}=Lk,l0=16180,Ov=16181,Pv=16182,Iv=16183,jv=16184,Bv=16185,zv=16186,Fv=16187,Uv=16188,Hv=16189,fg=16190,pu=16191,q1=16192,qv=16193,Y1=16194,Yv=16195,$v=16196,Vv=16197,Wv=16198,xm=16199,vm=16200,Xv=16201,Gv=16202,Kv=16203,Jv=16204,Zv=16205,$1=16206,Qv=16207,tw=16208,Ri=16209,zk=16210,Fk=16211,lT=852,cT=592,uT=15,fT=uT,ew=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function dT(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const od=n=>{if(!n)return 1;const t=n.state;return!t||t.strm!==n||t.mode<l0||t.mode>Fk?1:0},Uk=n=>{if(od(n))return Dl;const t=n.state;return n.total_in=n.total_out=t.total=0,n.msg="",t.wrap&&(n.adler=t.wrap&1),t.mode=l0,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(lT),t.distcode=t.distdyn=new Int32Array(cT),t.sane=1,t.back=-1,Jf},Hk=n=>{if(od(n))return Dl;const t=n.state;return t.wsize=0,t.whave=0,t.wnext=0,Uk(n)},qk=(n,t)=>{let e;if(od(n))return Dl;const r=n.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Dl:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=e,r.wbits=t,Hk(n))},Yk=(n,t)=>{if(!n)return Dl;const e=new dT;n.state=e,e.strm=n,e.window=null,e.mode=l0;const r=qk(n,t);return r!==Jf&&(n.state=null),r},hT=n=>Yk(n,fT);let nw=!0,V1,W1;const pT=n=>{if(nw){V1=new Int32Array(512),W1=new Int32Array(32);let t=0;for(;t<144;)n.lens[t++]=8;for(;t<256;)n.lens[t++]=9;for(;t<280;)n.lens[t++]=7;for(;t<288;)n.lens[t++]=8;for(Zh(Pk,n.lens,0,288,V1,0,n.work,{bits:9}),t=0;t<32;)n.lens[t++]=5;Zh(Ik,n.lens,0,32,W1,0,n.work,{bits:5}),nw=!1}n.lencode=V1,n.lenbits=9,n.distcode=W1,n.distbits=5},$k=(n,t,e,r)=>{let i;const s=n.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(e-r,e-r+i),s.wnext),r-=i,r?(s.window.set(t.subarray(e-r,e),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},mT=(n,t)=>{let e,r,i,s,l,c,f,d,p,g,b,y,M,C,D=0,L,H,Y,W,St,_t,Ct,bt;const ot=new Uint8Array(4);let jt,Z;const ct=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(od(n)||!n.output||!n.input&&n.avail_in!==0)return Dl;e=n.state,e.mode===pu&&(e.mode=q1),l=n.next_out,i=n.output,f=n.avail_out,s=n.next_in,r=n.input,c=n.avail_in,d=e.hold,p=e.bits,g=c,b=f,bt=Jf;t:for(;;)switch(e.mode){case l0:if(e.wrap===0){e.mode=q1;break}for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.wrap&2&&d===35615){e.wbits===0&&(e.wbits=15),e.check=0,ot[0]=d&255,ot[1]=d>>>8&255,e.check=Nc(e.check,ot,2,0),d=0,p=0,e.mode=Ov;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((d&255)<<8)+(d>>8))%31){n.msg="incorrect header check",e.mode=Ri;break}if((d&15)!==Rv){n.msg="unknown compression method",e.mode=Ri;break}if(d>>>=4,p-=4,Ct=(d&15)+8,e.wbits===0&&(e.wbits=Ct),Ct>15||Ct>e.wbits){n.msg="invalid window size",e.mode=Ri;break}e.dmax=1<<e.wbits,e.flags=0,n.adler=e.check=1,e.mode=d&512?Hv:pu,d=0,p=0;break;case Ov:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.flags=d,(e.flags&255)!==Rv){n.msg="unknown compression method",e.mode=Ri;break}if(e.flags&57344){n.msg="unknown header flags set",e.mode=Ri;break}e.head&&(e.head.text=d>>8&1),e.flags&512&&e.wrap&4&&(ot[0]=d&255,ot[1]=d>>>8&255,e.check=Nc(e.check,ot,2,0)),d=0,p=0,e.mode=Pv;case Pv:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.head&&(e.head.time=d),e.flags&512&&e.wrap&4&&(ot[0]=d&255,ot[1]=d>>>8&255,ot[2]=d>>>16&255,ot[3]=d>>>24&255,e.check=Nc(e.check,ot,4,0)),d=0,p=0,e.mode=Iv;case Iv:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.head&&(e.head.xflags=d&255,e.head.os=d>>8),e.flags&512&&e.wrap&4&&(ot[0]=d&255,ot[1]=d>>>8&255,e.check=Nc(e.check,ot,2,0)),d=0,p=0,e.mode=jv;case jv:if(e.flags&1024){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.length=d,e.head&&(e.head.extra_len=d),e.flags&512&&e.wrap&4&&(ot[0]=d&255,ot[1]=d>>>8&255,e.check=Nc(e.check,ot,2,0)),d=0,p=0}else e.head&&(e.head.extra=null);e.mode=Bv;case Bv:if(e.flags&1024&&(y=e.length,y>c&&(y=c),y&&(e.head&&(Ct=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(r.subarray(s,s+y),Ct)),e.flags&512&&e.wrap&4&&(e.check=Nc(e.check,r,y,s)),c-=y,s+=y,e.length-=y),e.length))break t;e.length=0,e.mode=zv;case zv:if(e.flags&2048){if(c===0)break t;y=0;do Ct=r[s+y++],e.head&&Ct&&e.length<65536&&(e.head.name+=String.fromCharCode(Ct));while(Ct&&y<c);if(e.flags&512&&e.wrap&4&&(e.check=Nc(e.check,r,y,s)),c-=y,s+=y,Ct)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=Fv;case Fv:if(e.flags&4096){if(c===0)break t;y=0;do Ct=r[s+y++],e.head&&Ct&&e.length<65536&&(e.head.comment+=String.fromCharCode(Ct));while(Ct&&y<c);if(e.flags&512&&e.wrap&4&&(e.check=Nc(e.check,r,y,s)),c-=y,s+=y,Ct)break t}else e.head&&(e.head.comment=null);e.mode=Uv;case Uv:if(e.flags&512){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.wrap&4&&d!==(e.check&65535)){n.msg="header crc mismatch",e.mode=Ri;break}d=0,p=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),n.adler=e.check=0,e.mode=pu;break;case Hv:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.adler=e.check=ew(d),d=0,p=0,e.mode=fg;case fg:if(e.havedict===0)return n.next_out=l,n.avail_out=f,n.next_in=s,n.avail_in=c,e.hold=d,e.bits=p,sT;n.adler=e.check=1,e.mode=pu;case pu:if(t===iT||t===bm)break t;case q1:if(e.last){d>>>=p&7,p-=p&7,e.mode=$1;break}for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}switch(e.last=d&1,d>>>=1,p-=1,d&3){case 0:e.mode=qv;break;case 1:if(pT(e),e.mode=xm,t===bm){d>>>=2,p-=2;break t}break;case 2:e.mode=$v;break;case 3:n.msg="invalid block type",e.mode=Ri}d>>>=2,p-=2;break;case qv:for(d>>>=p&7,p-=p&7;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if((d&65535)!==(d>>>16^65535)){n.msg="invalid stored block lengths",e.mode=Ri;break}if(e.length=d&65535,d=0,p=0,e.mode=Y1,t===bm)break t;case Y1:e.mode=Yv;case Yv:if(y=e.length,y){if(y>c&&(y=c),y>f&&(y=f),y===0)break t;i.set(r.subarray(s,s+y),l),c-=y,s+=y,f-=y,l+=y,e.length-=y;break}e.mode=pu;break;case $v:for(;p<14;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.nlen=(d&31)+257,d>>>=5,p-=5,e.ndist=(d&31)+1,d>>>=5,p-=5,e.ncode=(d&15)+4,d>>>=4,p-=4,e.nlen>286||e.ndist>30){n.msg="too many length or distance symbols",e.mode=Ri;break}e.have=0,e.mode=Vv;case Vv:for(;e.have<e.ncode;){for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.lens[ct[e.have++]]=d&7,d>>>=3,p-=3}for(;e.have<19;)e.lens[ct[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,jt={bits:e.lenbits},bt=Zh(rT,e.lens,0,19,e.lencode,0,e.work,jt),e.lenbits=jt.bits,bt){n.msg="invalid code lengths set",e.mode=Ri;break}e.have=0,e.mode=Wv;case Wv:for(;e.have<e.nlen+e.ndist;){for(;D=e.lencode[d&(1<<e.lenbits)-1],L=D>>>24,H=D>>>16&255,Y=D&65535,!(L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(Y<16)d>>>=L,p-=L,e.lens[e.have++]=Y;else{if(Y===16){for(Z=L+2;p<Z;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(d>>>=L,p-=L,e.have===0){n.msg="invalid bit length repeat",e.mode=Ri;break}Ct=e.lens[e.have-1],y=3+(d&3),d>>>=2,p-=2}else if(Y===17){for(Z=L+3;p<Z;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=L,p-=L,Ct=0,y=3+(d&7),d>>>=3,p-=3}else{for(Z=L+7;p<Z;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=L,p-=L,Ct=0,y=11+(d&127),d>>>=7,p-=7}if(e.have+y>e.nlen+e.ndist){n.msg="invalid bit length repeat",e.mode=Ri;break}for(;y--;)e.lens[e.have++]=Ct}}if(e.mode===Ri)break;if(e.lens[256]===0){n.msg="invalid code -- missing end-of-block",e.mode=Ri;break}if(e.lenbits=9,jt={bits:e.lenbits},bt=Zh(Pk,e.lens,0,e.nlen,e.lencode,0,e.work,jt),e.lenbits=jt.bits,bt){n.msg="invalid literal/lengths set",e.mode=Ri;break}if(e.distbits=6,e.distcode=e.distdyn,jt={bits:e.distbits},bt=Zh(Ik,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,jt),e.distbits=jt.bits,bt){n.msg="invalid distances set",e.mode=Ri;break}if(e.mode=xm,t===bm)break t;case xm:e.mode=vm;case vm:if(c>=6&&f>=258){n.next_out=l,n.avail_out=f,n.next_in=s,n.avail_in=c,e.hold=d,e.bits=p,JE(n,b),l=n.next_out,i=n.output,f=n.avail_out,s=n.next_in,r=n.input,c=n.avail_in,d=e.hold,p=e.bits,e.mode===pu&&(e.back=-1);break}for(e.back=0;D=e.lencode[d&(1<<e.lenbits)-1],L=D>>>24,H=D>>>16&255,Y=D&65535,!(L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(H&&(H&240)===0){for(W=L,St=H,_t=Y;D=e.lencode[_t+((d&(1<<W+St)-1)>>W)],L=D>>>24,H=D>>>16&255,Y=D&65535,!(W+L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=W,p-=W,e.back+=W}if(d>>>=L,p-=L,e.back+=L,e.length=Y,H===0){e.mode=Zv;break}if(H&32){e.back=-1,e.mode=pu;break}if(H&64){n.msg="invalid literal/length code",e.mode=Ri;break}e.extra=H&15,e.mode=Xv;case Xv:if(e.extra){for(Z=e.extra;p<Z;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.length+=d&(1<<e.extra)-1,d>>>=e.extra,p-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=Gv;case Gv:for(;D=e.distcode[d&(1<<e.distbits)-1],L=D>>>24,H=D>>>16&255,Y=D&65535,!(L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if((H&240)===0){for(W=L,St=H,_t=Y;D=e.distcode[_t+((d&(1<<W+St)-1)>>W)],L=D>>>24,H=D>>>16&255,Y=D&65535,!(W+L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=W,p-=W,e.back+=W}if(d>>>=L,p-=L,e.back+=L,H&64){n.msg="invalid distance code",e.mode=Ri;break}e.offset=Y,e.extra=H&15,e.mode=Kv;case Kv:if(e.extra){for(Z=e.extra;p<Z;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.offset+=d&(1<<e.extra)-1,d>>>=e.extra,p-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){n.msg="invalid distance too far back",e.mode=Ri;break}e.mode=Jv;case Jv:if(f===0)break t;if(y=b-f,e.offset>y){if(y=e.offset-y,y>e.whave&&e.sane){n.msg="invalid distance too far back",e.mode=Ri;break}y>e.wnext?(y-=e.wnext,M=e.wsize-y):M=e.wnext-y,y>e.length&&(y=e.length),C=e.window}else C=i,M=l-e.offset,y=e.length;y>f&&(y=f),f-=y,e.length-=y;do i[l++]=C[M++];while(--y);e.length===0&&(e.mode=vm);break;case Zv:if(f===0)break t;i[l++]=e.length,f--,e.mode=vm;break;case $1:if(e.wrap){for(;p<32;){if(c===0)break t;c--,d|=r[s++]<<p,p+=8}if(b-=f,n.total_out+=b,e.total+=b,e.wrap&4&&b&&(n.adler=e.check=e.flags?Nc(e.check,i,b,l-b):r2(e.check,i,b,l-b)),b=f,e.wrap&4&&(e.flags?d:ew(d))!==e.check){n.msg="incorrect data check",e.mode=Ri;break}d=0,p=0}e.mode=Qv;case Qv:if(e.wrap&&e.flags){for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(e.wrap&4&&d!==(e.total&4294967295)){n.msg="incorrect length check",e.mode=Ri;break}d=0,p=0}e.mode=tw;case tw:bt=oT;break t;case Ri:bt=jk;break t;case zk:return Bk;case Fk:default:return Dl}return n.next_out=l,n.avail_out=f,n.next_in=s,n.avail_in=c,e.hold=d,e.bits=p,(e.wsize||b!==n.avail_out&&e.mode<Ri&&(e.mode<$1||t!==Lv))&&$k(n,n.output,n.next_out,b-n.avail_out),g-=n.avail_in,b-=n.avail_out,n.total_in+=g,n.total_out+=b,e.total+=b,e.wrap&4&&b&&(n.adler=e.check=e.flags?Nc(e.check,i,b,n.next_out-b):r2(e.check,i,b,n.next_out-b)),n.data_type=e.bits+(e.last?64:0)+(e.mode===pu?128:0)+(e.mode===xm||e.mode===Y1?256:0),(g===0&&b===0||t===Lv)&&bt===Jf&&(bt=aT),bt},gT=n=>{if(od(n))return Dl;let t=n.state;return t.window&&(t.window=null),n.state=null,Jf},yT=(n,t)=>{if(od(n))return Dl;const e=n.state;return(e.wrap&2)===0?Dl:(e.head=t,t.done=!1,Jf)},bT=(n,t)=>{const e=t.length;let r,i,s;return od(n)||(r=n.state,r.wrap!==0&&r.mode!==fg)?Dl:r.mode===fg&&(i=1,i=r2(i,t,e,0),i!==r.check)?jk:(s=$k(n,t,e,e),s?(r.mode=zk,Bk):(r.havedict=1,Jf))};var xT=Hk,vT=qk,wT=Uk,ST=hT,kT=Yk,AT=mT,MT=gT,CT=yT,ET=bT,TT="pako inflate (from Nodeca project)",wu={inflateReset:xT,inflateReset2:vT,inflateResetKeep:wT,inflateInit:ST,inflateInit2:kT,inflate:AT,inflateEnd:MT,inflateGetHeader:CT,inflateSetDictionary:ET,inflateInfo:TT};function NT(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var _T=NT;const Vk=Object.prototype.toString,{Z_NO_FLUSH:DT,Z_FINISH:LT,Z_OK:pp,Z_STREAM_END:X1,Z_NEED_DICT:G1,Z_STREAM_ERROR:RT,Z_DATA_ERROR:rw,Z_MEM_ERROR:OT}=Lk;function Ep(n){this.options=Rk.assign({chunkSize:1024*64,windowBits:15,to:""},n||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(n&&n.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new GE,this.strm.avail_out=0;let e=wu.inflateInit2(this.strm,t.windowBits);if(e!==pp)throw new Error(i2[e]);if(this.header=new _T,wu.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=o2.string2buf(t.dictionary):Vk.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=wu.inflateSetDictionary(this.strm,t.dictionary),e!==pp)))throw new Error(i2[e])}Ep.prototype.push=function(n,t){const e=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,l,c;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?LT:DT,Vk.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(r),e.next_out=0,e.avail_out=r),s=wu.inflate(e,l),s===G1&&i&&(s=wu.inflateSetDictionary(e,i),s===pp?s=wu.inflate(e,l):s===rw&&(s=G1));e.avail_in>0&&s===X1&&e.state.wrap>0&&n[e.next_in]!==0;)wu.inflateReset(e),s=wu.inflate(e,l);switch(s){case RT:case rw:case G1:case OT:return this.onEnd(s),this.ended=!0,!1}if(c=e.avail_out,e.next_out&&(e.avail_out===0||s===X1))if(this.options.to==="string"){let f=o2.utf8border(e.output,e.next_out),d=e.next_out-f,p=o2.buf2string(e.output,f);e.next_out=d,e.avail_out=r-d,d&&e.output.set(e.output.subarray(f,f+d),0),this.onData(p)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(s===pp&&c===0)){if(s===X1)return s=wu.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Ep.prototype.onData=function(n){this.chunks.push(n)};Ep.prototype.onEnd=function(n){n===pp&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Rk.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function PT(n,t){const e=new Ep(t);if(e.push(n),e.err)throw e.msg||i2[e.err];return e.result}var IT=Ep,jT=PT,BT={Inflate:IT,inflate:jT};const{Inflate:zT,inflate:FT}=BT;var iw=zT,UT=FT;const Wk=[];for(let n=0;n<256;n++){let t=n;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t=t>>>1;Wk[n]=t}const ow=4294967295;function HT(n,t,e){let r=n;for(let i=0;i<e;i++)r=Wk[(r^t[i])&255]^r>>>8;return r}function qT(n,t){return(HT(ow,n,t)^ow)>>>0}function sw(n,t,e){const r=n.readUint32(),i=qT(new Uint8Array(n.buffer,n.byteOffset+n.offset-t-4,t),t);if(i!==r)throw new Error(`CRC mismatch for chunk ${e}. Expected ${r}, found ${i}`)}function Xk(n,t,e){for(let r=0;r<e;r++)t[r]=n[r]}function Gk(n,t,e,r){let i=0;for(;i<r;i++)t[i]=n[i];for(;i<e;i++)t[i]=n[i]+t[i-r]&255}function Kk(n,t,e,r){let i=0;if(e.length===0)for(;i<r;i++)t[i]=n[i];else for(;i<r;i++)t[i]=n[i]+e[i]&255}function Jk(n,t,e,r,i){let s=0;if(e.length===0){for(;s<i;s++)t[s]=n[s];for(;s<r;s++)t[s]=n[s]+(t[s-i]>>1)&255}else{for(;s<i;s++)t[s]=n[s]+(e[s]>>1)&255;for(;s<r;s++)t[s]=n[s]+(t[s-i]+e[s]>>1)&255}}function Zk(n,t,e,r,i){let s=0;if(e.length===0){for(;s<i;s++)t[s]=n[s];for(;s<r;s++)t[s]=n[s]+t[s-i]&255}else{for(;s<i;s++)t[s]=n[s]+e[s]&255;for(;s<r;s++)t[s]=n[s]+YT(t[s-i],e[s],e[s-i])&255}}function YT(n,t,e){const r=n+t-e,i=Math.abs(r-n),s=Math.abs(r-t),l=Math.abs(r-e);return i<=s&&i<=l?n:s<=l?t:e}function $T(n,t,e,r,i,s){switch(n){case 0:Xk(t,e,i);break;case 1:Gk(t,e,i,s);break;case 2:Kk(t,e,r,i);break;case 3:Jk(t,e,r,i,s);break;case 4:Zk(t,e,r,i,s);break;default:throw new Error(`Unsupported filter: ${n}`)}}const VT=new Uint16Array([255]),WT=new Uint8Array(VT.buffer),XT=WT[0]===255;function GT(n){const{data:t,width:e,height:r,channels:i,depth:s}=n,l=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],c=Math.ceil(s/8)*i,f=new Uint8Array(r*e*c);let d=0;for(let p=0;p<7;p++){const g=l[p],b=Math.ceil((e-g.x)/g.xStep),y=Math.ceil((r-g.y)/g.yStep);if(b<=0||y<=0)continue;const M=b*c,C=new Uint8Array(M);for(let D=0;D<y;D++){const L=t[d++],H=t.subarray(d,d+M);d+=M;const Y=new Uint8Array(M);$T(L,H,Y,C,M,c),C.set(Y);for(let W=0;W<b;W++){const St=g.x+W*g.xStep,_t=g.y+D*g.yStep;if(!(St>=e||_t>=r))for(let Ct=0;Ct<c;Ct++)f[(_t*e+St)*c+Ct]=Y[W*c+Ct]}}}if(s===16){const p=new Uint16Array(f.buffer);if(XT)for(let g=0;g<p.length;g++)p[g]=KT(p[g]);return p}else return f}function KT(n){return(n&255)<<8|n>>8&255}const JT=new Uint16Array([255]),ZT=new Uint8Array(JT.buffer),QT=ZT[0]===255,tN=new Uint8Array(0);function aw(n){const{data:t,width:e,height:r,channels:i,depth:s}=n,l=Math.ceil(s/8)*i,c=Math.ceil(s/8*i*e),f=new Uint8Array(r*c);let d=tN,p=0,g,b;for(let y=0;y<r;y++){switch(g=t.subarray(p+1,p+1+c),b=f.subarray(y*c,(y+1)*c),t[p]){case 0:Xk(g,b,c);break;case 1:Gk(g,b,c,l);break;case 2:Kk(g,b,d,c);break;case 3:Jk(g,b,d,c,l);break;case 4:Zk(g,b,d,c,l);break;default:throw new Error(`Unsupported filter: ${t[p]}`)}d=b,p+=c+1}if(s===16){const y=new Uint16Array(f.buffer);if(QT)for(let M=0;M<y.length;M++)y[M]=eN(y[M]);return y}else return f}function eN(n){return(n&255)<<8|n>>8&255}const Km=Uint8Array.of(137,80,78,71,13,10,26,10);function lw(n){if(!nN(n.readBytes(Km.length)))throw new Error("wrong PNG signature")}function nN(n){if(n.length<Km.length)return!1;for(let t=0;t<Km.length;t++)if(n[t]!==Km[t])return!1;return!0}const rN="tEXt",iN=0,Qk=new TextDecoder("latin1");function oN(n){if(aN(n),n.length===0||n.length>79)throw new Error("keyword length must be between 1 and 79")}const sN=/^[\u0000-\u00FF]*$/;function aN(n){if(!sN.test(n))throw new Error("invalid latin1 text")}function lN(n,t,e){const r=t4(t);n[r]=cN(t,e-r.length-1)}function t4(n){for(n.mark();n.readByte()!==iN;);const t=n.offset;n.reset();const e=Qk.decode(n.readBytes(t-n.offset-1));return n.skip(1),oN(e),e}function cN(n,t){return Qk.decode(n.readBytes(t))}const Wa={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},K1={UNKNOWN:-1,DEFLATE:0},cw={UNKNOWN:-1,ADAPTIVE:0},J1={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},wm={NONE:0,BACKGROUND:1,PREVIOUS:2},Z1={SOURCE:0,OVER:1};class uN extends l5{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,e={}){super(t);const{checkCrc:r=!1}=e;this._checkCrc=r,this._inflator=new iw,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=K1.UNKNOWN,this._filterMethod=cw.UNKNOWN,this._interlaceMethod=J1.UNKNOWN,this._colorType=Wa.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(lw(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeChunk(t,e)}return this.decodeImage(),this._png}decodeApng(){for(lw(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeApngChunk(t,e)}return this.decodeApngImage(),this._apng}decodeChunk(t,e){const r=this.offset;switch(e){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case rN:lN(this._png.text,this,t);break;case"pHYs":this.decodepHYs();break;default:this.skip(t);break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${e}`);this._checkCrc?sw(this,t+4,e):this.skip(4)}decodeApngChunk(t,e){const r=this.offset;switch(e!=="fdAT"&&e!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),e){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,e),this.offset=r+t;break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${e}`);this._checkCrc?sw(this,t+4,e):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=fN(this.readUint8());const e=this.readUint8();this._colorType=e;let r;switch(e){case Wa.GREYSCALE:r=1;break;case Wa.TRUECOLOUR:r=3;break;case Wa.INDEXED_COLOUR:r=1;break;case Wa.GREYSCALE_ALPHA:r=2;break;case Wa.TRUECOLOUR_ALPHA:r=4;break;case Wa.UNKNOWN:default:throw new Error(`Unknown color type: ${e}`)}if(this._png.channels=r,this._compressionMethod=this.readUint8(),this._compressionMethod!==K1.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${t}`);const e=t/3;this._hasPalette=!0;const r=[];this._palette=r;for(let i=0;i<e;i++)r.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;const e=t,r=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,r,e)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let e=t,r=this.offset+this.byteOffset;if(r+=4,e-=4,this._inflator.push(new Uint8Array(this.buffer,r,e)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodetRNS(t){switch(this._colorType){case Wa.GREYSCALE:case Wa.TRUECOLOUR:{if(t%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${t}`);if(t/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${t/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let e=0;e<t/2;e++)this._transparency[e]=this.readUint16();break}case Wa.INDEXED_COLOUR:{if(t>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${t} vs ${this._palette.length})`);let e=0;for(;e<t;e++){const r=this.readByte();this._palette[e].push(r)}for(;e<this._palette.length;e++)this._palette[e].push(255);break}case Wa.UNKNOWN:case Wa.GREYSCALE_ALPHA:case Wa.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(t){const e=t4(this),r=this.readUint8();if(r!==K1.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${r}`);const i=this.readBytes(t-e.length-2);this._png.iccEmbeddedProfile={name:e,profile:UT(i)}}decodepHYs(){const t=this.readUint32(),e=this.readUint32(),r=this.readByte();this._png.resolution={x:t,y:e,unit:r}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let t=0;t<this._numberOfFrames;t++){const e={sequenceNumber:this._frames[t].sequenceNumber,delayNumber:this._frames[t].delayNumber,delayDenominator:this._frames[t].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},r=this._frames.at(t);if(r){if(r.data=aw({data:r.data,width:r.width,height:r.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),t===0||r.xOffset===0&&r.yOffset===0&&r.width===this._png.width&&r.height===this._png.height)e.data=r.data;else{const i=this._apng.frames.at(t-1);this.disposeFrame(r,i,e),this.addFrameDataToCanvas(e,r)}this._apng.frames.push(e)}}return this._apng}disposeFrame(t,e,r){switch(t.disposeOp){case wm.NONE:break;case wm.BACKGROUND:for(let i=0;i<this._png.height;i++)for(let s=0;s<this._png.width;s++){const l=(i*t.width+s)*this._png.channels;for(let c=0;c<this._png.channels;c++)r.data[l+c]=0}break;case wm.PREVIOUS:r.data.set(e.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,e){const r=1<<this._png.depth,i=(s,l)=>{const c=((s+e.yOffset)*this._png.width+e.xOffset+l)*this._png.channels,f=(s*e.width+l)*this._png.channels;return{index:c,frameIndex:f}};switch(e.blendOp){case Z1.SOURCE:for(let s=0;s<e.height;s++)for(let l=0;l<e.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++)t.data[c+d]=e.data[f+d]}break;case Z1.OVER:for(let s=0;s<e.height;s++)for(let l=0;l<e.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++){const p=e.data[f+this._png.channels-1]/r,g=d%(this._png.channels-1)===0?1:e.data[f+d],b=Math.floor(p*g+(1-p)*t.data[c+d]);t.data[c+d]+=b}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const t=this._isAnimated?(this._frames?.at(0)).data:this._inflator.result;if(this._filterMethod!==cw.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===J1.NO_INTERLACE)this._png.data=aw({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===J1.ADAM7)this._png.data=GT({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const t=this._inflator.result,e=this._frames.at(-1);e?e.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:wm.NONE,blendOp:Z1.SOURCE,data:t}),this._inflator=new iw,this._writingDataChunks=!1}}function fN(n){if(n!==1&&n!==2&&n!==4&&n!==8&&n!==16)throw new Error(`invalid bit depth: ${n}`);return n}var uw;(function(n){n[n.UNKNOWN=0]="UNKNOWN",n[n.METRE=1]="METRE"})(uw||(uw={}));function dN(n,t){return new uN(n,t).decode()}var Wn=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function Q1(){Wn.console&&typeof Wn.console.log=="function"&&Wn.console.log.apply(Wn.console,arguments)}var ai={log:Q1,warn:function(n){Wn.console&&(typeof Wn.console.warn=="function"?Wn.console.warn.apply(Wn.console,arguments):Q1.call(null,arguments))},error:function(n){Wn.console&&(typeof Wn.console.error=="function"?Wn.console.error.apply(Wn.console,arguments):Q1(n))}};function ty(n,t,e){var r=new XMLHttpRequest;r.open("GET",n),r.responseType="blob",r.onload=function(){Rf(r.response,t,e)},r.onerror=function(){ai.error("could not download file")},r.send()}function fw(n){var t=new XMLHttpRequest;t.open("HEAD",n,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Sm(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(t)}}var Rf=Wn.saveAs||((typeof window>"u"?"undefined":Hr(window))!=="object"||window!==Wn?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(n,t,e){var r=Wn.URL||Wn.webkitURL,i=document.createElement("a");t=t||n.name||"download",i.download=t,i.rel="noopener",typeof n=="string"?(i.href=n,i.origin!==location.origin?fw(i.href)?ty(n,t,e):Sm(i,i.target="_blank"):Sm(i)):(i.href=r.createObjectURL(n),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){Sm(i)},0))}:"msSaveOrOpenBlob"in navigator?function(n,t,e){if(t=t||n.name||"download",typeof n=="string")if(fw(n))ty(n,t,e);else{var r=document.createElement("a");r.href=n,r.target="_blank",setTimeout(function(){Sm(r)})}else navigator.msSaveOrOpenBlob((function(i,s){return s===void 0?s={autoBom:!1}:Hr(s)!=="object"&&(ai.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i})(n,e),t)}:function(n,t,e,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof n=="string")return ty(n,t,e);var i=n.type==="application/octet-stream",s=/constructor/i.test(Wn.HTMLElement)||Wn.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||i&&s)&&(typeof FileReader>"u"?"undefined":Hr(FileReader))==="object"){var c=new FileReader;c.onloadend=function(){var p=c.result;p=l?p:p.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=p:location=p,r=null},c.readAsDataURL(n)}else{var f=Wn.URL||Wn.webkitURL,d=f.createObjectURL(n);r?r.location=d:location.href=d,r=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}});function e4(n){var t;n=n||"",this.ok=!1,n.charAt(0)=="#"&&(n=n.substr(1,6)),n={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[n=(n=n.replace(/ /g,"")).toLowerCase()]||n;for(var e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(c){return[parseInt(c[1]),parseInt(c[2]),parseInt(c[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(c){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(c){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]}}],r=0;r<e.length;r++){var i=e[r].re,s=e[r].process,l=i.exec(n);l&&(t=s(l),this.r=t[0],this.g=t[1],this.b=t[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var c=this.r.toString(16),f=this.g.toString(16),d=this.b.toString(16);return c.length==1&&(c="0"+c),f.length==1&&(f="0"+f),d.length==1&&(d="0"+d),"#"+c+f+d}}var Jm=Wn.atob.bind(Wn),dw=Wn.btoa.bind(Wn);function ey(n,t){var e=n[0],r=n[1],i=n[2],s=n[3];e=Is(e,r,i,s,t[0],7,-680876936),s=Is(s,e,r,i,t[1],12,-389564586),i=Is(i,s,e,r,t[2],17,606105819),r=Is(r,i,s,e,t[3],22,-1044525330),e=Is(e,r,i,s,t[4],7,-176418897),s=Is(s,e,r,i,t[5],12,1200080426),i=Is(i,s,e,r,t[6],17,-1473231341),r=Is(r,i,s,e,t[7],22,-45705983),e=Is(e,r,i,s,t[8],7,1770035416),s=Is(s,e,r,i,t[9],12,-1958414417),i=Is(i,s,e,r,t[10],17,-42063),r=Is(r,i,s,e,t[11],22,-1990404162),e=Is(e,r,i,s,t[12],7,1804603682),s=Is(s,e,r,i,t[13],12,-40341101),i=Is(i,s,e,r,t[14],17,-1502002290),e=js(e,r=Is(r,i,s,e,t[15],22,1236535329),i,s,t[1],5,-165796510),s=js(s,e,r,i,t[6],9,-1069501632),i=js(i,s,e,r,t[11],14,643717713),r=js(r,i,s,e,t[0],20,-373897302),e=js(e,r,i,s,t[5],5,-701558691),s=js(s,e,r,i,t[10],9,38016083),i=js(i,s,e,r,t[15],14,-660478335),r=js(r,i,s,e,t[4],20,-405537848),e=js(e,r,i,s,t[9],5,568446438),s=js(s,e,r,i,t[14],9,-1019803690),i=js(i,s,e,r,t[3],14,-187363961),r=js(r,i,s,e,t[8],20,1163531501),e=js(e,r,i,s,t[13],5,-1444681467),s=js(s,e,r,i,t[2],9,-51403784),i=js(i,s,e,r,t[7],14,1735328473),e=Bs(e,r=js(r,i,s,e,t[12],20,-1926607734),i,s,t[5],4,-378558),s=Bs(s,e,r,i,t[8],11,-2022574463),i=Bs(i,s,e,r,t[11],16,1839030562),r=Bs(r,i,s,e,t[14],23,-35309556),e=Bs(e,r,i,s,t[1],4,-1530992060),s=Bs(s,e,r,i,t[4],11,1272893353),i=Bs(i,s,e,r,t[7],16,-155497632),r=Bs(r,i,s,e,t[10],23,-1094730640),e=Bs(e,r,i,s,t[13],4,681279174),s=Bs(s,e,r,i,t[0],11,-358537222),i=Bs(i,s,e,r,t[3],16,-722521979),r=Bs(r,i,s,e,t[6],23,76029189),e=Bs(e,r,i,s,t[9],4,-640364487),s=Bs(s,e,r,i,t[12],11,-421815835),i=Bs(i,s,e,r,t[15],16,530742520),e=zs(e,r=Bs(r,i,s,e,t[2],23,-995338651),i,s,t[0],6,-198630844),s=zs(s,e,r,i,t[7],10,1126891415),i=zs(i,s,e,r,t[14],15,-1416354905),r=zs(r,i,s,e,t[5],21,-57434055),e=zs(e,r,i,s,t[12],6,1700485571),s=zs(s,e,r,i,t[3],10,-1894986606),i=zs(i,s,e,r,t[10],15,-1051523),r=zs(r,i,s,e,t[1],21,-2054922799),e=zs(e,r,i,s,t[8],6,1873313359),s=zs(s,e,r,i,t[15],10,-30611744),i=zs(i,s,e,r,t[6],15,-1560198380),r=zs(r,i,s,e,t[13],21,1309151649),e=zs(e,r,i,s,t[4],6,-145523070),s=zs(s,e,r,i,t[11],10,-1120210379),i=zs(i,s,e,r,t[2],15,718787259),r=zs(r,i,s,e,t[9],21,-343485551),n[0]=af(e,n[0]),n[1]=af(r,n[1]),n[2]=af(i,n[2]),n[3]=af(s,n[3])}function c0(n,t,e,r,i,s){return t=af(af(t,n),af(r,s)),af(t<<i|t>>>32-i,e)}function Is(n,t,e,r,i,s,l){return c0(t&e|~t&r,n,t,i,s,l)}function js(n,t,e,r,i,s,l){return c0(t&r|e&~r,n,t,i,s,l)}function Bs(n,t,e,r,i,s,l){return c0(t^e^r,n,t,i,s,l)}function zs(n,t,e,r,i,s,l){return c0(e^(t|~r),n,t,i,s,l)}function n4(n){var t,e=n.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=n.length;t+=64)ey(r,hN(n.substring(t-64,t)));n=n.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n.length;t++)i[t>>2]|=n.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(ey(r,i),t=0;t<16;t++)i[t]=0;return i[14]=8*e,ey(r,i),r}function hN(n){var t,e=[];for(t=0;t<64;t+=4)e[t>>2]=n.charCodeAt(t)+(n.charCodeAt(t+1)<<8)+(n.charCodeAt(t+2)<<16)+(n.charCodeAt(t+3)<<24);return e}var hw="0123456789abcdef".split("");function pN(n){for(var t="",e=0;e<4;e++)t+=hw[n>>8*e+4&15]+hw[n>>8*e&15];return t}function mN(n){return String.fromCharCode(255&n,(65280&n)>>8,(16711680&n)>>16,(4278190080&n)>>24)}function s2(n){return n4(n).map(mN).join("")}var gN=(function(n){for(var t=0;t<n.length;t++)n[t]=pN(n[t]);return n.join("")})(n4("hello"))!="5d41402abc4b2a76b9719d911017c592";function af(n,t){if(gN){var e=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(e>>16)<<16|65535&e}return n+t&4294967295}function a2(n,t){var e,r,i,s;if(n!==e){for(var l=(i=n,s=1+(256/n.length|0),new Array(s+1).join(i)),c=[],f=0;f<256;f++)c[f]=f;var d=0;for(f=0;f<256;f++){var p=c[f];d=(d+p+l.charCodeAt(f))%256,c[f]=c[d],c[d]=p}e=n,r=c}else c=r;var g=t.length,b=0,y=0,M="";for(f=0;f<g;f++)y=(y+(p=c[b=(b+1)%256]))%256,c[b]=c[y],c[y]=p,l=c[(c[b]+c[y])%256],M+=String.fromCharCode(t.charCodeAt(f)^l);return M}var pw={print:4,modify:8,copy:16,"annot-forms":32};function Rd(n,t,e,r){this.v=1,this.r=2;var i=192;n.forEach(function(c){if(pw.perm!==void 0)throw new Error("Invalid permission: "+c);i+=pw[c]}),this.padding="(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz";var s=(t+this.padding).substr(0,32),l=(e+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,l),this.P=-(1+(255^i)),this.encryptionKey=s2(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=a2(this.encryptionKey,this.padding)}function Od(n){if(/[^\u0000-\u00ff]/.test(n))throw new Error("Invalid PDF Name Object: "+n+", Only accept ASCII characters.");for(var t="",e=n.length,r=0;r<e;r++){var i=n.charCodeAt(r);t+=i<33||i===35||i===37||i===40||i===41||i===47||i===60||i===62||i===91||i===93||i===123||i===125||i>126?"#"+("0"+i.toString(16)).slice(-2):n[r]}return t}function mw(n){if(Hr(n)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(e,r,i){if(i=i||!1,typeof e!="string"||typeof r!="function"||typeof i!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(e)||(t[e]={});var s=Math.random().toString(35);return t[e][s]=[r,!!i],s},this.unsubscribe=function(e){for(var r in t)if(t[r][e])return delete t[r][e],Object.keys(t[r]).length===0&&delete t[r],!0;return!1},this.publish=function(e){if(t.hasOwnProperty(e)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var s in t[e]){var l=t[e][s];try{l[0].apply(n,r)}catch(c){Wn.console&&ai.error("jsPDF PubSub Error",c.message,c)}l[1]&&i.push(s)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function dg(n){if(!(this instanceof dg))return new dg(n);var t="opacity,stroke-opacity".split(",");for(var e in n)n.hasOwnProperty(e)&&t.indexOf(e)>=0&&(this[e]=n[e]);this.id="",this.objectNumber=-1}function r4(n,t){this.gState=n,this.matrix=t,this.id="",this.objectNumber=-1}function Of(n,t,e,r,i){if(!(this instanceof Of))return new Of(n,t,e,r,i);this.type=n==="axial"?2:3,this.coords=t,this.colors=e,r4.call(this,r,i)}function Fd(n,t,e,r,i){if(!(this instanceof Fd))return new Fd(n,t,e,r,i);this.boundingBox=n,this.xStep=t,this.yStep=e,this.stream="",this.cloneIndex=0,r4.call(this,r,i)}function xn(n){var t,e=typeof arguments[0]=="string"?arguments[0]:"p",r=arguments[1],i=arguments[2],s=arguments[3],l=[],c=1,f=16,d="S",p=null;Hr(n=n||{})==="object"&&(e=n.orientation,r=n.unit||r,i=n.format||i,s=n.compress||n.compressPdf||s,(p=n.encryption||null)!==null&&(p.userPassword=p.userPassword||"",p.ownerPassword=p.ownerPassword||"",p.userPermissions=p.userPermissions||[]),c=typeof n.userUnit=="number"?Math.abs(n.userUnit):1,n.precision!==void 0&&(t=n.precision),n.floatPrecision!==void 0&&(f=n.floatPrecision),d=n.defaultPathOperation||"S"),l=n.filters||(s===!0?["FlateEncode"]:l),r=r||"mm",e=(""+(e||"P")).toLowerCase();var g=n.putOnlyUsedFonts||!1,b={},y={internal:{},__private__:{}};y.__private__.PubSub=mw;var M="1.3",C=y.__private__.getPdfVersion=function(){return M};y.__private__.setPdfVersion=function(A){M=A};var D={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};y.__private__.getPageFormats=function(){return D};var L=y.__private__.getPageFormat=function(A){return D[A]};i=i||"a4";var H="compat",Y="advanced",W=H;function St(){this.saveGraphicsState(),ft(new Je(tn,0,0,-tn,0,pa()*tn).toString()+" cm"),this.setFontSize(this.getFontSize()/tn),d="n",W=Y}function _t(){this.restoreGraphicsState(),d="S",W=H}var Ct=y.__private__.combineFontStyleAndFontWeight=function(A,B){if(A=="bold"&&B=="normal"||A=="bold"&&B==400||A=="normal"&&B=="italic"||A=="bold"&&B=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return B&&(A=B==400||B==="normal"?A==="italic"?"italic":"normal":B!=700&&B!=="bold"||A!=="normal"?(B==700?"bold":B)+""+A:"bold"),A};y.advancedAPI=function(A){var B=W===H;return B&&St.call(this),typeof A!="function"||(A(this),B&&_t.call(this)),this},y.compatAPI=function(A){var B=W===Y;return B&&_t.call(this),typeof A!="function"||(A(this),B&&St.call(this)),this},y.isAdvancedAPI=function(){return W===Y};var bt,ot=function(A){if(W!==Y)throw new Error(A+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},jt=y.roundToPrecision=y.__private__.roundToPrecision=function(A,B){var ht=t||B;if(isNaN(A)||isNaN(ht))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return A.toFixed(ht).replace(/0+$/,"")};bt=y.hpf=y.__private__.hpf=typeof f=="number"?function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.hpf");return jt(A,f)}:f==="smart"?function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.hpf");return jt(A,A>-1&&A<1?16:5)}:function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.hpf");return jt(A,16)};var Z=y.f2=y.__private__.f2=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.f2");return jt(A,2)},ct=y.__private__.f3=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.f3");return jt(A,3)},V=y.scale=y.__private__.scale=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.scale");return W===H?A*tn:W===Y?A:void 0},xt=function(A){return V((function(B){return W===H?pa()-B:W===Y?B:void 0})(A))};y.__private__.setPrecision=y.setPrecision=function(A){typeof parseInt(A,10)=="number"&&(t=parseInt(A,10))};var Lt,dt="00000000000000000000000000000000",st=y.__private__.getFileId=function(){return dt},lt=y.__private__.setFileId=function(A){return dt=A!==void 0&&/^[a-fA-F0-9]{32}$/.test(A)?A.toUpperCase():dt.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),p!==null&&(hi=new Rd(p.userPermissions,p.userPassword,p.ownerPassword,dt)),dt};y.setFileId=function(A){return lt(A),this},y.getFileId=function(){return st()};var zt=y.__private__.convertDateToPDFDate=function(A){var B=A.getTimezoneOffset(),ht=B<0?"+":"-",Tt=Math.floor(Math.abs(B/60)),Bt=Math.abs(B%60),ne=[ht,tt(Tt),"'",tt(Bt),"'"].join("");return["D:",A.getFullYear(),tt(A.getMonth()+1),tt(A.getDate()),tt(A.getHours()),tt(A.getMinutes()),tt(A.getSeconds()),ne].join("")},At=y.__private__.convertPDFDateToDate=function(A){var B=parseInt(A.substr(2,4),10),ht=parseInt(A.substr(6,2),10)-1,Tt=parseInt(A.substr(8,2),10),Bt=parseInt(A.substr(10,2),10),ne=parseInt(A.substr(12,2),10),xe=parseInt(A.substr(14,2),10);return new Date(B,ht,Tt,Bt,ne,xe,0)},K=y.__private__.setCreationDate=function(A){var B;if(A===void 0&&(A=new Date),A instanceof Date)B=zt(A);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(A))throw new Error("Invalid argument passed to jsPDF.setCreationDate");B=A}return Lt=B},P=y.__private__.getCreationDate=function(A){var B=Lt;return A==="jsDate"&&(B=At(Lt)),B};y.setCreationDate=function(A){return K(A),this},y.getCreationDate=function(A){return P(A)};var X,tt=y.__private__.padd2=function(A){return("0"+parseInt(A)).slice(-2)},gt=y.__private__.padd2Hex=function(A){return("00"+(A=A.toString())).substr(A.length)},vt=0,kt=[],qt=[],Rt=0,Zt=[],Ae=[],le=!1,Ie=qt;y.__private__.setCustomOutputDestination=function(A){le=!0,Ie=A};var Ue=function(A){le||(Ie=A)};y.__private__.resetCustomOutputDestination=function(){le=!1,Ie=qt};var ft=y.__private__.out=function(A){return A=A.toString(),Rt+=A.length+1,Ie.push(A),Ie},Re=y.__private__.write=function(A){return ft(arguments.length===1?A.toString():Array.prototype.join.call(arguments," "))},rn=y.__private__.getArrayBuffer=function(A){for(var B=A.length,ht=new ArrayBuffer(B),Tt=new Uint8Array(ht);B--;)Tt[B]=A.charCodeAt(B);return ht},on=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];y.__private__.getStandardFonts=function(){return on};var be=n.fontSize||16;y.__private__.setFontSize=y.setFontSize=function(A){return be=W===Y?A/tn:A,this};var _e,Te=y.__private__.getFontSize=y.getFontSize=function(){return W===H?be:be*tn},Le=n.R2L||!1;y.__private__.setR2L=y.setR2L=function(A){return Le=A,this},y.__private__.getR2L=y.getR2L=function(){return Le};var Ye,hn=y.__private__.setZoomMode=function(A){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(A))_e=A;else if(isNaN(A)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(A)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+A+'" is not recognized.');_e=A}else _e=parseInt(A,10)};y.__private__.getZoomMode=function(){return _e};var Pn,wn=y.__private__.setPageMode=function(A){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(A)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+A+'" is not recognized.');Ye=A};y.__private__.getPageMode=function(){return Ye};var Nn=y.__private__.setLayoutMode=function(A){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(A)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+A+'" is not recognized.');Pn=A};y.__private__.getLayoutMode=function(){return Pn},y.__private__.setDisplayMode=y.setDisplayMode=function(A,B,ht){return hn(A),Nn(B),wn(ht),this};var Sn={title:"",subject:"",author:"",keywords:"",creator:""};y.__private__.getDocumentProperty=function(A){if(Object.keys(Sn).indexOf(A)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Sn[A]},y.__private__.getDocumentProperties=function(){return Sn},y.__private__.setDocumentProperties=y.setProperties=y.setDocumentProperties=function(A){for(var B in Sn)Sn.hasOwnProperty(B)&&A[B]&&(Sn[B]=A[B]);return this},y.__private__.setDocumentProperty=function(A,B){if(Object.keys(Sn).indexOf(A)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Sn[A]=B};var Be,tn,je,ur,bn,cn={},pn={},$n=[],en={},Qt={},ve={},me={},We=null,He=0,Pe=[],Vn=new mw(y),Xo=n.hotfixes||[],ui={},Hi={},Go=[],Je=function A(B,ht,Tt,Bt,ne,xe){if(!(this instanceof A))return new A(B,ht,Tt,Bt,ne,xe);isNaN(B)&&(B=1),isNaN(ht)&&(ht=0),isNaN(Tt)&&(Tt=0),isNaN(Bt)&&(Bt=1),isNaN(ne)&&(ne=0),isNaN(xe)&&(xe=0),this._matrix=[B,ht,Tt,Bt,ne,xe]};Object.defineProperty(Je.prototype,"sx",{get:function(){return this._matrix[0]},set:function(A){this._matrix[0]=A}}),Object.defineProperty(Je.prototype,"shy",{get:function(){return this._matrix[1]},set:function(A){this._matrix[1]=A}}),Object.defineProperty(Je.prototype,"shx",{get:function(){return this._matrix[2]},set:function(A){this._matrix[2]=A}}),Object.defineProperty(Je.prototype,"sy",{get:function(){return this._matrix[3]},set:function(A){this._matrix[3]=A}}),Object.defineProperty(Je.prototype,"tx",{get:function(){return this._matrix[4]},set:function(A){this._matrix[4]=A}}),Object.defineProperty(Je.prototype,"ty",{get:function(){return this._matrix[5]},set:function(A){this._matrix[5]=A}}),Object.defineProperty(Je.prototype,"a",{get:function(){return this._matrix[0]},set:function(A){this._matrix[0]=A}}),Object.defineProperty(Je.prototype,"b",{get:function(){return this._matrix[1]},set:function(A){this._matrix[1]=A}}),Object.defineProperty(Je.prototype,"c",{get:function(){return this._matrix[2]},set:function(A){this._matrix[2]=A}}),Object.defineProperty(Je.prototype,"d",{get:function(){return this._matrix[3]},set:function(A){this._matrix[3]=A}}),Object.defineProperty(Je.prototype,"e",{get:function(){return this._matrix[4]},set:function(A){this._matrix[4]=A}}),Object.defineProperty(Je.prototype,"f",{get:function(){return this._matrix[5]},set:function(A){this._matrix[5]=A}}),Object.defineProperty(Je.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Je.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Je.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Je.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Je.prototype.join=function(A){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(bt).join(A)},Je.prototype.multiply=function(A){var B=A.sx*this.sx+A.shy*this.shx,ht=A.sx*this.shy+A.shy*this.sy,Tt=A.shx*this.sx+A.sy*this.shx,Bt=A.shx*this.shy+A.sy*this.sy,ne=A.tx*this.sx+A.ty*this.shx+this.tx,xe=A.tx*this.shy+A.ty*this.sy+this.ty;return new Je(B,ht,Tt,Bt,ne,xe)},Je.prototype.decompose=function(){var A=this.sx,B=this.shy,ht=this.shx,Tt=this.sy,Bt=this.tx,ne=this.ty,xe=Math.sqrt(A*A+B*B),Ge=(A/=xe)*ht+(B/=xe)*Tt;ht-=A*Ge,Tt-=B*Ge;var un=Math.sqrt(ht*ht+Tt*Tt);return Ge/=un,A*(Tt/=un)<B*(ht/=un)&&(A=-A,B=-B,Ge=-Ge,xe=-xe),{scale:new Je(xe,0,0,un,0,0),translate:new Je(1,0,0,1,Bt,ne),rotate:new Je(A,B,-B,A,0,0),skew:new Je(1,0,Ge,1,0,0)}},Je.prototype.toString=function(A){return this.join(" ")},Je.prototype.inversed=function(){var A=this.sx,B=this.shy,ht=this.shx,Tt=this.sy,Bt=this.tx,ne=this.ty,xe=1/(A*Tt-B*ht),Ge=Tt*xe,un=-B*xe,In=-ht*xe,Bn=A*xe;return new Je(Ge,un,In,Bn,-Ge*Bt-In*ne,-un*Bt-Bn*ne)},Je.prototype.applyToPoint=function(A){var B=A.x*this.sx+A.y*this.shx+this.tx,ht=A.x*this.shy+A.y*this.sy+this.ty;return new da(B,ht)},Je.prototype.applyToRectangle=function(A){var B=this.applyToPoint(A),ht=this.applyToPoint(new da(A.x+A.w,A.y+A.h));return new ha(B.x,B.y,ht.x-B.x,ht.y-B.y)},Je.prototype.clone=function(){var A=this.sx,B=this.shy,ht=this.shx,Tt=this.sy,Bt=this.tx,ne=this.ty;return new Je(A,B,ht,Tt,Bt,ne)},y.Matrix=Je;var Ss=y.matrixMult=function(A,B){return B.multiply(A)},to=new Je(1,0,0,1,0,0);y.unitMatrix=y.identityMatrix=to;var Xt=function(A,B){if(!Qt[A]){var ht=(B instanceof Of?"Sh":"P")+(Object.keys(en).length+1).toString(10);B.id=ht,Qt[A]=ht,en[ht]=B,Vn.publish("addPattern",B)}};y.ShadingPattern=Of,y.TilingPattern=Fd,y.addShadingPattern=function(A,B){return ot("addShadingPattern()"),Xt(A,B),this},y.beginTilingPattern=function(A){ot("beginTilingPattern()"),Ts(A.boundingBox[0],A.boundingBox[1],A.boundingBox[2]-A.boundingBox[0],A.boundingBox[3]-A.boundingBox[1],A.matrix)},y.endTilingPattern=function(A,B){ot("endTilingPattern()"),B.stream=Ae[X].join(`
11
- `),Xt(A,B),Vn.publish("endTilingPattern",B),Go.pop().restore()};var Ei,Xn=y.__private__.newObject=function(){var A=fi();return Ti(A,!0),A},fi=y.__private__.newObjectDeferred=function(){return vt++,kt[vt]=function(){return Rt},vt},Ti=function(A,B){return B=typeof B=="boolean"&&B,kt[A]=Rt,B&&ft(A+" 0 obj"),A},Ko=y.__private__.newAdditionalObject=function(){var A={objId:fi(),content:""};return Zt.push(A),A},gi=fi(),Ar=fi(),ir=y.__private__.decodeColorString=function(A){var B=A.split(" ");if(B.length!==2||B[1]!=="g"&&B[1]!=="G")B.length!==5||B[4]!=="k"&&B[4]!=="K"||(B=[(1-B[0])*(1-B[3]),(1-B[1])*(1-B[3]),(1-B[2])*(1-B[3]),"r"]);else{var ht=parseFloat(B[0]);B=[ht,ht,ht,"r"]}for(var Tt="#",Bt=0;Bt<3;Bt++)Tt+=("0"+Math.floor(255*parseFloat(B[Bt])).toString(16)).slice(-2);return Tt},Gn=y.__private__.encodeColorString=function(A){var B;typeof A=="string"&&(A={ch1:A});var ht=A.ch1,Tt=A.ch2,Bt=A.ch3,ne=A.ch4,xe=A.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof ht=="string"&&ht.charAt(0)!=="#"){var Ge=new e4(ht);if(Ge.ok)ht=Ge.toHex();else if(!/^\d*\.?\d*$/.test(ht))throw new Error('Invalid color "'+ht+'" passed to jsPDF.encodeColorString.')}if(typeof ht=="string"&&/^#[0-9A-Fa-f]{3}$/.test(ht)&&(ht="#"+ht[1]+ht[1]+ht[2]+ht[2]+ht[3]+ht[3]),typeof ht=="string"&&/^#[0-9A-Fa-f]{6}$/.test(ht)){var un=parseInt(ht.substr(1),16);ht=un>>16&255,Tt=un>>8&255,Bt=255&un}if(Tt===void 0||ne===void 0&&ht===Tt&&Tt===Bt)B=typeof ht=="string"?ht+" "+xe[0]:A.precision===2?Z(ht/255)+" "+xe[0]:ct(ht/255)+" "+xe[0];else if(ne===void 0||Hr(ne)==="object"){if(ne&&!isNaN(ne.a)&&ne.a===0)return["1.","1.","1.",xe[1]].join(" ");B=typeof ht=="string"?[ht,Tt,Bt,xe[1]].join(" "):A.precision===2?[Z(ht/255),Z(Tt/255),Z(Bt/255),xe[1]].join(" "):[ct(ht/255),ct(Tt/255),ct(Bt/255),xe[1]].join(" ")}else B=typeof ht=="string"?[ht,Tt,Bt,ne,xe[2]].join(" "):A.precision===2?[Z(ht),Z(Tt),Z(Bt),Z(ne),xe[2]].join(" "):[ct(ht),ct(Tt),ct(Bt),ct(ne),xe[2]].join(" ");return B},Jo=y.__private__.getFilters=function(){return l},ks=y.__private__.putStream=function(A){var B=(A=A||{}).data||"",ht=A.filters||Jo(),Tt=A.alreadyAppliedFilters||[],Bt=A.addLength1||!1,ne=B.length,xe=A.objectId,Ge=function($r){return $r};if(p!==null&&xe===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");p!==null&&(Ge=hi.encryptor(xe,0));var un={};ht===!0&&(ht=["FlateEncode"]);var In=A.additionalKeyValues||[],Bn=(un=xn.API.processDataByFilters!==void 0?xn.API.processDataByFilters(B,ht):{data:B,reverseChain:[]}).reverseChain+(Array.isArray(Tt)?Tt.join(" "):Tt.toString());if(un.data.length!==0&&(In.push({key:"Length",value:un.data.length}),Bt===!0&&In.push({key:"Length1",value:ne})),Bn.length!=0)if(Bn.split("/").length-1==1)In.push({key:"Filter",value:Bn});else{In.push({key:"Filter",value:"["+Bn+"]"});for(var or=0;or<In.length;or+=1)if(In[or].key==="DecodeParms"){for(var $i=[],ue=0;ue<un.reverseChain.split("/").length-1;ue+=1)$i.push("null");$i.push(In[or].value),In[or].value="["+$i.join(" ")+"]"}}ft("<<");for(var Sr=0;Sr<In.length;Sr++)ft("/"+In[Sr].key+" "+In[Sr].value);ft(">>"),un.data.length!==0&&(ft("stream"),ft(Ge(un.data)),ft("endstream"))},Oa=y.__private__.putPage=function(A){var B=A.number,ht=A.data,Tt=A.objId,Bt=A.contentsObjId;Ti(Tt,!0),ft("<</Type /Page"),ft("/Parent "+A.rootDictionaryObjId+" 0 R"),ft("/Resources "+A.resourceDictionaryObjId+" 0 R"),ft("/MediaBox ["+parseFloat(bt(A.mediaBox.bottomLeftX))+" "+parseFloat(bt(A.mediaBox.bottomLeftY))+" "+bt(A.mediaBox.topRightX)+" "+bt(A.mediaBox.topRightY)+"]"),A.cropBox!==null&&ft("/CropBox ["+bt(A.cropBox.bottomLeftX)+" "+bt(A.cropBox.bottomLeftY)+" "+bt(A.cropBox.topRightX)+" "+bt(A.cropBox.topRightY)+"]"),A.bleedBox!==null&&ft("/BleedBox ["+bt(A.bleedBox.bottomLeftX)+" "+bt(A.bleedBox.bottomLeftY)+" "+bt(A.bleedBox.topRightX)+" "+bt(A.bleedBox.topRightY)+"]"),A.trimBox!==null&&ft("/TrimBox ["+bt(A.trimBox.bottomLeftX)+" "+bt(A.trimBox.bottomLeftY)+" "+bt(A.trimBox.topRightX)+" "+bt(A.trimBox.topRightY)+"]"),A.artBox!==null&&ft("/ArtBox ["+bt(A.artBox.bottomLeftX)+" "+bt(A.artBox.bottomLeftY)+" "+bt(A.artBox.topRightX)+" "+bt(A.artBox.topRightY)+"]"),typeof A.userUnit=="number"&&A.userUnit!==1&&ft("/UserUnit "+A.userUnit),Vn.publish("putPage",{objId:Tt,pageContext:Pe[B],pageNumber:B,page:ht}),ft("/Contents "+Bt+" 0 R"),ft(">>"),ft("endobj");var ne=ht.join(`
12
- `);return W===Y&&(ne+=`
13
- Q`),Ti(Bt,!0),ks({data:ne,filters:Jo(),objectId:Bt}),ft("endobj"),Tt},Zo=y.__private__.putPages=function(){var A,B,ht=[];for(A=1;A<=He;A++)Pe[A].objId=fi(),Pe[A].contentsObjId=fi();for(A=1;A<=He;A++)ht.push(Oa({number:A,data:Ae[A],objId:Pe[A].objId,contentsObjId:Pe[A].contentsObjId,mediaBox:Pe[A].mediaBox,cropBox:Pe[A].cropBox,bleedBox:Pe[A].bleedBox,trimBox:Pe[A].trimBox,artBox:Pe[A].artBox,userUnit:Pe[A].userUnit,rootDictionaryObjId:gi,resourceDictionaryObjId:Ar}));Ti(gi,!0),ft("<</Type /Pages");var Tt="/Kids [";for(B=0;B<He;B++)Tt+=ht[B]+" 0 R ";ft(Tt+"]"),ft("/Count "+He),ft(">>"),ft("endobj"),Vn.publish("postPutPages")},To=function(A){Vn.publish("putFont",{font:A,out:ft,newObject:Xn,putStream:ks}),A.isAlreadyPutted!==!0&&(A.objectNumber=Xn(),ft("<<"),ft("/Type /Font"),ft("/BaseFont /"+Od(A.postScriptName)),ft("/Subtype /Type1"),typeof A.encoding=="string"&&ft("/Encoding /"+A.encoding),ft("/FirstChar 32"),ft("/LastChar 255"),ft(">>"),ft("endobj"))},Ll=function(A){A.objectNumber=Xn();var B=[];B.push({key:"Type",value:"/XObject"}),B.push({key:"Subtype",value:"/Form"}),B.push({key:"BBox",value:"["+[bt(A.x),bt(A.y),bt(A.x+A.width),bt(A.y+A.height)].join(" ")+"]"}),B.push({key:"Matrix",value:"["+A.matrix.toString()+"]"});var ht=A.pages[1].join(`
14
- `);ks({data:ht,additionalKeyValues:B,objectId:A.objectNumber}),ft("endobj")},ca=function(A,B){B||(B=21);var ht=Xn(),Tt=(function(xe,Ge){var un,In=[],Bn=1/(Ge-1);for(un=0;un<1;un+=Bn)In.push(un);if(In.push(1),xe[0].offset!=0){var or={offset:0,color:xe[0].color};xe.unshift(or)}if(xe[xe.length-1].offset!=1){var $i={offset:1,color:xe[xe.length-1].color};xe.push($i)}for(var ue="",Sr=0,$r=0;$r<In.length;$r++){for(un=In[$r];un>xe[Sr+1].offset;)Sr++;var sn=xe[Sr].offset,an=(un-sn)/(xe[Sr+1].offset-sn),Do=xe[Sr].color,Ws=xe[Sr+1].color;ue+=gt(Math.round((1-an)*Do[0]+an*Ws[0]).toString(16))+gt(Math.round((1-an)*Do[1]+an*Ws[1]).toString(16))+gt(Math.round((1-an)*Do[2]+an*Ws[2]).toString(16))}return ue.trim()})(A.colors,B),Bt=[];Bt.push({key:"FunctionType",value:"0"}),Bt.push({key:"Domain",value:"[0.0 1.0]"}),Bt.push({key:"Size",value:"["+B+"]"}),Bt.push({key:"BitsPerSample",value:"8"}),Bt.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Bt.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),ks({data:Tt,additionalKeyValues:Bt,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:ht}),ft("endobj"),A.objectNumber=Xn(),ft("<< /ShadingType "+A.type),ft("/ColorSpace /DeviceRGB");var ne="/Coords ["+bt(parseFloat(A.coords[0]))+" "+bt(parseFloat(A.coords[1]))+" ";A.type===2?ne+=bt(parseFloat(A.coords[2]))+" "+bt(parseFloat(A.coords[3])):ne+=bt(parseFloat(A.coords[2]))+" "+bt(parseFloat(A.coords[3]))+" "+bt(parseFloat(A.coords[4]))+" "+bt(parseFloat(A.coords[5])),ft(ne+="]"),A.matrix&&ft("/Matrix ["+A.matrix.toString()+"]"),ft("/Function "+ht+" 0 R"),ft("/Extend [true true]"),ft(">>"),ft("endobj")},As=function(A,B){var ht=fi(),Tt=Xn();B.push({resourcesOid:ht,objectOid:Tt}),A.objectNumber=Tt;var Bt=[];Bt.push({key:"Type",value:"/Pattern"}),Bt.push({key:"PatternType",value:"1"}),Bt.push({key:"PaintType",value:"1"}),Bt.push({key:"TilingType",value:"1"}),Bt.push({key:"BBox",value:"["+A.boundingBox.map(bt).join(" ")+"]"}),Bt.push({key:"XStep",value:bt(A.xStep)}),Bt.push({key:"YStep",value:bt(A.yStep)}),Bt.push({key:"Resources",value:ht+" 0 R"}),A.matrix&&Bt.push({key:"Matrix",value:"["+A.matrix.toString()+"]"}),ks({data:A.stream,additionalKeyValues:Bt,objectId:A.objectNumber}),ft("endobj")},Qa=function(A){for(var B in A.objectNumber=Xn(),ft("<<"),A)switch(B){case"opacity":ft("/ca "+Z(A[B]));break;case"stroke-opacity":ft("/CA "+Z(A[B]))}ft(">>"),ft("endobj")},Qo=function(A){Ti(A.resourcesOid,!0),ft("<<"),ft("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var B in ft("/Font <<"),cn)cn.hasOwnProperty(B)&&(g===!1||g===!0&&b.hasOwnProperty(B))&&ft("/"+B+" "+cn[B].objectNumber+" 0 R");ft(">>")})(),(function(){if(Object.keys(en).length>0){for(var B in ft("/Shading <<"),en)en.hasOwnProperty(B)&&en[B]instanceof Of&&en[B].objectNumber>=0&&ft("/"+B+" "+en[B].objectNumber+" 0 R");Vn.publish("putShadingPatternDict"),ft(">>")}})(),(function(B){if(Object.keys(en).length>0){for(var ht in ft("/Pattern <<"),en)en.hasOwnProperty(ht)&&en[ht]instanceof y.TilingPattern&&en[ht].objectNumber>=0&&en[ht].objectNumber<B&&ft("/"+ht+" "+en[ht].objectNumber+" 0 R");Vn.publish("putTilingPatternDict"),ft(">>")}})(A.objectOid),(function(){if(Object.keys(ve).length>0){var B;for(B in ft("/ExtGState <<"),ve)ve.hasOwnProperty(B)&&ve[B].objectNumber>=0&&ft("/"+B+" "+ve[B].objectNumber+" 0 R");Vn.publish("putGStateDict"),ft(">>")}})(),(function(){for(var B in ft("/XObject <<"),ui)ui.hasOwnProperty(B)&&ui[B].objectNumber>=0&&ft("/"+B+" "+ui[B].objectNumber+" 0 R");Vn.publish("putXobjectDict"),ft(">>")})(),ft(">>"),ft("endobj")},di=function(A){pn[A.fontName]=pn[A.fontName]||{},pn[A.fontName][A.fontStyle]=A.id},tl=function(A,B,ht,Tt,Bt){var ne={id:"F"+(Object.keys(cn).length+1).toString(10),postScriptName:A,fontName:B,fontStyle:ht,encoding:Tt,isStandardFont:Bt||!1,metadata:{}};return Vn.publish("addFont",{font:ne,instance:this}),cn[ne.id]=ne,di(ne),ne.id},Pi=y.__private__.pdfEscape=y.pdfEscape=function(A,B){return(function(ht,Tt){var Bt,ne,xe,Ge,un,In,Bn,or,$i;if(xe=(Tt=Tt||{}).sourceEncoding||"Unicode",un=Tt.outputEncoding,(Tt.autoencode||un)&&cn[Be].metadata&&cn[Be].metadata[xe]&&cn[Be].metadata[xe].encoding&&(Ge=cn[Be].metadata[xe].encoding,!un&&cn[Be].encoding&&(un=cn[Be].encoding),!un&&Ge.codePages&&(un=Ge.codePages[0]),typeof un=="string"&&(un=Ge[un]),un)){for(Bn=!1,In=[],Bt=0,ne=ht.length;Bt<ne;Bt++)(or=un[ht.charCodeAt(Bt)])?In.push(String.fromCharCode(or)):In.push(ht[Bt]),In[Bt].charCodeAt(0)>>8&&(Bn=!0);ht=In.join("")}for(Bt=ht.length;Bn===void 0&&Bt!==0;)ht.charCodeAt(Bt-1)>>8&&(Bn=!0),Bt--;if(!Bn)return ht;for(In=Tt.noBOM?[]:[254,255],Bt=0,ne=ht.length;Bt<ne;Bt++){if(($i=(or=ht.charCodeAt(Bt))>>8)>>8)throw new Error("Character at position "+Bt+" of string '"+ht+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");In.push($i),In.push(or-($i<<8))}return String.fromCharCode.apply(void 0,In)})(A,B).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},qr=y.__private__.beginPage=function(A){Ae[++He]=[],Pe[He]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(A[0]),topRightY:Number(A[1])}},ac(He),Ue(Ae[X])},Ms=function(A,B){var ht,Tt,Bt;switch(e=B||e,typeof A=="string"&&(ht=L(A.toLowerCase()),Array.isArray(ht)&&(Tt=ht[0],Bt=ht[1])),Array.isArray(A)&&(Tt=A[0]*tn,Bt=A[1]*tn),isNaN(Tt)&&(Tt=i[0],Bt=i[1]),(Tt>14400||Bt>14400)&&(ai.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Tt=Math.min(14400,Tt),Bt=Math.min(14400,Bt)),i=[Tt,Bt],e.substr(0,1)){case"l":Bt>Tt&&(i=[Bt,Tt]);break;case"p":Tt>Bt&&(i=[Bt,Tt])}qr(i),xr(vn),ft(Cs),_o!==0&&ft(_o+" J"),Uo!==0&&ft(Uo+" j"),Vn.publish("addPage",{pageNumber:He})},Rl=function(A){A>0&&A<=He&&(Ae.splice(A,1),Pe.splice(A,1),He--,X>He&&(X=He),this.setPage(X))},ac=function(A){A>0&&A<=He&&(X=A)},Bc=y.__private__.getNumberOfPages=y.getNumberOfPages=function(){return Ae.length-1},zc=function(A,B,ht){var Tt,Bt=void 0;return ht=ht||{},A=A!==void 0?A:cn[Be].fontName,B=B!==void 0?B:cn[Be].fontStyle,Tt=A.toLowerCase(),pn[Tt]!==void 0&&pn[Tt][B]!==void 0?Bt=pn[Tt][B]:pn[A]!==void 0&&pn[A][B]!==void 0?Bt=pn[A][B]:ht.disableWarning===!1&&ai.warn("Unable to look up font label for font '"+A+"', '"+B+"'. Refer to getFontList() for available fonts."),Bt||ht.noFallback||(Bt=pn.times[B])==null&&(Bt=pn.times.normal),Bt},eo=y.__private__.putInfo=function(){var A=Xn(),B=function(Tt){return Tt};for(var ht in p!==null&&(B=hi.encryptor(A,0)),ft("<<"),ft("/Producer ("+Pi(B("jsPDF "+xn.version))+")"),Sn)Sn.hasOwnProperty(ht)&&Sn[ht]&&ft("/"+ht.substr(0,1).toUpperCase()+ht.substr(1)+" ("+Pi(B(Sn[ht]))+")");ft("/CreationDate ("+Pi(B(Lt))+")"),ft(">>"),ft("endobj")},yi=y.__private__.putCatalog=function(A){var B=(A=A||{}).rootDictionaryObjId||gi;switch(Xn(),ft("<<"),ft("/Type /Catalog"),ft("/Pages "+B+" 0 R"),_e||(_e="fullwidth"),_e){case"fullwidth":ft("/OpenAction [3 0 R /FitH null]");break;case"fullheight":ft("/OpenAction [3 0 R /FitV null]");break;case"fullpage":ft("/OpenAction [3 0 R /Fit]");break;case"original":ft("/OpenAction [3 0 R /XYZ null null 1]");break;default:var ht=""+_e;ht.substr(ht.length-1)==="%"&&(_e=parseInt(_e)/100),typeof _e=="number"&&ft("/OpenAction [3 0 R /XYZ null null "+Z(_e)+"]")}switch(Pn||(Pn="continuous"),Pn){case"continuous":ft("/PageLayout /OneColumn");break;case"single":ft("/PageLayout /SinglePage");break;case"two":case"twoleft":ft("/PageLayout /TwoColumnLeft");break;case"tworight":ft("/PageLayout /TwoColumnRight")}Ye&&ft("/PageMode /"+Ye),Vn.publish("putCatalog"),ft(">>"),ft("endobj")},Ni=y.__private__.putTrailer=function(){ft("trailer"),ft("<<"),ft("/Size "+(vt+1)),ft("/Root "+vt+" 0 R"),ft("/Info "+(vt-1)+" 0 R"),p!==null&&ft("/Encrypt "+hi.oid+" 0 R"),ft("/ID [ <"+dt+"> <"+dt+"> ]"),ft(">>")},Fn=y.__private__.putHeader=function(){ft("%PDF-"+M),ft("%ºß¬à")},Po=y.__private__.putXRef=function(){var A="0000000000";ft("xref"),ft("0 "+(vt+1)),ft("0000000000 65535 f ");for(var B=1;B<=vt;B++)typeof kt[B]=="function"?ft((A+kt[B]()).slice(-10)+" 00000 n "):kt[B]!==void 0?ft((A+kt[B]).slice(-10)+" 00000 n "):ft("0000000000 00000 n ")},fr=y.__private__.buildDocument=function(){var A;vt=0,Rt=0,qt=[],kt=[],Zt=[],gi=fi(),Ar=fi(),Ue(qt),Vn.publish("buildDocument"),Fn(),Zo(),(function(){Vn.publish("putAdditionalObjects");for(var ht=0;ht<Zt.length;ht++){var Tt=Zt[ht];Ti(Tt.objId,!0),ft(Tt.content),ft("endobj")}Vn.publish("postPutAdditionalObjects")})(),A=[],(function(){for(var ht in cn)cn.hasOwnProperty(ht)&&(g===!1||g===!0&&b.hasOwnProperty(ht))&&To(cn[ht])})(),(function(){var ht;for(ht in ve)ve.hasOwnProperty(ht)&&Qa(ve[ht])})(),(function(){for(var ht in ui)ui.hasOwnProperty(ht)&&Ll(ui[ht])})(),(function(ht){var Tt;for(Tt in en)en.hasOwnProperty(Tt)&&(en[Tt]instanceof Of?ca(en[Tt]):en[Tt]instanceof Fd&&As(en[Tt],ht))})(A),Vn.publish("putResources"),A.forEach(Qo),Qo({resourcesOid:Ar,objectOid:Number.MAX_SAFE_INTEGER}),Vn.publish("postPutResources"),p!==null&&(hi.oid=Xn(),ft("<<"),ft("/Filter /Standard"),ft("/V "+hi.v),ft("/R "+hi.r),ft("/U <"+hi.toHexString(hi.U)+">"),ft("/O <"+hi.toHexString(hi.O)+">"),ft("/P "+hi.P),ft(">>"),ft("endobj")),eo(),yi();var B=Rt;return Po(),Ni(),ft("startxref"),ft(""+B),ft("%%EOF"),Ue(Ae[X]),qt.join(`
15
- `)},go=y.__private__.getBlob=function(A){return new Blob([rn(A)],{type:"application/pdf"})},qi=function(A){for(;A.firstChild;)A.removeChild(A.firstChild)},Yr=function(A){var B,ht=A.document,Tt=ht.documentElement,Bt=ht.head,ne=ht.body;return Bt||(Bt=ht.createElement("head"),Tt.appendChild(Bt)),ne||(ne=ht.createElement("body"),Tt.appendChild(ne)),qi(Bt),qi(ne),(B=ht.createElement("style")).appendChild(ht.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),Bt.appendChild(B),{document:ht,body:ne}},dr=y.output=y.__private__.output=(Ei=function(A,B){switch(typeof(B=B||{})=="string"?B={filename:B}:B.filename=B.filename||"generated.pdf",A){case void 0:return fr();case"save":y.save(B.filename);break;case"arraybuffer":return rn(fr());case"blob":return go(fr());case"bloburi":case"bloburl":if(Wn.URL!==void 0&&typeof Wn.URL.createObjectURL=="function")return Wn.URL&&Wn.URL.createObjectURL(go(fr()))||void 0;ai.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var ht="",Tt=fr();try{ht=dw(Tt)}catch{ht=dw(unescape(encodeURIComponent(Tt)))}return"data:application/pdf;filename="+encodeURIComponent(B.filename)+";base64,"+ht;case"pdfobjectnewwindow":case"pdfjsnewwindow":throw new Error("jsPDF viewer output modes are disabled in this build.");case"dataurlnewwindow":if(Object.prototype.toString.call(Wn)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var Bt=Wn.open();if(Bt!==null){var ne=Yr(Bt),xe=ne.document.createElement("iframe");xe.src=this.output("datauristring",B),ne.body.appendChild(xe),Bt.document.title=B.filename}if(Bt||typeof safari>"u")return Bt;break;case"datauri":case"dataurl":return Wn.document.location.href=this.output("datauristring",B);default:return null}},Ei.foo=function(){try{return Ei.apply(this,arguments)}catch(ht){var A=ht.stack||"";~A.indexOf(" at ")&&(A=A.split(" at ")[1]);var B="Error in function "+A.split(`
16
- `)[0].split("<")[0]+": "+ht.message;if(!Wn.console)throw new Error(B);Wn.console.error(B,ht),Wn.alert&&alert(B)}},Ei.foo.bar=Ei,Ei.foo),Ir=function(A){return Array.isArray(Xo)===!0&&Xo.indexOf(A)>-1};switch(r){case"pt":tn=1;break;case"mm":tn=72/25.4;break;case"cm":tn=72/2.54;break;case"in":tn=72;break;case"px":tn=Ir("px_scaling")==1?.75:96/72;break;case"pc":case"em":tn=12;break;case"ex":tn=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);tn=r}var hi=null;K(),lt();var Ys=y.__private__.getPageInfo=y.getPageInfo=function(A){if(isNaN(A)||A%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Pe[A].objId,pageNumber:A,pageContext:Pe[A]}},te=y.__private__.getPageInfoByObjId=function(A){if(isNaN(A)||A%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var B in Pe)if(Pe[B].objId===A)break;return Ys(B)},el=y.__private__.getCurrentPageInfo=y.getCurrentPageInfo=function(){return{objId:Pe[X].objId,pageNumber:X,pageContext:Pe[X]}};y.addPage=function(){return Ms.apply(this,arguments),this},y.setPage=function(){return ac.apply(this,arguments),Ue.call(this,Ae[X]),this},y.insertPage=function(A){return this.addPage(),this.movePage(X,A),this},y.movePage=function(A,B){var ht,Tt;if(A>B){ht=Ae[A],Tt=Pe[A];for(var Bt=A;Bt>B;Bt--)Ae[Bt]=Ae[Bt-1],Pe[Bt]=Pe[Bt-1];Ae[B]=ht,Pe[B]=Tt,this.setPage(B)}else if(A<B){ht=Ae[A],Tt=Pe[A];for(var ne=A;ne<B;ne++)Ae[ne]=Ae[ne+1],Pe[ne]=Pe[ne+1];Ae[B]=ht,Pe[B]=Tt,this.setPage(B)}return this},y.deletePage=function(){return Rl.apply(this,arguments),this},y.__private__.text=y.text=function(A,B,ht,Tt,Bt){var ne,xe,Ge,un,In,Bn,or,$i,ue,Sr=(Tt=Tt||{}).scope||this;if(typeof A=="number"&&typeof B=="number"&&(typeof ht=="string"||Array.isArray(ht))){var $r=ht;ht=B,B=A,A=$r}if(arguments[3]instanceof Je==0?(Ge=arguments[4],un=arguments[5],Hr(or=arguments[3])==="object"&&or!==null||(typeof Ge=="string"&&(un=Ge,Ge=null),typeof or=="string"&&(un=or,or=null),typeof or=="number"&&(Ge=or,or=null),Tt={flags:or,angle:Ge,align:un})):(ot("The transform parameter of text() with a Matrix value"),ue=Bt),isNaN(B)||isNaN(ht)||A==null)throw new Error("Invalid arguments passed to jsPDF.text");if(A.length===0)return Sr;var sn,an="",Do=typeof Tt.lineHeightFactor=="number"?Tt.lineHeightFactor:es,Ws=Sr.internal.scaleFactor;function Fc(yr){return yr=yr.split(" ").join(Array(Tt.TabLen||9).join(" ")),Pi(yr,or)}function gr(yr){for(var Mr,ti=yr.concat(),Dr=[],ss=ti.length;ss--;)typeof(Mr=ti.shift())=="string"?Dr.push(Mr):Array.isArray(yr)&&(Mr.length===1||Mr[1]===void 0&&Mr[2]===void 0)?Dr.push(Mr[0]):Dr.push([Mr[0],Mr[1],Mr[2]]);return Dr}function yo(yr,Mr){var ti;if(typeof yr=="string")ti=Mr(yr)[0];else if(Array.isArray(yr)){for(var Dr,ss,Hl=yr.concat(),ul=[],Hc=Hl.length;Hc--;)typeof(Dr=Hl.shift())=="string"?ul.push(Mr(Dr)[0]):Array.isArray(Dr)&&typeof Dr[0]=="string"&&(ss=Mr(Dr[0],Dr[1],Dr[2]),ul.push([ss[0],ss[1],ss[2]]));ti=ul}return ti}var il=!1,Xs=!0;if(typeof A=="string")il=!0;else if(Array.isArray(A)){var zl=A.concat();xe=[];for(var za,Vi=zl.length;Vi--;)(typeof(za=zl.shift())!="string"||Array.isArray(za)&&typeof za[0]!="string")&&(Xs=!1);il=Xs}if(il===!1)throw new Error('Type of text must be string or Array. "'+A+'" is not recognized.');typeof A=="string"&&(A=A.match(/[\r?\n]/)?A.split(/\r\n|\r|\n/g):[A]);var Gs=be/Sr.internal.scaleFactor,rs=Gs*(Do-1);switch(Tt.baseline){case"bottom":ht-=rs;break;case"top":ht+=Gs-rs;break;case"hanging":ht+=Gs-2*rs;break;case"middle":ht+=Gs/2-rs}if((Bn=Tt.maxWidth||0)>0&&(typeof A=="string"?A=Sr.splitTextToSize(A,Bn):Object.prototype.toString.call(A)==="[object Array]"&&(A=A.reduce(function(yr,Mr){return yr.concat(Sr.splitTextToSize(Mr,Bn))},[]))),ne={text:A,x:B,y:ht,options:Tt,mutex:{pdfEscape:Pi,activeFontKey:Be,fonts:cn,activeFontSize:be}},Vn.publish("preProcessText",ne),A=ne.text,Ge=(Tt=ne.options).angle,ue instanceof Je==0&&Ge&&typeof Ge=="number"){Ge*=Math.PI/180,Tt.rotationDirection===0&&(Ge=-Ge),W===Y&&(Ge=-Ge);var pc=Math.cos(Ge),Ks=Math.sin(Ge);ue=new Je(pc,Ks,-Ks,pc,0,0)}else Ge&&Ge instanceof Je&&(ue=Ge);W!==Y||ue||(ue=to),(In=Tt.charSpace||fa)!==void 0&&(an+=bt(V(In))+` Tc
17
- `,this.setCharSpace(this.getCharSpace()||0)),($i=Tt.horizontalScale)!==void 0&&(an+=bt(100*$i)+` Tz
18
- `),Tt.lang;var bo=-1,mc=Tt.renderingMode!==void 0?Tt.renderingMode:Tt.stroke,ol=Sr.internal.getCurrentPageInfo().pageContext;switch(mc){case 0:case!1:case"fill":bo=0;break;case 1:case!0:case"stroke":bo=1;break;case 2:case"fillThenStroke":bo=2;break;case 3:case"invisible":bo=3;break;case 4:case"fillAndAddForClipping":bo=4;break;case 5:case"strokeAndAddPathForClipping":bo=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":bo=6;break;case 7:case"addToPathForClipping":bo=7}var Js=ol.usedRenderingMode!==void 0?ol.usedRenderingMode:-1;bo!==-1?an+=bo+` Tr
19
- `:Js!==-1&&(an+=`0 Tr
20
- `),bo!==-1&&(ol.usedRenderingMode=bo),un=Tt.align||"left";var pi,sl=be*Do,ma=Sr.internal.pageSize.getWidth(),al=cn[Be];In=Tt.charSpace||fa,Bn=Tt.maxWidth||0,or=Object.assign({autoencode:!0,noBOM:!0},Tt.flags);var xo=[],ji=function(yr){return Sr.getStringUnitWidth(yr,{font:al,charSpace:In,fontSize:be,doKerning:!1})*be/Ws};if(Object.prototype.toString.call(A)==="[object Array]"){var _i;xe=gr(A),un!=="left"&&(pi=xe.map(ji));var Qr,Fa=0;if(un==="right"){B-=pi[0],A=[],Vi=xe.length;for(var ga=0;ga<Vi;ga++)ga===0?(Qr=Fo(B),_i=Yi(ht)):(Qr=V(Fa-pi[ga]),_i=-sl),A.push([xe[ga],Qr,_i]),Fa=pi[ga]}else if(un==="center"){B-=pi[0]/2,A=[],Vi=xe.length;for(var ya=0;ya<Vi;ya++)ya===0?(Qr=Fo(B),_i=Yi(ht)):(Qr=V((Fa-pi[ya])/2),_i=-sl),A.push([xe[ya],Qr,_i]),Fa=pi[ya]}else if(un==="left"){A=[],Vi=xe.length;for(var Me=0;Me<Vi;Me++)A.push(xe[Me])}else if(un==="justify"&&al.encoding==="Identity-H"){A=[],Vi=xe.length,Bn=Bn!==0?Bn:ma;for(var Wi=0,bi=0;bi<Vi;bi++)if(_i=bi===0?Yi(ht):-sl,Qr=bi===0?Fo(B):Wi,bi<Vi-1){var Uc=V((Bn-pi[bi])/(xe[bi].split(" ").length-1)),mi=xe[bi].split(" ");A.push([mi[0]+" ",Qr,_i]),Wi=0;for(var ro=1;ro<mi.length;ro++){var ll=(ji(mi[ro-1]+" "+mi[ro])-ji(mi[ro]))*Ws+Uc;ro==mi.length-1?A.push([mi[ro],ll,0]):A.push([mi[ro]+" ",ll,0]),Wi-=ll}}else A.push([xe[bi],Qr,_i]);A.push(["",Wi,0])}else{if(un!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(A=[],Vi=xe.length,Bn=Bn!==0?Bn:ma,bi=0;bi<Vi;bi++){_i=bi===0?Yi(ht):-sl,Qr=bi===0?Fo(B):0;var Fl=xe[bi].split(" ").length-1,gc=Fl>0?(Bn-pi[bi])/Fl:0;bi<Vi-1?xo.push(bt(V(gc))):xo.push(0),A.push([xe[bi],Qr,_i])}}}(typeof Tt.R2L=="boolean"?Tt.R2L:Le)===!0&&(A=yo(A,function(yr,Mr,ti){return[yr.split("").reverse().join(""),Mr,ti]})),ne={text:A,x:B,y:ht,options:Tt,mutex:{pdfEscape:Pi,activeFontKey:Be,fonts:cn,activeFontSize:be}},Vn.publish("postProcessText",ne),A=ne.text,sn=ne.mutex.isHex||!1;var Ul=cn[Be].encoding;Ul!=="WinAnsiEncoding"&&Ul!=="StandardEncoding"||(A=yo(A,function(yr,Mr,ti){return[Fc(yr),Mr,ti]})),xe=gr(A),A=[];for(var ba,cl,is,Ds=Array.isArray(xe[0])?1:0,io="",Zs=function(yr,Mr,ti){var Dr="";return ti instanceof Je?(ti=typeof Tt.angle=="number"?Ss(ti,new Je(1,0,0,1,yr,Mr)):Ss(new Je(1,0,0,1,yr,Mr),ti),W===Y&&(ti=Ss(new Je(1,0,0,-1,0,0),ti)),Dr=ti.join(" ")+` Tm
21
- `):Dr=bt(yr)+" "+bt(Mr)+` Td
22
- `,Dr},oo=0;oo<xe.length;oo++){switch(io="",Ds){case 1:is=(sn?"<":"(")+xe[oo][0]+(sn?">":")"),ba=parseFloat(xe[oo][1]),cl=parseFloat(xe[oo][2]);break;case 0:is=(sn?"<":"(")+xe[oo]+(sn?">":")"),ba=Fo(B),cl=Yi(ht)}xo!==void 0&&xo[oo]!==void 0&&(io=xo[oo]+` Tw
23
- `),oo===0?A.push(io+Zs(ba,cl,ue)+is):Ds===0?A.push(io+is):Ds===1&&A.push(io+Zs(ba,cl,ue)+is)}A=Ds===0?A.join(` Tj
24
- T* `):A.join(` Tj
25
- `),A+=` Tj
26
- `;var so=`BT
27
- /`;return so+=Be+" "+be+` Tf
28
- `,so+=bt(be*Do)+` TL
29
- `,so+=no+`
30
- `,so+=an,so+=A,ft(so+="ET"),b[Be]=!0,Sr};var Pa=y.__private__.clip=y.clip=function(A){return ft(A==="evenodd"?"W*":"W"),this};y.clipEvenOdd=function(){return Pa("evenodd")},y.__private__.discardPath=y.discardPath=function(){return ft("n"),this};var $s=y.__private__.isValidStyle=function(A){var B=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(A)!==-1&&(B=!0),B};y.__private__.setDefaultPathOperation=y.setDefaultPathOperation=function(A){return $s(A)&&(d=A),this};var Io=y.__private__.getStyle=y.getStyle=function(A){var B=d;switch(A){case"D":case"S":B="S";break;case"F":B="f";break;case"FD":case"DF":B="B";break;case"f":case"f*":case"B":case"B*":B=A}return B},Ol=y.close=function(){return ft("h"),this};y.stroke=function(){return ft("S"),this},y.fill=function(A){return Pl("f",A),this},y.fillEvenOdd=function(A){return Pl("f*",A),this},y.fillStroke=function(A){return Pl("B",A),this},y.fillStrokeEvenOdd=function(A){return Pl("B*",A),this};var Pl=function(A,B){Hr(B)==="object"?Tu(B,A):ft(A)},lc=function(A){A===null||W===Y&&A===void 0||(A=Io(A),ft(A))};function cc(A,B,ht,Tt,Bt){var ne=new Fd(B||this.boundingBox,ht||this.xStep,Tt||this.yStep,this.gState,Bt||this.matrix);ne.stream=this.stream;var xe=A+"$$"+this.cloneIndex+++"$$";return Xt(xe,ne),ne}var Tu=function(A,B){var ht=Qt[A.key],Tt=en[ht];if(Tt instanceof Of)ft("q"),ft(uc(B)),Tt.gState&&y.setGState(Tt.gState),ft(A.matrix.toString()+" cm"),ft("/"+ht+" sh"),ft("Q");else if(Tt instanceof Fd){var Bt=new Je(1,0,0,-1,0,pa());A.matrix&&(Bt=Bt.multiply(A.matrix||to),ht=cc.call(Tt,A.key,A.boundingBox,A.xStep,A.yStep,Bt).id),ft("q"),ft("/Pattern cs"),ft("/"+ht+" scn"),Tt.gState&&y.setGState(Tt.gState),ft(B),ft("Q")}},uc=function(A){switch(A){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},jo=y.moveTo=function(A,B){return ft(bt(V(A))+" "+bt(xt(B))+" m"),this},Bo=y.lineTo=function(A,B){return ft(bt(V(A))+" "+bt(xt(B))+" l"),this},ts=y.curveTo=function(A,B,ht,Tt,Bt,ne){return ft([bt(V(A)),bt(xt(B)),bt(V(ht)),bt(xt(Tt)),bt(V(Bt)),bt(xt(ne)),"c"].join(" ")),this};y.__private__.line=y.line=function(A,B,ht,Tt,Bt){if(isNaN(A)||isNaN(B)||isNaN(ht)||isNaN(Tt)||!$s(Bt))throw new Error("Invalid arguments passed to jsPDF.line");return W===H?this.lines([[ht-A,Tt-B]],A,B,[1,1],Bt||"S"):this.lines([[ht-A,Tt-B]],A,B,[1,1]).stroke()},y.__private__.lines=y.lines=function(A,B,ht,Tt,Bt,ne){var xe,Ge,un,In,Bn,or,$i,ue,Sr,$r,sn,an;if(typeof A=="number"&&(an=ht,ht=B,B=A,A=an),Tt=Tt||[1,1],ne=ne||!1,isNaN(B)||isNaN(ht)||!Array.isArray(A)||!Array.isArray(Tt)||!$s(Bt)||typeof ne!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(jo(B,ht),xe=Tt[0],Ge=Tt[1],In=A.length,$r=B,sn=ht,un=0;un<In;un++)(Bn=A[un]).length===2?($r=Bn[0]*xe+$r,sn=Bn[1]*Ge+sn,Bo($r,sn)):(or=Bn[0]*xe+$r,$i=Bn[1]*Ge+sn,ue=Bn[2]*xe+$r,Sr=Bn[3]*Ge+sn,$r=Bn[4]*xe+$r,sn=Bn[5]*Ge+sn,ts(or,$i,ue,Sr,$r,sn));return ne&&Ol(),lc(Bt),this},y.path=function(A){for(var B=0;B<A.length;B++){var ht=A[B],Tt=ht.c;switch(ht.op){case"m":jo(Tt[0],Tt[1]);break;case"l":Bo(Tt[0],Tt[1]);break;case"c":ts.apply(this,Tt);break;case"h":Ol()}}return this},y.__private__.rect=y.rect=function(A,B,ht,Tt,Bt){if(isNaN(A)||isNaN(B)||isNaN(ht)||isNaN(Tt)||!$s(Bt))throw new Error("Invalid arguments passed to jsPDF.rect");return W===H&&(Tt=-Tt),ft([bt(V(A)),bt(xt(B)),bt(V(ht)),bt(V(Tt)),"re"].join(" ")),lc(Bt),this},y.__private__.triangle=y.triangle=function(A,B,ht,Tt,Bt,ne,xe){if(isNaN(A)||isNaN(B)||isNaN(ht)||isNaN(Tt)||isNaN(Bt)||isNaN(ne)||!$s(xe))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[ht-A,Tt-B],[Bt-ht,ne-Tt],[A-Bt,B-ne]],A,B,[1,1],xe,!0),this},y.__private__.roundedRect=y.roundedRect=function(A,B,ht,Tt,Bt,ne,xe){if(isNaN(A)||isNaN(B)||isNaN(ht)||isNaN(Tt)||isNaN(Bt)||isNaN(ne)||!$s(xe))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var Ge=4/3*(Math.SQRT2-1);return Bt=Math.min(Bt,.5*ht),ne=Math.min(ne,.5*Tt),this.lines([[ht-2*Bt,0],[Bt*Ge,0,Bt,ne-ne*Ge,Bt,ne],[0,Tt-2*ne],[0,ne*Ge,-Bt*Ge,ne,-Bt,ne],[2*Bt-ht,0],[-Bt*Ge,0,-Bt,-ne*Ge,-Bt,-ne],[0,2*ne-Tt],[0,-ne*Ge,Bt*Ge,-ne,Bt,-ne]],A+Bt,B,[1,1],xe,!0),this},y.__private__.ellipse=y.ellipse=function(A,B,ht,Tt,Bt){if(isNaN(A)||isNaN(B)||isNaN(ht)||isNaN(Tt)||!$s(Bt))throw new Error("Invalid arguments passed to jsPDF.ellipse");var ne=4/3*(Math.SQRT2-1)*ht,xe=4/3*(Math.SQRT2-1)*Tt;return jo(A+ht,B),ts(A+ht,B-xe,A+ne,B-Tt,A,B-Tt),ts(A-ne,B-Tt,A-ht,B-xe,A-ht,B),ts(A-ht,B+xe,A-ne,B+Tt,A,B+Tt),ts(A+ne,B+Tt,A+ht,B+xe,A+ht,B),lc(Bt),this},y.__private__.circle=y.circle=function(A,B,ht,Tt){if(isNaN(A)||isNaN(B)||isNaN(ht)||!$s(Tt))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(A,B,ht,ht,Tt)},y.setFont=function(A,B,ht){return ht&&(B=Ct(B,ht)),Be=zc(A,B,{disableWarning:!1}),this};var fc=y.__private__.getFont=y.getFont=function(){return cn[zc.apply(y,arguments)]};y.__private__.getFontList=y.getFontList=function(){var A,B,ht={};for(A in pn)if(pn.hasOwnProperty(A))for(B in ht[A]=[],pn[A])pn[A].hasOwnProperty(B)&&ht[A].push(B);return ht},y.addFont=function(A,B,ht,Tt,Bt){var ne=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&ne.indexOf(arguments[3])!==-1?Bt=arguments[3]:arguments[3]&&ne.indexOf(arguments[3])==-1&&(ht=Ct(ht,Tt)),tl.call(this,A,B,ht,Bt=Bt||"Identity-H")};var es,vn=n.lineWidth||.200025,dc=y.__private__.getLineWidth=y.getLineWidth=function(){return vn},xr=y.__private__.setLineWidth=y.setLineWidth=function(A){return vn=A,ft(bt(V(A))+" w"),this};y.__private__.setLineDash=xn.API.setLineDash=xn.API.setLineDashPattern=function(A,B){if(A=A||[],B=B||0,isNaN(B)||!Array.isArray(A))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return A=A.map(function(ht){return bt(V(ht))}).join(" "),B=bt(V(B)),ft("["+A+"] "+B+" d"),this};var hc=y.__private__.getLineHeight=y.getLineHeight=function(){return be*es};y.__private__.getLineHeight=y.getLineHeight=function(){return be*es};var ua=y.__private__.setLineHeightFactor=y.setLineHeightFactor=function(A){return typeof(A=A||1.15)=="number"&&(es=A),this},zo=y.__private__.getLineHeightFactor=y.getLineHeightFactor=function(){return es};ua(n.lineHeight);var Fo=y.__private__.getHorizontalCoordinate=function(A){return V(A)},Yi=y.__private__.getVerticalCoordinate=function(A){return W===Y?A:Pe[X].mediaBox.topRightY-Pe[X].mediaBox.bottomLeftY-V(A)},No=y.__private__.getHorizontalCoordinateString=y.getHorizontalCoordinateString=function(A){return bt(Fo(A))},nl=y.__private__.getVerticalCoordinateString=y.getVerticalCoordinateString=function(A){return bt(Yi(A))},Cs=n.strokeColor||"0 G";y.__private__.getStrokeColor=y.getDrawColor=function(){return ir(Cs)},y.__private__.setStrokeColor=y.setDrawColor=function(A,B,ht,Tt){return Cs=Gn({ch1:A,ch2:B,ch3:ht,ch4:Tt,pdfColorType:"draw",precision:2}),ft(Cs),this};var Ia=n.fillColor||"0 g";y.__private__.getFillColor=y.getFillColor=function(){return ir(Ia)},y.__private__.setFillColor=y.setFillColor=function(A,B,ht,Tt){return Ia=Gn({ch1:A,ch2:B,ch3:ht,ch4:Tt,pdfColorType:"fill",precision:2}),ft(Ia),this};var no=n.textColor||"0 g",ja=y.__private__.getTextColor=y.getTextColor=function(){return ir(no)};y.__private__.setTextColor=y.setTextColor=function(A,B,ht,Tt){return no=Gn({ch1:A,ch2:B,ch3:ht,ch4:Tt,pdfColorType:"text",precision:3}),this};var fa=n.charSpace,Ii=y.__private__.getCharSpace=y.getCharSpace=function(){return parseFloat(fa||0)};y.__private__.setCharSpace=y.setCharSpace=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return fa=A,this};var _o=0;y.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},y.__private__.setLineCap=y.setLineCap=function(A){var B=y.CapJoinStyles[A];if(B===void 0)throw new Error("Line cap style of '"+A+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return _o=B,ft(B+" J"),this};var Uo=0;y.__private__.setLineJoin=y.setLineJoin=function(A){var B=y.CapJoinStyles[A];if(B===void 0)throw new Error("Line join style of '"+A+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Uo=B,ft(B+" j"),this},y.__private__.setLineMiterLimit=y.__private__.setMiterLimit=y.setLineMiterLimit=y.setMiterLimit=function(A){if(A=A||0,isNaN(A))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return ft(bt(V(A))+" M"),this},y.GState=dg,y.setGState=function(A){(A=typeof A=="string"?ve[me[A]]:Es(null,A)).equals(We)||(ft("/"+A.id+" gs"),We=A)};var Es=function(A,B){if(!A||!me[A]){var ht=!1;for(var Tt in ve)if(ve.hasOwnProperty(Tt)&&ve[Tt].equals(B)){ht=!0;break}if(ht)B=ve[Tt];else{var Bt="GS"+(Object.keys(ve).length+1).toString(10);ve[Bt]=B,B.id=Bt}return A&&(me[A]=B.id),Vn.publish("addGState",B),B}};y.addGState=function(A,B){return Es(A,B),this},y.saveGraphicsState=function(){return ft("q"),$n.push({key:Be,size:be,color:no}),this},y.restoreGraphicsState=function(){ft("Q");var A=$n.pop();return Be=A.key,be=A.size,no=A.color,We=null,this},y.setCurrentTransformationMatrix=function(A){return ft(A.toString()+" cm"),this},y.comment=function(A){return ft("#"+A),this};var da=function(A,B){var ht=A||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return ht},set:function(ne){isNaN(ne)||(ht=parseFloat(ne))}});var Tt=B||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return Tt},set:function(ne){isNaN(ne)||(Tt=parseFloat(ne))}});var Bt="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Bt},set:function(ne){Bt=ne.toString()}}),this},ha=function(A,B,ht,Tt){da.call(this,A,B),this.type="rect";var Bt=ht||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Bt},set:function(xe){isNaN(xe)||(Bt=parseFloat(xe))}});var ne=Tt||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return ne},set:function(xe){isNaN(xe)||(ne=parseFloat(xe))}}),this},Vs=function(){this.page=He,this.currentPage=X,this.pages=Ae.slice(0),this.pagesContext=Pe.slice(0),this.x=je,this.y=ur,this.matrix=bn,this.width=rl(X),this.height=_s(X),this.outputDestination=Ie,this.id="",this.objectNumber=-1};Vs.prototype.restore=function(){He=this.page,X=this.currentPage,Pe=this.pagesContext,Ae=this.pages,je=this.x,ur=this.y,bn=this.matrix,ns(X,this.width),Il(X,this.height),Ie=this.outputDestination};var Ts=function(A,B,ht,Tt,Bt){Go.push(new Vs),He=X=0,Ae=[],je=A,ur=B,bn=Bt,qr([ht,Tt])};for(var Ns in y.beginFormObject=function(A,B,ht,Tt,Bt){return Ts(A,B,ht,Tt,Bt),this},y.endFormObject=function(A){return(function(B){if(Hi[B])Go.pop().restore();else{var ht=new Vs,Tt="Xo"+(Object.keys(ui).length+1).toString(10);ht.id=Tt,Hi[B]=Tt,ui[Tt]=ht,Vn.publish("addFormObject",ht),Go.pop().restore()}})(A),this},y.doFormObject=function(A,B){var ht=ui[Hi[A]];return ft("q"),ft(B.toString()+" cm"),ft("/"+ht.id+" Do"),ft("Q"),this},y.getFormObject=function(A){var B=ui[Hi[A]];return{x:B.x,y:B.y,width:B.width,height:B.height,matrix:B.matrix}},y.save=function(A,B){return A=A||"generated.pdf",(B=B||{}).returnPromise=B.returnPromise||!1,B.returnPromise===!1?(Rf(go(fr()),A),typeof Rf.unload=="function"&&Wn.setTimeout&&setTimeout(Rf.unload,911),this):new Promise(function(ht,Tt){try{var Bt=Rf(go(fr()),A);typeof Rf.unload=="function"&&Wn.setTimeout&&setTimeout(Rf.unload,911),ht(Bt)}catch(ne){Tt(ne.message)}})},xn.API)xn.API.hasOwnProperty(Ns)&&(Ns==="events"&&xn.API.events.length?(function(A,B){var ht,Tt,Bt;for(Bt=B.length-1;Bt!==-1;Bt--)ht=B[Bt][0],Tt=B[Bt][1],A.subscribe.apply(A,[ht].concat(typeof Tt=="function"?[Tt]:Tt))})(Vn,xn.API.events):y[Ns]=xn.API[Ns]);function rl(A){return Pe[A].mediaBox.topRightX-Pe[A].mediaBox.bottomLeftX}function ns(A,B){Pe[A].mediaBox.topRightX=B+Pe[A].mediaBox.bottomLeftX}function _s(A){return Pe[A].mediaBox.topRightY-Pe[A].mediaBox.bottomLeftY}function Il(A,B){Pe[A].mediaBox.topRightY=B+Pe[A].mediaBox.bottomLeftY}var Ba=y.getPageWidth=function(A){return rl(A=A||X)/tn},jl=y.setPageWidth=function(A,B){ns(A,B*tn)},pa=y.getPageHeight=function(A){return _s(A=A||X)/tn},Bl=y.setPageHeight=function(A,B){Il(A,B*tn)};return y.internal={pdfEscape:Pi,getStyle:Io,getFont:fc,getFontSize:Te,getCharSpace:Ii,getTextColor:ja,getLineHeight:hc,getLineHeightFactor:zo,getLineWidth:dc,write:Re,getHorizontalCoordinate:Fo,getVerticalCoordinate:Yi,getCoordinateString:No,getVerticalCoordinateString:nl,collections:{},newObject:Xn,newAdditionalObject:Ko,newObjectDeferred:fi,newObjectDeferredBegin:Ti,getFilters:Jo,putStream:ks,events:Vn,scaleFactor:tn,pageSize:{getWidth:function(){return Ba(X)},setWidth:function(A){jl(X,A)},getHeight:function(){return pa(X)},setHeight:function(A){Bl(X,A)}},encryptionOptions:p,encryption:hi,getEncryptor:function(A){return p!==null?hi.encryptor(A,0):function(B){return B}},output:dr,getNumberOfPages:Bc,get pages(){return Ae},out:ft,f2:Z,f3:ct,getPageInfo:Ys,getPageInfoByObjId:te,getCurrentPageInfo:el,getPDFVersion:C,Point:da,Rectangle:ha,Matrix:Je,hasHotfix:Ir},Object.defineProperty(y.internal.pageSize,"width",{get:function(){return Ba(X)},set:function(A){jl(X,A)},enumerable:!0,configurable:!0}),Object.defineProperty(y.internal.pageSize,"height",{get:function(){return pa(X)},set:function(A){Bl(X,A)},enumerable:!0,configurable:!0}),(function(A){for(var B=0,ht=on.length;B<ht;B++){var Tt=tl.call(this,A[B][0],A[B][1],A[B][2],on[B][3],!0);g===!1&&(b[Tt]=!0);var Bt=A[B][0].split("-");di({id:Tt,fontName:Bt[0],fontStyle:Bt[1]||""})}Vn.publish("addFonts",{fonts:cn,dictionary:pn})}).call(y,on),Be="F1",Ms(i,e),Vn.publish("initialized"),y}Rd.prototype.lsbFirstWord=function(n){return String.fromCharCode(255&n,n>>8&255,n>>16&255,n>>24&255)},Rd.prototype.toHexString=function(n){return n.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Rd.prototype.hexToBytes=function(n){for(var t=[],e=0;e<n.length;e+=2)t.push(String.fromCharCode(parseInt(n.substr(e,2),16)));return t.join("")},Rd.prototype.processOwnerPassword=function(n,t){return a2(s2(t).substr(0,5),n)},Rd.prototype.encryptor=function(n,t){var e=s2(this.encryptionKey+String.fromCharCode(255&n,n>>8&255,n>>16&255,255&t,t>>8&255)).substr(0,10);return function(r){return a2(e,r)}},dg.prototype.equals=function(n){var t,e="id,objectNumber,equals";if(!n||Hr(n)!==Hr(this))return!1;var r=0;for(t in this)if(!(e.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!n.hasOwnProperty(t)||this[t]!==n[t])return!1;r++}for(t in n)n.hasOwnProperty(t)&&e.indexOf(t)<0&&r--;return r===0},xn.API={events:[]},xn.version="4.2.1";var Zi=xn.API,c5=1,sd=function(n){return n.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Md=function(n){return n.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Zf=function(n){return n.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var e=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(e.length===1?"0"+e:e)})},Yn=function(n){return n.toFixed(2)},Wu=function(n){return n.toFixed(5)};Zi.__acroform__={};var Ra=function(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n},gw=function(n){return n*c5},_c=function(n){var t=new o4,e=dn.internal.getHeight(n)||0,r=dn.internal.getWidth(n)||0;return t.BBox=[0,0,Number(Yn(r)),Number(Yn(e))],t},yN=Zi.__acroform__.setBit=function(n,t){if(n=n||0,t=t||0,isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return n|1<<t},bN=Zi.__acroform__.clearBit=function(n,t){if(n=n||0,t=t||0,isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return n&~(1<<t)},xN=Zi.__acroform__.getBit=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return n&1<<t?1:0},fo=Zi.__acroform__.getBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return xN(n,t-1)},ho=Zi.__acroform__.setBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return yN(n,t-1)},po=Zi.__acroform__.clearBitForPdf=function(n,t){if(isNaN(n)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return bN(n,t-1)},vN=Zi.__acroform__.calculateCoordinates=function(n,t){var e=t.internal.getHorizontalCoordinate,r=t.internal.getVerticalCoordinate,i=n[0],s=n[1],l=n[2],c=n[3],f={};return f.lowerLeft_X=e(i)||0,f.lowerLeft_Y=r(s+c)||0,f.upperRight_X=e(i+l)||0,f.upperRight_Y=r(s)||0,[Number(Yn(f.lowerLeft_X)),Number(Yn(f.lowerLeft_Y)),Number(Yn(f.upperRight_X)),Number(Yn(f.upperRight_Y))]},wN=function(n){if(n.appearanceStreamContent)return n.appearanceStreamContent;if(n.V||n.DV){var t=[],e=n._V||n.DV,r=l2(n,e),i=n.scope.internal.getFont(n.fontName,n.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(n.scope.__private__.encodeColorString(n.color)),t.push("/"+i+" "+Yn(r.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(r.text),t.push("ET"),t.push("Q"),t.push("EMC");var s=_c(n);return s.scope=n.scope,s.stream=t.join(`
31
- `),s}},l2=function(n,t){var e=n.fontSize===0?n.maxFontSize:n.fontSize,r={text:"",fontSize:""},i=(t=(t=t.substr(0,1)=="("?t.substr(1):t).substr(t.length-1)==")"?t.substr(0,t.length-1):t).split(" ");i=n.multiline?i.map(function(Z){return Z.split(`
32
- `)}):i.map(function(Z){return[Z]});var s=e,l=dn.internal.getHeight(n)||0;l=l<0?-l:l;var c=dn.internal.getWidth(n)||0;c=c<0?-c:c;var f=function(Z,ct,V){if(Z+1<i.length){var xt=ct+" "+i[Z+1][0];return km(xt,n,V).width<=c-4}return!1};s++;t:for(;s>0;){t="",s--;var d,p,g=km("3",n,s).height,b=n.multiline?l-s:(l-g)/2,y=b+=2,M=0,C=0,D=0;if(s<=0){t=`(...) Tj
33
- `,t+="% Width of Text: "+km(t,n,s=12).width+", FieldWidth:"+c+`
34
- `;break}for(var L="",H=0,Y=0;Y<i.length;Y++)if(i.hasOwnProperty(Y)){var W=!1;if(i[Y].length!==1&&D!==i[Y].length-1){if((g+2)*(H+2)+2>l)continue t;L+=i[Y][D],W=!0,C=Y,Y--}else{L=(L+=i[Y][D]+" ").substr(L.length-1)==" "?L.substr(0,L.length-1):L;var St=parseInt(Y),_t=f(St,L,s),Ct=Y>=i.length-1;if(_t&&!Ct){L+=" ",D=0;continue}if(_t||Ct){if(Ct)C=St;else if(n.multiline&&(g+2)*(H+2)+2>l)continue t}else{if(!n.multiline||(g+2)*(H+2)+2>l)continue t;C=St}}for(var bt="",ot=M;ot<=C;ot++){var jt=i[ot];if(n.multiline){if(ot===C){bt+=jt[D]+" ",D=(D+1)%jt.length;continue}if(ot===M){bt+=jt[jt.length-1]+" ";continue}}bt+=jt[0]+" "}switch(bt=bt.substr(bt.length-1)==" "?bt.substr(0,bt.length-1):bt,p=km(bt,n,s).width,n.textAlign){case"right":d=c-p-2;break;case"center":d=(c-p)/2;break;default:d=2}t+=Yn(d)+" "+Yn(y)+` Td
35
- `,t+="("+sd(bt)+`) Tj
36
- `,t+=-Yn(d)+` 0 Td
37
- `,y=-(s+2),p=0,M=W?C:C+1,H++,L=""}break}return r.text=t,r.fontSize=s,r},km=function(n,t,e){var r=t.scope.internal.getFont(t.fontName,t.fontStyle),i=t.scope.getStringUnitWidth(n,{font:r,fontSize:parseFloat(e),charSpace:0})*parseFloat(e);return{height:t.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(e),charSpace:0})*parseFloat(e)*1.5,width:i}},SN={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},kN=function(n,t){var e={type:"reference",object:n};t.internal.getPageInfo(n.page).pageContext.annotations.find(function(r){return r.type===e.type&&r.object===e.object})===void 0&&t.internal.getPageInfo(n.page).pageContext.annotations.push(e)},AN=function(n,t){if(t.scope=n,n.internal!==void 0&&(n.internal.acroformPlugin===void 0||n.internal.acroformPlugin.isInitialized===!1)){if(oc.FieldNum=0,n.internal.acroformPlugin=JSON.parse(JSON.stringify(SN)),n.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");c5=n.internal.scaleFactor,n.internal.acroformPlugin.acroFormDictionaryRoot=new s4,n.internal.acroformPlugin.acroFormDictionaryRoot.scope=n,n.internal.acroformPlugin.acroFormDictionaryRoot._eventID=n.internal.events.subscribe("postPutResources",function(){(function(e){e.internal.events.unsubscribe(e.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete e.internal.acroformPlugin.acroFormDictionaryRoot._eventID,e.internal.acroformPlugin.printedOut=!0})(n)}),n.internal.events.subscribe("buildDocument",function(){(function(e){e.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var r=e.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];s.objId=void 0,s.hasAnnotation&&kN(s,e)}})(n)}),n.internal.events.subscribe("putCatalog",function(){(function(e){if(e.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");e.internal.write("/AcroForm "+e.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(n)}),n.internal.events.subscribe("postPutPages",function(e){(function(r,i){var s=!r;for(var l in r||(i.internal.newObjectDeferredBegin(i.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),i.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),r=r||i.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(r.hasOwnProperty(l)){var c=r[l],f=[],d=c.Rect;if(c.Rect&&(c.Rect=vN(c.Rect,i)),i.internal.newObjectDeferredBegin(c.objId,!0),c.DA=dn.createDefaultAppearanceStream(c),Hr(c)==="object"&&typeof c.getKeyValueListForStream=="function"&&(f=c.getKeyValueListForStream()),c.Rect=d,c.hasAppearanceStream&&!c.appearanceStreamContent){var p=wN(c);f.push({key:"AP",value:"<</N "+p+">>"}),i.internal.acroformPlugin.xForms.push(p)}if(c.appearanceStreamContent){var g="";for(var b in c.appearanceStreamContent)if(c.appearanceStreamContent.hasOwnProperty(b)){var y=c.appearanceStreamContent[b];if(g+="/"+b+" ",g+="<<",Object.keys(y).length>=1||Array.isArray(y)){for(var l in y)if(y.hasOwnProperty(l)){var M=y[l];typeof M=="function"&&(M=M.call(i,c)),g+="/"+l+" "+M+" ",i.internal.acroformPlugin.xForms.indexOf(M)>=0||i.internal.acroformPlugin.xForms.push(M)}}else typeof(M=y)=="function"&&(M=M.call(i,c)),g+="/"+l+" "+M,i.internal.acroformPlugin.xForms.indexOf(M)>=0||i.internal.acroformPlugin.xForms.push(M);g+=">>"}f.push({key:"AP",value:`<<
38
- `+g+">>"})}i.internal.putStream({additionalKeyValues:f,objectId:c.objId}),i.internal.out("endobj")}s&&(function(C,D){for(var L in C)if(C.hasOwnProperty(L)){var H=L,Y=C[L];D.internal.newObjectDeferredBegin(Y.objId,!0),Hr(Y)==="object"&&typeof Y.putStream=="function"&&Y.putStream(),delete C[H]}})(i.internal.acroformPlugin.xForms,i)})(e,n)}),n.internal.acroformPlugin.isInitialized=!0}},i4=Zi.__acroform__.arrayToPdfArray=function(n,t,e){var r=function(l){return l};if(Array.isArray(n)){for(var i="[",s=0;s<n.length;s++)switch(s!==0&&(i+=" "),Hr(n[s])){case"boolean":case"number":case"object":i+=n[s].toString();break;case"string":n[s].substr(0,1)==="/"?i+="/"+Zf(n[s].substr(1)):(t!==void 0&&e&&(r=e.internal.getEncryptor(t)),i+="("+sd(r(n[s].toString()))+")")}return i+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},ny=function(n,t,e){var r=function(i){return i};return t!==void 0&&e&&(r=e.internal.getEncryptor(t)),(n=n||"").toString(),"("+sd(r(n))+")"},Oc=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(n){this._objId=n}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};Oc.prototype.toString=function(){return this.objId+" 0 R"},Oc.prototype.putStream=function(){var n=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:n,objectId:this.objId}),this.scope.internal.out("endobj")},Oc.prototype.getKeyValueListForStream=function(){var n=[],t=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var e in t)if(Object.getOwnPropertyDescriptor(this,t[e]).configurable===!1){var r=t[e],i=this[r];i&&(Array.isArray(i)?n.push({key:r,value:i4(i,this.objId,this.scope)}):i instanceof Oc?(i.scope=this.scope,n.push({key:r,value:i.objId+" 0 R"})):typeof i!="function"&&n.push({key:r,value:i}))}return n};var o4=function(){Oc.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var n,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(e){n=e.trim()},get:function(){return n||null}})};Ra(o4,Oc);var s4=function(){Oc.call(this);var n,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(n){var e=function(r){return r};return this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),"("+sd(e(n))+")"}},set:function(e){n=e}})};Ra(s4,Oc);var oc=function n(){Oc.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(L){if(isNaN(L))throw new Error('Invalid value "'+L+'" for attribute F supplied.');t=L}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!fo(t,3)},set:function(L){L?this.F=ho(t,3):this.F=po(t,3)}});var e=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return e},set:function(L){if(isNaN(L))throw new Error('Invalid value "'+L+'" for attribute Ff supplied.');e=L}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(L){r=L!==void 0?L:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(L){r[0]=L}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(L){r[1]=L}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(L){r[2]=L}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(L){r[3]=L}});var i="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(L){switch(L){case"/Btn":case"/Tx":case"/Ch":case"/Sig":i=L;break;default:throw new Error('Invalid value "'+L+'" for attribute FT supplied.')}}});var s=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!s||s.length<1){if(this instanceof hg)return;s="FieldObject"+n.FieldNum++}var L=function(H){return H};return this.scope&&(L=this.scope.internal.getEncryptor(this.objId)),"("+sd(L(s))+")"},set:function(L){s=L.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(L){s=L}});var l="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return l},set:function(L){l=L}});var c="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return c},set:function(L){c=L}});var f=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return f},set:function(L){f=L}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/c5:d},set:function(L){d=L}});var p="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return p},set:function(L){p=L}});var g="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!g||this instanceof hg||this instanceof Hf))return ny(g,this.objId,this.scope)},set:function(L){L=L.toString(),g=L}});var b=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(b)return this instanceof $o==0?ny(b,this.objId,this.scope):b},set:function(L){L=L.toString(),b=this instanceof $o==0?L.substr(0,1)==="("?Md(L.substr(1,L.length-2)):Md(L):L}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof $o==1?Md(b.substr(1,b.length-1)):b},set:function(L){L=L.toString(),b=this instanceof $o==1?"/"+Zf(L):L}});var y=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(y)return y},set:function(L){this.V=L}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(y)return this instanceof $o==0?ny(y,this.objId,this.scope):y},set:function(L){L=L.toString(),y=this instanceof $o==0?L.substr(0,1)==="("?Md(L.substr(1,L.length-2)):Md(L):L}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof $o==1?Md(y.substr(1,y.length-1)):y},set:function(L){L=L.toString(),y=this instanceof $o==1?"/"+Zf(L):L}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var M,C=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return C},set:function(L){L=!!L,C=L}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(M)return M},set:function(L){M=L}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,1)},set:function(L){L?this.Ff=ho(this.Ff,1):this.Ff=po(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,2)},set:function(L){L?this.Ff=ho(this.Ff,2):this.Ff=po(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,3)},set:function(L){L?this.Ff=ho(this.Ff,3):this.Ff=po(this.Ff,3)}});var D=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(D!==null)return D},set:function(L){if([0,1,2].indexOf(L)===-1)throw new Error('Invalid value "'+L+'" for attribute Q supplied.');D=L}}),Object.defineProperty(this,"textAlign",{get:function(){var L;switch(D){case 0:default:L="left";break;case 1:L="center";break;case 2:L="right"}return L},configurable:!0,enumerable:!0,set:function(L){switch(L){case"right":case 2:D=2;break;case"center":case 1:D=1;break;default:D=0}}})};Ra(oc,Oc);var qd=function(){oc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var n=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return n},set:function(e){n=e}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return n},set:function(e){n=e}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return i4(t,this.objId,this.scope)},set:function(e){var r,i;i=[],typeof(r=e)=="string"&&(i=(function(s,l,c){c||(c=1);for(var f,d=[];f=l.exec(s);)d.push(f[c]);return d})(r,/\((.*?)\)/g)),t=i}}),this.getOptions=function(){return t},this.setOptions=function(e){t=e,this.sort&&t.sort()},this.addOption=function(e){e=(e=e||"").toString(),t.push(e),this.sort&&t.sort()},this.removeOption=function(e,r){for(r=r||!1,e=(e=e||"").toString();t.indexOf(e)!==-1&&(t.splice(t.indexOf(e),1),r!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,18)},set:function(e){e?this.Ff=ho(this.Ff,18):this.Ff=po(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,19)},set:function(e){this.combo===!0&&(e?this.Ff=ho(this.Ff,19):this.Ff=po(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,20)},set:function(e){e?(this.Ff=ho(this.Ff,20),t.sort()):this.Ff=po(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,22)},set:function(e){e?this.Ff=ho(this.Ff,22):this.Ff=po(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,23)},set:function(e){e?this.Ff=ho(this.Ff,23):this.Ff=po(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,27)},set:function(e){e?this.Ff=ho(this.Ff,27):this.Ff=po(this.Ff,27)}}),this.hasAppearanceStream=!1};Ra(qd,oc);var Yd=function(){qd.call(this),this.fontName="helvetica",this.combo=!1};Ra(Yd,qd);var $d=function(){Yd.call(this),this.combo=!0};Ra($d,Yd);var Zm=function(){$d.call(this),this.edit=!0};Ra(Zm,$d);var $o=function(){oc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,15)},set:function(e){e?this.Ff=ho(this.Ff,15):this.Ff=po(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,16)},set:function(e){e?this.Ff=ho(this.Ff,16):this.Ff=po(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,17)},set:function(e){e?this.Ff=ho(this.Ff,17):this.Ff=po(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,26)},set:function(e){e?this.Ff=ho(this.Ff,26):this.Ff=po(this.Ff,26)}});var n,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var e=function(s){return s};if(this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var r,i=[];for(r in i.push("<<"),t)i.push("/"+r+" ("+sd(e(t[r]))+")");return i.push(">>"),i.join(`
39
- `)}},set:function(e){Hr(e)==="object"&&(t=e)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(e){typeof e=="string"&&(t.CA=e)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(e){var r=e==null?"":e.toString();r.substr(0,1)==="/"&&(r=r.substr(1)),n="/"+Zf(r)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(e){n="/"+Zf(e)}})};Ra($o,oc);var Qm=function(){$o.call(this),this.pushButton=!0};Ra(Qm,$o);var Vd=function(){$o.call(this),this.radio=!0,this.pushButton=!1;var n=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return n},set:function(t){n=t!==void 0?t:[]}})};Ra(Vd,$o);var hg=function(){var n,t;oc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return n},set:function(i){n=i}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(i){t=i}});var e,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var i=function(c){return c};this.scope&&(i=this.scope.internal.getEncryptor(this.objId));var s,l=[];for(s in l.push("<<"),r)l.push("/"+s+" ("+sd(i(r[s]))+")");return l.push(">>"),l.join(`
40
- `)},set:function(i){Hr(i)==="object"&&(r=i)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(i){typeof i=="string"&&(r.CA=i)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),e="/"+Zf(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),e="/"+Zf(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=dn.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};Ra(hg,oc),Vd.prototype.setAppearance=function(n){if(!("createAppearanceStream"in n)||!("getCA"in n))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var e=this.Kids[t];e.appearanceStreamContent=n.createAppearanceStream(e.optionName),e.caption=n.getCA()}},Vd.prototype.createOption=function(n){var t=new hg;return t.Parent=this,t.optionName=n,this.Kids.push(t),MN.call(this.scope,t),t};var tg=function(){$o.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=dn.CheckBox.createAppearanceStream()};Ra(tg,$o);var Hf=function(){oc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,13)},set:function(t){t?this.Ff=ho(this.Ff,13):this.Ff=po(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,21)},set:function(t){t?this.Ff=ho(this.Ff,21):this.Ff=po(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,23)},set:function(t){t?this.Ff=ho(this.Ff,23):this.Ff=po(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,24)},set:function(t){t?this.Ff=ho(this.Ff,24):this.Ff=po(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,25)},set:function(t){t?this.Ff=ho(this.Ff,25):this.Ff=po(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,26)},set:function(t){t?this.Ff=ho(this.Ff,26):this.Ff=po(this.Ff,26)}});var n=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return n},set:function(t){n=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return n},set:function(t){Number.isInteger(t)&&(n=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};Ra(Hf,oc);var eg=function(){Hf.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!fo(this.Ff,14)},set:function(n){n?this.Ff=ho(this.Ff,14):this.Ff=po(this.Ff,14)}}),this.password=!0};Ra(eg,Hf);var dn={CheckBox:{createAppearanceStream:function(){return{N:{On:dn.CheckBox.YesNormal},D:{On:dn.CheckBox.YesPushDown,Off:dn.CheckBox.OffPushDown}}},YesPushDown:function(n){var t=_c(n);t.scope=n.scope;var e=[],r=n.scope.internal.getFont(n.fontName,n.fontStyle).id,i=n.scope.__private__.encodeColorString(n.color),s=l2(n,n.caption);return e.push("0.749023 g"),e.push("0 0 "+Yn(dn.internal.getWidth(n))+" "+Yn(dn.internal.getHeight(n))+" re"),e.push("f"),e.push("BMC"),e.push("q"),e.push("0 0 1 rg"),e.push("/"+r+" "+Yn(s.fontSize)+" Tf "+i),e.push("BT"),e.push(s.text),e.push("ET"),e.push("Q"),e.push("EMC"),t.stream=e.join(`
41
- `),t},YesNormal:function(n){var t=_c(n);t.scope=n.scope;var e=n.scope.internal.getFont(n.fontName,n.fontStyle).id,r=n.scope.__private__.encodeColorString(n.color),i=[],s=dn.internal.getHeight(n),l=dn.internal.getWidth(n),c=l2(n,n.caption);return i.push("1 g"),i.push("0 0 "+Yn(l)+" "+Yn(s)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+Yn(l-1)+" "+Yn(s-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+e+" "+Yn(c.fontSize)+" Tf "+r),i.push(c.text),i.push("ET"),i.push("Q"),t.stream=i.join(`
42
- `),t},OffPushDown:function(n){var t=_c(n);t.scope=n.scope;var e=[];return e.push("0.749023 g"),e.push("0 0 "+Yn(dn.internal.getWidth(n))+" "+Yn(dn.internal.getHeight(n))+" re"),e.push("f"),t.stream=e.join(`
43
- `),t}},RadioButton:{Circle:{createAppearanceStream:function(n){var t={D:{Off:dn.RadioButton.Circle.OffPushDown},N:{}};return t.N[n]=dn.RadioButton.Circle.YesNormal,t.D[n]=dn.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(n){var t=_c(n);t.scope=n.scope;var e=[],r=dn.internal.getWidth(n)<=dn.internal.getHeight(n)?dn.internal.getWidth(n)/4:dn.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=dn.internal.Bezier_C,s=Number((r*i).toFixed(5));return e.push("q"),e.push("1 0 0 1 "+Wu(dn.internal.getWidth(n)/2)+" "+Wu(dn.internal.getHeight(n)/2)+" cm"),e.push(r+" 0 m"),e.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),e.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),e.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),e.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),e.push("f"),e.push("Q"),t.stream=e.join(`
44
- `),t},YesPushDown:function(n){var t=_c(n);t.scope=n.scope;var e=[],r=dn.internal.getWidth(n)<=dn.internal.getHeight(n)?dn.internal.getWidth(n)/4:dn.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*dn.internal.Bezier_C).toFixed(5)),l=Number((r*dn.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+Wu(dn.internal.getWidth(n)/2)+" "+Wu(dn.internal.getHeight(n)/2)+" cm"),e.push(i+" 0 m"),e.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),e.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),e.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),e.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),e.push("f"),e.push("Q"),e.push("0 g"),e.push("q"),e.push("1 0 0 1 "+Wu(dn.internal.getWidth(n)/2)+" "+Wu(dn.internal.getHeight(n)/2)+" cm"),e.push(r+" 0 m"),e.push(r+" "+l+" "+l+" "+r+" 0 "+r+" c"),e.push("-"+l+" "+r+" -"+r+" "+l+" -"+r+" 0 c"),e.push("-"+r+" -"+l+" -"+l+" -"+r+" 0 -"+r+" c"),e.push(l+" -"+r+" "+r+" -"+l+" "+r+" 0 c"),e.push("f"),e.push("Q"),t.stream=e.join(`
45
- `),t},OffPushDown:function(n){var t=_c(n);t.scope=n.scope;var e=[],r=dn.internal.getWidth(n)<=dn.internal.getHeight(n)?dn.internal.getWidth(n)/4:dn.internal.getHeight(n)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*dn.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+Wu(dn.internal.getWidth(n)/2)+" "+Wu(dn.internal.getHeight(n)/2)+" cm"),e.push(i+" 0 m"),e.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),e.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),e.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),e.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),e.push("f"),e.push("Q"),t.stream=e.join(`
46
- `),t}},Cross:{createAppearanceStream:function(n){var t={D:{Off:dn.RadioButton.Cross.OffPushDown},N:{}};return t.N[n]=dn.RadioButton.Cross.YesNormal,t.D[n]=dn.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(n){var t=_c(n);t.scope=n.scope;var e=[],r=dn.internal.calculateCross(n);return e.push("q"),e.push("1 1 "+Yn(dn.internal.getWidth(n)-2)+" "+Yn(dn.internal.getHeight(n)-2)+" re"),e.push("W"),e.push("n"),e.push(Yn(r.x1.x)+" "+Yn(r.x1.y)+" m"),e.push(Yn(r.x2.x)+" "+Yn(r.x2.y)+" l"),e.push(Yn(r.x4.x)+" "+Yn(r.x4.y)+" m"),e.push(Yn(r.x3.x)+" "+Yn(r.x3.y)+" l"),e.push("s"),e.push("Q"),t.stream=e.join(`
47
- `),t},YesPushDown:function(n){var t=_c(n);t.scope=n.scope;var e=dn.internal.calculateCross(n),r=[];return r.push("0.749023 g"),r.push("0 0 "+Yn(dn.internal.getWidth(n))+" "+Yn(dn.internal.getHeight(n))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+Yn(dn.internal.getWidth(n)-2)+" "+Yn(dn.internal.getHeight(n)-2)+" re"),r.push("W"),r.push("n"),r.push(Yn(e.x1.x)+" "+Yn(e.x1.y)+" m"),r.push(Yn(e.x2.x)+" "+Yn(e.x2.y)+" l"),r.push(Yn(e.x4.x)+" "+Yn(e.x4.y)+" m"),r.push(Yn(e.x3.x)+" "+Yn(e.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
48
- `),t},OffPushDown:function(n){var t=_c(n);t.scope=n.scope;var e=[];return e.push("0.749023 g"),e.push("0 0 "+Yn(dn.internal.getWidth(n))+" "+Yn(dn.internal.getHeight(n))+" re"),e.push("f"),t.stream=e.join(`
49
- `),t}}},createDefaultAppearanceStream:function(n){var t=n.scope.internal.getFont(n.fontName,n.fontStyle).id,e=n.scope.__private__.encodeColorString(n.color);return"/"+t+" "+n.fontSize+" Tf "+e}};dn.internal={Bezier_C:.551915024494,calculateCross:function(n){var t=dn.internal.getWidth(n),e=dn.internal.getHeight(n),r=Math.min(t,e);return{x1:{x:(t-r)/2,y:(e-r)/2+r},x2:{x:(t-r)/2+r,y:(e-r)/2},x3:{x:(t-r)/2,y:(e-r)/2},x4:{x:(t-r)/2+r,y:(e-r)/2+r}}}},dn.internal.getWidth=function(n){var t=0;return Hr(n)==="object"&&(t=gw(n.Rect[2])),t},dn.internal.getHeight=function(n){var t=0;return Hr(n)==="object"&&(t=gw(n.Rect[3])),t};var MN=Zi.addField=function(n){if(AN(this,n),!(n instanceof oc))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=n).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),n.page=n.scope.internal.getCurrentPageInfo().pageNumber,this};Zi.AcroFormChoiceField=qd,Zi.AcroFormListBox=Yd,Zi.AcroFormComboBox=$d,Zi.AcroFormEditBox=Zm,Zi.AcroFormButton=$o,Zi.AcroFormPushButton=Qm,Zi.AcroFormRadioButton=Vd,Zi.AcroFormCheckBox=tg,Zi.AcroFormTextField=Hf,Zi.AcroFormPasswordField=eg,Zi.AcroFormAppearance=dn,Zi.AcroForm={ChoiceField:qd,ListBox:Yd,ComboBox:$d,EditBox:Zm,Button:$o,PushButton:Qm,RadioButton:Vd,CheckBox:tg,TextField:Hf,PasswordField:eg,Appearance:dn},xn.AcroForm={ChoiceField:qd,ListBox:Yd,ComboBox:$d,EditBox:Zm,Button:$o,PushButton:Qm,RadioButton:Vd,CheckBox:tg,TextField:Hf,PasswordField:eg,Appearance:dn};xn.AcroForm;function a4(n){return n.reduce(function(t,e,r){return t[e]=r,t},{})}(function(n){var t="addImage_";n.__addimage__={};var e="UNKNOWN",r={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},i=n.__addimage__.getImageFileTypeByImageData=function(Z,ct){var V,xt,Lt,dt,st,lt=e;if((ct=ct||e)==="RGBA"||Z.data!==void 0&&Z.data instanceof Uint8ClampedArray&&"height"in Z&&"width"in Z)return"RGBA";if(_t(Z))for(st in r)for(Lt=r[st],V=0;V<Lt.length;V+=1){for(dt=!0,xt=0;xt<Lt[V].length;xt+=1)if(Lt[V][xt]!==void 0&&Lt[V][xt]!==Z[xt]){dt=!1;break}if(dt===!0){lt=st;break}}else for(st in r)for(Lt=r[st],V=0;V<Lt.length;V+=1){for(dt=!0,xt=0;xt<Lt[V].length;xt+=1)if(Lt[V][xt]!==void 0&&Lt[V][xt]!==Z.charCodeAt(xt)){dt=!1;break}if(dt===!0){lt=st;break}}return lt===e&&ct!==e&&(lt=ct),lt},s=function Z(ct){for(var V=this.internal.write,xt=this.internal.putStream,Lt=(0,this.internal.getFilters)();Lt.indexOf("FlateEncode")!==-1;)Lt.splice(Lt.indexOf("FlateEncode"),1);ct.objectId=this.internal.newObject();var dt=[];if(dt.push({key:"Type",value:"/XObject"}),dt.push({key:"Subtype",value:"/Image"}),dt.push({key:"Width",value:ct.width}),dt.push({key:"Height",value:ct.height}),ct.colorSpace===L.INDEXED?dt.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(ct.palette.length/3-1)+" "+("sMask"in ct&&ct.sMask!==void 0?ct.objectId+2:ct.objectId+1)+" 0 R]"}):(dt.push({key:"ColorSpace",value:"/"+ct.colorSpace}),ct.colorSpace===L.DEVICE_CMYK&&dt.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),dt.push({key:"BitsPerComponent",value:ct.bitsPerComponent}),"decodeParameters"in ct&&ct.decodeParameters!==void 0&&dt.push({key:"DecodeParms",value:"<<"+ct.decodeParameters+">>"}),"transparency"in ct&&Array.isArray(ct.transparency)&&ct.transparency.length>0){for(var st="",lt=0,zt=ct.transparency.length;lt<zt;lt++)st+=ct.transparency[lt]+" "+ct.transparency[lt]+" ";dt.push({key:"Mask",value:"["+st+"]"})}ct.sMask!==void 0&&dt.push({key:"SMask",value:ct.objectId+1+" 0 R"});var At=ct.filter!==void 0?["/"+ct.filter]:void 0;if(xt({data:ct.data,additionalKeyValues:dt,alreadyAppliedFilters:At,objectId:ct.objectId}),V("endobj"),"sMask"in ct&&ct.sMask!==void 0){var K,P=(K=ct.sMaskBitsPerComponent)!==null&&K!==void 0?K:ct.bitsPerComponent,X={width:ct.width,height:ct.height,colorSpace:"DeviceGray",bitsPerComponent:P,data:ct.sMask};"filter"in ct&&(X.decodeParameters="/Predictor ".concat(ct.predictor," /Colors 1 /BitsPerComponent ").concat(P," /Columns ").concat(ct.width),X.filter=ct.filter),Z.call(this,X)}if(ct.colorSpace===L.INDEXED){var tt=this.internal.newObject();xt({data:bt(new Uint8Array(ct.palette)),objectId:tt}),V("endobj")}},l=function(){var Z=this.internal.collections[t+"images"];for(var ct in Z)s.call(this,Z[ct])},c=function(){var Z,ct=this.internal.collections[t+"images"],V=this.internal.write;for(var xt in ct)V("/I"+(Z=ct[xt]).index,Z.objectId,"0","R")},f=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",l),this.internal.events.subscribe("putXobjectDict",c))},d=function(){var Z=this.internal.collections[t+"images"];return f.call(this),Z},p=function(){return Object.keys(this.internal.collections[t+"images"]).length},g=function(Z){return typeof n["process"+Z.toUpperCase()]=="function"},b=function(Z){return Hr(Z)==="object"&&Z.nodeType===1},y=function(Z,ct){if(Z.nodeName==="IMG"&&Z.hasAttribute("src")){var V=""+Z.getAttribute("src");if(V.indexOf("data:image/")===0)return Jm(unescape(V).split("base64,").pop());var xt=n.loadFile(V,!0);if(xt!==void 0)return xt}if(Z.nodeName==="CANVAS"){if(Z.width===0||Z.height===0)throw new Error("Given canvas must have data. Canvas width: "+Z.width+", height: "+Z.height);var Lt;switch(ct){case"PNG":Lt="image/png";break;case"WEBP":Lt="image/webp";break;default:Lt="image/jpeg"}return Jm(Z.toDataURL(Lt,1).split("base64,").pop())}},M=function(Z){var ct=this.internal.collections[t+"images"];if(ct){for(var V in ct)if(Z===ct[V].alias)return ct[V]}},C=function(Z,ct,V){return Z||ct||(Z=-96,ct=-96),Z<0&&(Z=-1*V.width*72/Z/this.internal.scaleFactor),ct<0&&(ct=-1*V.height*72/ct/this.internal.scaleFactor),Z===0&&(Z=ct*V.width/V.height),ct===0&&(ct=Z*V.height/V.width),[Z,ct]},D=function(Z,ct,V,xt,Lt,dt){var st=C.call(this,V,xt,Lt),lt=this.internal.getCoordinateString,zt=this.internal.getVerticalCoordinateString,At=d.call(this);if(V=st[0],xt=st[1],At[Lt.index]=Lt,dt){dt*=Math.PI/180;var K=Math.cos(dt),P=Math.sin(dt),X=function(gt){return gt.toFixed(4)},tt=[X(K),X(P),X(-1*P),X(K),0,0,"cm"]}this.internal.write("q"),dt?(this.internal.write([1,"0","0",1,lt(Z),zt(ct+xt),"cm"].join(" ")),this.internal.write(tt.join(" ")),this.internal.write([lt(V),"0","0",lt(xt),"0","0","cm"].join(" "))):this.internal.write([lt(V),"0","0",lt(xt),lt(Z),zt(ct+xt),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+Lt.index+" Do"),this.internal.write("Q")},L=n.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};n.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var H=n.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},Y=n.__addimage__.sHashCode=function(Z){var ct,V,xt=0;if(typeof Z=="string")for(V=Z.length,ct=0;ct<V;ct++)xt=(xt<<5)-xt+Z.charCodeAt(ct),xt|=0;else if(_t(Z))for(V=Z.byteLength/2,ct=0;ct<V;ct++)xt=(xt<<5)-xt+Z[ct],xt|=0;return xt},W=n.__addimage__.validateStringAsBase64=function(Z){(Z=Z||"").toString().trim();var ct=!0;return Z.length===0&&(ct=!1),Z.length%4!=0&&(ct=!1),/^[A-Za-z0-9+/]+$/.test(Z.substr(0,Z.length-2))===!1&&(ct=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(Z.substr(-2))===!1&&(ct=!1),ct},St=n.__addimage__.extractImageFromDataUrl=function(Z){if(Z==null||!(Z=Z.trim()).startsWith("data:"))return null;var ct=Z.indexOf(",");return ct<0?null:Z.substring(0,ct).trim().endsWith("base64")?Z.substring(ct+1):null};n.__addimage__.isArrayBuffer=function(Z){return Z instanceof ArrayBuffer};var _t=n.__addimage__.isArrayBufferView=function(Z){return Z instanceof Int8Array||Z instanceof Uint8Array||Z instanceof Uint8ClampedArray||Z instanceof Int16Array||Z instanceof Uint16Array||Z instanceof Int32Array||Z instanceof Uint32Array||Z instanceof Float32Array||Z instanceof Float64Array},Ct=n.__addimage__.binaryStringToUint8Array=function(Z){for(var ct=Z.length,V=new Uint8Array(ct),xt=0;xt<ct;xt++)V[xt]=Z.charCodeAt(xt);return V},bt=n.__addimage__.arrayBufferToBinaryString=function(Z){for(var ct="",V=_t(Z)?Z:new Uint8Array(Z),xt=0;xt<V.length;xt+=8192)ct+=String.fromCharCode.apply(null,V.subarray(xt,xt+8192));return ct};n.addImage=function(){var Z,ct,V,xt,Lt,dt,st,lt,zt;if(typeof arguments[1]=="number"?(ct=e,V=arguments[1],xt=arguments[2],Lt=arguments[3],dt=arguments[4],st=arguments[5],lt=arguments[6],zt=arguments[7]):(ct=arguments[1],V=arguments[2],xt=arguments[3],Lt=arguments[4],dt=arguments[5],st=arguments[6],lt=arguments[7],zt=arguments[8]),Hr(Z=arguments[0])==="object"&&!b(Z)&&"imageData"in Z){var At=Z;Z=At.imageData,ct=At.format||ct||e,V=At.x||V||0,xt=At.y||xt||0,Lt=At.w||At.width||Lt,dt=At.h||At.height||dt,st=At.alias||st,lt=At.compression||lt,zt=At.rotation||At.angle||zt}var K=this.internal.getFilters();if(lt===void 0&&K.indexOf("FlateEncode")!==-1&&(lt="SLOW"),isNaN(V)||isNaN(xt))throw new Error("Invalid coordinates passed to jsPDF.addImage");f.call(this);var P=ot.call(this,Z,ct,st,lt);return D.call(this,V,xt,Lt,dt,P,zt),this};var ot=function(Z,ct,V,xt){var Lt,dt,st;if(typeof Z=="string"&&i(Z)===e){Z=unescape(Z);var lt=jt(Z,!1);(lt!==""||(lt=n.loadFile(Z,!0))!==void 0)&&(Z=lt)}if(b(Z)&&(Z=y(Z,ct)),ct=i(Z,ct),!g(ct))throw new Error("addImage does not support files of type '"+ct+"', please ensure that a plugin for '"+ct+"' support is added.");if(((st=V)==null||st.length===0)&&(V=(function(zt){return typeof zt=="string"||_t(zt)?Y(zt):_t(zt.data)?Y(zt.data):null})(Z)),(Lt=M.call(this,V))||(Z instanceof Uint8Array||ct==="RGBA"||(dt=Z,Z=Ct(Z)),Lt=this["process"+ct.toUpperCase()](Z,p.call(this),V,(function(zt){return zt&&typeof zt=="string"&&(zt=zt.toUpperCase()),zt in n.image_compression?zt:H.NONE})(xt),dt)),!Lt)throw new Error("An unknown error occurred whilst processing the image.");return Lt},jt=n.__addimage__.convertBase64ToBinaryString=function(Z,ct){ct=typeof ct!="boolean"||ct;var V,xt="";if(typeof Z=="string"){var Lt;V=(Lt=St(Z))!==null&&Lt!==void 0?Lt:Z;try{xt=Jm(V)}catch(dt){if(ct)throw W(V)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+dt.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return xt};n.getImageProperties=function(Z){var ct,V,xt="";if(b(Z)&&(Z=y(Z)),typeof Z=="string"&&i(Z)===e&&((xt=jt(Z,!1))===""&&(xt=n.loadFile(Z)||""),Z=xt),V=i(Z),!g(V))throw new Error("addImage does not support files of type '"+V+"', please ensure that a plugin for '"+V+"' support is added.");if(Z instanceof Uint8Array||(Z=Ct(Z)),!(ct=this["process"+V.toUpperCase()](Z)))throw new Error("An unknown error occurred whilst processing the image");return ct.fileType=V,ct}})(xn.API),(function(n){var t=function(e){if(e!==void 0&&e!="")return!0};xn.API.events.push(["addPage",function(e){this.internal.getPageInfo(e.pageNumber).pageContext.annotations=[]}]),n.events.push(["putPage",function(e){for(var r,i,s,l=this.internal.getCoordinateString,c=this.internal.getVerticalCoordinateString,f=this.internal.getPageInfoByObjId(e.objId),d=e.pageContext.annotations,p=!1,g=0;g<d.length&&!p;g++)switch((r=d[g]).type){case"link":(t(r.options.url)||t(r.options.pageNumber))&&(p=!0);break;case"reference":case"text":case"freetext":p=!0}if(p!=0){this.internal.write("/Annots [");for(var b=0;b<d.length;b++){r=d[b];var y=this.internal.pdfEscape,M=this.internal.getEncryptor(e.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var C=this.internal.newAdditionalObject(),D=this.internal.newAdditionalObject(),L=this.internal.getEncryptor(C.objId),H=r.title||"Note";s="<</Type /Annot /Subtype /Text "+(i="/Rect ["+l(r.bounds.x)+" "+c(r.bounds.y+r.bounds.h)+" "+l(r.bounds.x+r.bounds.w)+" "+c(r.bounds.y)+"] ")+"/Contents ("+y(L(r.contents))+")",s+=" /Popup "+D.objId+" 0 R",s+=" /P "+f.objId+" 0 R",s+=" /T ("+y(L(H))+") >>",C.content=s;var Y=C.objId+" 0 R";s="<</Type /Annot /Subtype /Popup "+(i="/Rect ["+l(r.bounds.x+30)+" "+c(r.bounds.y+r.bounds.h)+" "+l(r.bounds.x+r.bounds.w+30)+" "+c(r.bounds.y)+"] ")+" /Parent "+Y,r.open&&(s+=" /Open true"),s+=" >>",D.content=s,this.internal.write(C.objId,"0 R",D.objId,"0 R");break;case"freetext":i="/Rect ["+l(r.bounds.x)+" "+c(r.bounds.y)+" "+l(r.bounds.x+r.bounds.w)+" "+c(r.bounds.y+r.bounds.h)+"] ";var W="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(r.color||"#000000");s="<</Type /Annot /Subtype /FreeText "+i+"/Contents ("+y(M(r.contents))+")",s+=" /DS("+y(M(W))+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(r.options.name){var St=this.annotations._nameMap[r.options.name];r.options.pageNumber=St.page,r.options.top=St.y}else r.options.top||(r.options.top=0);if(i="/Rect ["+r.finalBounds.x+" "+r.finalBounds.y+" "+r.finalBounds.w+" "+r.finalBounds.h+"] ",s="",r.options.url)s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /A <</S /URI /URI ("+y(M(r.options.url))+") >>";else if(r.options.pageNumber)switch(s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(r.options.pageNumber).objId+" 0 R",r.options.magFactor=r.options.magFactor||"XYZ",r.options.magFactor){case"Fit":s+=" /Fit]";break;case"FitH":s+=" /FitH "+r.options.top+"]";break;case"FitV":r.options.left=r.options.left||0,s+=" /FitV "+r.options.left+"]";break;default:var _t=c(r.options.top);r.options.left=r.options.left||0,r.options.zoom===void 0&&(r.options.zoom=0),s+=" /XYZ "+r.options.left+" "+_t+" "+r.options.zoom+"]"}s!=""&&(s+=" >>",this.internal.write(s))}}this.internal.write("]")}}]),n.createAnnotation=function(e){var r=this.internal.getCurrentPageInfo();switch(e.type){case"link":this.link(e.bounds.x,e.bounds.y,e.bounds.w,e.bounds.h,e);break;case"text":case"freetext":r.pageContext.annotations.push(e)}},n.link=function(e,r,i,s,l){var c=this.internal.getCurrentPageInfo(),f=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;c.pageContext.annotations.push({finalBounds:{x:f(e),y:d(r),w:f(e+i),h:d(r+s)},options:l,type:"link"})},n.textWithLink=function(e,r,i,s){var l,c,f=this.getTextWidth(e),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){c=s.maxWidth;var p=this.splitTextToSize(e,c).length;l=Math.ceil(d*p)}else c=f,l=d;return this.text(e,r,i,s),i+=.2*d,s.align==="center"&&(r-=f/2),s.align==="right"&&(r-=f),this.link(r,i-d,c,l,s),f},n.getTextWidth=function(e){var r=this.internal.getFontSize();return this.getStringUnitWidth(e)*r/this.internal.scaleFactor}})(xn.API),(function(n){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},e={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},r={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},i=[1570,1571,1573,1575];n.__arabicParser__={};var s=n.__arabicParser__.isInArabicSubstitutionA=function(C){return t[C.charCodeAt(0)]!==void 0},l=n.__arabicParser__.isArabicLetter=function(C){return typeof C=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(C)},c=n.__arabicParser__.isArabicEndLetter=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length<=2},f=n.__arabicParser__.isArabicAlfLetter=function(C){return l(C)&&i.indexOf(C.charCodeAt(0))>=0};n.__arabicParser__.arabicLetterHasIsolatedForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length>=1};var d=n.__arabicParser__.arabicLetterHasFinalForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length>=2};n.__arabicParser__.arabicLetterHasInitialForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length>=3};var p=n.__arabicParser__.arabicLetterHasMedialForm=function(C){return l(C)&&s(C)&&t[C.charCodeAt(0)].length==4},g=n.__arabicParser__.resolveLigatures=function(C){var D=0,L=e,H="",Y=0;for(D=0;D<C.length;D+=1)L[C.charCodeAt(D)]!==void 0?(Y++,typeof(L=L[C.charCodeAt(D)])=="number"&&(H+=String.fromCharCode(L),L=e,Y=0),D===C.length-1&&(L=e,H+=C.charAt(D-(Y-1)),D-=Y-1,Y=0)):(L=e,H+=C.charAt(D-Y),D-=Y,Y=0);return H};n.__arabicParser__.isArabicDiacritic=function(C){return C!==void 0&&r[C.charCodeAt(0)]!==void 0};var b=n.__arabicParser__.getCorrectForm=function(C,D,L){return l(C)?s(C)===!1?-1:!d(C)||!l(D)&&!l(L)||!l(L)&&c(D)||c(C)&&!l(D)||c(C)&&f(D)||c(C)&&c(D)?0:p(C)&&l(D)&&!c(D)&&l(L)&&d(L)?3:c(C)||!l(L)?1:2:-1},y=function(C){var D=0,L=0,H=0,Y="",W="",St="",_t=(C=C||"").split("\\s+"),Ct=[];for(D=0;D<_t.length;D+=1){for(Ct.push(""),L=0;L<_t[D].length;L+=1)Y=_t[D][L],W=_t[D][L-1],St=_t[D][L+1],l(Y)?(H=b(Y,W,St),Ct[D]+=H!==-1?String.fromCharCode(t[Y.charCodeAt(0)][H]):Y):Ct[D]+=Y;Ct[D]=g(Ct[D])}return Ct.join(" ")},M=n.__arabicParser__.processArabic=n.processArabic=function(){var C,D=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,L=[];if(Array.isArray(D)){var H=0;for(L=[],H=0;H<D.length;H+=1)Array.isArray(D[H])?L.push([y(D[H][0]),D[H][1],D[H][2]]):L.push([y(D[H])]);C=L}else C=y(D);return typeof arguments[0]=="string"?C:(arguments[0].text=C,arguments[0])};n.events.push(["preProcessText",M])})(xn.API),xn.API.autoPrint=function(n){var t;return(n=n||{}).variant=n.variant||"non-conform",n.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+t+" 0 R")})),this},(function(n){var t=function(){var e=void 0;Object.defineProperty(this,"pdf",{get:function(){return e},set:function(c){e=c}});var r=150;Object.defineProperty(this,"width",{get:function(){return r},set:function(c){r=isNaN(c)||Number.isInteger(c)===!1||c<0?150:c,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=r+1)}});var i=300;Object.defineProperty(this,"height",{get:function(){return i},set:function(c){i=isNaN(c)||Number.isInteger(c)===!1||c<0?300:c,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=i+1)}});var s=[];Object.defineProperty(this,"childNodes",{get:function(){return s},set:function(c){s=c}});var l={};Object.defineProperty(this,"style",{get:function(){return l},set:function(c){l=c}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(e,r){var i;if((e=e||"2d")!=="2d")return null;for(i in r)this.pdf.context2d.hasOwnProperty(i)&&(this.pdf.context2d[i]=r[i]);return this.pdf.context2d._canvas=this,this.pdf.context2d},t.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},n.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])})(xn.API),(function(n){var t={left:0,top:0,bottom:0,right:0},e=!1,r=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),i.call(this))},i=function(){this.internal.__cell__.lastCell=new s,this.internal.__cell__.pages=1},s=function(){var f=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return f},set:function(C){f=C}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(C){d=C}});var p=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return p},set:function(C){p=C}});var g=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return g},set:function(C){g=C}});var b=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return b},set:function(C){b=C}});var y=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return y},set:function(C){y=C}});var M=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return M},set:function(C){M=C}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},n.setHeaderFunction=function(f){return r.call(this),this.internal.__cell__.headerFunction=typeof f=="function"?f:void 0,this},n.getTextDimensions=function(f,d){r.call(this);var p=(d=d||{}).fontSize||this.getFontSize(),g=d.font||this.getFont(),b=d.scaleFactor||this.internal.scaleFactor,y=0,M=0,C=0,D=this;if(!Array.isArray(f)&&typeof f!="string"){if(typeof f!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");f=String(f)}var L=d.maxWidth;L>0?typeof f=="string"?f=this.splitTextToSize(f,L):Object.prototype.toString.call(f)==="[object Array]"&&(f=f.reduce(function(Y,W){return Y.concat(D.splitTextToSize(W,L))},[])):f=Array.isArray(f)?f:[f];for(var H=0;H<f.length;H++)y<(C=this.getStringUnitWidth(f[H],{font:g})*p)&&(y=C);return y!==0&&(M=f.length),{w:y/=b,h:Math.max((M*p*this.getLineHeightFactor()-p*(this.getLineHeightFactor()-1))/b,0)}},n.cellAddPage=function(){r.call(this),this.addPage();var f=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new s(f.left,f.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var l=n.cell=function(){var f;f=arguments[0]instanceof s?arguments[0]:new s(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),r.call(this);var d=this.internal.__cell__.lastCell,p=this.internal.__cell__.padding,g=this.internal.__cell__.margins||t,b=this.internal.__cell__.tableHeaderRow,y=this.internal.__cell__.printHeaders;return d.lineNumber!==void 0&&(d.lineNumber===f.lineNumber?(f.x=(d.x||0)+(d.width||0),f.y=d.y||0):d.y+d.height+f.height+g.bottom>this.getPageHeight()?(this.cellAddPage(),f.y=g.top,y&&b&&(this.printHeaderRow(f.lineNumber,!0),f.y+=b[0].height)):f.y=d.y+d.height||f.y),f.text[0]!==void 0&&(this.rect(f.x,f.y,f.width,f.height,e===!0?"FD":void 0),f.align==="right"?this.text(f.text,f.x+f.width-p,f.y+p,{align:"right",baseline:"top"}):f.align==="center"?this.text(f.text,f.x+f.width/2,f.y+p,{align:"center",baseline:"top",maxWidth:f.width-p-p}):this.text(f.text,f.x+p,f.y+p,{align:"left",baseline:"top",maxWidth:f.width-p-p})),this.internal.__cell__.lastCell=f,this};n.table=function(f,d,p,g,b){if(r.call(this),!p)throw new Error("No data for PDF table.");var y,M,C,D,L=[],H=[],Y=[],W={},St={},_t=[],Ct=[],bt=(b=b||{}).autoSize||!1,ot=b.printHeaders!==!1,jt=b.css&&b.css["font-size"]!==void 0?16*b.css["font-size"]:b.fontSize||12,Z=b.margins||Object.assign({width:this.getPageWidth()},t),ct=typeof b.padding=="number"?b.padding:3,V=b.headerBackgroundColor||"#c8c8c8",xt=b.headerTextColor||"#000";if(i.call(this),this.internal.__cell__.printHeaders=ot,this.internal.__cell__.margins=Z,this.internal.__cell__.table_font_size=jt,this.internal.__cell__.padding=ct,this.internal.__cell__.headerBackgroundColor=V,this.internal.__cell__.headerTextColor=xt,this.setFontSize(jt),g==null)H=L=Object.keys(p[0]),Y=L.map(function(){return"left"});else if(Array.isArray(g)&&Hr(g[0])==="object")for(L=g.map(function(At){return At.name}),H=g.map(function(At){return At.prompt||At.name||""}),Y=g.map(function(At){return At.align||"left"}),y=0;y<g.length;y+=1)St[g[y].name]=.7499990551181103*g[y].width;else Array.isArray(g)&&typeof g[0]=="string"&&(H=L=g,Y=L.map(function(){return"left"}));if(bt||Array.isArray(g)&&typeof g[0]=="string")for(y=0;y<L.length;y+=1){for(W[D=L[y]]=p.map(function(At){return At[D]}),this.setFont(void 0,"bold"),_t.push(this.getTextDimensions(H[y],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),M=W[D],this.setFont(void 0,"normal"),C=0;C<M.length;C+=1)_t.push(this.getTextDimensions(M[C],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);St[D]=Math.max.apply(null,_t)+ct+ct,_t=[]}if(ot){var Lt={};for(y=0;y<L.length;y+=1)Lt[L[y]]={},Lt[L[y]].text=H[y],Lt[L[y]].align=Y[y];var dt=c.call(this,Lt,St);Ct=L.map(function(At){return new s(f,d,St[At],dt,Lt[At].text,void 0,Lt[At].align)}),this.setTableHeaderRow(Ct),this.printHeaderRow(1,!1)}var st=g.reduce(function(At,K){return At[K.name]=K.align,At},{});for(y=0;y<p.length;y+=1){"rowStart"in b&&b.rowStart instanceof Function&&b.rowStart({row:y,data:p[y]},this);var lt=c.call(this,p[y],St);for(C=0;C<L.length;C+=1){var zt=p[y][L[C]];"cellStart"in b&&b.cellStart instanceof Function&&b.cellStart({row:y,col:C,data:zt},this),l.call(this,new s(f,d,St[L[C]],lt,zt,y+2,st[L[C]]))}}return this.internal.__cell__.table_x=f,this.internal.__cell__.table_y=d,this};var c=function(f,d){var p=this.internal.__cell__.padding,g=this.internal.__cell__.table_font_size,b=this.internal.scaleFactor;return Object.keys(f).map(function(y){var M=f[y];return this.splitTextToSize(M.hasOwnProperty("text")?M.text:M,d[y]-p-p)},this).map(function(y){return this.getLineHeightFactor()*y.length*g/b+p+p},this).reduce(function(y,M){return Math.max(y,M)},0)};n.setTableHeaderRow=function(f){r.call(this),this.internal.__cell__.tableHeaderRow=f},n.printHeaderRow=function(f,d){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var p;if(e=!0,typeof this.internal.__cell__.headerFunction=="function"){var g=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(g[0],g[1],g[2],g[3],void 0,-1)}this.setFont(void 0,"bold");for(var b=[],y=0;y<this.internal.__cell__.tableHeaderRow.length;y+=1){p=this.internal.__cell__.tableHeaderRow[y].clone(),d&&(p.y=this.internal.__cell__.margins.top||0,b.push(p)),p.lineNumber=f;var M=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),l.call(this,p),this.setTextColor(M)}b.length>0&&this.setTableHeaderRow(b),this.setFont(void 0,"normal"),e=!1}})(xn.API);var l4={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},c4=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],c2=a4(c4),u4=[100,200,300,400,500,600,700,800,900],CN=a4(u4);function ry(n){var t=n.family.replace(/"|'/g,"").toLowerCase(),e=(function(s){return l4[s=s||"normal"]?s:"normal"})(n.style),r=(function(s){return s?typeof s=="number"?s>=100&&s<=900&&s%100==0?s:400:/^\d00$/.test(s)?parseInt(s):s==="bold"?700:400:400})(n.weight),i=(function(s){return typeof c2[s=s||"normal"]=="number"?s:"normal"})(n.stretch);return{family:t,style:e,weight:r,stretch:i,src:n.src||[],ref:n.ref||{name:t,style:[i,e,r].join(" ")}}}function yw(n,t,e,r){var i;for(i=e;i>=0&&i<t.length;i+=r)if(n[t[i]])return n[t[i]];for(i=e;i>=0&&i<t.length;i-=r)if(n[t[i]])return n[t[i]]}var EN={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},bw={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function xw(n){return[n.stretch,n.style,n.weight,n.family].join(" ")}function vw(n){return n.trimLeft()}function TN(n,t){for(var e=0;e<n.length;){if(n.charAt(e)===t)return[n.substring(0,e),n.substring(e+1)];e+=1}return null}function NN(n){var t=n.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],n.substring(t[0].length)]}var Cd,Am,ww,Sw,kw,iy=["times"];function Aw(n,t,e,r,i){var s=4,l=Cw;switch(i){case xn.API.image_compression.FAST:s=1,l=Mw;break;case xn.API.image_compression.MEDIUM:s=6,l=Ew;break;case xn.API.image_compression.SLOW:s=9,l=Tw}n=(function(f,d,p,g){for(var b,y=f.length/d,M=new Uint8Array(f.length+y),C=[_N,Mw,Cw,Ew,Tw],D=0;D<y;D+=1){var L=D*d,H=f.subarray(L,L+d);if(g)M.set(g(H,p,b),L+D);else{for(var Y=C.length,W=[],St=0;St<Y;St+=1)W[St]=C[St](H,p,b);var _t=LN(W.concat());M.set(W[_t],L+D)}b=H}return M})(n,t,Math.ceil(e*r/8),l);var c=n2(n,{level:s});return xn.API.__addimage__.arrayBufferToBinaryString(c)}function _N(n){var t=Array.apply([],n);return t.unshift(0),t}function Mw(n,t){var e=n.length,r=[];r[0]=1;for(var i=0;i<e;i+=1){var s=n[i-t]||0;r[i+1]=n[i]-s+256&255}return r}function Cw(n,t,e){var r=n.length,i=[];i[0]=2;for(var s=0;s<r;s+=1){var l=e&&e[s]||0;i[s+1]=n[s]-l+256&255}return i}function Ew(n,t,e){var r=n.length,i=[];i[0]=3;for(var s=0;s<r;s+=1){var l=n[s-t]||0,c=e&&e[s]||0;i[s+1]=n[s]+256-(l+c>>>1)&255}return i}function Tw(n,t,e){var r=n.length,i=[];i[0]=4;for(var s=0;s<r;s+=1){var l=DN(n[s-t]||0,e&&e[s]||0,e&&e[s-t]||0);i[s+1]=n[s]-l+256&255}return i}function DN(n,t,e){if(n===t&&t===e)return n;var r=Math.abs(t-e),i=Math.abs(n-e),s=Math.abs(n+t-e-e);return r<=i&&r<=s?n:i<=s?t:e}function LN(n){var t=n.map(function(e){return e.reduce(function(r,i){return r+Math.abs(i)},0)});return t.indexOf(Math.min.apply(null,t))}function oy(n,t,e){var r=t*e,i=Math.floor(r/8),s=16-(r-8*i+e),l=(1<<e)-1;return f4(n,i)>>s&l}function Nw(n,t,e,r){var i=e*r,s=Math.floor(i/8),l=16-(i-8*s+r),c=(1<<r)-1,f=(t&c)<<l;(function(d,p,g){if(p+1<d.byteLength)d.setUint16(p,g,!1);else{var b=g>>8&255;d.setUint8(p,b)}})(n,s,f4(n,s)&~(c<<l)&65535|f)}function f4(n,t){return t+1<n.byteLength?n.getUint16(t,!1):n.getUint8(t)<<8}function RN(n){var t=0;if(n[t++]!==71||n[t++]!==73||n[t++]!==70||n[t++]!==56||(n[t++]+1&253)!=56||n[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var e=n[t++]|n[t++]<<8,r=n[t++]|n[t++]<<8,i=n[t++],s=i>>7,l=1<<1+(7&i);n[t++],n[t++];var c=null,f=null;s&&(c=t,f=l,t+=3*l);var d=!0,p=[],g=0,b=null,y=0,M=null;for(this.width=e,this.height=r;d&&t<n.length;)switch(n[t++]){case 33:switch(n[t++]){case 255:if(n[t]!==11||n[t+1]==78&&n[t+2]==69&&n[t+3]==84&&n[t+4]==83&&n[t+5]==67&&n[t+6]==65&&n[t+7]==80&&n[t+8]==69&&n[t+9]==50&&n[t+10]==46&&n[t+11]==48&&n[t+12]==3&&n[t+13]==1&&n[t+16]==0)t+=14,M=n[t++]|n[t++]<<8,t++;else for(t+=12;;){if(!((Z=n[t++])>=0))throw Error("Invalid block size");if(Z===0)break;t+=Z}break;case 249:if(n[t++]!==4||n[t+4]!==0)throw new Error("Invalid graphics extension block.");var C=n[t++];g=n[t++]|n[t++]<<8,b=n[t++],1&C||(b=null),y=C>>2&7,t++;break;case 254:for(;;){if(!((Z=n[t++])>=0))throw Error("Invalid block size");if(Z===0)break;t+=Z}break;default:throw new Error("Unknown graphic control label: 0x"+n[t-1].toString(16))}break;case 44:var D=n[t++]|n[t++]<<8,L=n[t++]|n[t++]<<8,H=n[t++]|n[t++]<<8,Y=n[t++]|n[t++]<<8,W=n[t++],St=W>>6&1,_t=1<<1+(7&W),Ct=c,bt=f,ot=!1;W>>7&&(ot=!0,Ct=t,bt=_t,t+=3*_t);var jt=t;for(t++;;){var Z;if(!((Z=n[t++])>=0))throw Error("Invalid block size");if(Z===0)break;t+=Z}p.push({x:D,y:L,width:H,height:Y,has_local_palette:ot,palette_offset:Ct,palette_size:bt,data_offset:jt,data_length:t-jt,transparent_index:b,interlaced:!!St,delay:g,disposal:y});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+n[t-1].toString(16))}this.numFrames=function(){return p.length},this.loopCount=function(){return M},this.frameInfo=function(ct){if(ct<0||ct>=p.length)throw new Error("Frame index out of range.");return p[ct]},this.decodeAndBlitFrameBGRA=function(ct,V){var xt=this.frameInfo(ct),Lt=xt.width*xt.height;if(Lt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var dt=new Uint8Array(Lt);_w(n,xt.data_offset,dt,Lt);var st=xt.palette_offset,lt=xt.transparent_index;lt===null&&(lt=256);var zt=xt.width,At=e-zt,K=zt,P=4*(xt.y*e+xt.x),X=4*((xt.y+xt.height)*e+xt.x),tt=P,gt=4*At;xt.interlaced===!0&&(gt+=4*e*7);for(var vt=8,kt=0,qt=dt.length;kt<qt;++kt){var Rt=dt[kt];if(K===0&&(K=zt,(tt+=gt)>=X&&(gt=4*At+4*e*(vt-1),tt=P+(zt+At)*(vt<<1),vt>>=1)),Rt===lt)tt+=4;else{var Zt=n[st+3*Rt],Ae=n[st+3*Rt+1],le=n[st+3*Rt+2];V[tt++]=le,V[tt++]=Ae,V[tt++]=Zt,V[tt++]=255}--K}},this.decodeAndBlitFrameRGBA=function(ct,V){var xt=this.frameInfo(ct),Lt=xt.width*xt.height;if(Lt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var dt=new Uint8Array(Lt);_w(n,xt.data_offset,dt,Lt);var st=xt.palette_offset,lt=xt.transparent_index;lt===null&&(lt=256);var zt=xt.width,At=e-zt,K=zt,P=4*(xt.y*e+xt.x),X=4*((xt.y+xt.height)*e+xt.x),tt=P,gt=4*At;xt.interlaced===!0&&(gt+=4*e*7);for(var vt=8,kt=0,qt=dt.length;kt<qt;++kt){var Rt=dt[kt];if(K===0&&(K=zt,(tt+=gt)>=X&&(gt=4*At+4*e*(vt-1),tt=P+(zt+At)*(vt<<1),vt>>=1)),Rt===lt)tt+=4;else{var Zt=n[st+3*Rt],Ae=n[st+3*Rt+1],le=n[st+3*Rt+2];V[tt++]=Zt,V[tt++]=Ae,V[tt++]=le,V[tt++]=255}--K}}}function _w(n,t,e,r){for(var i=n[t++],s=1<<i,l=s+1,c=l+1,f=i+1,d=(1<<f)-1,p=0,g=0,b=0,y=n[t++],M=new Int32Array(4096),C=null;;){for(;p<16&&y!==0;)g|=n[t++]<<p,p+=8,y===1?y=n[t++]:--y;if(p<f)break;var D=g&d;if(g>>=f,p-=f,D!==s){if(D===l)break;for(var L=D<c?D:C,H=0,Y=L;Y>s;)Y=M[Y]>>8,++H;var W=Y;if(b+H+(L!==D?1:0)>r)return void ai.log("Warning, gif stream longer than expected.");e[b++]=W;var St=b+=H;for(L!==D&&(e[b++]=W),Y=L;H--;)Y=M[Y],e[--St]=255&Y,Y>>=8;C!==null&&c<4096&&(M[c++]=C<<8|W,c>=d+1&&f<12&&(++f,d=d<<1|1)),C=D}else c=l+1,d=(1<<(f=i+1))-1,C=null}return b!==r&&ai.log("Warning, gif stream shorter than expected."),e}function sy(n){var t,e,r,i,s,l=Math.floor,c=new Array(64),f=new Array(64),d=new Array(64),p=new Array(64),g=new Array(65535),b=new Array(65535),y=new Array(64),M=new Array(64),C=[],D=0,L=7,H=new Array(64),Y=new Array(64),W=new Array(64),St=new Array(256),_t=new Array(2048),Ct=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],bt=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],ot=[0,1,2,3,4,5,6,7,8,9,10,11],jt=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],Z=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],ct=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],xt=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Lt=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function dt(P,X){for(var tt=0,gt=0,vt=new Array,kt=1;kt<=16;kt++){for(var qt=1;qt<=P[kt];qt++)vt[X[gt]]=[],vt[X[gt]][0]=tt,vt[X[gt]][1]=kt,gt++,tt++;tt*=2}return vt}function st(P){for(var X=P[0],tt=P[1]-1;tt>=0;)X&1<<tt&&(D|=1<<L),tt--,--L<0&&(D==255?(lt(255),lt(0)):lt(D),L=7,D=0)}function lt(P){C.push(P)}function zt(P){lt(P>>8&255),lt(255&P)}function At(P,X,tt,gt,vt){for(var kt,qt=vt[0],Rt=vt[240],Zt=(function(be,_e){var Te,Le,Ye,hn,Pn,wn,Nn,Sn,Be,tn,je=0;for(Be=0;Be<8;++Be){Te=be[je],Le=be[je+1],Ye=be[je+2],hn=be[je+3],Pn=be[je+4],wn=be[je+5],Nn=be[je+6];var ur=Te+(Sn=be[je+7]),bn=Te-Sn,cn=Le+Nn,pn=Le-Nn,$n=Ye+wn,en=Ye-wn,Qt=hn+Pn,ve=hn-Pn,me=ur+Qt,We=ur-Qt,He=cn+$n,Pe=cn-$n;be[je]=me+He,be[je+4]=me-He;var Vn=.707106781*(Pe+We);be[je+2]=We+Vn,be[je+6]=We-Vn;var Xo=.382683433*((me=ve+en)-(Pe=pn+bn)),ui=.5411961*me+Xo,Hi=1.306562965*Pe+Xo,Go=.707106781*(He=en+pn),Je=bn+Go,Ss=bn-Go;be[je+5]=Ss+ui,be[je+3]=Ss-ui,be[je+1]=Je+Hi,be[je+7]=Je-Hi,je+=8}for(je=0,Be=0;Be<8;++Be){Te=be[je],Le=be[je+8],Ye=be[je+16],hn=be[je+24],Pn=be[je+32],wn=be[je+40],Nn=be[je+48];var to=Te+(Sn=be[je+56]),Xt=Te-Sn,Ei=Le+Nn,Xn=Le-Nn,fi=Ye+wn,Ti=Ye-wn,Ko=hn+Pn,gi=hn-Pn,Ar=to+Ko,ir=to-Ko,Gn=Ei+fi,Jo=Ei-fi;be[je]=Ar+Gn,be[je+32]=Ar-Gn;var ks=.707106781*(Jo+ir);be[je+16]=ir+ks,be[je+48]=ir-ks;var Oa=.382683433*((Ar=gi+Ti)-(Jo=Xn+Xt)),Zo=.5411961*Ar+Oa,To=1.306562965*Jo+Oa,Ll=.707106781*(Gn=Ti+Xn),ca=Xt+Ll,As=Xt-Ll;be[je+40]=As+Zo,be[je+24]=As-Zo,be[je+8]=ca+To,be[je+56]=ca-To,je++}for(Be=0;Be<64;++Be)tn=be[Be]*_e[Be],y[Be]=tn>0?tn+.5|0:tn-.5|0;return y})(P,X),Ae=0;Ae<64;++Ae)M[Ct[Ae]]=Zt[Ae];var le=M[0]-tt;tt=M[0],le==0?st(gt[0]):(st(gt[b[kt=32767+le]]),st(g[kt]));for(var Ie=63;Ie>0&&M[Ie]==0;)Ie--;if(Ie==0)return st(qt),tt;for(var Ue,ft=1;ft<=Ie;){for(var Re=ft;M[ft]==0&&ft<=Ie;)++ft;var rn=ft-Re;if(rn>=16){Ue=rn>>4;for(var on=1;on<=Ue;++on)st(Rt);rn&=15}kt=32767+M[ft],st(vt[(rn<<4)+b[kt]]),st(g[kt]),ft++}return Ie!=63&&st(qt),tt}function K(P){P=Math.min(Math.max(P,1),100),s!=P&&((function(X){for(var tt=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],gt=0;gt<64;gt++){var vt=l((tt[gt]*X+50)/100);vt=Math.min(Math.max(vt,1),255),c[Ct[gt]]=vt}for(var kt=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],qt=0;qt<64;qt++){var Rt=l((kt[qt]*X+50)/100);Rt=Math.min(Math.max(Rt,1),255),f[Ct[qt]]=Rt}for(var Zt=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],Ae=0,le=0;le<8;le++)for(var Ie=0;Ie<8;Ie++)d[Ae]=1/(c[Ct[Ae]]*Zt[le]*Zt[Ie]*8),p[Ae]=1/(f[Ct[Ae]]*Zt[le]*Zt[Ie]*8),Ae++})(P<50?Math.floor(5e3/P):Math.floor(200-2*P)),s=P)}this.encode=function(P,X){X&&K(X),C=new Array,D=0,L=7,zt(65496),zt(65504),zt(16),lt(74),lt(70),lt(73),lt(70),lt(0),lt(1),lt(1),lt(0),zt(1),zt(1),lt(0),lt(0),(function(){zt(65499),zt(132),lt(0);for(var Le=0;Le<64;Le++)lt(c[Le]);lt(1);for(var Ye=0;Ye<64;Ye++)lt(f[Ye])})(),(function(Le,Ye){zt(65472),zt(17),lt(8),zt(Ye),zt(Le),lt(3),lt(1),lt(17),lt(0),lt(2),lt(17),lt(1),lt(3),lt(17),lt(1)})(P.width,P.height),(function(){zt(65476),zt(418),lt(0);for(var Le=0;Le<16;Le++)lt(bt[Le+1]);for(var Ye=0;Ye<=11;Ye++)lt(ot[Ye]);lt(16);for(var hn=0;hn<16;hn++)lt(jt[hn+1]);for(var Pn=0;Pn<=161;Pn++)lt(Z[Pn]);lt(1);for(var wn=0;wn<16;wn++)lt(ct[wn+1]);for(var Nn=0;Nn<=11;Nn++)lt(V[Nn]);lt(17);for(var Sn=0;Sn<16;Sn++)lt(xt[Sn+1]);for(var Be=0;Be<=161;Be++)lt(Lt[Be])})(),zt(65498),zt(12),lt(3),lt(1),lt(0),lt(2),lt(17),lt(3),lt(17),lt(0),lt(63),lt(0);var tt=0,gt=0,vt=0;D=0,L=7,this.encode.displayName="_encode_";for(var kt,qt,Rt,Zt,Ae,le,Ie,Ue,ft,Re=P.data,rn=P.width,on=P.height,be=4*rn,_e=0;_e<on;){for(kt=0;kt<be;){for(Ae=be*_e+kt,Ie=-1,Ue=0,ft=0;ft<64;ft++)le=Ae+(Ue=ft>>3)*be+(Ie=4*(7&ft)),_e+Ue>=on&&(le-=be*(_e+1+Ue-on)),kt+Ie>=be&&(le-=kt+Ie-be+4),qt=Re[le++],Rt=Re[le++],Zt=Re[le++],H[ft]=(_t[qt]+_t[Rt+256|0]+_t[Zt+512|0]>>16)-128,Y[ft]=(_t[qt+768|0]+_t[Rt+1024|0]+_t[Zt+1280|0]>>16)-128,W[ft]=(_t[qt+1280|0]+_t[Rt+1536|0]+_t[Zt+1792|0]>>16)-128;tt=At(H,d,tt,t,r),gt=At(Y,p,gt,e,i),vt=At(W,p,vt,e,i),kt+=32}_e+=8}if(L>=0){var Te=[];Te[1]=L+1,Te[0]=(1<<L+1)-1,st(Te)}return zt(65497),new Uint8Array(C)},n=n||50,(function(){for(var P=String.fromCharCode,X=0;X<256;X++)St[X]=P(X)})(),t=dt(bt,ot),e=dt(ct,V),r=dt(jt,Z),i=dt(xt,Lt),(function(){for(var P=1,X=2,tt=1;tt<=15;tt++){for(var gt=P;gt<X;gt++)b[32767+gt]=tt,g[32767+gt]=[],g[32767+gt][1]=tt,g[32767+gt][0]=gt;for(var vt=-(X-1);vt<=-P;vt++)b[32767+vt]=tt,g[32767+vt]=[],g[32767+vt][1]=tt,g[32767+vt][0]=X-1+vt;P<<=1,X<<=1}})(),(function(){for(var P=0;P<256;P++)_t[P]=19595*P,_t[P+256|0]=38470*P,_t[P+512|0]=7471*P+32768,_t[P+768|0]=-11059*P,_t[P+1024|0]=-21709*P,_t[P+1280|0]=32768*P+8421375,_t[P+1536|0]=-27439*P,_t[P+1792|0]=-5329*P})(),K(n)}function Zl(n,t){if(this.pos=0,this.buffer=n,this.datav=new DataView(n.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function Dw(n){function t(ot){if(!ot)throw Error("assert :P")}function e(ot,jt,Z){for(var ct=0;4>ct;ct++)if(ot[jt+ct]!=Z.charCodeAt(ct))return!0;return!1}function r(ot,jt,Z,ct,V){for(var xt=0;xt<V;xt++)ot[jt+xt]=Z[ct+xt]}function i(ot,jt,Z,ct){for(var V=0;V<ct;V++)ot[jt+V]=Z}function s(ot){return new Int32Array(ot)}function l(ot,jt){for(var Z=[],ct=0;ct<ot;ct++)Z.push(new jt);return Z}function c(ot,jt){var Z=[];return(function ct(V,xt,Lt){for(var dt=Lt[xt],st=0;st<dt&&(V.push(Lt.length>xt+1?[]:new jt),!(Lt.length<xt+1));st++)ct(V[st],xt+1,Lt)})(Z,0,ot),Z}var f=function(){var ot=this;function jt(m,v){for(var E=1<<v-1>>>0;m&E;)E>>>=1;return E?(m&E-1)+E:m}function Z(m,v,E,R,F){t(!(R%E));do m[v+(R-=E)]=F;while(0<R)}function ct(m,v,E,R,F){if(t(2328>=F),512>=F)var q=s(512);else if((q=s(F))==null)return 0;return(function($,Q,at,mt,Dt,Wt){var pt,Ot,Ht=Q,ie=1<<at,$t=s(16),re=s(16);for(t(Dt!=0),t(mt!=null),t($!=null),t(0<at),Ot=0;Ot<Dt;++Ot){if(15<mt[Ot])return 0;++$t[mt[Ot]]}if($t[0]==Dt)return 0;for(re[1]=0,pt=1;15>pt;++pt){if($t[pt]>1<<pt)return 0;re[pt+1]=re[pt]+$t[pt]}for(Ot=0;Ot<Dt;++Ot)pt=mt[Ot],0<mt[Ot]&&(Wt[re[pt]++]=Ot);if(re[15]==1)return(mt=new V).g=0,mt.value=Wt[0],Z($,Ht,1,ie,mt),ie;var ce,Se=-1,ge=ie-1,Ze=0,$e=1,Dn=1,nn=1<<at;for(Ot=0,pt=1,Dt=2;pt<=at;++pt,Dt<<=1){if($e+=Dn<<=1,0>(Dn-=$t[pt]))return 0;for(;0<$t[pt];--$t[pt])(mt=new V).g=pt,mt.value=Wt[Ot++],Z($,Ht+Ze,Dt,nn,mt),Ze=jt(Ze,pt)}for(pt=at+1,Dt=2;15>=pt;++pt,Dt<<=1){if($e+=Dn<<=1,0>(Dn-=$t[pt]))return 0;for(;0<$t[pt];--$t[pt]){if(mt=new V,(Ze&ge)!=Se){for(Ht+=nn,ce=1<<(Se=pt)-at;15>Se&&!(0>=(ce-=$t[Se]));)++Se,ce<<=1;ie+=nn=1<<(ce=Se-at),$[Q+(Se=Ze&ge)].g=ce+at,$[Q+Se].value=Ht-Q-Se}mt.g=pt-at,mt.value=Wt[Ot++],Z($,Ht+(Ze>>at),Dt,nn,mt),Ze=jt(Ze,pt)}}return $e!=2*re[15]-1?0:ie})(m,v,E,R,F,q)}function V(){this.value=this.g=0}function xt(){this.value=this.g=0}function Lt(){this.G=l(5,V),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=l(al,xt)}function dt(m,v,E,R){t(m!=null),t(v!=null),t(2147483648>R),m.Ca=254,m.I=0,m.b=-8,m.Ka=0,m.oa=v,m.pa=E,m.Jd=v,m.Yc=E+R,m.Zc=4<=R?E+R-4+1:E,qt(m)}function st(m,v){for(var E=0;0<v--;)E|=Zt(m,128)<<v;return E}function lt(m,v){var E=st(m,v);return Rt(m)?-E:E}function zt(m,v,E,R){var F,q=0;for(t(m!=null),t(v!=null),t(4294967288>R),m.Sb=R,m.Ra=0,m.u=0,m.h=0,4<R&&(R=4),F=0;F<R;++F)q+=v[E+F]<<8*F;m.Ra=q,m.bb=R,m.oa=v,m.pa=E}function At(m){for(;8<=m.u&&m.bb<m.Sb;)m.Ra>>>=8,m.Ra+=m.oa[m.pa+m.bb]<<_i-8>>>0,++m.bb,m.u-=8;gt(m)&&(m.h=1,m.u=0)}function K(m,v){if(t(0<=v),!m.h&&v<=ji){var E=tt(m)&xo[v];return m.u+=v,At(m),E}return m.h=1,m.u=0}function P(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function X(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function tt(m){return m.Ra>>>(m.u&_i-1)>>>0}function gt(m){return t(m.bb<=m.Sb),m.h||m.bb==m.Sb&&m.u>_i}function vt(m,v){m.u=v,m.h=gt(m)}function kt(m){m.u>=Qr&&(t(m.u>=Qr),At(m))}function qt(m){t(m!=null&&m.oa!=null),m.pa<m.Zc?(m.I=(m.oa[m.pa++]|m.I<<8)>>>0,m.b+=8):(t(m!=null&&m.oa!=null),m.pa<m.Yc?(m.b+=8,m.I=m.oa[m.pa++]|m.I<<8):m.Ka?m.b=0:(m.I<<=8,m.b+=8,m.Ka=1))}function Rt(m){return st(m,1)}function Zt(m,v){var E=m.Ca;0>m.b&&qt(m);var R=m.b,F=E*v>>>8,q=(m.I>>>R>F)+0;for(q?(E-=F,m.I-=F+1<<R>>>0):E=F+1,R=E,F=0;256<=R;)F+=8,R>>=8;return R=7^F+Fa[R],m.b-=R,m.Ca=(E<<R)-1,q}function Ae(m,v,E){m[v+0]=E>>24&255,m[v+1]=E>>16&255,m[v+2]=E>>8&255,m[v+3]=255&E}function le(m,v){return m[v+0]|m[v+1]<<8}function Ie(m,v){return le(m,v)|m[v+2]<<16}function Ue(m,v){return le(m,v)|le(m,v+2)<<16}function ft(m,v){var E=1<<v;return t(m!=null),t(0<v),m.X=s(E),m.X==null?0:(m.Mb=32-v,m.Xa=v,1)}function Re(m,v){t(m!=null),t(v!=null),t(m.Xa==v.Xa),r(v.X,0,m.X,0,1<<v.Xa)}function rn(){this.X=[],this.Xa=this.Mb=0}function on(m,v,E,R){t(E!=null),t(R!=null);var F=E[0],q=R[0];return F==0&&(F=(m*q+v/2)/v),q==0&&(q=(v*F+m/2)/m),0>=F||0>=q?0:(E[0]=F,R[0]=q,1)}function be(m,v){return m+(1<<v)-1>>>v}function _e(m,v){return((4278255360&m)+(4278255360&v)>>>0&4278255360)+((16711935&m)+(16711935&v)>>>0&16711935)>>>0}function Te(m,v){ot[v]=function(E,R,F,q,$,Q,at){var mt;for(mt=0;mt<$;++mt){var Dt=ot[m](Q[at+mt-1],F,q+mt);Q[at+mt]=_e(E[R+mt],Dt)}}}function Le(){this.ud=this.hd=this.jd=0}function Ye(m,v){return((4278124286&(m^v))>>>1)+(m&v)>>>0}function hn(m){return 0<=m&&256>m?m:0>m?0:255<m?255:void 0}function Pn(m,v){return hn(m+(m-v+.5>>1))}function wn(m,v,E){return Math.abs(v-E)-Math.abs(m-E)}function Nn(m,v,E,R,F,q,$){for(R=q[$-1],E=0;E<F;++E)q[$+E]=R=_e(m[v+E],R)}function Sn(m,v,E,R,F){var q;for(q=0;q<E;++q){var $=m[v+q],Q=$>>8&255,at=16711935&(at=(at=16711935&$)+((Q<<16)+Q));R[F+q]=(4278255360&$)+at>>>0}}function Be(m,v){v.jd=255&m,v.hd=m>>8&255,v.ud=m>>16&255}function tn(m,v,E,R,F,q){var $;for($=0;$<R;++$){var Q=v[E+$],at=Q>>>8,mt=Q,Dt=255&(Dt=(Dt=Q>>>16)+((m.jd<<24>>24)*(at<<24>>24)>>>5));mt=255&(mt=(mt+=(m.hd<<24>>24)*(at<<24>>24)>>>5)+((m.ud<<24>>24)*(Dt<<24>>24)>>>5)),F[q+$]=(4278255360&Q)+(Dt<<16)+mt}}function je(m,v,E,R,F){ot[v]=function(q,$,Q,at,mt,Dt,Wt,pt,Ot){for(at=Wt;at<pt;++at)for(Wt=0;Wt<Ot;++Wt)mt[Dt++]=F(Q[R(q[$++])])},ot[m]=function(q,$,Q,at,mt,Dt,Wt){var pt=8>>q.b,Ot=q.Ea,Ht=q.K[0],ie=q.w;if(8>pt)for(q=(1<<q.b)-1,ie=(1<<pt)-1;$<Q;++$){var $t,re=0;for($t=0;$t<Ot;++$t)$t&q||(re=R(at[mt++])),Dt[Wt++]=F(Ht[re&ie]),re>>=pt}else ot["VP8LMapColor"+E](at,mt,Ht,ie,Dt,Wt,$,Q,Ot)}}function ur(m,v,E,R,F){for(E=v+E;v<E;){var q=m[v++];R[F++]=q>>16&255,R[F++]=q>>8&255,R[F++]=255&q}}function bn(m,v,E,R,F){for(E=v+E;v<E;){var q=m[v++];R[F++]=q>>16&255,R[F++]=q>>8&255,R[F++]=255&q,R[F++]=q>>24&255}}function cn(m,v,E,R,F){for(E=v+E;v<E;){var q=($=m[v++])>>16&240|$>>12&15,$=240&$|$>>28&15;R[F++]=q,R[F++]=$}}function pn(m,v,E,R,F){for(E=v+E;v<E;){var q=($=m[v++])>>16&248|$>>13&7,$=$>>5&224|$>>3&31;R[F++]=q,R[F++]=$}}function $n(m,v,E,R,F){for(E=v+E;v<E;){var q=m[v++];R[F++]=255&q,R[F++]=q>>8&255,R[F++]=q>>16&255}}function en(m,v,E,R,F,q){if(q==0)for(E=v+E;v<E;)Ae(R,((q=m[v++])[0]>>24|q[1]>>8&65280|q[2]<<8&16711680|q[3]<<24)>>>0),F+=32;else r(R,F,m,v,E)}function Qt(m,v){ot[v][0]=ot[m+"0"],ot[v][1]=ot[m+"1"],ot[v][2]=ot[m+"2"],ot[v][3]=ot[m+"3"],ot[v][4]=ot[m+"4"],ot[v][5]=ot[m+"5"],ot[v][6]=ot[m+"6"],ot[v][7]=ot[m+"7"],ot[v][8]=ot[m+"8"],ot[v][9]=ot[m+"9"],ot[v][10]=ot[m+"10"],ot[v][11]=ot[m+"11"],ot[v][12]=ot[m+"12"],ot[v][13]=ot[m+"13"],ot[v][14]=ot[m+"0"],ot[v][15]=ot[m+"0"]}function ve(m){return m==Sc||m==Wc||m==ql||m==Yl}function me(){this.eb=[],this.size=this.A=this.fb=0}function We(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function He(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new me,this.f.kb=new We,this.sd=null}function Pe(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Vn(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function Xo(m){return alert("todo:WebPSamplerProcessPlane"),m.T}function ui(m,v){var E=m.T,R=v.ba.f.RGBA,F=R.eb,q=R.fb+m.ka*R.A,$=Bi[v.ba.S],Q=m.y,at=m.O,mt=m.f,Dt=m.N,Wt=m.ea,pt=m.W,Ot=v.cc,Ht=v.dc,ie=v.Mc,$t=v.Nc,re=m.ka,ce=m.ka+m.T,Se=m.U,ge=Se+1>>1;for(re==0?$(Q,at,null,null,mt,Dt,Wt,pt,mt,Dt,Wt,pt,F,q,null,null,Se):($(v.ec,v.fc,Q,at,Ot,Ht,ie,$t,mt,Dt,Wt,pt,F,q-R.A,F,q,Se),++E);re+2<ce;re+=2)Ot=mt,Ht=Dt,ie=Wt,$t=pt,Dt+=m.Rc,pt+=m.Rc,q+=2*R.A,$(Q,(at+=2*m.fa)-m.fa,Q,at,Ot,Ht,ie,$t,mt,Dt,Wt,pt,F,q-R.A,F,q,Se);return at+=m.fa,m.j+ce<m.o?(r(v.ec,v.fc,Q,at,Se),r(v.cc,v.dc,mt,Dt,ge),r(v.Mc,v.Nc,Wt,pt,ge),E--):1&ce||$(Q,at,null,null,mt,Dt,Wt,pt,mt,Dt,Wt,pt,F,q+R.A,null,null,Se),E}function Hi(m,v,E){var R=m.F,F=[m.J];if(R!=null){var q=m.U,$=v.ba.S,Q=$==wc||$==ql;v=v.ba.f.RGBA;var at=[0],mt=m.ka;at[0]=m.T,m.Kb&&(mt==0?--at[0]:(--mt,F[0]-=m.width),m.j+m.ka+m.T==m.o&&(at[0]=m.o-m.j-mt));var Dt=v.eb;mt=v.fb+mt*v.A,m=yc(R,F[0],m.width,q,at,Dt,mt+(Q?0:3),v.A),t(E==at),m&&ve($)&&fl(Dt,mt,Q,q,at,v.A)}return 0}function Go(m){var v=m.ma,E=v.ba.S,R=11>E,F=E==vo||E==ls||E==wc||E==Qs||E==12||ve(E);if(v.memory=null,v.Ib=null,v.Jb=null,v.Nd=null,!pi(v.Oa,m,F?11:12))return 0;if(F&&ve(E)&&Ws(),m.da)alert("todo:use_scaling");else{if(R){if(v.Ib=Xo,m.Kb){if(E=m.U+1>>1,v.memory=s(m.U+2*E),v.memory==null)return 0;v.ec=v.memory,v.fc=0,v.cc=v.ec,v.dc=v.fc+m.U,v.Mc=v.cc,v.Nc=v.dc+E,v.Ib=ui,Ws()}}else alert("todo:EmitYUV");F&&(v.Jb=Hi,R&&an())}if(R&&!pl){for(m=0;256>m;++m)Di[m]=89858*(m-128)+Wl>>Rs,ah[m]=-22014*(m-128)+Wl,_u[m]=-45773*(m-128),Mc[m]=113618*(m-128)+Wl>>Rs;for(m=Gi;m<Sa;++m)v=76283*(m-16)+Wl>>Rs,Cc[m-Gi]=eo(v,255),fd[m-Gi]=eo(v+8>>4,15);pl=1}return 1}function Je(m){var v=m.ma,E=m.U,R=m.T;return t(!(1&m.ka)),0>=E||0>=R?0:(E=v.Ib(m,v),v.Jb!=null&&v.Jb(m,v,E),v.Dc+=E,1)}function Ss(m){m.ma.memory=null}function to(m,v,E,R){return K(m,8)!=47?0:(v[0]=K(m,14)+1,E[0]=K(m,14)+1,R[0]=K(m,1),K(m,3)!=0?0:!m.h)}function Xt(m,v){if(4>m)return m+1;var E=m-2>>1;return(2+(1&m)<<E)+K(v,E)+1}function Ei(m,v){return 120<v?v-120:1<=(E=((E=cs[v-1])>>4)*m+(8-(15&E)))?E:1;var E}function Xn(m,v,E){var R=tt(E),F=m[v+=255&R].g-8;return 0<F&&(vt(E,E.u+8),R=tt(E),v+=m[v].value,v+=R&(1<<F)-1),vt(E,E.u+m[v].g),m[v].value}function fi(m,v,E){return E.g+=m.g,E.value+=m.value<<v>>>0,t(8>=E.g),m.g}function Ti(m,v,E){var R=m.xc;return t((v=R==0?0:m.vc[m.md*(E>>R)+(v>>R)])<m.Wb),m.Ya[v]}function Ko(m,v,E,R){var F=m.ab,q=m.c*v,$=m.C;v=$+v;var Q=E,at=R;for(R=m.Ta,E=m.Ua;0<F--;){var mt=m.gc[F],Dt=$,Wt=v,pt=Q,Ot=at,Ht=(at=R,Q=E,mt.Ea);switch(t(Dt<Wt),t(Wt<=mt.nc),mt.hc){case 2:Me(pt,Ot,(Wt-Dt)*Ht,at,Q);break;case 0:var ie=Dt,$t=Wt,re=at,ce=Q,Se=(nn=mt).Ea;ie==0&&(ga(pt,Ot,null,null,1,re,ce),Nn(pt,Ot+1,0,0,Se-1,re,ce+1),Ot+=Se,ce+=Se,++ie);for(var ge=1<<nn.b,Ze=ge-1,$e=be(Se,nn.b),Dn=nn.K,nn=nn.w+(ie>>nn.b)*$e;ie<$t;){var Jn=Dn,jr=nn,zn=1;for(ya(pt,Ot,re,ce-Se,1,re,ce);zn<Se;){var Ve=(zn&~Ze)+ge;Ve>Se&&(Ve=Se),(0,ro[Jn[jr++]>>8&15])(pt,Ot+ +zn,re,ce+zn-Se,Ve-zn,re,ce+zn),zn=Ve}Ot+=Se,ce+=Se,++ie&Ze||(nn+=$e)}Wt!=mt.nc&&r(at,Q-Ht,at,Q+(Wt-Dt-1)*Ht,Ht);break;case 1:for(Ht=pt,$t=Ot,Se=(pt=mt.Ea)-(ce=pt&~(re=(Ot=1<<mt.b)-1)),ie=be(pt,mt.b),ge=mt.K,mt=mt.w+(Dt>>mt.b)*ie;Dt<Wt;){for(Ze=ge,$e=mt,Dn=new Le,nn=$t+ce,Jn=$t+pt;$t<nn;)Be(Ze[$e++],Dn),ll(Dn,Ht,$t,Ot,at,Q),$t+=Ot,Q+=Ot;$t<Jn&&(Be(Ze[$e++],Dn),ll(Dn,Ht,$t,Se,at,Q),$t+=Se,Q+=Se),++Dt&re||(mt+=ie)}break;case 3:if(pt==at&&Ot==Q&&0<mt.b){for($t=at,pt=Ht=Q+(Wt-Dt)*Ht-(ce=(Wt-Dt)*be(mt.Ea,mt.b)),Ot=at,re=Q,ie=[],ce=(Se=ce)-1;0<=ce;--ce)ie[ce]=Ot[re+ce];for(ce=Se-1;0<=ce;--ce)$t[pt+ce]=ie[ce];Wi(mt,Dt,Wt,at,Ht,at,Q)}else Wi(mt,Dt,Wt,pt,Ot,at,Q)}Q=R,at=E}at!=E&&r(R,E,Q,at,q)}function gi(m,v){var E=m.V,R=m.Ba+m.c*m.C,F=v-m.C;if(t(v<=m.l.o),t(16>=F),0<F){var q=m.l,$=m.Ta,Q=m.Ua,at=q.width;if(Ko(m,F,E,R),F=Q=[Q],t((E=m.C)<(R=v)),t(q.v<q.va),R>q.o&&(R=q.o),E<q.j){var mt=q.j-E;E=q.j,F[0]+=mt*at}if(E>=R?E=0:(F[0]+=4*q.v,q.ka=E-q.j,q.U=q.va-q.v,q.T=R-E,E=1),E){if(Q=Q[0],11>(E=m.ca).S){var Dt=E.f.RGBA,Wt=(R=E.S,F=q.U,q=q.T,mt=Dt.eb,Dt.A),pt=q;for(Dt=Dt.fb+m.Ma*Dt.A;0<pt--;){var Ot=$,Ht=Q,ie=F,$t=mt,re=Dt;switch(R){case $c:Fl(Ot,Ht,ie,$t,re);break;case vo:gc(Ot,Ht,ie,$t,re);break;case Sc:gc(Ot,Ht,ie,$t,re),fl($t,re,0,ie,1,0);break;case Vc:cl(Ot,Ht,ie,$t,re);break;case ls:en(Ot,Ht,ie,$t,re,1);break;case Wc:en(Ot,Ht,ie,$t,re,1),fl($t,re,0,ie,1,0);break;case wc:en(Ot,Ht,ie,$t,re,0);break;case ql:en(Ot,Ht,ie,$t,re,0),fl($t,re,1,ie,1,0);break;case Qs:Ul(Ot,Ht,ie,$t,re);break;case Yl:Ul(Ot,Ht,ie,$t,re),as($t,re,ie,1,0);break;case Ua:ba(Ot,Ht,ie,$t,re);break;default:t(0)}Q+=at,Dt+=Wt}m.Ma+=q}else alert("todo:EmitRescaledRowsYUVA");t(m.Ma<=E.height)}}m.C=v,t(m.C<=m.i)}function Ar(m){var v;if(0<m.ua)return 0;for(v=0;v<m.Wb;++v){var E=m.Ya[v].G,R=m.Ya[v].H;if(0<E[1][R[1]+0].g||0<E[2][R[2]+0].g||0<E[3][R[3]+0].g)return 0}return 1}function ir(m,v,E,R,F,q){if(m.Z!=0){var $=m.qd,Q=m.rd;for(t(ra[m.Z]!=null);v<E;++v)ra[m.Z]($,Q,R,F,R,F,q),$=R,Q=F,F+=q;m.qd=$,m.rd=Q}}function Gn(m,v){var E=m.l.ma,R=E.Z==0||E.Z==1?m.l.j:m.C;if(R=m.C<R?R:m.C,t(v<=m.l.o),v>R){var F=m.l.width,q=E.ca,$=E.tb+F*R,Q=m.V,at=m.Ba+m.c*R,mt=m.gc;t(m.ab==1),t(mt[0].hc==3),Uc(mt[0],R,v,Q,at,q,$),ir(E,R,v,q,$,F)}m.C=m.Ma=v}function Jo(m,v,E,R,F,q,$){var Q=m.$/R,at=m.$%R,mt=m.m,Dt=m.s,Wt=E+m.$,pt=Wt;F=E+R*F;var Ot=E+R*q,Ht=280+Dt.ua,ie=m.Pb?Q:16777216,$t=0<Dt.ua?Dt.Wa:null,re=Dt.wc,ce=Wt<Ot?Ti(Dt,at,Q):null;t(m.C<q),t(Ot<=F);var Se=!1;t:for(;;){for(;Se||Wt<Ot;){var ge=0;if(Q>=ie){var Ze=Wt-E;t((ie=m).Pb),ie.wd=ie.m,ie.xd=Ze,0<ie.s.ua&&Re(ie.s.Wa,ie.s.vb),ie=Q+Ha}if(at&re||(ce=Ti(Dt,at,Q)),t(ce!=null),ce.Qb&&(v[Wt]=ce.qb,Se=!0),!Se)if(kt(mt),ce.jc){ge=mt,Ze=v;var $e=Wt,Dn=ce.pd[tt(ge)&al-1];t(ce.jc),256>Dn.g?(vt(ge,ge.u+Dn.g),Ze[$e]=Dn.value,ge=0):(vt(ge,ge.u+Dn.g-256),t(256<=Dn.value),ge=Dn.value),ge==0&&(Se=!0)}else ge=Xn(ce.G[0],ce.H[0],mt);if(mt.h)break;if(Se||256>ge){if(!Se)if(ce.nd)v[Wt]=(ce.qb|ge<<8)>>>0;else{if(kt(mt),Se=Xn(ce.G[1],ce.H[1],mt),kt(mt),Ze=Xn(ce.G[2],ce.H[2],mt),$e=Xn(ce.G[3],ce.H[3],mt),mt.h)break;v[Wt]=($e<<24|Se<<16|ge<<8|Ze)>>>0}if(Se=!1,++Wt,++at>=R&&(at=0,++Q,$!=null&&Q<=q&&!(Q%16)&&$(m,Q),$t!=null))for(;pt<Wt;)ge=v[pt++],$t.X[(506832829*ge&4294967295)>>>$t.Mb]=ge}else if(280>ge){if(ge=Xt(ge-256,mt),Ze=Xn(ce.G[4],ce.H[4],mt),kt(mt),Ze=Ei(R,Ze=Xt(Ze,mt)),mt.h)break;if(Wt-E<Ze||F-Wt<ge)break t;for($e=0;$e<ge;++$e)v[Wt+$e]=v[Wt+$e-Ze];for(Wt+=ge,at+=ge;at>=R;)at-=R,++Q,$!=null&&Q<=q&&!(Q%16)&&$(m,Q);if(t(Wt<=F),at&re&&(ce=Ti(Dt,at,Q)),$t!=null)for(;pt<Wt;)ge=v[pt++],$t.X[(506832829*ge&4294967295)>>>$t.Mb]=ge}else{if(!(ge<Ht))break t;for(Se=ge-280,t($t!=null);pt<Wt;)ge=v[pt++],$t.X[(506832829*ge&4294967295)>>>$t.Mb]=ge;ge=Wt,t(!(Se>>>(Ze=$t).Xa)),v[ge]=Ze.X[Se],Se=!0}Se||t(mt.h==gt(mt))}if(m.Pb&&mt.h&&Wt<F)t(m.m.h),m.a=5,m.m=m.wd,m.$=m.xd,0<m.s.ua&&Re(m.s.vb,m.s.Wa);else{if(mt.h)break t;$?.(m,Q>q?q:Q),m.a=0,m.$=Wt-E}return 1}return m.a=3,0}function ks(m){t(m!=null),m.vc=null,m.yc=null,m.Ya=null;var v=m.Wa;v!=null&&(v.X=null),m.vb=null,t(m!=null)}function Oa(){var m=new Ge;return m==null?null:(m.a=0,m.xb=hl,Qt("Predictor","VP8LPredictors"),Qt("Predictor","VP8LPredictors_C"),Qt("PredictorAdd","VP8LPredictorsAdd"),Qt("PredictorAdd","VP8LPredictorsAdd_C"),Me=Sn,ll=tn,Fl=ur,gc=bn,Ul=cn,ba=pn,cl=$n,ot.VP8LMapColor32b=bi,ot.VP8LMapColor8b=mi,m)}function Zo(m,v,E,R,F){var q=1,$=[m],Q=[v],at=R.m,mt=R.s,Dt=null,Wt=0;t:for(;;){if(E)for(;q&&K(at,1);){var pt=$,Ot=Q,Ht=R,ie=1,$t=Ht.m,re=Ht.gc[Ht.ab],ce=K($t,2);if(Ht.Oc&1<<ce)q=0;else{switch(Ht.Oc|=1<<ce,re.hc=ce,re.Ea=pt[0],re.nc=Ot[0],re.K=[null],++Ht.ab,t(4>=Ht.ab),ce){case 0:case 1:re.b=K($t,3)+2,ie=Zo(be(re.Ea,re.b),be(re.nc,re.b),0,Ht,re.K),re.K=re.K[0];break;case 3:var Se,ge=K($t,8)+1,Ze=16<ge?0:4<ge?1:2<ge?2:3;if(pt[0]=be(re.Ea,Ze),re.b=Ze,Se=ie=Zo(ge,1,0,Ht,re.K)){var $e,Dn=ge,nn=re,Jn=1<<(8>>nn.b),jr=s(Jn);if(jr==null)Se=0;else{var zn=nn.K[0],Ve=nn.w;for(jr[0]=nn.K[0][0],$e=1;$e<1*Dn;++$e)jr[$e]=_e(zn[Ve+$e],jr[$e-1]);for(;$e<4*Jn;++$e)jr[$e]=0;nn.K[0]=null,nn.K[0]=jr,Se=1}}ie=Se;break;case 2:break;default:t(0)}q=ie}}if($=$[0],Q=Q[0],q&&K(at,1)&&!(q=1<=(Wt=K(at,4))&&11>=Wt)){R.a=3;break t}var Oe;if(Oe=q)e:{var ni,Mn,jn,kr=R,zi=$,Fi=Q,Rr=Wt,ri=E,Ui=kr.m,ii=kr.s,Un=[null],kn=1,Nr=0,er=us[Rr];n:for(;;){if(ri&&K(Ui,1)){var w=K(Ui,3)+2,k=be(zi,w),_=be(Fi,w),N=k*_;if(!Zo(k,_,0,kr,Un))break n;for(Un=Un[0],ii.xc=w,ni=0;ni<N;++ni){var j=Un[ni]>>8&65535;Un[ni]=j,j>=kn&&(kn=j+1)}}if(Ui.h)break n;for(Mn=0;5>Mn;++Mn){var G=Ls[Mn];!Mn&&0<Rr&&(G+=1<<Rr),Nr<G&&(Nr=G)}var nt=l(kn*er,V),z=kn,J=l(z,Lt);if(J==null)var ut=null;else t(65536>=z),ut=J;var it=s(Nr);if(ut==null||it==null||nt==null){kr.a=1;break n}var rt=nt;for(ni=jn=0;ni<kn;++ni){var I=ut[ni],Mt=I.G,It=I.H,wt=0,Et=1,yt=0;for(Mn=0;5>Mn;++Mn){G=Ls[Mn],Mt[Mn]=rt,It[Mn]=jn,!Mn&&0<Rr&&(G+=1<<Rr);i:{var Ft,Vt=G,pe=kr,se=it,Ee=rt,Qe=jn,En=0,fe=pe.m,Xe=K(fe,1);if(i(se,0,0,Vt),Xe){var we=K(fe,1)+1,Tn=K(fe,1),Yt=K(fe,Tn==0?1:8);se[Yt]=1,we==2&&(se[Yt=K(fe,8)]=1);var De=1}else{var ze=s(19),Fe=K(fe,4)+4;if(19<Fe){pe.a=3;var ke=0;break i}for(Ft=0;Ft<Fe;++Ft)ze[kc[Ft]]=K(fe,3);var _n=void 0,qe=void 0,nr=pe,sr=ze,br=Vt,oi=se,Wr=0,hr=nr.m,Cr=8,vi=l(128,V);r:for(;ct(vi,0,7,sr,19);){if(K(hr,1)){var So=2+2*K(hr,3);if((_n=2+K(hr,So))>br)break r}else _n=br;for(qe=0;qe<br&&_n--;){kt(hr);var Qc=vi[0+(127&tt(hr))];vt(hr,hr.u+Qc.g);var ia=Qc.value;if(16>ia)oi[qe++]=ia,ia!=0&&(Cr=ia);else{var Af=ia==16,Du=ia-16,Gl=$l[Du],tu=K(hr,wo[Du])+Gl;if(qe+tu>br)break r;for(var Lu=Af?Cr:0;0<tu--;)oi[qe++]=Lu}}Wr=1;break r}Wr||(nr.a=3),De=Wr}(De=De&&!fe.h)&&(En=ct(Ee,Qe,8,se,Vt)),De&&En!=0?ke=En:(pe.a=3,ke=0)}if(ke==0)break n;if(Et&&Xc[Mn]==1&&(Et=rt[jn].g==0),wt+=rt[jn].g,jn+=ke,3>=Mn){var gl,eu=it[0];for(gl=1;gl<G;++gl)it[gl]>eu&&(eu=it[gl]);yt+=eu}}if(I.nd=Et,I.Qb=0,Et&&(I.qb=(Mt[3][It[3]+0].value<<24|Mt[1][It[1]+0].value<<16|Mt[2][It[2]+0].value)>>>0,wt==0&&256>Mt[0][It[0]+0].value&&(I.Qb=1,I.qb+=Mt[0][It[0]+0].value<<8)),I.jc=!I.Qb&&6>yt,I.jc){var nu,Xr=I;for(nu=0;nu<al;++nu){var qo=nu,Br=Xr.pd[qo],Ro=Xr.G[0][Xr.H[0]+qo];256<=Ro.value?(Br.g=Ro.g+256,Br.value=Ro.value):(Br.g=0,Br.value=0,qo>>=fi(Ro,8,Br),qo>>=fi(Xr.G[1][Xr.H[1]+qo],16,Br),qo>>=fi(Xr.G[2][Xr.H[2]+qo],0,Br),fi(Xr.G[3][Xr.H[3]+qo],24,Br))}}}ii.vc=Un,ii.Wb=kn,ii.Ya=ut,ii.yc=nt,Oe=1;break e}Oe=0}if(!(q=Oe)){R.a=3;break t}if(0<Wt){if(mt.ua=1<<Wt,!ft(mt.Wa,Wt)){R.a=1,q=0;break t}}else mt.ua=0;var Os=R,co=$,Or=Q,zr=Os.s,Aa=zr.xc;if(Os.c=co,Os.i=Or,zr.md=be(co,Aa),zr.wc=Aa==0?-1:(1<<Aa)-1,E){R.xb=na;break t}if((Dt=s($*Q))==null){R.a=1,q=0;break t}q=(q=Jo(R,Dt,0,$,Q,Q,null))&&!at.h;break t}return q?(F!=null?F[0]=Dt:(t(Dt==null),t(E)),R.$=0,E||ks(mt)):ks(mt),q}function To(m,v){var E=m.c*m.i,R=E+v+16*v;return t(m.c<=v),m.V=s(R),m.V==null?(m.Ta=null,m.Ua=0,m.a=1,0):(m.Ta=m.V,m.Ua=m.Ba+E+v,1)}function Ll(m,v){var E=m.C,R=v-E,F=m.V,q=m.Ba+m.c*E;for(t(v<=m.l.o);0<R;){var $=16<R?16:R,Q=m.l.ma,at=m.l.width,mt=at*$,Dt=Q.ca,Wt=Q.tb+at*E,pt=m.Ta,Ot=m.Ua;Ko(m,$,F,q),Ho(pt,Ot,Dt,Wt,mt),ir(Q,E,E+$,Dt,Wt,at),R-=$,F+=$*m.c,E+=$}t(E==v),m.C=m.Ma=v}function ca(){this.ub=this.yd=this.td=this.Rb=0}function As(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Qa(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function Qo(){this.Yb=(function(){var m=[];return(function v(E,R,F){for(var q=F[R],$=0;$<q&&(E.push(F.length>R+1?[]:0),!(F.length<R+1));$++)v(E[$],R+1,F)})(m,0,[3,11]),m})()}function di(){this.jb=s(3),this.Wc=c([4,8],Qo),this.Xc=c([4,17],Qo)}function tl(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function Pi(){this.ld=this.La=this.dd=this.tc=0}function qr(){this.Na=this.la=0}function Ms(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Rl(){this.ad=s(384),this.Za=0,this.Ob=s(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function ac(){this.uc=this.M=this.Nb=0,this.wa=Array(new Pi),this.Y=0,this.ya=Array(new Rl),this.aa=0,this.l=new yi}function Bc(){this.y=s(16),this.f=s(8),this.ea=s(8)}function zc(){this.cb=this.a=0,this.sc="",this.m=new P,this.Od=new ca,this.Kc=new As,this.ed=new tl,this.Qa=new Qa,this.Ic=this.$c=this.Aa=0,this.D=new ac,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=l(8,P),this.ia=0,this.pb=l(4,Ms),this.Pa=new di,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Bc),this.Hd=0,this.rb=Array(new qr),this.sb=0,this.wa=Array(new Pi),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Rl),this.L=this.aa=0,this.gd=c([4,2],Pi),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function eo(m,v){return 0>m?0:m>v?v:m}function yi(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Ni(){var m=new zc;return m!=null&&(m.a=0,m.sc="OK",m.cb=0,m.Xb=0,xi||(xi=go)),m}function Fn(m,v,E){return m.a==0&&(m.a=v,m.sc=E,m.cb=0),0}function Po(m,v,E){return 3<=E&&m[v+0]==157&&m[v+1]==1&&m[v+2]==42}function fr(m,v){if(m==null)return 0;if(m.a=0,m.sc="OK",v==null)return Fn(m,2,"null VP8Io passed to VP8GetHeaders()");var E=v.data,R=v.w,F=v.ha;if(4>F)return Fn(m,7,"Truncated header.");var q=E[R+0]|E[R+1]<<8|E[R+2]<<16,$=m.Od;if($.Rb=!(1&q),$.td=q>>1&7,$.yd=q>>4&1,$.ub=q>>5,3<$.td)return Fn(m,3,"Incorrect keyframe parameters.");if(!$.yd)return Fn(m,4,"Frame not displayable.");R+=3,F-=3;var Q=m.Kc;if($.Rb){if(7>F)return Fn(m,7,"cannot parse picture header");if(!Po(E,R,F))return Fn(m,3,"Bad code word");Q.c=16383&(E[R+4]<<8|E[R+3]),Q.Td=E[R+4]>>6,Q.i=16383&(E[R+6]<<8|E[R+5]),Q.Ud=E[R+6]>>6,R+=7,F-=7,m.za=Q.c+15>>4,m.Ub=Q.i+15>>4,v.width=Q.c,v.height=Q.i,v.Da=0,v.j=0,v.v=0,v.va=v.width,v.o=v.height,v.da=0,v.ib=v.width,v.hb=v.height,v.U=v.width,v.T=v.height,i((q=m.Pa).jb,0,255,q.jb.length),t((q=m.Qa)!=null),q.Cb=0,q.Bb=0,q.Fb=1,i(q.Zb,0,0,q.Zb.length),i(q.Lb,0,0,q.Lb)}if($.ub>F)return Fn(m,7,"bad partition length");dt(q=m.m,E,R,$.ub),R+=$.ub,F-=$.ub,$.Rb&&(Q.Ld=Rt(q),Q.Kd=Rt(q)),Q=m.Qa;var at,mt=m.Pa;if(t(q!=null),t(Q!=null),Q.Cb=Rt(q),Q.Cb){if(Q.Bb=Rt(q),Rt(q)){for(Q.Fb=Rt(q),at=0;4>at;++at)Q.Zb[at]=Rt(q)?lt(q,7):0;for(at=0;4>at;++at)Q.Lb[at]=Rt(q)?lt(q,6):0}if(Q.Bb)for(at=0;3>at;++at)mt.jb[at]=Rt(q)?st(q,8):255}else Q.Bb=0;if(q.Ka)return Fn(m,3,"cannot parse segment header");if((Q=m.ed).zd=Rt(q),Q.Tb=st(q,6),Q.wb=st(q,3),Q.Pc=Rt(q),Q.Pc&&Rt(q)){for(mt=0;4>mt;++mt)Rt(q)&&(Q.vd[mt]=lt(q,6));for(mt=0;4>mt;++mt)Rt(q)&&(Q.od[mt]=lt(q,6))}if(m.L=Q.Tb==0?0:Q.zd?1:2,q.Ka)return Fn(m,3,"cannot parse filter header");var Dt=F;if(F=at=R,R=at+Dt,Q=Dt,m.Xb=(1<<st(m.m,2))-1,Dt<3*(mt=m.Xb))E=7;else{for(at+=3*mt,Q-=3*mt,Dt=0;Dt<mt;++Dt){var Wt=E[F+0]|E[F+1]<<8|E[F+2]<<16;Wt>Q&&(Wt=Q),dt(m.Jc[+Dt],E,at,Wt),at+=Wt,Q-=Wt,F+=3}dt(m.Jc[+mt],E,at,Q),E=at<R?0:5}if(E!=0)return Fn(m,E,"cannot parse partitions");for(E=st(at=m.m,7),F=Rt(at)?lt(at,4):0,R=Rt(at)?lt(at,4):0,Q=Rt(at)?lt(at,4):0,mt=Rt(at)?lt(at,4):0,at=Rt(at)?lt(at,4):0,Dt=m.Qa,Wt=0;4>Wt;++Wt){if(Dt.Cb){var pt=Dt.Zb[Wt];Dt.Fb||(pt+=E)}else{if(0<Wt){m.pb[Wt]=m.pb[0];continue}pt=E}var Ot=m.pb[Wt];Ot.Sc[0]=fs[eo(pt+F,127)],Ot.Sc[1]=ds[eo(pt+0,127)],Ot.Eb[0]=2*fs[eo(pt+R,127)],Ot.Eb[1]=101581*ds[eo(pt+Q,127)]>>16,8>Ot.Eb[1]&&(Ot.Eb[1]=8),Ot.Qc[0]=fs[eo(pt+mt,117)],Ot.Qc[1]=ds[eo(pt+at,127)],Ot.lc=pt+at}if(!$.Rb)return Fn(m,4,"Not a key frame.");for(Rt(q),$=m.Pa,E=0;4>E;++E){for(F=0;8>F;++F)for(R=0;3>R;++R)for(Q=0;11>Q;++Q)mt=Zt(q,Lr[E][F][R][Q])?st(q,8):ud[E][F][R][Q],$.Wc[E][F].Yb[R][Q]=mt;for(F=0;17>F;++F)$.Xc[E][F]=$.Wc[E][tr[F]]}return m.kc=Rt(q),m.kc&&(m.Bd=st(q,8)),m.cb=1}function go(m,v,E,R,F,q,$){var Q=v[F].Yb[E];for(E=0;16>F;++F){if(!Zt(m,Q[E+0]))return F;for(;!Zt(m,Q[E+1]);)if(Q=v[++F].Yb[0],E=0,F==16)return 16;var at=v[F+1].Yb;if(Zt(m,Q[E+2])){var mt=m,Dt=0;if(Zt(mt,(pt=Q)[(Wt=E)+3]))if(Zt(mt,pt[Wt+6])){for(Q=0,Wt=2*(Dt=Zt(mt,pt[Wt+8]))+(pt=Zt(mt,pt[Wt+9+Dt])),Dt=0,pt=Gc[Wt];pt[Q];++Q)Dt+=Dt+Zt(mt,pt[Q]);Dt+=3+(8<<Wt)}else Zt(mt,pt[Wt+7])?(Dt=7+2*Zt(mt,165),Dt+=Zt(mt,145)):Dt=5+Zt(mt,159);else Dt=Zt(mt,pt[Wt+4])?3+Zt(mt,pt[Wt+5]):2;Q=at[2]}else Dt=1,Q=at[1];at=$+ta[F],0>(mt=m).b&&qt(mt);var Wt,pt=mt.b,Ot=(Wt=mt.Ca>>1)-(mt.I>>pt)>>31;--mt.b,mt.Ca+=Ot,mt.Ca|=1,mt.I-=(Wt+1&Ot)<<pt,q[at]=((Dt^Ot)-Ot)*R[(0<F)+0]}return 16}function qi(m){var v=m.rb[m.sb-1];v.la=0,v.Na=0,i(m.zc,0,0,m.zc.length),m.ja=0}function Yr(m,v,E,R,F){F=m[v+E+32*R]+(F>>3),m[v+E+32*R]=-256&F?0>F?0:255:F}function dr(m,v,E,R,F,q){Yr(m,v,0,E,R+F),Yr(m,v,1,E,R+q),Yr(m,v,2,E,R-q),Yr(m,v,3,E,R-F)}function Ir(m){return(20091*m>>16)+m}function hi(m,v,E,R){var F,q=0,$=s(16);for(F=0;4>F;++F){var Q=m[v+0]+m[v+8],at=m[v+0]-m[v+8],mt=(35468*m[v+4]>>16)-Ir(m[v+12]),Dt=Ir(m[v+4])+(35468*m[v+12]>>16);$[q+0]=Q+Dt,$[q+1]=at+mt,$[q+2]=at-mt,$[q+3]=Q-Dt,q+=4,v++}for(F=q=0;4>F;++F)Q=(m=$[q+0]+4)+$[q+8],at=m-$[q+8],mt=(35468*$[q+4]>>16)-Ir($[q+12]),Yr(E,R,0,0,Q+(Dt=Ir($[q+4])+(35468*$[q+12]>>16))),Yr(E,R,1,0,at+mt),Yr(E,R,2,0,at-mt),Yr(E,R,3,0,Q-Dt),q++,R+=32}function Ys(m,v,E,R){var F=m[v+0]+4,q=35468*m[v+4]>>16,$=Ir(m[v+4]),Q=35468*m[v+1]>>16;dr(E,R,0,F+$,m=Ir(m[v+1]),Q),dr(E,R,1,F+q,m,Q),dr(E,R,2,F-q,m,Q),dr(E,R,3,F-$,m,Q)}function te(m,v,E,R,F){hi(m,v,E,R),F&&hi(m,v+16,E,R+4)}function el(m,v,E,R){Ds(m,v+0,E,R,1),Ds(m,v+32,E,R+128,1)}function Pa(m,v,E,R){var F;for(m=m[v+0]+4,F=0;4>F;++F)for(v=0;4>v;++v)Yr(E,R,v,F,m)}function $s(m,v,E,R){m[v+0]&&oo(m,v+0,E,R),m[v+16]&&oo(m,v+16,E,R+4),m[v+32]&&oo(m,v+32,E,R+128),m[v+48]&&oo(m,v+48,E,R+128+4)}function Io(m,v,E,R){var F,q=s(16);for(F=0;4>F;++F){var $=m[v+0+F]+m[v+12+F],Q=m[v+4+F]+m[v+8+F],at=m[v+4+F]-m[v+8+F],mt=m[v+0+F]-m[v+12+F];q[0+F]=$+Q,q[8+F]=$-Q,q[4+F]=mt+at,q[12+F]=mt-at}for(F=0;4>F;++F)$=(m=q[0+4*F]+3)+q[3+4*F],Q=q[1+4*F]+q[2+4*F],at=q[1+4*F]-q[2+4*F],mt=m-q[3+4*F],E[R+0]=$+Q>>3,E[R+16]=mt+at>>3,E[R+32]=$-Q>>3,E[R+48]=mt-at>>3,R+=64}function Ol(m,v,E){var R,F=v-32,q=ao,$=255-m[F-1];for(R=0;R<E;++R){var Q,at=q,mt=$+m[v-1];for(Q=0;Q<E;++Q)m[v+Q]=at[mt+m[F+Q]];v+=32}}function Pl(m,v){Ol(m,v,4)}function lc(m,v){Ol(m,v,8)}function cc(m,v){Ol(m,v,16)}function Tu(m,v){var E;for(E=0;16>E;++E)r(m,v+32*E,m,v-32,16)}function uc(m,v){var E;for(E=16;0<E;--E)i(m,v,m[v-1],16),v+=32}function jo(m,v,E){var R;for(R=0;16>R;++R)i(v,E+32*R,m,16)}function Bo(m,v){var E,R=16;for(E=0;16>E;++E)R+=m[v-1+32*E]+m[v+E-32];jo(R>>5,m,v)}function ts(m,v){var E,R=8;for(E=0;16>E;++E)R+=m[v-1+32*E];jo(R>>4,m,v)}function fc(m,v){var E,R=8;for(E=0;16>E;++E)R+=m[v+E-32];jo(R>>4,m,v)}function es(m,v){jo(128,m,v)}function vn(m,v,E){return m+2*v+E+2>>2}function dc(m,v){var E,R=v-32;for(R=new Uint8Array([vn(m[R-1],m[R+0],m[R+1]),vn(m[R+0],m[R+1],m[R+2]),vn(m[R+1],m[R+2],m[R+3]),vn(m[R+2],m[R+3],m[R+4])]),E=0;4>E;++E)r(m,v+32*E,R,0,R.length)}function xr(m,v){var E=m[v-1],R=m[v-1+32],F=m[v-1+64],q=m[v-1+96];Ae(m,v+0,16843009*vn(m[v-1-32],E,R)),Ae(m,v+32,16843009*vn(E,R,F)),Ae(m,v+64,16843009*vn(R,F,q)),Ae(m,v+96,16843009*vn(F,q,q))}function hc(m,v){var E,R=4;for(E=0;4>E;++E)R+=m[v+E-32]+m[v-1+32*E];for(R>>=3,E=0;4>E;++E)i(m,v+32*E,R,4)}function ua(m,v){var E=m[v-1+0],R=m[v-1+32],F=m[v-1+64],q=m[v-1-32],$=m[v+0-32],Q=m[v+1-32],at=m[v+2-32],mt=m[v+3-32];m[v+0+96]=vn(R,F,m[v-1+96]),m[v+1+96]=m[v+0+64]=vn(E,R,F),m[v+2+96]=m[v+1+64]=m[v+0+32]=vn(q,E,R),m[v+3+96]=m[v+2+64]=m[v+1+32]=m[v+0+0]=vn($,q,E),m[v+3+64]=m[v+2+32]=m[v+1+0]=vn(Q,$,q),m[v+3+32]=m[v+2+0]=vn(at,Q,$),m[v+3+0]=vn(mt,at,Q)}function zo(m,v){var E=m[v+1-32],R=m[v+2-32],F=m[v+3-32],q=m[v+4-32],$=m[v+5-32],Q=m[v+6-32],at=m[v+7-32];m[v+0+0]=vn(m[v+0-32],E,R),m[v+1+0]=m[v+0+32]=vn(E,R,F),m[v+2+0]=m[v+1+32]=m[v+0+64]=vn(R,F,q),m[v+3+0]=m[v+2+32]=m[v+1+64]=m[v+0+96]=vn(F,q,$),m[v+3+32]=m[v+2+64]=m[v+1+96]=vn(q,$,Q),m[v+3+64]=m[v+2+96]=vn($,Q,at),m[v+3+96]=vn(Q,at,at)}function Fo(m,v){var E=m[v-1+0],R=m[v-1+32],F=m[v-1+64],q=m[v-1-32],$=m[v+0-32],Q=m[v+1-32],at=m[v+2-32],mt=m[v+3-32];m[v+0+0]=m[v+1+64]=q+$+1>>1,m[v+1+0]=m[v+2+64]=$+Q+1>>1,m[v+2+0]=m[v+3+64]=Q+at+1>>1,m[v+3+0]=at+mt+1>>1,m[v+0+96]=vn(F,R,E),m[v+0+64]=vn(R,E,q),m[v+0+32]=m[v+1+96]=vn(E,q,$),m[v+1+32]=m[v+2+96]=vn(q,$,Q),m[v+2+32]=m[v+3+96]=vn($,Q,at),m[v+3+32]=vn(Q,at,mt)}function Yi(m,v){var E=m[v+0-32],R=m[v+1-32],F=m[v+2-32],q=m[v+3-32],$=m[v+4-32],Q=m[v+5-32],at=m[v+6-32],mt=m[v+7-32];m[v+0+0]=E+R+1>>1,m[v+1+0]=m[v+0+64]=R+F+1>>1,m[v+2+0]=m[v+1+64]=F+q+1>>1,m[v+3+0]=m[v+2+64]=q+$+1>>1,m[v+0+32]=vn(E,R,F),m[v+1+32]=m[v+0+96]=vn(R,F,q),m[v+2+32]=m[v+1+96]=vn(F,q,$),m[v+3+32]=m[v+2+96]=vn(q,$,Q),m[v+3+64]=vn($,Q,at),m[v+3+96]=vn(Q,at,mt)}function No(m,v){var E=m[v-1+0],R=m[v-1+32],F=m[v-1+64],q=m[v-1+96];m[v+0+0]=E+R+1>>1,m[v+2+0]=m[v+0+32]=R+F+1>>1,m[v+2+32]=m[v+0+64]=F+q+1>>1,m[v+1+0]=vn(E,R,F),m[v+3+0]=m[v+1+32]=vn(R,F,q),m[v+3+32]=m[v+1+64]=vn(F,q,q),m[v+3+64]=m[v+2+64]=m[v+0+96]=m[v+1+96]=m[v+2+96]=m[v+3+96]=q}function nl(m,v){var E=m[v-1+0],R=m[v-1+32],F=m[v-1+64],q=m[v-1+96],$=m[v-1-32],Q=m[v+0-32],at=m[v+1-32],mt=m[v+2-32];m[v+0+0]=m[v+2+32]=E+$+1>>1,m[v+0+32]=m[v+2+64]=R+E+1>>1,m[v+0+64]=m[v+2+96]=F+R+1>>1,m[v+0+96]=q+F+1>>1,m[v+3+0]=vn(Q,at,mt),m[v+2+0]=vn($,Q,at),m[v+1+0]=m[v+3+32]=vn(E,$,Q),m[v+1+32]=m[v+3+64]=vn(R,E,$),m[v+1+64]=m[v+3+96]=vn(F,R,E),m[v+1+96]=vn(q,F,R)}function Cs(m,v){var E;for(E=0;8>E;++E)r(m,v+32*E,m,v-32,8)}function Ia(m,v){var E;for(E=0;8>E;++E)i(m,v,m[v-1],8),v+=32}function no(m,v,E){var R;for(R=0;8>R;++R)i(v,E+32*R,m,8)}function ja(m,v){var E,R=8;for(E=0;8>E;++E)R+=m[v+E-32]+m[v-1+32*E];no(R>>4,m,v)}function fa(m,v){var E,R=4;for(E=0;8>E;++E)R+=m[v+E-32];no(R>>3,m,v)}function Ii(m,v){var E,R=4;for(E=0;8>E;++E)R+=m[v-1+32*E];no(R>>3,m,v)}function _o(m,v){no(128,m,v)}function Uo(m,v,E){var R=m[v-E],F=m[v+0],q=3*(F-R)+xa[1020+m[v-2*E]-m[v+E]],$=vc[112+(q+4>>3)];m[v-E]=ao[255+R+vc[112+(q+3>>3)]],m[v+0]=ao[255+F-$]}function Es(m,v,E,R){var F=m[v+0],q=m[v+E];return Xi[255+m[v-2*E]-m[v-E]]>R||Xi[255+q-F]>R}function da(m,v,E,R){return 4*Xi[255+m[v-E]-m[v+0]]+Xi[255+m[v-2*E]-m[v+E]]<=R}function ha(m,v,E,R,F){var q=m[v-3*E],$=m[v-2*E],Q=m[v-E],at=m[v+0],mt=m[v+E],Dt=m[v+2*E],Wt=m[v+3*E];return 4*Xi[255+Q-at]+Xi[255+$-mt]>R?0:Xi[255+m[v-4*E]-q]<=F&&Xi[255+q-$]<=F&&Xi[255+$-Q]<=F&&Xi[255+Wt-Dt]<=F&&Xi[255+Dt-mt]<=F&&Xi[255+mt-at]<=F}function Vs(m,v,E,R){var F=2*R+1;for(R=0;16>R;++R)da(m,v+R,E,F)&&Uo(m,v+R,E)}function Ts(m,v,E,R){var F=2*R+1;for(R=0;16>R;++R)da(m,v+R*E,1,F)&&Uo(m,v+R*E,1)}function Ns(m,v,E,R){var F;for(F=3;0<F;--F)Vs(m,v+=4*E,E,R)}function rl(m,v,E,R){var F;for(F=3;0<F;--F)Ts(m,v+=4,E,R)}function ns(m,v,E,R,F,q,$,Q){for(q=2*q+1;0<F--;){if(ha(m,v,E,q,$))if(Es(m,v,E,Q))Uo(m,v,E);else{var at=m,mt=v,Dt=E,Wt=at[mt-2*Dt],pt=at[mt-Dt],Ot=at[mt+0],Ht=at[mt+Dt],ie=at[mt+2*Dt],$t=27*(ce=xa[1020+3*(Ot-pt)+xa[1020+Wt-Ht]])+63>>7,re=18*ce+63>>7,ce=9*ce+63>>7;at[mt-3*Dt]=ao[255+at[mt-3*Dt]+ce],at[mt-2*Dt]=ao[255+Wt+re],at[mt-Dt]=ao[255+pt+$t],at[mt+0]=ao[255+Ot-$t],at[mt+Dt]=ao[255+Ht-re],at[mt+2*Dt]=ao[255+ie-ce]}v+=R}}function _s(m,v,E,R,F,q,$,Q){for(q=2*q+1;0<F--;){if(ha(m,v,E,q,$))if(Es(m,v,E,Q))Uo(m,v,E);else{var at=m,mt=v,Dt=E,Wt=at[mt-Dt],pt=at[mt+0],Ot=at[mt+Dt],Ht=vc[112+(4+(ie=3*(pt-Wt))>>3)],ie=vc[112+(ie+3>>3)],$t=Ht+1>>1;at[mt-2*Dt]=ao[255+at[mt-2*Dt]+$t],at[mt-Dt]=ao[255+Wt+ie],at[mt+0]=ao[255+pt-Ht],at[mt+Dt]=ao[255+Ot-$t]}v+=R}}function Il(m,v,E,R,F,q){ns(m,v,E,1,16,R,F,q)}function Ba(m,v,E,R,F,q){ns(m,v,1,E,16,R,F,q)}function jl(m,v,E,R,F,q){var $;for($=3;0<$;--$)_s(m,v+=4*E,E,1,16,R,F,q)}function pa(m,v,E,R,F,q){var $;for($=3;0<$;--$)_s(m,v+=4,1,E,16,R,F,q)}function Bl(m,v,E,R,F,q,$,Q){ns(m,v,F,1,8,q,$,Q),ns(E,R,F,1,8,q,$,Q)}function A(m,v,E,R,F,q,$,Q){ns(m,v,1,F,8,q,$,Q),ns(E,R,1,F,8,q,$,Q)}function B(m,v,E,R,F,q,$,Q){_s(m,v+4*F,F,1,8,q,$,Q),_s(E,R+4*F,F,1,8,q,$,Q)}function ht(m,v,E,R,F,q,$,Q){_s(m,v+4,1,F,8,q,$,Q),_s(E,R+4,1,F,8,q,$,Q)}function Tt(){this.ba=new He,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Vn,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function Bt(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function ne(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function xe(){this.ua=0,this.Wa=new rn,this.vb=new rn,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new Lt,this.yc=new V}function Ge(){this.xb=this.a=0,this.l=new yi,this.ca=new He,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new X,this.Pb=0,this.wd=new X,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new xe,this.ab=0,this.gc=l(4,ne),this.Oc=0}function un(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new yi,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function In(m,v,E,R,F,q,$){for(m=m==null?0:m[v+0],v=0;v<$;++v)F[q+v]=m+E[R+v]&255,m=F[q+v]}function Bn(m,v,E,R,F,q,$){var Q;if(m==null)In(null,null,E,R,F,q,$);else for(Q=0;Q<$;++Q)F[q+Q]=m[v+Q]+E[R+Q]&255}function or(m,v,E,R,F,q,$){if(m==null)In(null,null,E,R,F,q,$);else{var Q,at=m[v+0],mt=at,Dt=at;for(Q=0;Q<$;++Q)mt=Dt+(at=m[v+Q])-mt,Dt=E[R+Q]+(-256&mt?0>mt?0:255:mt)&255,mt=at,F[q+Q]=Dt}}function $i(m,v,E,R){var F=v.width,q=v.o;if(t(m!=null&&v!=null),0>E||0>=R||E+R>q)return null;if(!m.Cc){if(m.ga==null){var $;if(m.ga=new un,($=m.ga==null)||($=v.width*v.o,t(m.Gb.length==0),m.Gb=s($),m.Uc=0,m.Gb==null?$=0:(m.mb=m.Gb,m.nb=m.Uc,m.rc=null,$=1),$=!$),!$){$=m.ga;var Q=m.Fa,at=m.P,mt=m.qc,Dt=m.mb,Wt=m.nb,pt=at+1,Ot=mt-1,Ht=$.l;if(t(Q!=null&&Dt!=null&&v!=null),ra[0]=null,ra[1]=In,ra[2]=Bn,ra[3]=or,$.ca=Dt,$.tb=Wt,$.c=v.width,$.i=v.height,t(0<$.c&&0<$.i),1>=mt)v=0;else if($.$a=3&Q[at+0],$.Z=Q[at+0]>>2&3,$.Lc=Q[at+0]>>4&3,at=Q[at+0]>>6&3,0>$.$a||1<$.$a||4<=$.Z||1<$.Lc||at)v=0;else if(Ht.put=Je,Ht.ac=Go,Ht.bc=Ss,Ht.ma=$,Ht.width=v.width,Ht.height=v.height,Ht.Da=v.Da,Ht.v=v.v,Ht.va=v.va,Ht.j=v.j,Ht.o=v.o,$.$a)t:{t($.$a==1),v=Oa();e:for(;;){if(v==null){v=0;break t}if(t($!=null),$.mc=v,v.c=$.c,v.i=$.i,v.l=$.l,v.l.ma=$,v.l.width=$.c,v.l.height=$.i,v.a=0,zt(v.m,Q,pt,Ot),!Zo($.c,$.i,1,v,null)||(v.ab==1&&v.gc[0].hc==3&&Ar(v.s)?($.ic=1,Q=v.c*v.i,v.Ta=null,v.Ua=0,v.V=s(Q),v.Ba=0,v.V==null?(v.a=1,v=0):v=1):($.ic=0,v=To(v,$.c)),!v))break e;v=1;break t}$.mc=null,v=0}else v=Ot>=$.c*$.i;$=!v}if($)return null;m.ga.Lc!=1?m.Ga=0:R=q-E}t(m.ga!=null),t(E+R<=q);t:{if(v=(Q=m.ga).c,q=Q.l.o,Q.$a==0){if(pt=m.rc,Ot=m.Vc,Ht=m.Fa,at=m.P+1+E*v,mt=m.mb,Dt=m.nb+E*v,t(at<=m.P+m.qc),Q.Z!=0)for(t(ra[Q.Z]!=null),$=0;$<R;++$)ra[Q.Z](pt,Ot,Ht,at,mt,Dt,v),pt=mt,Ot=Dt,Dt+=v,at+=v;else for($=0;$<R;++$)r(mt,Dt,Ht,at,v),pt=mt,Ot=Dt,Dt+=v,at+=v;m.rc=pt,m.Vc=Ot}else{if(t(Q.mc!=null),v=E+R,t(($=Q.mc)!=null),t(v<=$.i),$.C>=v)v=1;else if(Q.ic||an(),Q.ic){Q=$.V,pt=$.Ba,Ot=$.c;var ie=$.i,$t=(Ht=1,at=$.$/Ot,mt=$.$%Ot,Dt=$.m,Wt=$.s,$.$),re=Ot*ie,ce=Ot*v,Se=Wt.wc,ge=$t<ce?Ti(Wt,mt,at):null;t($t<=re),t(v<=ie),t(Ar(Wt));e:for(;;){for(;!Dt.h&&$t<ce;){if(mt&Se||(ge=Ti(Wt,mt,at)),t(ge!=null),kt(Dt),256>(ie=Xn(ge.G[0],ge.H[0],Dt)))Q[pt+$t]=ie,++$t,++mt>=Ot&&(mt=0,++at<=v&&!(at%16)&&Gn($,at));else{if(!(280>ie)){Ht=0;break e}ie=Xt(ie-256,Dt);var Ze,$e=Xn(ge.G[4],ge.H[4],Dt);if(kt(Dt),!($t>=($e=Ei(Ot,$e=Xt($e,Dt)))&&re-$t>=ie)){Ht=0;break e}for(Ze=0;Ze<ie;++Ze)Q[pt+$t+Ze]=Q[pt+$t+Ze-$e];for($t+=ie,mt+=ie;mt>=Ot;)mt-=Ot,++at<=v&&!(at%16)&&Gn($,at);$t<ce&&mt&Se&&(ge=Ti(Wt,mt,at))}t(Dt.h==gt(Dt))}Gn($,at>v?v:at);break e}!Ht||Dt.h&&$t<re?(Ht=0,$.a=Dt.h?5:3):$.$=$t,v=Ht}else v=Jo($,$.V,$.Ba,$.c,$.i,v,Ll);if(!v){R=0;break t}}E+R>=q&&(m.Cc=1),R=1}if(!R)return null;if(m.Cc&&((R=m.ga)!=null&&(R.mc=null),m.ga=null,0<m.Ga))return alert("todo:WebPDequantizeLevels"),null}return m.nb+E*F}function ue(m,v,E,R,F,q){for(;0<F--;){var $,Q=m,at=v+(E?1:0),mt=m,Dt=v+(E?0:3);for($=0;$<R;++$){var Wt=mt[Dt+4*$];Wt!=255&&(Wt*=32897,Q[at+4*$+0]=Q[at+4*$+0]*Wt>>23,Q[at+4*$+1]=Q[at+4*$+1]*Wt>>23,Q[at+4*$+2]=Q[at+4*$+2]*Wt>>23)}v+=q}}function Sr(m,v,E,R,F){for(;0<R--;){var q;for(q=0;q<E;++q){var $=m[v+2*q+0],Q=15&(mt=m[v+2*q+1]),at=4369*Q,mt=(240&mt|mt>>4)*at>>16;m[v+2*q+0]=(240&$|$>>4)*at>>16&240|(15&$|$<<4)*at>>16>>4&15,m[v+2*q+1]=240&mt|Q}v+=F}}function $r(m,v,E,R,F,q,$,Q){var at,mt,Dt=255;for(mt=0;mt<F;++mt){for(at=0;at<R;++at){var Wt=m[v+at];q[$+4*at]=Wt,Dt&=Wt}v+=E,$+=Q}return Dt!=255}function sn(m,v,E,R,F){var q;for(q=0;q<F;++q)E[R+q]=m[v+q]>>8}function an(){fl=ue,as=Sr,yc=$r,Ho=sn}function Do(m,v,E){ot[m]=function(R,F,q,$,Q,at,mt,Dt,Wt,pt,Ot,Ht,ie,$t,re,ce,Se){var ge,Ze=Se-1>>1,$e=Q[at+0]|mt[Dt+0]<<16,Dn=Wt[pt+0]|Ot[Ht+0]<<16;t(R!=null);var nn=3*$e+Dn+131074>>2;for(v(R[F+0],255&nn,nn>>16,ie,$t),q!=null&&(nn=3*Dn+$e+131074>>2,v(q[$+0],255&nn,nn>>16,re,ce)),ge=1;ge<=Ze;++ge){var Jn=Q[at+ge]|mt[Dt+ge]<<16,jr=Wt[pt+ge]|Ot[Ht+ge]<<16,zn=$e+Jn+Dn+jr+524296,Ve=zn+2*(Jn+Dn)>>3;nn=Ve+$e>>1,$e=(zn=zn+2*($e+jr)>>3)+Jn>>1,v(R[F+2*ge-1],255&nn,nn>>16,ie,$t+(2*ge-1)*E),v(R[F+2*ge-0],255&$e,$e>>16,ie,$t+(2*ge-0)*E),q!=null&&(nn=zn+Dn>>1,$e=Ve+jr>>1,v(q[$+2*ge-1],255&nn,nn>>16,re,ce+(2*ge-1)*E),v(q[$+2*ge+0],255&$e,$e>>16,re,ce+(2*ge+0)*E)),$e=Jn,Dn=jr}1&Se||(nn=3*$e+Dn+131074>>2,v(R[F+Se-1],255&nn,nn>>16,ie,$t+(Se-1)*E),q!=null&&(nn=3*Dn+$e+131074>>2,v(q[$+Se-1],255&nn,nn>>16,re,ce+(Se-1)*E)))}}function Ws(){Bi[$c]=va,Bi[vo]=Ac,Bi[Vc]=kf,Bi[ls]=Kc,Bi[wc]=qa,Bi[Qs]=wa,Bi[Ua]=hs,Bi[Sc]=Ac,Bi[Wc]=Kc,Bi[ql]=qa,Bi[Yl]=wa}function Fc(m){return m&-16384?0>m?0:255:m>>Jc}function gr(m,v){return Fc((19077*m>>8)+(26149*v>>8)-14234)}function yo(m,v,E){return Fc((19077*m>>8)-(6419*v>>8)-(13320*E>>8)+8708)}function il(m,v){return Fc((19077*m>>8)+(33050*v>>8)-17685)}function Xs(m,v,E,R,F){R[F+0]=gr(m,E),R[F+1]=yo(m,v,E),R[F+2]=il(m,v)}function zl(m,v,E,R,F){R[F+0]=il(m,v),R[F+1]=yo(m,v,E),R[F+2]=gr(m,E)}function za(m,v,E,R,F){var q=yo(m,v,E);v=q<<3&224|il(m,v)>>3,R[F+0]=248&gr(m,E)|q>>5,R[F+1]=v}function Vi(m,v,E,R,F){var q=240&il(m,v)|15;R[F+0]=240&gr(m,E)|yo(m,v,E)>>4,R[F+1]=q}function Gs(m,v,E,R,F){R[F+0]=255,Xs(m,v,E,R,F+1)}function rs(m,v,E,R,F){zl(m,v,E,R,F),R[F+3]=255}function pc(m,v,E,R,F){Xs(m,v,E,R,F),R[F+3]=255}function Ks(m,v,E){ot[m]=function(R,F,q,$,Q,at,mt,Dt,Wt){for(var pt=Dt+(-2&Wt)*E;Dt!=pt;)v(R[F+0],q[$+0],Q[at+0],mt,Dt),v(R[F+1],q[$+0],Q[at+0],mt,Dt+E),F+=2,++$,++at,Dt+=2*E;1&Wt&&v(R[F+0],q[$+0],Q[at+0],mt,Dt)}}function bo(m,v,E){return E==0?m==0?v==0?6:5:v==0?4:0:E}function mc(m,v,E,R,F){switch(m>>>30){case 3:Ds(v,E,R,F,0);break;case 2:io(v,E,R,F);break;case 1:oo(v,E,R,F)}}function ol(m,v){var E,R,F=v.M,q=v.Nb,$=m.oc,Q=m.pc+40,at=m.oc,mt=m.pc+584,Dt=m.oc,Wt=m.pc+600;for(E=0;16>E;++E)$[Q+32*E-1]=129;for(E=0;8>E;++E)at[mt+32*E-1]=129,Dt[Wt+32*E-1]=129;for(0<F?$[Q-1-32]=at[mt-1-32]=Dt[Wt-1-32]=129:(i($,Q-32-1,127,21),i(at,mt-32-1,127,9),i(Dt,Wt-32-1,127,9)),R=0;R<m.za;++R){var pt=v.ya[v.aa+R];if(0<R){for(E=-1;16>E;++E)r($,Q+32*E-4,$,Q+32*E+12,4);for(E=-1;8>E;++E)r(at,mt+32*E-4,at,mt+32*E+4,4),r(Dt,Wt+32*E-4,Dt,Wt+32*E+4,4)}var Ot=m.Gd,Ht=m.Hd+R,ie=pt.ad,$t=pt.Hc;if(0<F&&(r($,Q-32,Ot[Ht].y,0,16),r(at,mt-32,Ot[Ht].f,0,8),r(Dt,Wt-32,Ot[Ht].ea,0,8)),pt.Za){var re=$,ce=Q-32+16;for(0<F&&(R>=m.za-1?i(re,ce,Ot[Ht].y[15],4):r(re,ce,Ot[Ht+1].y,0,4)),E=0;4>E;E++)re[ce+128+E]=re[ce+256+E]=re[ce+384+E]=re[ce+0+E];for(E=0;16>E;++E,$t<<=2)re=$,ce=Q+Vr[E],ei[pt.Ob[E]](re,ce),mc($t,ie,16*+E,re,ce)}else if(re=bo(R,F,pt.Ob[0]),Lo[re]($,Q),$t!=0)for(E=0;16>E;++E,$t<<=2)mc($t,ie,16*+E,$,Q+Vr[E]);for(E=pt.Gc,re=bo(R,F,pt.Dd),ea[re](at,mt),ea[re](Dt,Wt),$t=ie,re=at,ce=mt,255&(pt=0|E)&&(170&pt?Zs($t,256,re,ce):so($t,256,re,ce)),pt=Dt,$t=Wt,255&(E>>=8)&&(170&E?Zs(ie,320,pt,$t):so(ie,320,pt,$t)),F<m.Ub-1&&(r(Ot[Ht].y,0,$,Q+480,16),r(Ot[Ht].f,0,at,mt+224,8),r(Ot[Ht].ea,0,Dt,Wt+224,8)),E=8*q*m.B,Ot=m.sa,Ht=m.ta+16*R+16*q*m.R,ie=m.qa,pt=m.ra+8*R+E,$t=m.Ha,re=m.Ia+8*R+E,E=0;16>E;++E)r(Ot,Ht+E*m.R,$,Q+32*E,16);for(E=0;8>E;++E)r(ie,pt+E*m.B,at,mt+32*E,8),r($t,re+E*m.B,Dt,Wt+32*E,8)}}function Js(m,v,E,R,F,q,$,Q,at){var mt=[0],Dt=[0],Wt=0,pt=at!=null?at.kd:0,Ot=at??new Bt;if(m==null||12>E)return 7;Ot.data=m,Ot.w=v,Ot.ha=E,v=[v],E=[E],Ot.gb=[Ot.gb];t:{var Ht=v,ie=E,$t=Ot.gb;if(t(m!=null),t(ie!=null),t($t!=null),$t[0]=0,12<=ie[0]&&!e(m,Ht[0],"RIFF")){if(e(m,Ht[0]+8,"WEBP")){$t=3;break t}var re=Ue(m,Ht[0]+4);if(12>re||4294967286<re){$t=3;break t}if(pt&&re>ie[0]-8){$t=7;break t}$t[0]=re,Ht[0]+=12,ie[0]-=12}$t=0}if($t!=0)return $t;for(re=0<Ot.gb[0],E=E[0];;){t:{var ce=m;ie=v,$t=E;var Se=mt,ge=Dt,Ze=Ht=[0];if((nn=Wt=[Wt])[0]=0,8>$t[0])$t=7;else{if(!e(ce,ie[0],"VP8X")){if(Ue(ce,ie[0]+4)!=10){$t=3;break t}if(18>$t[0]){$t=7;break t}var $e=Ue(ce,ie[0]+8),Dn=1+Ie(ce,ie[0]+12);if(2147483648<=Dn*(ce=1+Ie(ce,ie[0]+15))){$t=3;break t}Ze!=null&&(Ze[0]=$e),Se!=null&&(Se[0]=Dn),ge!=null&&(ge[0]=ce),ie[0]+=18,$t[0]-=18,nn[0]=1}$t=0}}if(Wt=Wt[0],Ht=Ht[0],$t!=0)return $t;if(ie=!!(2&Ht),!re&&Wt)return 3;if(q!=null&&(q[0]=!!(16&Ht)),$!=null&&($[0]=ie),Q!=null&&(Q[0]=0),$=mt[0],Ht=Dt[0],Wt&&ie&&at==null){$t=0;break}if(4>E){$t=7;break}if(re&&Wt||!re&&!Wt&&!e(m,v[0],"ALPH")){E=[E],Ot.na=[Ot.na],Ot.P=[Ot.P],Ot.Sa=[Ot.Sa];t:{$e=m,$t=v,re=E;var nn=Ot.gb;Se=Ot.na,ge=Ot.P,Ze=Ot.Sa,Dn=22,t($e!=null),t(re!=null),ce=$t[0];var Jn=re[0];for(t(Se!=null),t(Ze!=null),Se[0]=null,ge[0]=null,Ze[0]=0;;){if($t[0]=ce,re[0]=Jn,8>Jn){$t=7;break t}var jr=Ue($e,ce+4);if(4294967286<jr){$t=3;break t}var zn=8+jr+1&-2;if(Dn+=zn,0<nn&&Dn>nn){$t=3;break t}if(!e($e,ce,"VP8 ")||!e($e,ce,"VP8L")){$t=0;break t}if(Jn[0]<zn){$t=7;break t}e($e,ce,"ALPH")||(Se[0]=$e,ge[0]=ce+8,Ze[0]=jr),ce+=zn,Jn-=zn}}if(E=E[0],Ot.na=Ot.na[0],Ot.P=Ot.P[0],Ot.Sa=Ot.Sa[0],$t!=0)break}E=[E],Ot.Ja=[Ot.Ja],Ot.xa=[Ot.xa];t:if(nn=m,$t=v,re=E,Se=Ot.gb[0],ge=Ot.Ja,Ze=Ot.xa,$e=$t[0],ce=!e(nn,$e,"VP8 "),Dn=!e(nn,$e,"VP8L"),t(nn!=null),t(re!=null),t(ge!=null),t(Ze!=null),8>re[0])$t=7;else{if(ce||Dn){if(nn=Ue(nn,$e+4),12<=Se&&nn>Se-12){$t=3;break t}if(pt&&nn>re[0]-8){$t=7;break t}ge[0]=nn,$t[0]+=8,re[0]-=8,Ze[0]=Dn}else Ze[0]=5<=re[0]&&nn[$e+0]==47&&!(nn[$e+4]>>5),ge[0]=re[0];$t=0}if(E=E[0],Ot.Ja=Ot.Ja[0],Ot.xa=Ot.xa[0],v=v[0],$t!=0)break;if(4294967286<Ot.Ja)return 3;if(Q==null||ie||(Q[0]=Ot.xa?2:1),$=[$],Ht=[Ht],Ot.xa){if(5>E){$t=7;break}Q=$,pt=Ht,ie=q,m==null||5>E?m=0:5<=E&&m[v+0]==47&&!(m[v+4]>>5)?(re=[0],nn=[0],Se=[0],zt(ge=new X,m,v,E),to(ge,re,nn,Se)?(Q!=null&&(Q[0]=re[0]),pt!=null&&(pt[0]=nn[0]),ie!=null&&(ie[0]=Se[0]),m=1):m=0):m=0}else{if(10>E){$t=7;break}Q=Ht,m==null||10>E||!Po(m,v+3,E-3)?m=0:(pt=m[v+0]|m[v+1]<<8|m[v+2]<<16,ie=16383&(m[v+7]<<8|m[v+6]),m=16383&(m[v+9]<<8|m[v+8]),1&pt||3<(pt>>1&7)||!(pt>>4&1)||pt>>5>=Ot.Ja||!ie||!m?m=0:($&&($[0]=ie),Q&&(Q[0]=m),m=1))}if(!m||($=$[0],Ht=Ht[0],Wt&&(mt[0]!=$||Dt[0]!=Ht)))return 3;at!=null&&(at[0]=Ot,at.offset=v-at.w,t(4294967286>v-at.w),t(at.offset==at.ha-E));break}return $t==0||$t==7&&Wt&&at==null?(q!=null&&(q[0]|=Ot.na!=null&&0<Ot.na.length),R!=null&&(R[0]=$),F!=null&&(F[0]=Ht),0):$t}function pi(m,v,E){var R=v.width,F=v.height,q=0,$=0,Q=R,at=F;if(v.Da=m!=null&&0<m.Da,v.Da&&(Q=m.cd,at=m.bd,q=m.v,$=m.j,11>E||(q&=-2,$&=-2),0>q||0>$||0>=Q||0>=at||q+Q>R||$+at>F))return 0;if(v.v=q,v.j=$,v.va=q+Q,v.o=$+at,v.U=Q,v.T=at,v.da=m!=null&&0<m.da,v.da){if(!on(Q,at,E=[m.ib],q=[m.hb]))return 0;v.ib=E[0],v.hb=q[0]}return v.ob=m!=null&&m.ob,v.Kb=m==null||!m.Sd,v.da&&(v.ob=v.ib<3*R/4&&v.hb<3*F/4,v.Kb=0),1}function sl(m){if(m==null)return 2;if(11>m.S){var v=m.f.RGBA;v.fb+=(m.height-1)*v.A,v.A=-v.A}else v=m.f.kb,m=m.height,v.O+=(m-1)*v.fa,v.fa=-v.fa,v.N+=(m-1>>1)*v.Ab,v.Ab=-v.Ab,v.W+=(m-1>>1)*v.Db,v.Db=-v.Db,v.F!=null&&(v.J+=(m-1)*v.lb,v.lb=-v.lb);return 0}function ma(m,v,E,R){if(R==null||0>=m||0>=v)return 2;if(E!=null){if(E.Da){var F=E.cd,q=E.bd,$=-2&E.v,Q=-2&E.j;if(0>$||0>Q||0>=F||0>=q||$+F>m||Q+q>v)return 2;m=F,v=q}if(E.da){if(!on(m,v,F=[E.ib],q=[E.hb]))return 2;m=F[0],v=q[0]}}R.width=m,R.height=v;t:{var at=R.width,mt=R.height;if(m=R.S,0>=at||0>=mt||!(m>=$c&&13>m))m=2;else{if(0>=R.Rd&&R.sd==null){$=q=F=v=0;var Dt=(Q=at*Zc[m])*mt;if(11>m||(q=(mt+1)/2*(v=(at+1)/2),m==12&&($=(F=at)*mt)),(mt=s(Dt+2*q+$))==null){m=1;break t}R.sd=mt,11>m?((at=R.f.RGBA).eb=mt,at.fb=0,at.A=Q,at.size=Dt):((at=R.f.kb).y=mt,at.O=0,at.fa=Q,at.Fd=Dt,at.f=mt,at.N=0+Dt,at.Ab=v,at.Cd=q,at.ea=mt,at.W=0+Dt+q,at.Db=v,at.Ed=q,m==12&&(at.F=mt,at.J=0+Dt+2*q),at.Tc=$,at.lb=F)}if(v=1,F=R.S,q=R.width,$=R.height,F>=$c&&13>F)if(11>F)m=R.f.RGBA,v&=(Q=Math.abs(m.A))*($-1)+q<=m.size,v&=Q>=q*Zc[F],v&=m.eb!=null;else{m=R.f.kb,Q=(q+1)/2,Dt=($+1)/2,at=Math.abs(m.fa),mt=Math.abs(m.Ab);var Wt=Math.abs(m.Db),pt=Math.abs(m.lb),Ot=pt*($-1)+q;v&=at*($-1)+q<=m.Fd,v&=mt*(Dt-1)+Q<=m.Cd,v=(v&=Wt*(Dt-1)+Q<=m.Ed)&at>=q&mt>=Q&Wt>=Q,v&=m.y!=null,v&=m.f!=null,v&=m.ea!=null,F==12&&(v&=pt>=q,v&=Ot<=m.Tc,v&=m.F!=null)}else v=0;m=v?0:2}}return m!=0||E!=null&&E.fd&&(m=sl(R)),m}var al=64,xo=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],ji=24,_i=32,Qr=8,Fa=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];Te("Predictor0","PredictorAdd0"),ot.Predictor0=function(){return 4278190080},ot.Predictor1=function(m){return m},ot.Predictor2=function(m,v,E){return v[E+0]},ot.Predictor3=function(m,v,E){return v[E+1]},ot.Predictor4=function(m,v,E){return v[E-1]},ot.Predictor5=function(m,v,E){return Ye(Ye(m,v[E+1]),v[E+0])},ot.Predictor6=function(m,v,E){return Ye(m,v[E-1])},ot.Predictor7=function(m,v,E){return Ye(m,v[E+0])},ot.Predictor8=function(m,v,E){return Ye(v[E-1],v[E+0])},ot.Predictor9=function(m,v,E){return Ye(v[E+0],v[E+1])},ot.Predictor10=function(m,v,E){return Ye(Ye(m,v[E-1]),Ye(v[E+0],v[E+1]))},ot.Predictor11=function(m,v,E){var R=v[E+0];return 0>=wn(R>>24&255,m>>24&255,(v=v[E-1])>>24&255)+wn(R>>16&255,m>>16&255,v>>16&255)+wn(R>>8&255,m>>8&255,v>>8&255)+wn(255&R,255&m,255&v)?R:m},ot.Predictor12=function(m,v,E){var R=v[E+0];return(hn((m>>24&255)+(R>>24&255)-((v=v[E-1])>>24&255))<<24|hn((m>>16&255)+(R>>16&255)-(v>>16&255))<<16|hn((m>>8&255)+(R>>8&255)-(v>>8&255))<<8|hn((255&m)+(255&R)-(255&v)))>>>0},ot.Predictor13=function(m,v,E){var R=v[E-1];return(Pn((m=Ye(m,v[E+0]))>>24&255,R>>24&255)<<24|Pn(m>>16&255,R>>16&255)<<16|Pn(m>>8&255,R>>8&255)<<8|Pn(255&m,255&R))>>>0};var ga=ot.PredictorAdd0;ot.PredictorAdd1=Nn,Te("Predictor2","PredictorAdd2"),Te("Predictor3","PredictorAdd3"),Te("Predictor4","PredictorAdd4"),Te("Predictor5","PredictorAdd5"),Te("Predictor6","PredictorAdd6"),Te("Predictor7","PredictorAdd7"),Te("Predictor8","PredictorAdd8"),Te("Predictor9","PredictorAdd9"),Te("Predictor10","PredictorAdd10"),Te("Predictor11","PredictorAdd11"),Te("Predictor12","PredictorAdd12"),Te("Predictor13","PredictorAdd13");var ya=ot.PredictorAdd2;je("ColorIndexInverseTransform","MapARGB","32b",function(m){return m>>8&255},function(m){return m}),je("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(m){return m},function(m){return m>>8&255});var Me,Wi=ot.ColorIndexInverseTransform,bi=ot.MapARGB,Uc=ot.VP8LColorIndexInverseTransformAlpha,mi=ot.MapAlpha,ro=ot.VP8LPredictorsAdd=[];ro.length=16,(ot.VP8LPredictors=[]).length=16,(ot.VP8LPredictorsAdd_C=[]).length=16,(ot.VP8LPredictors_C=[]).length=16;var ll,Fl,gc,Ul,ba,cl,is,Ds,io,Zs,oo,so,yr,Mr,ti,Dr,ss,Hl,ul,Hc,wf,cd,Nu,Sf,fl,as,yc,Ho,dl=s(511),qc=s(2041),bc=s(225),xc=s(767),Yc=0,xa=qc,vc=bc,ao=xc,Xi=dl,$c=0,vo=1,Vc=2,ls=3,wc=4,Qs=5,Ua=6,Sc=7,Wc=8,ql=9,Yl=10,wo=[2,3,7],$l=[3,3,11],Ls=[280,256,256,256,40],Xc=[0,1,1,1,0],kc=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],cs=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],us=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Ha=8,fs=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],ds=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],xi=null,Gc=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],ta=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],Vl=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],ud=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],lo=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],Lr=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],tr=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],Lo=[],ei=[],ea=[],na=1,hl=2,ra=[],Bi=[];Do("UpsampleRgbLinePair",Xs,3),Do("UpsampleBgrLinePair",zl,3),Do("UpsampleRgbaLinePair",pc,4),Do("UpsampleBgraLinePair",rs,4),Do("UpsampleArgbLinePair",Gs,4),Do("UpsampleRgba4444LinePair",Vi,2),Do("UpsampleRgb565LinePair",za,2);var va=ot.UpsampleRgbLinePair,kf=ot.UpsampleBgrLinePair,Ac=ot.UpsampleRgbaLinePair,Kc=ot.UpsampleBgraLinePair,qa=ot.UpsampleArgbLinePair,wa=ot.UpsampleRgba4444LinePair,hs=ot.UpsampleRgb565LinePair,Rs=16,Wl=1<<Rs-1,Gi=-227,Sa=482,Jc=6,pl=0,Di=s(256),Mc=s(256),_u=s(256),ah=s(256),Cc=s(Sa-Gi),fd=s(Sa-Gi);Ks("YuvToRgbRow",Xs,3),Ks("YuvToBgrRow",zl,3),Ks("YuvToRgbaRow",pc,4),Ks("YuvToBgraRow",rs,4),Ks("YuvToArgbRow",Gs,4),Ks("YuvToRgba4444Row",Vi,2),Ks("YuvToRgb565Row",za,2);var Vr=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],ka=[0,2,8],ml=[8,7,6,4,4,2,2,2,1,1,1,1],Xl=1;this.WebPDecodeRGBA=function(m,v,E,R,F){var q=vo,$=new Tt,Q=new He;$.ba=Q,Q.S=q,Q.width=[Q.width],Q.height=[Q.height];var at=Q.width,mt=Q.height,Dt=new Pe;if(Dt==null||m==null)var Wt=2;else t(Dt!=null),Wt=Js(m,v,E,Dt.width,Dt.height,Dt.Pd,Dt.Qd,Dt.format,null);if(Wt!=0?at=0:(at!=null&&(at[0]=Dt.width[0]),mt!=null&&(mt[0]=Dt.height[0]),at=1),at){Q.width=Q.width[0],Q.height=Q.height[0],R!=null&&(R[0]=Q.width),F!=null&&(F[0]=Q.height);t:{if(R=new yi,(F=new Bt).data=m,F.w=v,F.ha=E,F.kd=1,v=[0],t(F!=null),((m=Js(F.data,F.w,F.ha,null,null,null,v,null,F))==0||m==7)&&v[0]&&(m=4),(v=m)==0){if(t($!=null),R.data=F.data,R.w=F.w+F.offset,R.ha=F.ha-F.offset,R.put=Je,R.ac=Go,R.bc=Ss,R.ma=$,F.xa){if((m=Oa())==null){$=1;break t}if((function(pt,Ot){var Ht=[0],ie=[0],$t=[0];e:for(;;){if(pt==null)return 0;if(Ot==null)return pt.a=2,0;if(pt.l=Ot,pt.a=0,zt(pt.m,Ot.data,Ot.w,Ot.ha),!to(pt.m,Ht,ie,$t)){pt.a=3;break e}if(pt.xb=hl,Ot.width=Ht[0],Ot.height=ie[0],!Zo(Ht[0],ie[0],1,pt,null))break e;return 1}return t(pt.a!=0),0})(m,R)){if(R=(v=ma(R.width,R.height,$.Oa,$.ba))==0){e:{R=m;n:for(;;){if(R==null){R=0;break e}if(t(R.s.yc!=null),t(R.s.Ya!=null),t(0<R.s.Wb),t((E=R.l)!=null),t((F=E.ma)!=null),R.xb!=0){if(R.ca=F.ba,R.tb=F.tb,t(R.ca!=null),!pi(F.Oa,E,ls)){R.a=2;break n}if(!To(R,E.width)||E.da)break n;if((E.da||ve(R.ca.S))&&an(),11>R.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),R.ca.f.kb.F!=null&&an()),R.Pb&&0<R.s.ua&&R.s.vb.X==null&&!ft(R.s.vb,R.s.Wa.Xa)){R.a=1;break n}R.xb=0}if(!Jo(R,R.V,R.Ba,R.c,R.i,E.o,gi))break n;F.Dc=R.Ma,R=1;break e}t(R.a!=0),R=0}R=!R}R&&(v=m.a)}else v=m.a}else{if((m=new Ni)==null){$=1;break t}if(m.Fa=F.na,m.P=F.P,m.qc=F.Sa,fr(m,R)){if((v=ma(R.width,R.height,$.Oa,$.ba))==0){if(m.Aa=0,E=$.Oa,t((F=m)!=null),E!=null){if(0<(at=0>(at=E.Md)?0:100<at?255:255*at/100)){for(mt=Dt=0;4>mt;++mt)12>(Wt=F.pb[mt]).lc&&(Wt.ia=at*ml[0>Wt.lc?0:Wt.lc]>>3),Dt|=Wt.ia;Dt&&(alert("todo:VP8InitRandom"),F.ia=1)}F.Ga=E.Id,100<F.Ga?F.Ga=100:0>F.Ga&&(F.Ga=0)}(function(pt,Ot){if(pt==null)return 0;if(Ot==null)return Fn(pt,2,"NULL VP8Io parameter in VP8Decode().");if(!pt.cb&&!fr(pt,Ot))return 0;if(t(pt.cb),Ot.ac==null||Ot.ac(Ot)){Ot.ob&&(pt.L=0);var Ht=ka[pt.L];if(pt.L==2?(pt.yb=0,pt.zb=0):(pt.yb=Ot.v-Ht>>4,pt.zb=Ot.j-Ht>>4,0>pt.yb&&(pt.yb=0),0>pt.zb&&(pt.zb=0)),pt.Va=Ot.o+15+Ht>>4,pt.Hb=Ot.va+15+Ht>>4,pt.Hb>pt.za&&(pt.Hb=pt.za),pt.Va>pt.Ub&&(pt.Va=pt.Ub),0<pt.L){var ie=pt.ed;for(Ht=0;4>Ht;++Ht){var $t;if(pt.Qa.Cb){var re=pt.Qa.Lb[Ht];pt.Qa.Fb||(re+=ie.Tb)}else re=ie.Tb;for($t=0;1>=$t;++$t){var ce=pt.gd[Ht][$t],Se=re;if(ie.Pc&&(Se+=ie.vd[0],$t&&(Se+=ie.od[0])),0<(Se=0>Se?0:63<Se?63:Se)){var ge=Se;0<ie.wb&&(ge=4<ie.wb?ge>>2:ge>>1)>9-ie.wb&&(ge=9-ie.wb),1>ge&&(ge=1),ce.dd=ge,ce.tc=2*Se+ge,ce.ld=40<=Se?2:15<=Se?1:0}else ce.tc=0;ce.La=$t}}}Ht=0}else Fn(pt,6,"Frame setup failed"),Ht=pt.a;if(Ht=Ht==0){if(Ht){pt.$c=0,0<pt.Aa||(pt.Ic=Xl);e:{Ht=pt.Ic,ie=4*(ge=pt.za);var Ze=32*ge,$e=ge+1,Dn=0<pt.L?ge*(0<pt.Aa?2:1):0,nn=(pt.Aa==2?2:1)*ge;if((ce=ie+832+($t=3*(16*Ht+ka[pt.L])/2*Ze)+(re=pt.Fa!=null&&0<pt.Fa.length?pt.Kc.c*pt.Kc.i:0))!=ce)Ht=0;else{if(ce>pt.Vb){if(pt.Vb=0,pt.Ec=s(ce),pt.Fc=0,pt.Ec==null){Ht=Fn(pt,1,"no memory during frame initialization.");break e}pt.Vb=ce}ce=pt.Ec,Se=pt.Fc,pt.Ac=ce,pt.Bc=Se,Se+=ie,pt.Gd=l(Ze,Bc),pt.Hd=0,pt.rb=l($e+1,qr),pt.sb=1,pt.wa=Dn?l(Dn,Pi):null,pt.Y=0,pt.D.Nb=0,pt.D.wa=pt.wa,pt.D.Y=pt.Y,0<pt.Aa&&(pt.D.Y+=ge),t(!0),pt.oc=ce,pt.pc=Se,Se+=832,pt.ya=l(nn,Rl),pt.aa=0,pt.D.ya=pt.ya,pt.D.aa=pt.aa,pt.Aa==2&&(pt.D.aa+=ge),pt.R=16*ge,pt.B=8*ge,ge=(Ze=ka[pt.L])*pt.R,Ze=Ze/2*pt.B,pt.sa=ce,pt.ta=Se+ge,pt.qa=pt.sa,pt.ra=pt.ta+16*Ht*pt.R+Ze,pt.Ha=pt.qa,pt.Ia=pt.ra+8*Ht*pt.B+Ze,pt.$c=0,Se+=$t,pt.mb=re?ce:null,pt.nb=re?Se:null,t(Se+re<=pt.Fc+pt.Vb),qi(pt),i(pt.Ac,pt.Bc,0,ie),Ht=1}}if(Ht){if(Ot.ka=0,Ot.y=pt.sa,Ot.O=pt.ta,Ot.f=pt.qa,Ot.N=pt.ra,Ot.ea=pt.Ha,Ot.Vd=pt.Ia,Ot.fa=pt.R,Ot.Rc=pt.B,Ot.F=null,Ot.J=0,!Yc){for(Ht=-255;255>=Ht;++Ht)dl[255+Ht]=0>Ht?-Ht:Ht;for(Ht=-1020;1020>=Ht;++Ht)qc[1020+Ht]=-128>Ht?-128:127<Ht?127:Ht;for(Ht=-112;112>=Ht;++Ht)bc[112+Ht]=-16>Ht?-16:15<Ht?15:Ht;for(Ht=-255;510>=Ht;++Ht)xc[255+Ht]=0>Ht?0:255<Ht?255:Ht;Yc=1}is=Io,Ds=te,Zs=el,oo=Pa,so=$s,io=Ys,yr=Il,Mr=Ba,ti=Bl,Dr=A,ss=jl,Hl=pa,ul=B,Hc=ht,wf=Vs,cd=Ts,Nu=Ns,Sf=rl,ei[0]=hc,ei[1]=Pl,ei[2]=dc,ei[3]=xr,ei[4]=ua,ei[5]=Fo,ei[6]=zo,ei[7]=Yi,ei[8]=nl,ei[9]=No,Lo[0]=Bo,Lo[1]=cc,Lo[2]=Tu,Lo[3]=uc,Lo[4]=ts,Lo[5]=fc,Lo[6]=es,ea[0]=ja,ea[1]=lc,ea[2]=Cs,ea[3]=Ia,ea[4]=Ii,ea[5]=fa,ea[6]=_o,Ht=1}else Ht=0}Ht&&(Ht=(function(Jn,jr){for(Jn.M=0;Jn.M<Jn.Va;++Jn.M){var zn,Ve=Jn.Jc[Jn.M&Jn.Xb],Oe=Jn.m,ni=Jn;for(zn=0;zn<ni.za;++zn){var Mn=Oe,jn=ni,kr=jn.Ac,zi=jn.Bc+4*zn,Fi=jn.zc,Rr=jn.ya[jn.aa+zn];if(jn.Qa.Bb?Rr.$b=Zt(Mn,jn.Pa.jb[0])?2+Zt(Mn,jn.Pa.jb[2]):Zt(Mn,jn.Pa.jb[1]):Rr.$b=0,jn.kc&&(Rr.Ad=Zt(Mn,jn.Bd)),Rr.Za=!Zt(Mn,145)+0,Rr.Za){var ri=Rr.Ob,Ui=0;for(jn=0;4>jn;++jn){var ii,Un=Fi[0+jn];for(ii=0;4>ii;++ii){Un=lo[kr[zi+ii]][Un];for(var kn=Vl[Zt(Mn,Un[0])];0<kn;)kn=Vl[2*kn+Zt(Mn,Un[kn])];Un=-kn,kr[zi+ii]=Un}r(ri,Ui,kr,zi,4),Ui+=4,Fi[0+jn]=Un}}else Un=Zt(Mn,156)?Zt(Mn,128)?1:3:Zt(Mn,163)?2:0,Rr.Ob[0]=Un,i(kr,zi,Un,4),i(Fi,0,Un,4);Rr.Dd=Zt(Mn,142)?Zt(Mn,114)?Zt(Mn,183)?1:3:2:0}if(ni.m.Ka)return Fn(Jn,7,"Premature end-of-partition0 encountered.");for(;Jn.ja<Jn.za;++Jn.ja){if(ni=Ve,Mn=(Oe=Jn).rb[Oe.sb-1],kr=Oe.rb[Oe.sb+Oe.ja],zn=Oe.ya[Oe.aa+Oe.ja],zi=Oe.kc?zn.Ad:0)Mn.la=kr.la=0,zn.Za||(Mn.Na=kr.Na=0),zn.Hc=0,zn.Gc=0,zn.ia=0;else{var Nr,er;if(Mn=kr,kr=ni,zi=Oe.Pa.Xc,Fi=Oe.ya[Oe.aa+Oe.ja],Rr=Oe.pb[Fi.$b],jn=Fi.ad,ri=0,Ui=Oe.rb[Oe.sb-1],Un=ii=0,i(jn,ri,0,384),Fi.Za)var w=0,k=zi[3];else{kn=s(16);var _=Mn.Na+Ui.Na;if(_=xi(kr,zi[1],_,Rr.Eb,0,kn,0),Mn.Na=Ui.Na=(0<_)+0,1<_)is(kn,0,jn,ri);else{var N=kn[0]+3>>3;for(kn=0;256>kn;kn+=16)jn[ri+kn]=N}w=1,k=zi[0]}var j=15&Mn.la,G=15&Ui.la;for(kn=0;4>kn;++kn){var nt=1&G;for(N=er=0;4>N;++N)j=j>>1|(nt=(_=xi(kr,k,_=nt+(1&j),Rr.Sc,w,jn,ri))>w)<<7,er=er<<2|(3<_?3:1<_?2:jn[ri+0]!=0),ri+=16;j>>=4,G=G>>1|nt<<7,ii=(ii<<8|er)>>>0}for(k=j,w=G>>4,Nr=0;4>Nr;Nr+=2){for(er=0,j=Mn.la>>4+Nr,G=Ui.la>>4+Nr,kn=0;2>kn;++kn){for(nt=1&G,N=0;2>N;++N)_=nt+(1&j),j=j>>1|(nt=0<(_=xi(kr,zi[2],_,Rr.Qc,0,jn,ri)))<<3,er=er<<2|(3<_?3:1<_?2:jn[ri+0]!=0),ri+=16;j>>=2,G=G>>1|nt<<5}Un|=er<<4*Nr,k|=j<<4<<Nr,w|=(240&G)<<Nr}Mn.la=k,Ui.la=w,Fi.Hc=ii,Fi.Gc=Un,Fi.ia=43690&Un?0:Rr.ia,zi=!(ii|Un)}if(0<Oe.L&&(Oe.wa[Oe.Y+Oe.ja]=Oe.gd[zn.$b][zn.Za],Oe.wa[Oe.Y+Oe.ja].La|=!zi),ni.Ka)return Fn(Jn,7,"Premature end-of-file encountered.")}if(qi(Jn),Oe=jr,ni=1,zn=(Ve=Jn).D,Mn=0<Ve.L&&Ve.M>=Ve.zb&&Ve.M<=Ve.Va,Ve.Aa==0)e:{if(zn.M=Ve.M,zn.uc=Mn,ol(Ve,zn),ni=1,zn=(er=Ve.D).Nb,Mn=(Un=ka[Ve.L])*Ve.R,kr=Un/2*Ve.B,kn=16*zn*Ve.R,N=8*zn*Ve.B,zi=Ve.sa,Fi=Ve.ta-Mn+kn,Rr=Ve.qa,jn=Ve.ra-kr+N,ri=Ve.Ha,Ui=Ve.Ia-kr+N,G=(j=er.M)==0,ii=j>=Ve.Va-1,Ve.Aa==2&&ol(Ve,er),er.uc)for(nt=(_=Ve).D.M,t(_.D.uc),er=_.yb;er<_.Hb;++er){w=er,k=nt;var z=(J=(yt=_).D).Nb;Nr=yt.R;var J=J.wa[J.Y+w],ut=yt.sa,it=yt.ta+16*z*Nr+16*w,rt=J.dd,I=J.tc;if(I!=0)if(t(3<=I),yt.L==1)0<w&&cd(ut,it,Nr,I+4),J.La&&Sf(ut,it,Nr,I),0<k&&wf(ut,it,Nr,I+4),J.La&&Nu(ut,it,Nr,I);else{var Mt=yt.B,It=yt.qa,wt=yt.ra+8*z*Mt+8*w,Et=yt.Ha,yt=yt.Ia+8*z*Mt+8*w;z=J.ld,0<w&&(Mr(ut,it,Nr,I+4,rt,z),Dr(It,wt,Et,yt,Mt,I+4,rt,z)),J.La&&(Hl(ut,it,Nr,I,rt,z),Hc(It,wt,Et,yt,Mt,I,rt,z)),0<k&&(yr(ut,it,Nr,I+4,rt,z),ti(It,wt,Et,yt,Mt,I+4,rt,z)),J.La&&(ss(ut,it,Nr,I,rt,z),ul(It,wt,Et,yt,Mt,I,rt,z))}}if(Ve.ia&&alert("todo:DitherRow"),Oe.put!=null){if(er=16*j,j=16*(j+1),G?(Oe.y=Ve.sa,Oe.O=Ve.ta+kn,Oe.f=Ve.qa,Oe.N=Ve.ra+N,Oe.ea=Ve.Ha,Oe.W=Ve.Ia+N):(er-=Un,Oe.y=zi,Oe.O=Fi,Oe.f=Rr,Oe.N=jn,Oe.ea=ri,Oe.W=Ui),ii||(j-=Un),j>Oe.o&&(j=Oe.o),Oe.F=null,Oe.J=null,Ve.Fa!=null&&0<Ve.Fa.length&&er<j&&(Oe.J=$i(Ve,Oe,er,j-er),Oe.F=Ve.mb,Oe.F==null&&Oe.F.length==0)){ni=Fn(Ve,3,"Could not decode alpha data.");break e}er<Oe.j&&(Un=Oe.j-er,er=Oe.j,t(!(1&Un)),Oe.O+=Ve.R*Un,Oe.N+=Ve.B*(Un>>1),Oe.W+=Ve.B*(Un>>1),Oe.F!=null&&(Oe.J+=Oe.width*Un)),er<j&&(Oe.O+=Oe.v,Oe.N+=Oe.v>>1,Oe.W+=Oe.v>>1,Oe.F!=null&&(Oe.J+=Oe.v),Oe.ka=er-Oe.j,Oe.U=Oe.va-Oe.v,Oe.T=j-er,ni=Oe.put(Oe))}zn+1!=Ve.Ic||ii||(r(Ve.sa,Ve.ta-Mn,zi,Fi+16*Ve.R,Mn),r(Ve.qa,Ve.ra-kr,Rr,jn+8*Ve.B,kr),r(Ve.Ha,Ve.Ia-kr,ri,Ui+8*Ve.B,kr))}if(!ni)return Fn(Jn,6,"Output aborted.")}return 1})(pt,Ot)),Ot.bc!=null&&Ot.bc(Ot),Ht&=1}return Ht?(pt.cb=0,Ht):0})(m,R)||(v=m.a)}}else v=m.a}v==0&&$.Oa!=null&&$.Oa.fd&&(v=sl($.ba))}$=v}q=$!=0?null:11>q?Q.f.RGBA.eb:Q.f.kb.y}else q=null;return q};var Zc=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(ot,jt){for(var Z="",ct=0;ct<4;ct++)Z+=String.fromCharCode(ot[jt++]);return Z}function p(ot,jt){return ot[jt+0]|ot[jt+1]<<8}function g(ot,jt){return(ot[jt+0]|ot[jt+1]<<8|ot[jt+2]<<16)>>>0}function b(ot,jt){return(ot[jt+0]|ot[jt+1]<<8|ot[jt+2]<<16|ot[jt+3]<<24)>>>0}new f;var y=[0],M=[0],C=[],D=new f,L=n,H=(function(ot,jt){var Z={},ct=0,V=!1,xt=0,Lt=0;if(Z.frames=[],!(function(P,X){for(var tt=0;tt<4;tt++)if(P[X+tt]!="RIFF".charCodeAt(tt))return!0;return!1})(ot,jt)){for(b(ot,jt+=4),jt+=8;jt<ot.length;){var dt=d(ot,jt),st=b(ot,jt+=4);jt+=4;var lt=st+(1&st);switch(dt){case"VP8 ":case"VP8L":Z.frames[ct]===void 0&&(Z.frames[ct]={}),(K=Z.frames[ct]).src_off=V?Lt:jt-8,K.src_size=xt+st+8,ct++,V&&(V=!1,xt=0,Lt=0);break;case"VP8X":(K=Z.header={}).feature_flags=ot[jt];var zt=jt+4;K.canvas_width=1+g(ot,zt),zt+=3,K.canvas_height=1+g(ot,zt),zt+=3;break;case"ALPH":V=!0,xt=lt+8,Lt=jt-8;break;case"ANIM":(K=Z.header).bgcolor=b(ot,jt),zt=jt+4,K.loop_count=p(ot,zt),zt+=2;break;case"ANMF":var At,K;(K=Z.frames[ct]={}).offset_x=2*g(ot,jt),jt+=3,K.offset_y=2*g(ot,jt),jt+=3,K.width=1+g(ot,jt),jt+=3,K.height=1+g(ot,jt),jt+=3,K.duration=g(ot,jt),jt+=3,At=ot[jt++],K.dispose=1&At,K.blend=At>>1&1}dt!="ANMF"&&(jt+=lt)}return Z}})(L,0);H.response=L,H.rgbaoutput=!0,H.dataurl=!1;var Y=H.header?H.header:null,W=H.frames?H.frames:null;if(Y){Y.loop_counter=Y.loop_count,y=[Y.canvas_height],M=[Y.canvas_width];for(var St=0;St<W.length&&W[St].blend!=0;St++);}var _t=W[0],Ct=D.WebPDecodeRGBA(L,_t.src_off,_t.src_size,M,y);_t.rgba=Ct,_t.imgwidth=M[0],_t.imgheight=y[0];for(var bt=0;bt<M[0]*y[0]*4;bt++)C[bt]=Ct[bt];return this.width=M,this.height=y,this.data=C,this}function ON(){var n,t=this.internal.__metadata__.metadata,e=unescape(encodeURIComponent(t));n=this.internal.__metadata__.rawXml?e:'<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceUri+'"><jspdf:metadata>'+e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+"</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>",this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+n.length+" >>"),this.internal.write("stream"),this.internal.write(n),this.internal.write("endstream"),this.internal.write("endobj")}function PN(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(n){var t,e,r,i,s,l,c,f,d,p=function(P){return P=P||{},this.isStrokeTransparent=P.isStrokeTransparent||!1,this.strokeOpacity=P.strokeOpacity||1,this.strokeStyle=P.strokeStyle||"#000000",this.fillStyle=P.fillStyle||"#000000",this.isFillTransparent=P.isFillTransparent||!1,this.fillOpacity=P.fillOpacity||1,this.font=P.font||"10px sans-serif",this.textBaseline=P.textBaseline||"alphabetic",this.textAlign=P.textAlign||"left",this.lineWidth=P.lineWidth||1,this.lineJoin=P.lineJoin||"miter",this.lineCap=P.lineCap||"butt",this.path=P.path||[],this.transform=P.transform!==void 0?P.transform.clone():new f,this.globalCompositeOperation=P.globalCompositeOperation||"normal",this.globalAlpha=P.globalAlpha||1,this.clip_path=P.clip_path||[],this.currentPoint=P.currentPoint||new l,this.miterLimit=P.miterLimit||10,this.lastPoint=P.lastPoint||new l,this.lineDashOffset=P.lineDashOffset||0,this.lineDash=P.lineDash||[],this.margin=P.margin||[0,0,0,0],this.prevPageLastElemOffset=P.prevPageLastElemOffset||0,this.ignoreClearRect=typeof P.ignoreClearRect!="boolean"||P.ignoreClearRect,this};n.events.push(["initialized",function(){this.context2d=new g(this),t=this.internal.f2,e=this.internal.getCoordinateString,r=this.internal.getVerticalCoordinateString,i=this.internal.getHorizontalCoordinate,s=this.internal.getVerticalCoordinate,l=this.internal.Point,c=this.internal.Rectangle,f=this.internal.Matrix,d=new p}]);var g=function(P){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var X=P;Object.defineProperty(this,"pdf",{get:function(){return X}});var tt=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return tt},set:function(ft){tt=!!ft}});var gt=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return gt},set:function(ft){gt=!!ft}});var vt=0;Object.defineProperty(this,"posX",{get:function(){return vt},set:function(ft){isNaN(ft)||(vt=ft)}});var kt=0;Object.defineProperty(this,"posY",{get:function(){return kt},set:function(ft){isNaN(ft)||(kt=ft)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(ft){var Re;typeof ft=="number"?Re=[ft,ft,ft,ft]:((Re=new Array(4))[0]=ft[0],Re[1]=ft.length>=2?ft[1]:Re[0],Re[2]=ft.length>=3?ft[2]:Re[0],Re[3]=ft.length>=4?ft[3]:Re[1]),d.margin=Re}});var qt=!1;Object.defineProperty(this,"autoPaging",{get:function(){return qt},set:function(ft){qt=ft}});var Rt=0;Object.defineProperty(this,"lastBreak",{get:function(){return Rt},set:function(ft){Rt=ft}});var Zt=[];Object.defineProperty(this,"pageBreaks",{get:function(){return Zt},set:function(ft){Zt=ft}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(ft){ft instanceof p&&(d=ft)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(ft){d.path=ft}});var Ae=[];Object.defineProperty(this,"ctxStack",{get:function(){return Ae},set:function(ft){Ae=ft}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(ft){var Re;Re=b(ft),this.ctx.fillStyle=Re.style,this.ctx.isFillTransparent=Re.a===0,this.ctx.fillOpacity=Re.a,this.pdf.setFillColor(Re.r,Re.g,Re.b,{a:Re.a}),this.pdf.setTextColor(Re.r,Re.g,Re.b,{a:Re.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(ft){var Re=b(ft);this.ctx.strokeStyle=Re.style,this.ctx.isStrokeTransparent=Re.a===0,this.ctx.strokeOpacity=Re.a,Re.a===0?this.pdf.setDrawColor(255,255,255):(Re.a,this.pdf.setDrawColor(Re.r,Re.g,Re.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(ft){["butt","round","square"].indexOf(ft)!==-1&&(this.ctx.lineCap=ft,this.pdf.setLineCap(ft))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(ft){isNaN(ft)||(this.ctx.lineWidth=ft,this.pdf.setLineWidth(ft))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(ft){["bevel","round","miter"].indexOf(ft)!==-1&&(this.ctx.lineJoin=ft,this.pdf.setLineJoin(ft))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(ft){isNaN(ft)||(this.ctx.miterLimit=ft,this.pdf.setMiterLimit(ft))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(ft){this.ctx.textBaseline=ft}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(ft){["right","end","center","left","start"].indexOf(ft)!==-1&&(this.ctx.textAlign=ft)}});var le=null,Ie=null,Ue=null;Object.defineProperty(this,"fontFaces",{get:function(){return Ue},set:function(ft){le=null,Ie=null,Ue=ft}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(ft){var Re;if(this.ctx.font=ft,(Re=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(ft))!==null){var rn=Re[1];Re[2];var on=Re[3],be=Re[4];Re[5];var _e=Re[6],Te=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(be)[2];be=Math.floor(Te==="px"?parseFloat(be)*this.pdf.internal.scaleFactor:Te==="em"?parseFloat(be)*this.pdf.getFontSize():parseFloat(be)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(be);var Le=(function(je){var ur,bn,cn=[],pn=je.trim();if(pn==="")return iy;if(pn in bw)return[bw[pn]];for(;pn!=="";){switch(bn=null,ur=(pn=vw(pn)).charAt(0)){case'"':case"'":bn=TN(pn.substring(1),ur);break;default:bn=NN(pn)}if(bn===null||(cn.push(bn[0]),(pn=vw(bn[1]))!==""&&pn.charAt(0)!==","))return iy;pn=pn.replace(/^,/,"")}return cn})(_e);if(this.fontFaces){var Ye=(function(je,ur){var bn=je.getFontList(),cn=JSON.stringify(bn);if(le===null||Ie!==cn){var pn=(function($n){var en=[];return Object.keys($n).forEach(function(Qt){$n[Qt].forEach(function(ve){var me=null;switch(ve){case"bold":me={family:Qt,weight:"bold"};break;case"italic":me={family:Qt,style:"italic"};break;case"bolditalic":me={family:Qt,weight:"bold",style:"italic"};break;case"":case"normal":me={family:Qt}}me!==null&&(me.ref={name:Qt,style:ve},en.push(me))})}),en})(bn);le=(function($n){for(var en={},Qt=0;Qt<$n.length;++Qt){var ve=ry($n[Qt]),me=ve.family,We=ve.stretch,He=ve.style,Pe=ve.weight;en[me]=en[me]||{},en[me][We]=en[me][We]||{},en[me][We][He]=en[me][We][He]||{},en[me][We][He][Pe]=ve}return en})(pn.concat(ur)),Ie=cn}return le})(this.pdf,this.fontFaces),hn=Le.map(function(je){return{family:je,stretch:"normal",weight:on,style:rn}}),Pn=(function(je,ur,bn){for(var cn=(bn=bn||{}).defaultFontFamily||"times",pn=Object.assign({},EN,bn.genericFontFamilies||{}),$n=null,en=null,Qt=0;Qt<ur.length;++Qt)if(pn[($n=ry(ur[Qt])).family]&&($n.family=pn[$n.family]),je.hasOwnProperty($n.family)){en=je[$n.family];break}if(!(en=en||je[cn]))throw new Error("Could not find a font-family for the rule '"+xw($n)+"' and default family '"+cn+"'.");if(en=(function(ve,me){if(me[ve])return me[ve];var We=c2[ve],He=We<=c2.normal?-1:1,Pe=yw(me,c4,We,He);if(!Pe)throw new Error("Could not find a matching font-stretch value for "+ve);return Pe})($n.stretch,en),en=(function(ve,me){if(me[ve])return me[ve];for(var We=l4[ve],He=0;He<We.length;++He)if(me[We[He]])return me[We[He]];throw new Error("Could not find a matching font-style for "+ve)})($n.style,en),!(en=(function(ve,me){if(me[ve])return me[ve];if(ve===400&&me[500])return me[500];if(ve===500&&me[400])return me[400];var We=CN[ve],He=yw(me,u4,We,ve<400?-1:1);if(!He)throw new Error("Could not find a matching font-weight for value "+ve);return He})($n.weight,en)))throw new Error("Failed to resolve a font for the rule '"+xw($n)+"'.");return en})(Ye,hn);this.pdf.setFont(Pn.ref.name,Pn.ref.style)}else{var wn="";(on==="bold"||parseInt(on,10)>=700||rn==="bold")&&(wn="bold"),rn==="italic"&&(wn+="italic"),wn.length===0&&(wn="normal");for(var Nn="",Sn={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},Be=0;Be<Le.length;Be++){if(this.pdf.internal.getFont(Le[Be],wn,{noFallback:!0,disableWarning:!0})!==void 0){Nn=Le[Be];break}if(wn==="bolditalic"&&this.pdf.internal.getFont(Le[Be],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Nn=Le[Be],wn="bold";else if(this.pdf.internal.getFont(Le[Be],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Nn=Le[Be],wn="normal";break}}if(Nn===""){for(var tn=0;tn<Le.length;tn++)if(Sn[Le[tn]]){Nn=Sn[Le[tn]];break}}Nn=Nn===""?"Times":Nn,this.pdf.setFont(Nn,wn)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(ft){this.ctx.globalCompositeOperation=ft}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(ft){this.ctx.globalAlpha=ft}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(ft){this.ctx.lineDashOffset=ft,K.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(ft){this.ctx.lineDash=ft,K.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(ft){this.ctx.ignoreClearRect=!!ft}})};g.prototype.setLineDash=function(P){this.lineDash=P},g.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},g.prototype.fill=function(){W.call(this,"fill",!1)},g.prototype.stroke=function(){W.call(this,"stroke",!1)},g.prototype.beginPath=function(){this.path=[{type:"begin"}]},g.prototype.moveTo=function(P,X){if(isNaN(P)||isNaN(X))throw ai.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var tt=this.ctx.transform.applyToPoint(new l(P,X));this.path.push({type:"mt",x:tt.x,y:tt.y}),this.ctx.lastPoint=new l(P,X)},g.prototype.closePath=function(){var P=new l(0,0),X=0;for(X=this.path.length-1;X!==-1;X--)if(this.path[X].type==="begin"&&Hr(this.path[X+1])==="object"&&typeof this.path[X+1].x=="number"){P=new l(this.path[X+1].x,this.path[X+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new l(P.x,P.y)},g.prototype.lineTo=function(P,X){if(isNaN(P)||isNaN(X))throw ai.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var tt=this.ctx.transform.applyToPoint(new l(P,X));this.path.push({type:"lt",x:tt.x,y:tt.y}),this.ctx.lastPoint=new l(tt.x,tt.y)},g.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),W.call(this,null,!0)},g.prototype.quadraticCurveTo=function(P,X,tt,gt){if(isNaN(tt)||isNaN(gt)||isNaN(P)||isNaN(X))throw ai.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var vt=this.ctx.transform.applyToPoint(new l(tt,gt)),kt=this.ctx.transform.applyToPoint(new l(P,X));this.path.push({type:"qct",x1:kt.x,y1:kt.y,x:vt.x,y:vt.y}),this.ctx.lastPoint=new l(vt.x,vt.y)},g.prototype.bezierCurveTo=function(P,X,tt,gt,vt,kt){if(isNaN(vt)||isNaN(kt)||isNaN(P)||isNaN(X)||isNaN(tt)||isNaN(gt))throw ai.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var qt=this.ctx.transform.applyToPoint(new l(vt,kt)),Rt=this.ctx.transform.applyToPoint(new l(P,X)),Zt=this.ctx.transform.applyToPoint(new l(tt,gt));this.path.push({type:"bct",x1:Rt.x,y1:Rt.y,x2:Zt.x,y2:Zt.y,x:qt.x,y:qt.y}),this.ctx.lastPoint=new l(qt.x,qt.y)},g.prototype.arc=function(P,X,tt,gt,vt,kt){if(isNaN(P)||isNaN(X)||isNaN(tt)||isNaN(gt)||isNaN(vt))throw ai.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(kt=!!kt,!this.ctx.transform.isIdentity){var qt=this.ctx.transform.applyToPoint(new l(P,X));P=qt.x,X=qt.y;var Rt=this.ctx.transform.applyToPoint(new l(0,tt)),Zt=this.ctx.transform.applyToPoint(new l(0,0));tt=Math.sqrt(Math.pow(Rt.x-Zt.x,2)+Math.pow(Rt.y-Zt.y,2))}Math.abs(vt-gt)>=2*Math.PI&&(gt=0,vt=2*Math.PI),this.path.push({type:"arc",x:P,y:X,radius:tt,startAngle:gt,endAngle:vt,counterclockwise:kt})},g.prototype.arcTo=function(P,X,tt,gt,vt){throw new Error("arcTo not implemented.")},g.prototype.rect=function(P,X,tt,gt){if(isNaN(P)||isNaN(X)||isNaN(tt)||isNaN(gt))throw ai.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(P,X),this.lineTo(P+tt,X),this.lineTo(P+tt,X+gt),this.lineTo(P,X+gt),this.lineTo(P,X),this.lineTo(P+tt,X),this.lineTo(P,X)},g.prototype.fillRect=function(P,X,tt,gt){if(isNaN(P)||isNaN(X)||isNaN(tt)||isNaN(gt))throw ai.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!y.call(this)){var vt={};this.lineCap!=="butt"&&(vt.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(vt.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(P,X,tt,gt),this.fill(),vt.hasOwnProperty("lineCap")&&(this.lineCap=vt.lineCap),vt.hasOwnProperty("lineJoin")&&(this.lineJoin=vt.lineJoin)}},g.prototype.strokeRect=function(P,X,tt,gt){if(isNaN(P)||isNaN(X)||isNaN(tt)||isNaN(gt))throw ai.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");M.call(this)||(this.beginPath(),this.rect(P,X,tt,gt),this.stroke())},g.prototype.clearRect=function(P,X,tt,gt){if(isNaN(P)||isNaN(X)||isNaN(tt)||isNaN(gt))throw ai.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(P,X,tt,gt))},g.prototype.save=function(P){P=typeof P!="boolean"||P;for(var X=this.pdf.internal.getCurrentPageInfo().pageNumber,tt=0;tt<this.pdf.internal.getNumberOfPages();tt++)this.pdf.setPage(tt+1),this.pdf.internal.out("q");if(this.pdf.setPage(X),P){this.ctx.fontSize=this.pdf.internal.getFontSize();var gt=new p(this.ctx);this.ctxStack.push(this.ctx),this.ctx=gt}},g.prototype.restore=function(P){P=typeof P!="boolean"||P;for(var X=this.pdf.internal.getCurrentPageInfo().pageNumber,tt=0;tt<this.pdf.internal.getNumberOfPages();tt++)this.pdf.setPage(tt+1),this.pdf.internal.out("Q");this.pdf.setPage(X),P&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},g.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var b=function(P){var X,tt,gt,vt;if(P.isCanvasGradient===!0&&(P=P.getColor()),!P)return{r:0,g:0,b:0,a:0,style:P};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(P))X=0,tt=0,gt=0,vt=0;else{var kt=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(P);if(kt!==null)X=parseInt(kt[1]),tt=parseInt(kt[2]),gt=parseInt(kt[3]),vt=1;else if((kt=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(P))!==null)X=parseInt(kt[1]),tt=parseInt(kt[2]),gt=parseInt(kt[3]),vt=parseFloat(kt[4]);else{if(vt=1,typeof P=="string"&&P.charAt(0)!=="#"){var qt=new e4(P);P=qt.ok?qt.toHex():"#000000"}P.length===4?(X=P.substring(1,2),X+=X,tt=P.substring(2,3),tt+=tt,gt=P.substring(3,4),gt+=gt):(X=P.substring(1,3),tt=P.substring(3,5),gt=P.substring(5,7)),X=parseInt(X,16),tt=parseInt(tt,16),gt=parseInt(gt,16)}}return{r:X,g:tt,b:gt,a:vt,style:P}},y=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},M=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};g.prototype.fillText=function(P,X,tt,gt){if(isNaN(X)||isNaN(tt)||typeof P!="string")throw ai.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(gt=isNaN(gt)?void 0:gt,!y.call(this)){var vt=lt(this.ctx.transform.rotation),kt=this.ctx.transform.scaleX;ct.call(this,{text:P,x:X,y:tt,scale:kt,angle:vt,align:this.textAlign,maxWidth:gt})}},g.prototype.strokeText=function(P,X,tt,gt){if(isNaN(X)||isNaN(tt)||typeof P!="string")throw ai.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!M.call(this)){gt=isNaN(gt)?void 0:gt;var vt=lt(this.ctx.transform.rotation),kt=this.ctx.transform.scaleX;ct.call(this,{text:P,x:X,y:tt,scale:kt,renderingMode:"stroke",angle:vt,align:this.textAlign,maxWidth:gt})}},g.prototype.measureText=function(P){if(typeof P!="string")throw ai.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var X=this.pdf,tt=this.pdf.internal.scaleFactor,gt=X.internal.getFontSize(),vt=X.getStringUnitWidth(P)*gt/X.internal.scaleFactor;return new function(kt){var qt=(kt=kt||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return qt}}),this}({width:vt*=Math.round(96*tt/72*1e4)/1e4})},g.prototype.scale=function(P,X){if(isNaN(P)||isNaN(X))throw ai.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var tt=new f(P,0,0,X,0,0);this.ctx.transform=this.ctx.transform.multiply(tt)},g.prototype.rotate=function(P){if(isNaN(P))throw ai.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var X=new f(Math.cos(P),Math.sin(P),-Math.sin(P),Math.cos(P),0,0);this.ctx.transform=this.ctx.transform.multiply(X)},g.prototype.translate=function(P,X){if(isNaN(P)||isNaN(X))throw ai.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var tt=new f(1,0,0,1,P,X);this.ctx.transform=this.ctx.transform.multiply(tt)},g.prototype.transform=function(P,X,tt,gt,vt,kt){if(isNaN(P)||isNaN(X)||isNaN(tt)||isNaN(gt)||isNaN(vt)||isNaN(kt))throw ai.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var qt=new f(P,X,tt,gt,vt,kt);this.ctx.transform=this.ctx.transform.multiply(qt)},g.prototype.setTransform=function(P,X,tt,gt,vt,kt){P=isNaN(P)?1:P,X=isNaN(X)?0:X,tt=isNaN(tt)?0:tt,gt=isNaN(gt)?1:gt,vt=isNaN(vt)?0:vt,kt=isNaN(kt)?0:kt,this.ctx.transform=new f(P,X,tt,gt,vt,kt)};var C=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};g.prototype.drawImage=function(P,X,tt,gt,vt,kt,qt,Rt,Zt){var Ae=this.pdf.getImageProperties(P),le=1,Ie=1,Ue=1,ft=1;gt!==void 0&&Rt!==void 0&&(Ue=Rt/gt,ft=Zt/vt,le=Ae.width/gt*Rt/gt,Ie=Ae.height/vt*Zt/vt),kt===void 0&&(kt=X,qt=tt,X=0,tt=0),gt!==void 0&&Rt===void 0&&(Rt=gt,Zt=vt),gt===void 0&&Rt===void 0&&(Rt=Ae.width,Zt=Ae.height);var Re=this.ctx.transform.decompose(),rn=lt(Re.rotate.shx),on=new f,be=(on=(on=(on=on.multiply(Re.translate)).multiply(Re.skew)).multiply(Re.scale)).applyToRectangle(new c(kt-X*Ue,qt-tt*ft,gt*le,vt*Ie));if(this.autoPaging){for(var _e,Te=D.call(this,be),Le=[],Ye=0;Ye<Te.length;Ye+=1)Le.indexOf(Te[Ye])===-1&&Le.push(Te[Ye]);Y(Le);for(var hn=Le[0],Pn=Le[Le.length-1],wn=hn;wn<Pn+1;wn++){this.pdf.setPage(wn);var Nn=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Sn=wn===1?this.posY+this.margin[0]:this.margin[0],Be=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],tn=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],je=wn===1?0:Be+(wn-2)*tn;if(this.ctx.clip_path.length!==0){var ur=this.path;_e=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=H(_e,this.posX+this.margin[3],-je+Sn+this.ctx.prevPageLastElemOffset),St.call(this,"fill",!0),this.path=ur}var bn=JSON.parse(JSON.stringify(be));bn=H([bn],this.posX+this.margin[3],-je+Sn+this.ctx.prevPageLastElemOffset)[0];var cn=(wn>hn||wn<Pn)&&C.call(this);cn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Nn,tn,null).clip().discardPath()),this.pdf.addImage(P,"JPEG",bn.x,bn.y,bn.w,bn.h,null,null,rn),cn&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(P,"JPEG",be.x,be.y,be.w,be.h,null,null,rn)};var D=function(P,X,tt){var gt=[];X=X||this.pdf.internal.pageSize.width,tt=tt||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var vt=this.posY+this.ctx.prevPageLastElemOffset;switch(P.type){default:case"mt":case"lt":gt.push(Math.floor((P.y+vt)/tt)+1);break;case"arc":gt.push(Math.floor((P.y+vt-P.radius)/tt)+1),gt.push(Math.floor((P.y+vt+P.radius)/tt)+1);break;case"qct":var kt=zt(this.ctx.lastPoint.x,this.ctx.lastPoint.y,P.x1,P.y1,P.x,P.y);gt.push(Math.floor((kt.y+vt)/tt)+1),gt.push(Math.floor((kt.y+kt.h+vt)/tt)+1);break;case"bct":var qt=At(this.ctx.lastPoint.x,this.ctx.lastPoint.y,P.x1,P.y1,P.x2,P.y2,P.x,P.y);gt.push(Math.floor((qt.y+vt)/tt)+1),gt.push(Math.floor((qt.y+qt.h+vt)/tt)+1);break;case"rect":gt.push(Math.floor((P.y+vt)/tt)+1),gt.push(Math.floor((P.y+P.h+vt)/tt)+1)}for(var Rt=0;Rt<gt.length;Rt+=1)for(;this.pdf.internal.getNumberOfPages()<gt[Rt];)L.call(this);return gt},L=function(){var P=this.fillStyle,X=this.strokeStyle,tt=this.font,gt=this.lineCap,vt=this.lineWidth,kt=this.lineJoin;this.pdf.addPage(),this.fillStyle=P,this.strokeStyle=X,this.font=tt,this.lineCap=gt,this.lineWidth=vt,this.lineJoin=kt},H=function(P,X,tt){for(var gt=0;gt<P.length;gt++)switch(P[gt].type){case"bct":P[gt].x2+=X,P[gt].y2+=tt;case"qct":P[gt].x1+=X,P[gt].y1+=tt;default:P[gt].x+=X,P[gt].y+=tt}return P},Y=function(P){return P.sort(function(X,tt){return X-tt})},W=function(P,X){var tt=this.fillStyle,gt=this.strokeStyle,vt=this.lineCap,kt=this.lineWidth,qt=Math.abs(kt*this.ctx.transform.scaleX),Rt=this.lineJoin;if(this.autoPaging){for(var Zt,Ae,le=JSON.parse(JSON.stringify(this.path)),Ie=JSON.parse(JSON.stringify(this.path)),Ue=[],ft=0;ft<Ie.length;ft++)if(Ie[ft].x!==void 0)for(var Re=D.call(this,Ie[ft]),rn=0;rn<Re.length;rn+=1)Ue.indexOf(Re[rn])===-1&&Ue.push(Re[rn]);for(var on=0;on<Ue.length;on++)for(;this.pdf.internal.getNumberOfPages()<Ue[on];)L.call(this);Y(Ue);for(var be=Ue[0],_e=Ue[Ue.length-1],Te=be;Te<_e+1;Te++){this.pdf.setPage(Te),this.fillStyle=tt,this.strokeStyle=gt,this.lineCap=vt,this.lineWidth=qt,this.lineJoin=Rt;var Le=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Ye=Te===1?this.posY+this.margin[0]:this.margin[0],hn=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Pn=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],wn=Te===1?0:hn+(Te-2)*Pn;if(this.ctx.clip_path.length!==0){var Nn=this.path;Zt=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=H(Zt,this.posX+this.margin[3],-wn+Ye+this.ctx.prevPageLastElemOffset),St.call(this,P,!0),this.path=Nn}if(Ae=JSON.parse(JSON.stringify(le)),this.path=H(Ae,this.posX+this.margin[3],-wn+Ye+this.ctx.prevPageLastElemOffset),X===!1||Te===0){var Sn=(Te>be||Te<_e)&&C.call(this);Sn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Le,Pn,null).clip().discardPath()),St.call(this,P,X),Sn&&this.pdf.restoreGraphicsState()}this.lineWidth=kt}this.path=le}else this.lineWidth=qt,St.call(this,P,X),this.lineWidth=kt},St=function(P,X){if((P!=="stroke"||X||!M.call(this))&&(P==="stroke"||X||!y.call(this))){for(var tt,gt,vt=[],kt=this.path,qt=0;qt<kt.length;qt++){var Rt=kt[qt];switch(Rt.type){case"begin":vt.push({begin:!0});break;case"close":vt.push({close:!0});break;case"mt":vt.push({start:Rt,deltas:[],abs:[]});break;case"lt":var Zt=vt.length;if(kt[qt-1]&&!isNaN(kt[qt-1].x)&&(tt=[Rt.x-kt[qt-1].x,Rt.y-kt[qt-1].y],Zt>0)){for(;Zt>=0;Zt--)if(vt[Zt-1].close!==!0&&vt[Zt-1].begin!==!0){vt[Zt-1].deltas.push(tt),vt[Zt-1].abs.push(Rt);break}}break;case"bct":tt=[Rt.x1-kt[qt-1].x,Rt.y1-kt[qt-1].y,Rt.x2-kt[qt-1].x,Rt.y2-kt[qt-1].y,Rt.x-kt[qt-1].x,Rt.y-kt[qt-1].y],vt[vt.length-1].deltas.push(tt);break;case"qct":var Ae=kt[qt-1].x+2/3*(Rt.x1-kt[qt-1].x),le=kt[qt-1].y+2/3*(Rt.y1-kt[qt-1].y),Ie=Rt.x+2/3*(Rt.x1-Rt.x),Ue=Rt.y+2/3*(Rt.y1-Rt.y),ft=Rt.x,Re=Rt.y;tt=[Ae-kt[qt-1].x,le-kt[qt-1].y,Ie-kt[qt-1].x,Ue-kt[qt-1].y,ft-kt[qt-1].x,Re-kt[qt-1].y],vt[vt.length-1].deltas.push(tt);break;case"arc":vt.push({deltas:[],abs:[],arc:!0}),Array.isArray(vt[vt.length-1].abs)&&vt[vt.length-1].abs.push(Rt)}}gt=X?null:P==="stroke"?"stroke":"fill";for(var rn=!1,on=0;on<vt.length;on++)if(vt[on].arc)for(var be=vt[on].abs,_e=0;_e<be.length;_e++){var Te=be[_e];Te.type==="arc"?bt.call(this,Te.x,Te.y,Te.radius,Te.startAngle,Te.endAngle,Te.counterclockwise,void 0,X,!rn):V.call(this,Te.x,Te.y),rn=!0}else if(vt[on].close===!0)this.pdf.internal.out("h"),rn=!1;else if(vt[on].begin!==!0){var Le=vt[on].start.x,Ye=vt[on].start.y;xt.call(this,vt[on].deltas,Le,Ye),rn=!0}gt&&ot.call(this,gt),X&&jt.call(this)}},_t=function(P){var X=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,tt=X*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return P-tt;case"top":return P+X-tt;case"hanging":return P+X-2*tt;case"middle":return P+X/2-tt;default:return P}},Ct=function(P){return P+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};g.prototype.createLinearGradient=function(){var P=function(){};return P.colorStops=[],P.addColorStop=function(X,tt){this.colorStops.push([X,tt])},P.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},P.isCanvasGradient=!0,P},g.prototype.createPattern=function(){return this.createLinearGradient()},g.prototype.createRadialGradient=function(){return this.createLinearGradient()};var bt=function(P,X,tt,gt,vt,kt,qt,Rt,Zt){for(var Ae=dt.call(this,tt,gt,vt,kt),le=0;le<Ae.length;le++){var Ie=Ae[le];le===0&&(Zt?Z.call(this,Ie.x1+P,Ie.y1+X):V.call(this,Ie.x1+P,Ie.y1+X)),Lt.call(this,P,X,Ie.x2,Ie.y2,Ie.x3,Ie.y3,Ie.x4,Ie.y4)}Rt?jt.call(this):ot.call(this,qt)},ot=function(P){switch(P){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},jt=function(){this.pdf.clip(),this.pdf.discardPath()},Z=function(P,X){this.pdf.internal.out(e(P)+" "+r(X)+" m")},ct=function(P){var X;switch(P.align){case"right":case"end":X="right";break;case"center":X="center";break;default:X="left"}var tt,gt,vt,kt=this.pdf.getTextDimensions(P.text),qt=_t.call(this,P.y),Rt=Ct.call(this,qt)-kt.h,Zt=this.ctx.transform.applyToPoint(new l(P.x,qt));if(this.autoPaging){var Ae=this.ctx.transform.decompose(),le=new f;le=(le=(le=le.multiply(Ae.translate)).multiply(Ae.skew)).multiply(Ae.scale);for(var Ie=this.ctx.transform.applyToRectangle(new c(P.x,qt,kt.w,kt.h)),Ue=le.applyToRectangle(new c(P.x,Rt,kt.w,kt.h)),ft=D.call(this,Ue),Re=[],rn=0;rn<ft.length;rn+=1)Re.indexOf(ft[rn])===-1&&Re.push(ft[rn]);Y(Re);for(var on=Re[0],be=Re[Re.length-1],_e=on;_e<be+1;_e++){this.pdf.setPage(_e);var Te=_e===1?this.posY+this.margin[0]:this.margin[0],Le=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ye=this.pdf.internal.pageSize.height-this.margin[2],hn=Ye-this.margin[0],Pn=this.pdf.internal.pageSize.width-this.margin[1],wn=Pn-this.margin[3],Nn=_e===1?0:Le+(_e-2)*hn;if(this.ctx.clip_path.length!==0){var Sn=this.path;tt=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=H(tt,this.posX+this.margin[3],-1*Nn+Te),St.call(this,"fill",!0),this.path=Sn}var Be=H([JSON.parse(JSON.stringify(Ue))],this.posX+this.margin[3],-Nn+Te+this.ctx.prevPageLastElemOffset)[0];P.scale>=.01&&(gt=this.pdf.internal.getFontSize(),this.pdf.setFontSize(gt*P.scale),vt=this.lineWidth,this.lineWidth=vt*P.scale);var tn=this.autoPaging!=="text";if(tn||Be.y+Be.h<=Ye){if(tn||Be.y>=Te&&Be.x<=Pn){var je=tn?P.text:this.pdf.splitTextToSize(P.text,P.maxWidth||Pn-Be.x)[0],ur=H([JSON.parse(JSON.stringify(Ie))],this.posX+this.margin[3],-Nn+Te+this.ctx.prevPageLastElemOffset)[0],bn=tn&&(_e>on||_e<be)&&C.call(this);bn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],wn,hn,null).clip().discardPath()),this.pdf.text(je,ur.x,ur.y,{angle:P.angle,align:X,renderingMode:P.renderingMode}),bn&&this.pdf.restoreGraphicsState()}}else Be.y<Ye&&(this.ctx.prevPageLastElemOffset+=Ye-Be.y);P.scale>=.01&&(this.pdf.setFontSize(gt),this.lineWidth=vt)}}else P.scale>=.01&&(gt=this.pdf.internal.getFontSize(),this.pdf.setFontSize(gt*P.scale),vt=this.lineWidth,this.lineWidth=vt*P.scale),this.pdf.text(P.text,Zt.x+this.posX,Zt.y+this.posY,{angle:P.angle,align:X,renderingMode:P.renderingMode,maxWidth:P.maxWidth}),P.scale>=.01&&(this.pdf.setFontSize(gt),this.lineWidth=vt)},V=function(P,X,tt,gt){tt=tt||0,gt=gt||0,this.pdf.internal.out(e(P+tt)+" "+r(X+gt)+" l")},xt=function(P,X,tt){return this.pdf.lines(P,X,tt,null,null)},Lt=function(P,X,tt,gt,vt,kt,qt,Rt){this.pdf.internal.out([t(i(tt+P)),t(s(gt+X)),t(i(vt+P)),t(s(kt+X)),t(i(qt+P)),t(s(Rt+X)),"c"].join(" "))},dt=function(P,X,tt,gt){for(var vt=2*Math.PI,kt=Math.PI/2;X>tt;)X-=vt;var qt=Math.abs(tt-X);qt<vt&&gt&&(qt=vt-qt);for(var Rt=[],Zt=gt?-1:1,Ae=X;qt>1e-5;){var le=Ae+Zt*Math.min(qt,kt);Rt.push(st.call(this,P,Ae,le)),qt-=Math.abs(le-Ae),Ae=le}return Rt},st=function(P,X,tt){var gt=(tt-X)/2,vt=P*Math.cos(gt),kt=P*Math.sin(gt),qt=vt,Rt=-kt,Zt=qt*qt+Rt*Rt,Ae=Zt+qt*vt+Rt*kt,le=4/3*(Math.sqrt(2*Zt*Ae)-Ae)/(qt*kt-Rt*vt),Ie=qt-le*Rt,Ue=Rt+le*qt,ft=Ie,Re=-Ue,rn=gt+X,on=Math.cos(rn),be=Math.sin(rn);return{x1:P*Math.cos(X),y1:P*Math.sin(X),x2:Ie*on-Ue*be,y2:Ie*be+Ue*on,x3:ft*on-Re*be,y3:ft*be+Re*on,x4:P*Math.cos(tt),y4:P*Math.sin(tt)}},lt=function(P){return 180*P/Math.PI},zt=function(P,X,tt,gt,vt,kt){var qt=P+.5*(tt-P),Rt=X+.5*(gt-X),Zt=vt+.5*(tt-vt),Ae=kt+.5*(gt-kt),le=Math.min(P,vt,qt,Zt),Ie=Math.max(P,vt,qt,Zt),Ue=Math.min(X,kt,Rt,Ae),ft=Math.max(X,kt,Rt,Ae);return new c(le,Ue,Ie-le,ft-Ue)},At=function(P,X,tt,gt,vt,kt,qt,Rt){var Zt,Ae,le,Ie,Ue,ft,Re,rn,on,be,_e,Te,Le,Ye,hn=tt-P,Pn=gt-X,wn=vt-tt,Nn=kt-gt,Sn=qt-vt,Be=Rt-kt;for(Ae=0;Ae<41;Ae++)on=(Re=(le=P+(Zt=Ae/40)*hn)+Zt*((Ue=tt+Zt*wn)-le))+Zt*(Ue+Zt*(vt+Zt*Sn-Ue)-Re),be=(rn=(Ie=X+Zt*Pn)+Zt*((ft=gt+Zt*Nn)-Ie))+Zt*(ft+Zt*(kt+Zt*Be-ft)-rn),Ae==0?(_e=on,Te=be,Le=on,Ye=be):(_e=Math.min(_e,on),Te=Math.min(Te,be),Le=Math.max(Le,on),Ye=Math.max(Ye,be));return new c(Math.round(_e),Math.round(Te),Math.round(Le-_e),Math.round(Ye-Te))},K=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var P,X,tt=(P=this.ctx.lineDash,X=this.ctx.lineDashOffset,JSON.stringify({lineDash:P,lineDashOffset:X}));this.prevLineDash!==tt&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=tt)}}})(xn.API),(function(n){var t=function(l){var c,f,d,p,g,b,y,M,C,D;for(f=[],d=0,p=(l+=c="\0\0\0\0".slice(l.length%4||4)).length;p>d;d+=4)(g=(l.charCodeAt(d)<<24)+(l.charCodeAt(d+1)<<16)+(l.charCodeAt(d+2)<<8)+l.charCodeAt(d+3))!==0?(b=(g=((g=((g=((g=(g-(D=g%85))/85)-(C=g%85))/85)-(M=g%85))/85)-(y=g%85))/85)%85,f.push(b+33,y+33,M+33,C+33,D+33)):f.push(122);return(function(L,H){for(var Y=H;Y>0;Y--)L.pop()})(f,c.length),String.fromCharCode.apply(String,f)+"~>"},e=function(l){var c,f,d,p,g,b=String,y="length",M=255,C="charCodeAt",D="slice",L="replace";for(l[D](-2),l=l[D](0,-2)[L](/\s/g,"")[L]("z","!!!!!"),d=[],p=0,g=(l+=c="uuuuu"[D](l[y]%5||5))[y];g>p;p+=5)f=52200625*(l[C](p)-33)+614125*(l[C](p+1)-33)+7225*(l[C](p+2)-33)+85*(l[C](p+3)-33)+(l[C](p+4)-33),d.push(M&f>>24,M&f>>16,M&f>>8,M&f);return(function(H,Y){for(var W=Y;W>0;W--)H.pop()})(d,c[y]),b.fromCharCode.apply(b,d)},r=function(l){return l.split("").map(function(c){return("0"+c.charCodeAt().toString(16)).slice(-2)}).join("")+">"},i=function(l){var c=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((l=l.replace(/\s/g,"")).indexOf(">")!==-1&&(l=l.substr(0,l.indexOf(">"))),l.length%2&&(l+="0"),c.test(l)===!1)return"";for(var f="",d=0;d<l.length;d+=2)f+=String.fromCharCode("0x"+(l[d]+l[d+1]));return f},s=function(l){for(var c=new Uint8Array(l.length),f=l.length;f--;)c[f]=l.charCodeAt(f);return(c=n2(c)).reduce(function(d,p){return d+String.fromCharCode(p)},"")};n.processDataByFilters=function(l,c){var f=0,d=l||"",p=[];for(typeof(c=c||[])=="string"&&(c=[c]),f=0;f<c.length;f+=1)switch(c[f]){case"ASCII85Decode":case"/ASCII85Decode":d=e(d),p.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":d=t(d),p.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":d=i(d),p.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":d=r(d),p.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":d=s(d),p.push("/FlateDecode");break;default:throw new Error('The filter: "'+c[f]+'" is not implemented')}return{data:d,reverseChain:p.reverse().join(" ")}}})(xn.API),(function(n){n.loadFile=function(t,e,r){return(function(i,s,l){s=s!==!1,l=typeof l=="function"?l:function(){};var c=void 0;try{c=(function(f,d,p){var g=new XMLHttpRequest,b=0,y=function(M){var C=M.length,D=[],L=String.fromCharCode;for(b=0;b<C;b+=1)D.push(L(255&M.charCodeAt(b)));return D.join("")};if(g.open("GET",f,!d),g.overrideMimeType("text/plain; charset=x-user-defined"),d===!1&&(g.onload=function(){g.status===200?p(y(this.responseText)):p(void 0)}),g.send(null),d&&g.status===200)return y(g.responseText)})(i,s,l)}catch{}return c})(t,e,r)},n.allowFsRead=void 0,n.loadImageFile=n.loadFile})(xn.API),(function(n){function t(){return(Wn.html2canvas?Promise.resolve(Wn.html2canvas):z1(()=>import("./html2canvas.esm-DXEQVQnt.js"),[],import.meta.url)).catch(function(c){return Promise.reject(new Error("Could not load html2canvas: "+c))}).then(function(c){return c.default?c.default:c})}function e(){return(Wn.DOMPurify?Promise.resolve(Wn.DOMPurify):z1(()=>import("./purify.es-CEBYger9.js"),[],import.meta.url)).catch(function(c){return Promise.reject(new Error("Could not load dompurify: "+c))}).then(function(c){return c.default?c.default:c})}var r=function(c){var f=Hr(c);return f==="undefined"?"undefined":f==="string"||c instanceof String?"string":f==="number"||c instanceof Number?"number":f==="function"||c instanceof Function?"function":c&&c.constructor===Array?"array":c&&c.nodeType===1?"element":f==="object"?"object":"unknown"},i=function(c,f){var d=document.createElement(c);for(var p in f.className&&(d.className=f.className),f.innerHTML&&f.dompurify&&(d.innerHTML=f.dompurify.sanitize(f.innerHTML)),f.style)d.style[p]=f.style[p];return d},s=function c(f,d){for(var p=f.nodeType===3?document.createTextNode(f.nodeValue):f.cloneNode(!1),g=f.firstChild;g;g=g.nextSibling)d!==!0&&g.nodeType===1&&g.nodeName==="SCRIPT"||p.appendChild(c(g,d));return f.nodeType===1&&(f.nodeName==="CANVAS"?(p.width=f.width,p.height=f.height,p.getContext("2d").drawImage(f,0,0)):f.nodeName!=="TEXTAREA"&&f.nodeName!=="SELECT"||(p.value=f.value),p.addEventListener("load",function(){p.scrollTop=f.scrollTop,p.scrollLeft=f.scrollLeft},!0)),p},l=function c(f){var d=Object.assign(c.convert(Promise.resolve()),JSON.parse(JSON.stringify(c.template))),p=c.convert(Promise.resolve(),d);return(p=p.setProgress(1,c,1,[c])).set(f)};(l.prototype=Object.create(Promise.prototype)).constructor=l,l.convert=function(c,f){return c.__proto__=f||l.prototype,c},l.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},l.prototype.from=function(c,f){return this.then(function(){switch(f=f||(function(d){switch(r(d)){case"string":return"string";case"element":return d.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}})(c),f){case"string":return this.then(e).then(function(d){return this.set({src:i("div",{innerHTML:c,dompurify:d})})});case"element":return this.set({src:c});case"canvas":return this.set({canvas:c});case"img":return this.set({img:c});default:return this.error("Unknown source type.")}})},l.prototype.to=function(c){switch(c){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},l.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var c={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},f=s(this.prop.src,this.opt.html2canvas.javascriptEnabled);f.tagName==="BODY"&&(c.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:c}),this.prop.container.appendChild(f),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},l.prototype.toCanvas=function(){var c=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(c).then(t).then(function(f){var d=Object.assign({},this.opt.html2canvas);return delete d.onrendered,f(this.prop.container,d)}).then(function(f){(this.opt.html2canvas.onrendered||function(){})(f),this.prop.canvas=f,document.body.removeChild(this.prop.overlay)})},l.prototype.toContext2d=function(){var c=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(c).then(t).then(function(f){var d=this.opt.jsPDF,p=this.opt.fontFaces,g=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,b=Object.assign({async:!0,allowTaint:!0,scale:g,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete b.onrendered,d.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,d.context2d.posX=this.opt.x,d.context2d.posY=this.opt.y,d.context2d.margin=this.opt.margin,d.context2d.fontFaces=p,p)for(var y=0;y<p.length;++y){var M=p[y],C=M.src.find(function(D){return D.format==="truetype"});C&&d.addFont(C.url,M.ref.name,M.ref.style)}return b.windowHeight=b.windowHeight||0,b.windowHeight=b.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):b.windowHeight,d.context2d.save(!0),f(this.prop.container,b)}).then(function(f){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(f),this.prop.canvas=f,document.body.removeChild(this.prop.overlay)})},l.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var c=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=c})},l.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},l.prototype.output=function(c,f,d){return(d=d||"pdf").toLowerCase()==="img"||d.toLowerCase()==="image"?this.outputImg(c,f):this.outputPdf(c,f)},l.prototype.outputPdf=function(c,f){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(c,f)})},l.prototype.outputImg=function(c){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(c){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+c+'" is not supported.'}})},l.prototype.save=function(c){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(c?{filename:c}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},l.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},l.prototype.set=function(c){if(r(c)!=="object")return this;var f=Object.keys(c||{}).map(function(d){if(d in l.template.prop)return function(){this.prop[d]=c[d]};switch(d){case"margin":return this.setMargin.bind(this,c.margin);case"jsPDF":return function(){return this.opt.jsPDF=c.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,c.pageSize);default:return function(){this.opt[d]=c[d]}}},this);return this.then(function(){return this.thenList(f)})},l.prototype.get=function(c,f){return this.then(function(){var d=c in l.template.prop?this.prop[c]:this.opt[c];return f?f(d):d})},l.prototype.setMargin=function(c){return this.then(function(){switch(r(c)){case"number":c=[c,c,c,c];case"array":if(c.length===2&&(c=[c[0],c[1],c[0],c[1]]),c.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=c}).then(this.setPageSize)},l.prototype.setPageSize=function(c){function f(d,p){return Math.floor(d*p/72*96)}return this.then(function(){(c=c||xn.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(c.inner={width:c.width-this.opt.margin[1]-this.opt.margin[3],height:c.height-this.opt.margin[0]-this.opt.margin[2]},c.inner.px={width:f(c.inner.width,c.k),height:f(c.inner.height,c.k)},c.inner.ratio=c.inner.height/c.inner.width),this.prop.pageSize=c})},l.prototype.setProgress=function(c,f,d,p){return c!=null&&(this.progress.val=c),f!=null&&(this.progress.state=f),d!=null&&(this.progress.n=d),p!=null&&(this.progress.stack=p),this.progress.ratio=this.progress.val/this.progress.state,this},l.prototype.updateProgress=function(c,f,d,p){return this.setProgress(c?this.progress.val+c:null,f||null,d?this.progress.n+d:null,p?this.progress.stack.concat(p):null)},l.prototype.then=function(c,f){var d=this;return this.thenCore(c,f,function(p,g){return d.updateProgress(null,null,1,[p]),Promise.prototype.then.call(this,function(b){return d.updateProgress(null,p),b}).then(p,g).then(function(b){return d.updateProgress(1),b})})},l.prototype.thenCore=function(c,f,d){d=d||Promise.prototype.then;var p=this;c&&(c=c.bind(p)),f&&(f=f.bind(p));var g=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?p:l.convert(Object.assign({},p),Promise.prototype),b=d.call(g,c,f);return l.convert(b,p.__proto__)},l.prototype.thenExternal=function(c,f){return Promise.prototype.then.call(this,c,f)},l.prototype.thenList=function(c){var f=this;return c.forEach(function(d){f=f.thenCore(d)}),f},l.prototype.catch=function(c){c&&(c=c.bind(this));var f=Promise.prototype.catch.call(this,c);return l.convert(f,this)},l.prototype.catchExternal=function(c){return Promise.prototype.catch.call(this,c)},l.prototype.error=function(c){return this.then(function(){throw new Error(c)})},l.prototype.using=l.prototype.set,l.prototype.saveAs=l.prototype.save,l.prototype.export=l.prototype.output,l.prototype.run=l.prototype.then,xn.getPageSize=function(c,f,d){if(Hr(c)==="object"){var p=c;c=p.orientation,f=p.unit||f,d=p.format||d}f=f||"mm",d=d||"a4",c=(""+(c||"P")).toLowerCase();var g,b=(""+d).toLowerCase(),y={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(f){case"pt":g=1;break;case"mm":g=72/25.4;break;case"cm":g=72/2.54;break;case"in":g=72;break;case"px":g=.75;break;case"pc":case"em":g=12;break;case"ex":g=6;break;default:throw"Invalid unit: "+f}var M,C=0,D=0;if(y.hasOwnProperty(b))C=y[b][1]/g,D=y[b][0]/g;else try{C=d[1],D=d[0]}catch{throw new Error("Invalid format: "+d)}if(c==="p"||c==="portrait")c="p",D>C&&(M=D,D=C,C=M);else{if(c!=="l"&&c!=="landscape")throw"Invalid orientation: "+c;c="l",C>D&&(M=D,D=C,C=M)}return{width:D,height:C,unit:f,k:g,orientation:c}},n.html=function(c,f){(f=f||{}).callback=f.callback||function(){},f.html2canvas=f.html2canvas||{},f.html2canvas.canvas=f.html2canvas.canvas||this.canvas,f.jsPDF=f.jsPDF||this,f.fontFaces=f.fontFaces?f.fontFaces.map(ry):null;var d=new l(f);return f.worker?d:d.from(c).doCallback()}})(xn.API),xn.API.addJS=function(n){var t,e,r=(function(i){for(var s="",l=0;l<i.length;l++){var c=i[l];if(c==="("||c===")"){for(var f=0,d=l-1;d>=0&&i[d]==="\\";d--)f++;s+=f%2==0?"\\"+c:c}else s+=c}return s})(n);return this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(t+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),e=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+r+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){t!==void 0&&e!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},(function(n){var t;n.events.push(["postPutResources",function(){var e=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=e.outline.render().split(/\r\n/),s=0;s<i.length;s++){var l=i[s],c=r.exec(l);if(c!=null){var f=c[1];e.internal.newObjectDeferredBegin(f,!1)}e.internal.write(l)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,p=[];for(s=0;s<d;s++){var g=e.internal.newObject();p.push(g);var b=e.internal.getPageInfo(s+1);e.internal.write("<< /D["+b.objId+" 0 R /XYZ null null null]>> endobj")}var y=e.internal.newObject();for(e.internal.write("<< /Names [ "),s=0;s<p.length;s++)e.internal.write("(page_"+(s+1)+")"+p[s]+" 0 R");e.internal.write(" ] >>","endobj"),t=e.internal.newObject(),e.internal.write("<< /Dests "+y+" 0 R"),e.internal.write(">>","endobj")}}]),n.events.push(["putCatalog",function(){var e=this;e.outline.root.children.length>0&&(e.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&e.internal.write("/Names "+t+" 0 R"))}]),n.events.push(["initialized",function(){var e=this;e.outline={createNamedDestinations:!1,root:{children:[]}},e.outline.add=function(r,i,s){var l={title:i,options:s,children:[]};return r==null&&(r=this.root),r.children.push(l),l},e.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=e,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},e.outline.genIds_r=function(r){r.id=e.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},e.outline.renderRoot=function(r){this.objStart(r),this.line("/Type /Outlines"),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1]))),this.line("/Count "+this.count_r({count:0},r)),this.objEnd()},e.outline.renderItems=function(r){for(var i=this.ctx.pdf.internal.getVerticalCoordinateString,s=0;s<r.children.length;s++){var l=r.children[s];this.objStart(l),this.line("/Title "+this.makeString(l.title)),this.line("/Parent "+this.makeRef(r)),s>0&&this.line("/Prev "+this.makeRef(r.children[s-1])),s<r.children.length-1&&this.line("/Next "+this.makeRef(r.children[s+1])),l.children.length>0&&(this.line("/First "+this.makeRef(l.children[0])),this.line("/Last "+this.makeRef(l.children[l.children.length-1])));var c=this.count=this.count_r({count:0},l);if(c>0&&this.line("/Count "+c),l.options&&l.options.pageNumber){var f=e.internal.getPageInfo(l.options.pageNumber);this.line("/Dest ["+f.objId+" 0 R /XYZ 0 "+i(0)+" 0]")}this.objEnd()}for(var d=0;d<r.children.length;d++)this.renderItems(r.children[d])},e.outline.line=function(r){this.ctx.val+=r+`\r
50
- `},e.outline.makeRef=function(r){return r.id+" 0 R"},e.outline.makeString=function(r){return"("+e.internal.pdfEscape(r)+")"},e.outline.objStart=function(r){this.ctx.val+=`\r
51
- `+r.id+` 0 obj\r
52
- <<\r
53
- `},e.outline.objEnd=function(){this.ctx.val+=`>> \r
54
- endobj\r
55
- `},e.outline.count_r=function(r,i){for(var s=0;s<i.children.length;s++)r.count++,this.count_r(r,i.children[s]);return r.count}}])})(xn.API),(function(n){var t=[192,193,194,195,196,197,198,199];n.processJPEG=function(e,r,i,s,l,c){var f,d=this.decode.DCT_DECODE,p=null;if(typeof e=="string"||this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e)){switch(e=l||e,e=this.__addimage__.isArrayBuffer(e)?new Uint8Array(e):e,f=(function(g){for(var b,y=256*g.charCodeAt(4)+g.charCodeAt(5),M=g.length,C={width:0,height:0,numcomponents:1},D=4;D<M;D+=2){if(D+=y,t.indexOf(g.charCodeAt(D+1))!==-1){b=256*g.charCodeAt(D+5)+g.charCodeAt(D+6),C={width:256*g.charCodeAt(D+7)+g.charCodeAt(D+8),height:b,numcomponents:g.charCodeAt(D+9)};break}y=256*g.charCodeAt(D+2)+g.charCodeAt(D+3)}return C})(e=this.__addimage__.isArrayBufferView(e)?this.__addimage__.arrayBufferToBinaryString(e):e),f.numcomponents){case 1:c=this.color_spaces.DEVICE_GRAY;break;case 4:c=this.color_spaces.DEVICE_CMYK;break;case 3:c=this.color_spaces.DEVICE_RGB}p={data:e,width:f.width,height:f.height,colorSpace:c,bitsPerComponent:8,filter:d,index:r,alias:i}}return p}})(xn.API),xn.API.processPNG=function(n,t,e,r){if(this.__addimage__.isArrayBuffer(n)&&(n=new Uint8Array(n)),this.__addimage__.isArrayBufferView(n)){var i,s=dN(n,{checkCrc:!0}),l=s.width,c=s.height,f=s.channels,d=s.palette,p=s.depth;i=d&&f===1?(function(bt){for(var ot=bt.width,jt=bt.height,Z=bt.data,ct=bt.palette,V=bt.depth,xt=!1,Lt=[],dt=[],st=void 0,lt=!1,zt=0,At=0;At<ct.length;At++){var K=Cv(ct[At],4),P=K[0],X=K[1],tt=K[2],gt=K[3];Lt.push(P,X,tt),gt!=null&&(gt===0?(zt++,dt.length<1&&dt.push(At)):gt<255&&(lt=!0))}if(lt||zt>1){xt=!0,dt=void 0;var vt=ot*jt;st=new Uint8Array(vt);for(var kt=new DataView(Z.buffer),qt=0;qt<vt;qt++){var Rt=oy(kt,qt,V),Zt=Cv(ct[Rt],4)[3];st[qt]=Zt}}else zt===0&&(dt=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:xt?8:void 0,colorBytes:Z,alphaBytes:st,needSMask:xt,palette:Lt,mask:dt}})(s):f===2||f===4?(function(bt){for(var ot=bt.data,jt=bt.width,Z=bt.height,ct=bt.channels,V=bt.depth,xt=ct===2?"DeviceGray":"DeviceRGB",Lt=ct-1,dt=jt*Z,st=Lt,lt=dt*st,zt=1*dt,At=Math.ceil(lt*V/8),K=Math.ceil(zt*V/8),P=new Uint8Array(At),X=new Uint8Array(K),tt=new DataView(ot.buffer),gt=new DataView(P.buffer),vt=new DataView(X.buffer),kt=!1,qt=0;qt<dt;qt++){for(var Rt=qt*ct,Zt=0;Zt<st;Zt++)Nw(gt,oy(tt,Rt+Zt,V),qt*st+Zt,V);var Ae=oy(tt,Rt+st,V);Ae<(1<<V)-1&&(kt=!0),Nw(vt,Ae,1*qt,V)}return{colorSpace:xt,colorsPerPixel:Lt,sMaskBitsPerComponent:kt?V:void 0,colorBytes:P,alphaBytes:X,needSMask:kt}})(s):(function(bt){var ot=bt.data,jt=bt.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:jt,colorsPerPixel:jt==="DeviceGray"?1:3,colorBytes:ot instanceof Uint16Array?(function(Z){for(var ct=Z.length,V=new Uint8Array(2*ct),xt=new DataView(V.buffer,V.byteOffset,V.byteLength),Lt=0;Lt<ct;Lt++)xt.setUint16(2*Lt,Z[Lt],!1);return V})(ot):ot,needSMask:!1}})(s);var g,b,y,M=i,C=M.colorSpace,D=M.colorsPerPixel,L=M.sMaskBitsPerComponent,H=M.colorBytes,Y=M.alphaBytes,W=M.needSMask,St=M.palette,_t=M.mask,Ct=null;return r!==xn.API.image_compression.NONE&&typeof n2=="function"?(Ct=(function(bt){var ot;switch(bt){case xn.API.image_compression.FAST:ot=11;break;case xn.API.image_compression.MEDIUM:ot=13;break;case xn.API.image_compression.SLOW:ot=14;break;default:ot=12}return ot})(r),g=this.decode.FLATE_DECODE,b="/Predictor ".concat(Ct," /Colors ").concat(D," /BitsPerComponent ").concat(p," /Columns ").concat(l),n=Aw(H,Math.ceil(l*D*p/8),D,p,r),W&&(y=Aw(Y,Math.ceil(l*L/8),1,L,r))):(g=void 0,b=void 0,n=H,W&&(y=Y)),(this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n))&&(n=this.__addimage__.arrayBufferToBinaryString(n)),(y&&this.__addimage__.isArrayBuffer(y)||this.__addimage__.isArrayBufferView(y))&&(y=this.__addimage__.arrayBufferToBinaryString(y)),{alias:e,data:n,index:t,filter:g,decodeParameters:b,transparency:_t,palette:St,sMask:y,predictor:Ct,width:l,height:c,bitsPerComponent:p,sMaskBitsPerComponent:L,colorSpace:C}}},(function(n){n.processGIF89A=function(t,e,r,i){var s=new RN(t),l=s.width,c=s.height,f=[];s.decodeAndBlitFrameRGBA(0,f);var d={data:f,width:l,height:c},p=new sy(100).encode(d,100);return n.processJPEG.call(this,p,e,r,i)},n.processGIF87A=n.processGIF89A})(xn.API),Zl.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var n=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(n);for(var t=0;t<n;t++){var e=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:i,green:r,blue:e,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},Zl.prototype.parseBGR=function(){this.pos=this.offset;var n="bit"+this.bitPP,t=this.width*this.height*4;if(t>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(t);try{this[n]()}catch(e){ai.log("bit decode error:"+e)}},Zl.prototype.bit1=function(){var n,t=Math.ceil(this.width/8),e=t%4;for(n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<t;i++)for(var s=this.datav.getUint8(this.pos++,!0),l=r*this.width*4+8*i*4,c=0;c<8&&8*i+c<this.width;c++){var f=this.palette[s>>7-c&1];this.data[l+4*c]=f.blue,this.data[l+4*c+1]=f.green,this.data[l+4*c+2]=f.red,this.data[l+4*c+3]=255}e!==0&&(this.pos+=4-e)}},Zl.prototype.bit4=function(){for(var n=Math.ceil(this.width/2),t=n%4,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<n;i++){var s=this.datav.getUint8(this.pos++,!0),l=r*this.width*4+2*i*4,c=s>>4,f=15&s,d=this.palette[c];if(this.data[l]=d.blue,this.data[l+1]=d.green,this.data[l+2]=d.red,this.data[l+3]=255,2*i+1>=this.width)break;d=this.palette[f],this.data[l+4]=d.blue,this.data[l+4+1]=d.green,this.data[l+4+2]=d.red,this.data[l+4+3]=255}t!==0&&(this.pos+=4-t)}},Zl.prototype.bit8=function(){for(var n=this.width%4,t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),s=e*this.width*4+4*r;if(i<this.palette.length){var l=this.palette[i];this.data[s]=l.red,this.data[s+1]=l.green,this.data[s+2]=l.blue,this.data[s+3]=255}else this.data[s]=255,this.data[s+1]=255,this.data[s+2]=255,this.data[s+3]=255}n!==0&&(this.pos+=4-n)}},Zl.prototype.bit15=function(){for(var n=this.width%3,t=parseInt("11111",2),e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<this.width;i++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(s&t)/t*255|0,c=(s>>5&t)/t*255|0,f=(s>>10&t)/t*255|0,d=s>>15?255:0,p=r*this.width*4+4*i;this.data[p]=f,this.data[p+1]=c,this.data[p+2]=l,this.data[p+3]=d}this.pos+=n}},Zl.prototype.bit16=function(){for(var n=this.width%3,t=parseInt("11111",2),e=parseInt("111111",2),r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,s=0;s<this.width;s++){var l=this.datav.getUint16(this.pos,!0);this.pos+=2;var c=(l&t)/t*255|0,f=(l>>5&e)/e*255|0,d=(l>>11)/t*255|0,p=i*this.width*4+4*s;this.data[p]=d,this.data[p+1]=f,this.data[p+2]=c,this.data[p+3]=255}this.pos+=n}},Zl.prototype.bit24=function(){for(var n=this.height-1;n>=0;n--){for(var t=this.bottom_up?n:this.height-1-n,e=0;e<this.width;e++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*e;this.data[l]=s,this.data[l+1]=i,this.data[l+2]=r,this.data[l+3]=255}this.pos+=this.width%4}},Zl.prototype.bit32=function(){for(var n=this.height-1;n>=0;n--)for(var t=this.bottom_up?n:this.height-1-n,e=0;e<this.width;e++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),l=this.datav.getUint8(this.pos++,!0),c=t*this.width*4+4*e;this.data[c]=s,this.data[c+1]=i,this.data[c+2]=r,this.data[c+3]=l}},Zl.prototype.getData=function(){return this.data},(function(n){n.processBMP=function(t,e,r,i){var s=new Zl(t,!1),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new sy(100).encode(f,100);return n.processJPEG.call(this,d,e,r,i)}})(xn.API),Dw.prototype.getData=function(){return this.data},(function(n){n.processWEBP=function(t,e,r,i){var s=new Dw(t),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new sy(100).encode(f,100);return n.processJPEG.call(this,d,e,r,i)}})(xn.API),xn.API.processRGBA=function(n,t,e){for(var r=n.data,i=r.length,s=new Uint8Array(i/4*3),l=new Uint8Array(i/4),c=0,f=0,d=0;d<i;d+=4){var p=r[d],g=r[d+1],b=r[d+2],y=r[d+3];s[c++]=p,s[c++]=g,s[c++]=b,l[f++]=y}var M=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(l),data:M,index:t,alias:e,colorSpace:"DeviceRGB",bitsPerComponent:8,width:n.width,height:n.height}},xn.API.setLanguage=function(n){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[n]!==void 0&&(this.internal.languageSettings.languageCode=n,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},Cd=xn.API,Am=Cd.getCharWidthsArray=function(n,t){var e,r,i=(t=t||{}).font||this.internal.getFont(),s=t.fontSize||this.internal.getFontSize(),l=t.charSpace||this.internal.getCharSpace(),c=t.widths?t.widths:i.metadata.Unicode.widths,f=c.fof?c.fof:1,d=t.kerning?t.kerning:i.metadata.Unicode.kerning,p=d.fof?d.fof:1,g=t.doKerning!==!1,b=0,y=n.length,M=0,C=c[0]||f,D=[];for(e=0;e<y;e++)r=n.charCodeAt(e),typeof i.metadata.widthOfString=="function"?D.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(r))+l*(1e3/s)||0)/1e3):(b=g&&Hr(d[r])==="object"&&!isNaN(parseInt(d[r][M],10))?d[r][M]/p:0,D.push((c[r]||C)/f+b)),M=r;return D},ww=Cd.getStringUnitWidth=function(n,t){var e=(t=t||{}).fontSize||this.internal.getFontSize(),r=t.font||this.internal.getFont(),i=t.charSpace||this.internal.getCharSpace();return Cd.processArabic&&(n=Cd.processArabic(n)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(n,e,i)/e:Am.apply(this,arguments).reduce(function(s,l){return s+l},0)},Sw=function(n,t,e,r){for(var i=[],s=0,l=n.length,c=0;s!==l&&c+t[s]<e;)c+=t[s],s++;i.push(n.slice(0,s));var f=s;for(c=0;s!==l;)c+t[s]>r&&(i.push(n.slice(f,s)),c=0,f=s),c+=t[s],s++;return f!==s&&i.push(n.slice(f,s)),i},kw=function(n,t,e){e||(e={});var r,i,s,l,c,f,d,p=[],g=[p],b=e.textIndent||0,y=0,M=0,C=n.split(" "),D=Am.apply(this,[" ",e])[0];if(f=e.lineIndent===-1?C[0].length+2:e.lineIndent||0){var L=Array(f).join(" "),H=[];C.map(function(W){(W=W.split(/\s*\n/)).length>1?H=H.concat(W.map(function(St,_t){return(_t&&St.length?`
56
- `:"")+St})):H.push(W[0])}),C=H,f=ww.apply(this,[L,e])}for(s=0,l=C.length;s<l;s++){var Y=0;if(r=C[s],f&&r[0]==`
57
- `&&(r=r.substr(1),Y=1),b+y+(M=(i=Am.apply(this,[r,e])).reduce(function(W,St){return W+St},0))>t||Y){if(M>t){for(c=Sw.apply(this,[r,i,t-(b+y),t]),p.push(c.shift()),p=[c.pop()];c.length;)g.push([c.shift()]);M=i.slice(r.length-(p[0]?p[0].length:0)).reduce(function(W,St){return W+St},0)}else p=[r];g.push(p),b=M+f,y=D}else p.push(r),b+=y+M,y=D}return d=f?function(W,St){return(St?L:"")+W.join(" ")}:function(W){return W.join(" ")},g.map(d)},Cd.splitTextToSize=function(n,t,e){var r,i=(e=e||{}).fontSize||this.internal.getFontSize(),s=(function(p){if(p.widths&&p.kerning)return{widths:p.widths,kerning:p.kerning};var g=this.internal.getFont(p.fontName,p.fontStyle),b="Unicode";return g.metadata[b]?{widths:g.metadata[b].widths||{0:1},kerning:g.metadata[b].kerning||{}}:{font:g.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,e);r=Array.isArray(n)?n:String(n).split(/\r?\n/);var l=1*this.internal.scaleFactor*t/i;s.textIndent=e.textIndent?1*e.textIndent*this.internal.scaleFactor/i:0,s.lineIndent=e.lineIndent;var c,f,d=[];for(c=0,f=r.length;c<f;c++)d=d.concat(kw.apply(this,[r[c],l,s]));return d},(function(n){n.__fontmetrics__=n.__fontmetrics__||{};for(var t="0123456789abcdef",e="klmnopqrstuvwxyz",r={},i={},s=0;s<16;s++)r[e[s]]=t[s],i[t[s]]=e[s];var l=function(b){return"0x"+parseInt(b,10).toString(16)},c=n.__fontmetrics__.compress=function(b){var y,M,C,D,L=["{"];for(var H in b){if(y=b[H],isNaN(parseInt(H,10))?M="'"+H+"'":(H=parseInt(H,10),M=(M=l(H).slice(2)).slice(0,-1)+i[M.slice(-1)]),typeof y=="number")y<0?(C=l(y).slice(3),D="-"):(C=l(y).slice(2),D=""),C=D+C.slice(0,-1)+i[C.slice(-1)];else{if(Hr(y)!=="object")throw new Error("Don't know what to do with value type "+Hr(y)+".");C=c(y)}L.push(M+C)}return L.push("}"),L.join("")},f=n.__fontmetrics__.uncompress=function(b){if(typeof b!="string")throw new Error("Invalid argument passed to uncompress.");for(var y,M,C,D,L={},H=1,Y=L,W=[],St="",_t="",Ct=b.length-1,bt=1;bt<Ct;bt+=1)(D=b[bt])=="'"?y?(C=y.join(""),y=void 0):y=[]:y?y.push(D):D=="{"?(W.push([Y,C]),Y={},C=void 0):D=="}"?((M=W.pop())[0][M[1]]=Y,C=void 0,Y=M[0]):D=="-"?H=-1:C===void 0?r.hasOwnProperty(D)?(St+=r[D],C=parseInt(St,16)*H,H=1,St=""):St+=D:r.hasOwnProperty(D)?(_t+=r[D],Y[C]=parseInt(_t,16)*H,H=1,C=void 0,_t=""):_t+=D;return L},d={codePages:["WinAnsiEncoding"],WinAnsiEncoding:f("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},p={Unicode:{Courier:d,"Courier-Bold":d,"Courier-BoldOblique":d,"Courier-Oblique":d,Helvetica:d,"Helvetica-Bold":d,"Helvetica-BoldOblique":d,"Helvetica-Oblique":d,"Times-Roman":d,"Times-Bold":d,"Times-BoldItalic":d,"Times-Italic":d}},g={Unicode:{"Courier-Oblique":f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":f("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":f("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":f("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:f("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:f("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":f("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:f("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":f("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":f("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":f("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};n.events.push(["addFont",function(b){var y=b.font,M=g.Unicode[y.postScriptName];M&&(y.metadata.Unicode={},y.metadata.Unicode.widths=M.widths,y.metadata.Unicode.kerning=M.kerning);var C=p.Unicode[y.postScriptName];C&&(y.metadata.Unicode.encoding=C,y.encoding=C.codePages[0])}])})(xn.API),(function(n){var t=function(e){for(var r=e.length,i=new Uint8Array(r),s=0;s<r;s++)i[s]=e.charCodeAt(s);return i};n.API.events.push(["addFont",function(e){var r=void 0,i=e.font,s=e.instance;if(!i.isStandardFont){if(s===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(r=s.existsFileInVFS(i.postScriptName)===!1?s.loadFile(i.postScriptName):s.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(l,c){c=/^\x00\x01\x00\x00/.test(c)?t(c):t(Jm(c)),l.metadata=n.API.TTFFont.open(c),l.metadata.Unicode=l.metadata.Unicode||{encoding:{},kerning:{},widths:[]},l.metadata.glyIdsUsed=[0]})(i,r)}}])})(xn),xn.API.addSvgAsImage=function(n,t,e,r,i,s,l,c){if(isNaN(t)||isNaN(e))throw ai.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(i))throw ai.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var f=document.createElement("canvas");f.width=r,f.height=i;var d=f.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,f.width,f.height);var p={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},g=this;return(Wn.canvg?Promise.resolve(Wn.canvg):z1(()=>import("./index.es-B4Pcu2qZ.js"),[],import.meta.url)).catch(function(b){return Promise.reject(new Error("Could not load canvg: "+b))}).then(function(b){return b.default?b.default:b}).then(function(b){return b.fromString(d,n,p)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(b){return b.render(p)}).then(function(){g.addImage(f.toDataURL("image/jpeg",1),t,e,r,i,l,c)})},xn.API.putTotalPages=function(n){var t,e=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(n,"g"),e=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(n,this.internal.getFont()),"g"),e=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var i=0;i<this.internal.pages[r].length;i++)this.internal.pages[r][i]=this.internal.pages[r][i].replace(t,e);return this},xn.API.viewerPreferences=function(n,t){var e;n=n||{},t=t||!1;var r,i,s,l={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(l),f=[],d=0,p=0,g=0;function b(M,C){var D,L=!1;for(D=0;D<M.length;D+=1)M[D]===C&&(L=!0);return L}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(l)),this.internal.viewerpreferences.isSubscribed=!1),e=this.internal.viewerpreferences.configuration,n==="reset"||t===!0){var y=c.length;for(g=0;g<y;g+=1)e[c[g]].value=e[c[g]].defaultValue,e[c[g]].explicitSet=!1}if(Hr(n)==="object"){for(i in n)if(s=n[i],b(c,i)&&s!==void 0){if(e[i].type==="boolean"&&typeof s=="boolean")e[i].value=s;else if(e[i].type==="name"&&b(e[i].valueSet,s))e[i].value=s;else if(e[i].type==="integer"&&Number.isInteger(s))e[i].value=s;else if(e[i].type==="array"){for(d=0;d<s.length;d+=1)if(r=!0,s[d].length===1&&typeof s[d][0]=="number")f.push(String(s[d]-1));else if(s[d].length>1){for(p=0;p<s[d].length;p+=1)typeof s[d][p]!="number"&&(r=!1);r===!0&&f.push([s[d][0]-1,s[d][1]-1].join(" "))}e[i].value="["+f.join(" ")+"]"}else e[i].value=e[i].defaultValue;e[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var M,C=[];for(M in e)e[M].explicitSet===!0&&(e[M].type==="name"?C.push("/"+M+" /"+e[M].value):C.push("/"+M+" "+e[M].value));C.length!==0&&this.internal.write(`/ViewerPreferences
58
- <<
59
- `+C.join(`
60
- `)+`
61
- >>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=e,this},xn.API.addMetadata=function(n,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:n,namespaceUri:t??"http://jspdf.default.namespaceuri/",rawXml:typeof t=="boolean"&&t},this.internal.events.subscribe("putCatalog",PN),this.internal.events.subscribe("postPutResources",ON)),this},(function(n){var t=n.API,e=t.pdfEscape16=function(s,l){for(var c,f=l.metadata.Unicode.widths,d=["","0","00","000","0000"],p=[""],g=0,b=s.length;g<b;++g){if(c=l.metadata.characterToGlyph(s.charCodeAt(g)),l.metadata.glyIdsUsed.push(c),l.metadata.toUnicode[c]=s.charCodeAt(g),f.indexOf(c)==-1&&(f.push(c),f.push([parseInt(l.metadata.widthOfGlyph(c),10)])),c=="0")return p.join("");c=c.toString(16),p.push(d[4-c.length],c)}return p.join("")},r=function(s){var l,c,f,d,p,g,b;for(p=`/CIDInit /ProcSet findresource begin
62
- 12 dict begin
63
- begincmap
64
- /CIDSystemInfo <<
65
- /Registry (Adobe)
66
- /Ordering (UCS)
67
- /Supplement 0
68
- >> def
69
- /CMapName /Adobe-Identity-UCS def
70
- /CMapType 2 def
71
- 1 begincodespacerange
72
- <0000><ffff>
73
- endcodespacerange`,f=[],g=0,b=(c=Object.keys(s).sort(function(y,M){return y-M})).length;g<b;g++)l=c[g],f.length>=100&&(p+=`
74
- `+f.length+` beginbfchar
75
- `+f.join(`
76
- `)+`
77
- endbfchar`,f=[]),s[l]!==void 0&&s[l]!==null&&typeof s[l].toString=="function"&&(d=("0000"+s[l].toString(16)).slice(-4),l=("0000"+(+l).toString(16)).slice(-4),f.push("<"+l+"><"+d+">"));return f.length&&(p+=`
78
- `+f.length+` beginbfchar
79
- `+f.join(`
80
- `)+`
81
- endbfchar
82
- `),p+`endcmap
83
- CMapName currentdict /CMap defineresource pop
84
- end
85
- end`};t.events.push(["putFont",function(s){(function(l){var c=l.font,f=l.out,d=l.newObject,p=l.putStream;if(c.metadata instanceof n.API.TTFFont&&c.encoding==="Identity-H"){for(var g=c.metadata.Unicode.widths,b=c.metadata.subset.encode(c.metadata.glyIdsUsed,1),y="",M=0;M<b.length;M++)y+=String.fromCharCode(b[M]);var C=d();p({data:y,addLength1:!0,objectId:C}),f("endobj");var D=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:D}),f("endobj");var L=d();f("<<"),f("/Type /FontDescriptor"),f("/FontName /"+Od(c.fontName)),f("/FontFile2 "+C+" 0 R"),f("/FontBBox "+n.API.PDFObject.convert(c.metadata.bbox)),f("/Flags "+c.metadata.flags),f("/StemV "+c.metadata.stemV),f("/ItalicAngle "+c.metadata.italicAngle),f("/Ascent "+c.metadata.ascender),f("/Descent "+c.metadata.decender),f("/CapHeight "+c.metadata.capHeight),f(">>"),f("endobj");var H=d();f("<<"),f("/Type /Font"),f("/BaseFont /"+Od(c.fontName)),f("/FontDescriptor "+L+" 0 R"),f("/W "+n.API.PDFObject.convert(g)),f("/CIDToGIDMap /Identity"),f("/DW 1000"),f("/Subtype /CIDFontType2"),f("/CIDSystemInfo"),f("<<"),f("/Supplement 0"),f("/Registry (Adobe)"),f("/Ordering ("+c.encoding+")"),f(">>"),f(">>"),f("endobj"),c.objectNumber=d(),f("<<"),f("/Type /Font"),f("/Subtype /Type0"),f("/ToUnicode "+D+" 0 R"),f("/BaseFont /"+Od(c.fontName)),f("/Encoding /"+c.encoding),f("/DescendantFonts ["+H+" 0 R]"),f(">>"),f("endobj"),c.isAlreadyPutted=!0}})(s)}]),t.events.push(["putFont",function(s){(function(l){var c=l.font,f=l.out,d=l.newObject,p=l.putStream;if(c.metadata instanceof n.API.TTFFont&&c.encoding==="WinAnsiEncoding"){for(var g=c.metadata.rawData,b="",y=0;y<g.length;y++)b+=String.fromCharCode(g[y]);var M=d();p({data:b,addLength1:!0,objectId:M}),f("endobj");var C=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:C}),f("endobj");var D=d();f("<<"),f("/Descent "+c.metadata.decender),f("/CapHeight "+c.metadata.capHeight),f("/StemV "+c.metadata.stemV),f("/Type /FontDescriptor"),f("/FontFile2 "+M+" 0 R"),f("/Flags 96"),f("/FontBBox "+n.API.PDFObject.convert(c.metadata.bbox)),f("/FontName /"+Od(c.fontName)),f("/ItalicAngle "+c.metadata.italicAngle),f("/Ascent "+c.metadata.ascender),f(">>"),f("endobj"),c.objectNumber=d();for(var L=0;L<c.metadata.hmtx.widths.length;L++)c.metadata.hmtx.widths[L]=parseInt(c.metadata.hmtx.widths[L]*(1e3/c.metadata.head.unitsPerEm));f("<</Subtype/TrueType/Type/Font/ToUnicode "+C+" 0 R/BaseFont/"+Od(c.fontName)+"/FontDescriptor "+D+" 0 R/Encoding/"+c.encoding+" /FirstChar 29 /LastChar 255 /Widths "+n.API.PDFObject.convert(c.metadata.hmtx.widths)+">>"),f("endobj"),c.isAlreadyPutted=!0}})(s)}]);var i=function(s){var l,c=s.text||"",f=s.x,d=s.y,p=s.options||{},g=s.mutex||{},b=g.pdfEscape,y=g.activeFontKey,M=g.fonts,C=y,D="",L=0,H="",Y=M[C].encoding;if(M[C].encoding!=="Identity-H")return{text:c,x:f,y:d,options:p,mutex:g};for(H=c,C=y,Array.isArray(c)&&(H=c[0]),L=0;L<H.length;L+=1)M[C].metadata.hasOwnProperty("cmap")&&(l=M[C].metadata.cmap.unicode.codeMap[H[L].charCodeAt(0)]),l||H[L].charCodeAt(0)<256&&M[C].metadata.hasOwnProperty("Unicode")?D+=H[L]:D+="";var W="";return parseInt(C.slice(1))<14||Y==="WinAnsiEncoding"?W=b(D,C).split("").map(function(St){return St.charCodeAt(0).toString(16)}).join(""):Y==="Identity-H"&&(W=e(D,M[C])),g.isHex=!0,{text:W,x:f,y:d,options:p,mutex:g}};t.events.push(["postProcessText",function(s){var l=s.text||"",c=[],f={text:l,x:s.x,y:s.y,options:s.options,mutex:s.mutex};if(Array.isArray(l)){var d=0;for(d=0;d<l.length;d+=1)Array.isArray(l[d])&&l[d].length===3?c.push([i(Object.assign({},f,{text:l[d][0]})).text,l[d][1],l[d][2]]):c.push(i(Object.assign({},f,{text:l[d]})).text);s.text=c}else s.text=i(Object.assign({},f,{text:l})).text}])})(xn),(function(n){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};n.existsFileInVFS=function(e){return t.call(this),this.internal.vFS[e]!==void 0},n.addFileToVFS=function(e,r){return t.call(this),this.internal.vFS[e]=r,this},n.getFileFromVFS=function(e){return t.call(this),this.internal.vFS[e]!==void 0?this.internal.vFS[e]:null}})(xn.API),(function(n){n.__bidiEngine__=n.prototype.__bidiEngine__=function(r){var i,s,l,c,f,d,p,g=t,b=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],y=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],M={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},C={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},D=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],L=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),H=!1,Y=0;this.__bidiEngine__={};var W=function(Z){var ct=Z.charCodeAt(),V=ct>>8,xt=C[V];return xt!==void 0?g[256*xt+(255&ct)]:V===252||V===253?"AL":L.test(V)?"L":V===8?"R":"N"},St=function(Z){for(var ct,V=0;V<Z.length;V++){if((ct=W(Z.charAt(V)))==="L")return!1;if(ct==="R")return!0}return!1},_t=function(Z,ct,V,xt){var Lt,dt,st,lt,zt=ct[xt];switch(zt){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":H=!1;break;case"N":case"AN":break;case"EN":H&&(zt="AN");break;case"AL":H=!0,zt="R";break;case"WS":case"BN":zt="N";break;case"CS":xt<1||xt+1>=ct.length||(Lt=V[xt-1])!=="EN"&&Lt!=="AN"||(dt=ct[xt+1])!=="EN"&&dt!=="AN"?zt="N":H&&(dt="AN"),zt=dt===Lt?dt:"N";break;case"ES":zt=(Lt=xt>0?V[xt-1]:"B")==="EN"&&xt+1<ct.length&&ct[xt+1]==="EN"?"EN":"N";break;case"ET":if(xt>0&&V[xt-1]==="EN"){zt="EN";break}if(H){zt="N";break}for(st=xt+1,lt=ct.length;st<lt&&ct[st]==="ET";)st++;zt=st<lt&&ct[st]==="EN"?"EN":"N";break;case"NSM":if(l&&!c){for(lt=ct.length,st=xt+1;st<lt&&ct[st]==="NSM";)st++;if(st<lt){var At=Z[xt],K=At>=1425&&At<=2303||At===64286;if(Lt=ct[st],K&&(Lt==="R"||Lt==="AL")){zt="R";break}}}zt=xt<1||(Lt=ct[xt-1])==="B"?"N":V[xt-1];break;case"B":H=!1,i=!0,zt=Y;break;case"S":s=!0,zt="N"}return zt},Ct=function(Z,ct,V){var xt=Z.split("");return V&&bt(xt,V,{hiLevel:Y}),xt.reverse(),ct&&ct.reverse(),xt.join("")},bt=function(Z,ct,V){var xt,Lt,dt,st,lt,zt=-1,At=Z.length,K=0,P=[],X=Y?y:b,tt=[];for(H=!1,i=!1,s=!1,Lt=0;Lt<At;Lt++)tt[Lt]=W(Z[Lt]);for(dt=0;dt<At;dt++){if(lt=K,P[dt]=_t(Z,tt,P,dt),xt=240&(K=X[lt][M[P[dt]]]),K&=15,ct[dt]=st=X[K][5],xt>0)if(xt===16){for(Lt=zt;Lt<dt;Lt++)ct[Lt]=1;zt=-1}else zt=-1;if(X[K][6])zt===-1&&(zt=dt);else if(zt>-1){for(Lt=zt;Lt<dt;Lt++)ct[Lt]=st;zt=-1}tt[dt]==="B"&&(ct[dt]=0),V.hiLevel|=st}s&&(function(gt,vt,kt){for(var qt=0;qt<kt;qt++)if(gt[qt]==="S"){vt[qt]=Y;for(var Rt=qt-1;Rt>=0&&gt[Rt]==="WS";Rt--)vt[Rt]=Y}})(tt,ct,At)},ot=function(Z,ct,V,xt,Lt){if(!(Lt.hiLevel<Z)){if(Z===1&&Y===1&&!i)return ct.reverse(),void(V&&V.reverse());for(var dt,st,lt,zt,At=ct.length,K=0;K<At;){if(xt[K]>=Z){for(lt=K+1;lt<At&&xt[lt]>=Z;)lt++;for(zt=K,st=lt-1;zt<st;zt++,st--)dt=ct[zt],ct[zt]=ct[st],ct[st]=dt,V&&(dt=V[zt],V[zt]=V[st],V[st]=dt);K=lt}K++}}},jt=function(Z,ct,V){var xt=Z.split(""),Lt={hiLevel:Y};return V||(V=[]),bt(xt,V,Lt),(function(dt,st,lt){if(lt.hiLevel!==0&&p)for(var zt,At=0;At<dt.length;At++)st[At]===1&&(zt=D.indexOf(dt[At]))>=0&&(dt[At]=D[zt+1])})(xt,V,Lt),ot(2,xt,ct,V,Lt),ot(1,xt,ct,V,Lt),xt.join("")};return this.__bidiEngine__.doBidiReorder=function(Z,ct,V){if((function(Lt,dt){if(dt)for(var st=0;st<Lt.length;st++)dt[st]=st;c===void 0&&(c=St(Lt)),d===void 0&&(d=St(Lt))})(Z,ct),l||!f||d)if(l&&f&&c^d)Y=c?1:0,Z=Ct(Z,ct,V);else if(!l&&f&&d)Y=c?1:0,Z=jt(Z,ct,V),Z=Ct(Z,ct);else if(!l||c||f||d){if(l&&!f&&c^d)Z=Ct(Z,ct),c?(Y=0,Z=jt(Z,ct,V)):(Y=1,Z=jt(Z,ct,V),Z=Ct(Z,ct));else if(l&&c&&!f&&d)Y=1,Z=jt(Z,ct,V),Z=Ct(Z,ct);else if(!l&&!f&&c^d){var xt=p;c?(Y=1,Z=jt(Z,ct,V),Y=0,p=!1,Z=jt(Z,ct,V),p=xt):(Y=0,Z=jt(Z,ct,V),Z=Ct(Z,ct),Y=1,p=!1,Z=jt(Z,ct,V),p=xt,Z=Ct(Z,ct))}}else Y=0,Z=jt(Z,ct,V);else Y=c?1:0,Z=jt(Z,ct,V);return Z},this.__bidiEngine__.setOptions=function(Z){Z&&(l=Z.isInputVisual,f=Z.isOutputVisual,c=Z.isInputRtl,d=Z.isOutputRtl,p=Z.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],e=new n.__bidiEngine__({isInputVisual:!0});n.API.events.push(["postProcessText",function(r){var i=r.text;r.x,r.y;var s=r.options||{};r.mutex,s.lang;var l=[];if(s.isInputVisual=typeof s.isInputVisual!="boolean"||s.isInputVisual,e.setOptions(s),Object.prototype.toString.call(i)==="[object Array]"){var c=0;for(l=[],c=0;c<i.length;c+=1)Object.prototype.toString.call(i[c])==="[object Array]"?l.push([e.doBidiReorder(i[c][0]),i[c][1],i[c][2]]):l.push([e.doBidiReorder(i[c])]);r.text=l}else r.text=e.doBidiReorder(i);e.setOptions({isInputVisual:!0})}])})(xn),xn.API.TTFFont=(function(){function n(t){var e;if(this.rawData=t,e=this.contents=new pf(t),this.contents.pos=4,e.readString(4)==="ttcf")throw new Error("TTCF not supported.");e.pos=0,this.parse(),this.subset=new KN(this),this.registerTTF()}return n.open=function(t){return new n(t)},n.prototype.parse=function(){return this.directory=new IN(this.contents),this.head=new BN(this),this.name=new qN(this),this.cmap=new d4(this),this.toUnicode={},this.hhea=new zN(this),this.maxp=new YN(this),this.hmtx=new $N(this),this.post=new UN(this),this.os2=new FN(this),this.loca=new GN(this),this.glyf=new VN(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},n.prototype.registerTTF=function(){var t,e,r,i,s;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var l,c,f,d;for(d=[],l=0,c=(f=this.bbox).length;l<c;l++)t=f[l],d.push(Math.round(t*this.scaleFactor));return d}).call(this),this.stemV=0,this.post.exists?(r=255&(i=this.post.italic_angle),32768&(e=i>>16)&&(e=-(1+(65535^e))),this.italicAngle=+(e+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(s=this.familyClass)===1||s===2||s===3||s===4||s===5||s===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},n.prototype.characterToGlyph=function(t){var e;return((e=this.cmap.unicode)!=null?e.codeMap[t]:void 0)||0},n.prototype.widthOfGlyph=function(t){var e;return e=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*e},n.prototype.widthOfString=function(t,e,r){var i,s,l,c;for(l=0,s=0,c=(t=""+t).length;0<=c?s<c:s>c;s=0<=c?++s:--s)i=t.charCodeAt(s),l+=this.widthOfGlyph(this.characterToGlyph(i))+r*(1e3/e)||0;return l*(e/1e3)},n.prototype.lineHeight=function(t,e){var r;return e==null&&(e=!1),r=e?this.lineGap:0,(this.ascender+r-this.decender)/1e3*t},n})();var sc,pf=(function(){function n(t){this.data=t??[],this.pos=0,this.length=this.data.length}return n.prototype.readByte=function(){return this.data[this.pos++]},n.prototype.writeByte=function(t){return this.data[this.pos++]=t},n.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},n.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},n.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},n.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},n.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},n.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},n.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},n.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},n.prototype.readString=function(t){var e,r;for(r=[],e=0;0<=t?e<t:e>t;e=0<=t?++e:--e)r[e]=String.fromCharCode(this.readByte());return r.join("")},n.prototype.writeString=function(t){var e,r,i;for(i=[],e=0,r=t.length;0<=r?e<r:e>r;e=0<=r?++e:--e)i.push(this.writeByte(t.charCodeAt(e)));return i},n.prototype.readShort=function(){return this.readInt16()},n.prototype.writeShort=function(t){return this.writeInt16(t)},n.prototype.readLongLong=function(){var t,e,r,i,s,l,c,f;return t=this.readByte(),e=this.readByte(),r=this.readByte(),i=this.readByte(),s=this.readByte(),l=this.readByte(),c=this.readByte(),f=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^e)+1099511627776*(255^r)+4294967296*(255^i)+16777216*(255^s)+65536*(255^l)+256*(255^c)+(255^f)+1):72057594037927940*t+281474976710656*e+1099511627776*r+4294967296*i+16777216*s+65536*l+256*c+f},n.prototype.writeLongLong=function(t){var e,r;return e=Math.floor(t/4294967296),r=4294967295&t,this.writeByte(e>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},n.prototype.readInt=function(){return this.readInt32()},n.prototype.writeInt=function(t){return this.writeInt32(t)},n.prototype.read=function(t){var e,r;for(e=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)e.push(this.readByte());return e},n.prototype.write=function(t){var e,r,i,s;for(s=[],r=0,i=t.length;r<i;r++)e=t[r],s.push(this.writeByte(e));return s},n})(),IN=(function(){var n;function t(e){var r,i,s;for(this.scalarType=e.readInt(),this.tableCount=e.readShort(),this.searchRange=e.readShort(),this.entrySelector=e.readShort(),this.rangeShift=e.readShort(),this.tables={},i=0,s=this.tableCount;0<=s?i<s:i>s;i=0<=s?++i:--i)r={tag:e.readString(4),checksum:e.readInt(),offset:e.readInt(),length:e.readInt()},this.tables[r.tag]=r}return t.prototype.encode=function(e){var r,i,s,l,c,f,d,p,g,b,y,M,C;for(C in y=Object.keys(e).length,f=Math.log(2),g=16*Math.floor(Math.log(y)/f),l=Math.floor(g/f),p=16*y-g,(i=new pf).writeInt(this.scalarType),i.writeShort(y),i.writeShort(g),i.writeShort(l),i.writeShort(p),s=16*y,d=i.pos+s,c=null,M=[],e)for(b=e[C],i.writeString(C),i.writeInt(n(b)),i.writeInt(d),i.writeInt(b.length),M=M.concat(b),C==="head"&&(c=d),d+=b.length;d%4;)M.push(0),d++;return i.write(M),r=2981146554-n(i.data),i.pos=c+8,i.writeUInt32(r),i.data},n=function(e){var r,i,s,l;for(e=h4.call(e);e.length%4;)e.push(0);for(s=new pf(e),i=0,r=0,l=e.length;r<l;r=r+=4)i+=s.readUInt32();return 4294967295&i},t})(),jN={}.hasOwnProperty,jc=function(n,t){for(var e in t)jN.call(t,e)&&(n[e]=t[e]);function r(){this.constructor=n}return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};sc=(function(){function n(t){var e;this.file=t,e=this.file.directory.tables[this.tag],this.exists=!!e,e&&(this.offset=e.offset,this.length=e.length,this.parse(this.file.contents))}return n.prototype.parse=function(){},n.prototype.encode=function(){},n.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},n})();var BN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="head",n.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},n.prototype.encode=function(t){var e;return(e=new pf).writeInt(this.version),e.writeInt(this.revision),e.writeInt(this.checkSumAdjustment),e.writeInt(this.magicNumber),e.writeShort(this.flags),e.writeShort(this.unitsPerEm),e.writeLongLong(this.created),e.writeLongLong(this.modified),e.writeShort(this.xMin),e.writeShort(this.yMin),e.writeShort(this.xMax),e.writeShort(this.yMax),e.writeShort(this.macStyle),e.writeShort(this.lowestRecPPEM),e.writeShort(this.fontDirectionHint),e.writeShort(t),e.writeShort(this.glyphDataFormat),e.data},n})(),Lw=(function(){function n(t,e){var r,i,s,l,c,f,d,p,g,b,y,M,C,D,L,H,Y;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=e+t.readInt(),g=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(f=0;f<256;++f)this.codeMap[f]=t.readByte();break;case 4:for(y=t.readUInt16(),b=y/2,t.pos+=6,s=(function(){var W,St;for(St=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)St.push(t.readUInt16());return St})(),t.pos+=2,C=(function(){var W,St;for(St=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)St.push(t.readUInt16());return St})(),d=(function(){var W,St;for(St=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)St.push(t.readUInt16());return St})(),p=(function(){var W,St;for(St=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)St.push(t.readUInt16());return St})(),i=(this.length-t.pos+this.offset)/2,c=(function(){var W,St;for(St=[],f=W=0;0<=i?W<i:W>i;f=0<=i?++W:--W)St.push(t.readUInt16());return St})(),f=L=0,Y=s.length;L<Y;f=++L)for(D=s[f],r=H=M=C[f];M<=D?H<=D:H>=D;r=M<=D?++H:--H)p[f]===0?l=r+d[f]:(l=c[p[f]/2+(r-M)-(b-f)]||0)!==0&&(l+=d[f]),this.codeMap[r]=65535&l}t.pos=g}return n.encode=function(t,e){var r,i,s,l,c,f,d,p,g,b,y,M,C,D,L,H,Y,W,St,_t,Ct,bt,ot,jt,Z,ct,V,xt,Lt,dt,st,lt,zt,At,K,P,X,tt,gt,vt,kt,qt,Rt,Zt,Ae,le;switch(xt=new pf,l=Object.keys(t).sort(function(Ie,Ue){return Ie-Ue}),e){case"macroman":for(C=0,D=(function(){var Ie=[];for(M=0;M<256;++M)Ie.push(0);return Ie})(),H={0:0},s={},Lt=0,zt=l.length;Lt<zt;Lt++)H[Rt=t[i=l[Lt]]]==null&&(H[Rt]=++C),s[i]={old:t[i],new:H[t[i]]},D[i]=H[t[i]];return xt.writeUInt16(1),xt.writeUInt16(0),xt.writeUInt32(12),xt.writeUInt16(0),xt.writeUInt16(262),xt.writeUInt16(0),xt.write(D),{charMap:s,subtable:xt.data,maxGlyphID:C+1};case"unicode":for(ct=[],g=[],Y=0,H={},r={},L=d=null,dt=0,At=l.length;dt<At;dt++)H[St=t[i=l[dt]]]==null&&(H[St]=++Y),r[i]={old:St,new:H[St]},c=H[St]-i,L!=null&&c===d||(L&&g.push(L),ct.push(i),d=c),L=i;for(L&&g.push(L),g.push(65535),ct.push(65535),jt=2*(ot=ct.length),bt=2*Math.pow(Math.log(ot)/Math.LN2,2),b=Math.log(bt/2)/Math.LN2,Ct=2*ot-bt,f=[],_t=[],y=[],M=st=0,K=ct.length;st<K;M=++st){if(Z=ct[M],p=g[M],Z===65535){f.push(0),_t.push(0);break}if(Z-(V=r[Z].new)>=32768)for(f.push(0),_t.push(2*(y.length+ot-M)),i=lt=Z;Z<=p?lt<=p:lt>=p;i=Z<=p?++lt:--lt)y.push(r[i].new);else f.push(V-Z),_t.push(0)}for(xt.writeUInt16(3),xt.writeUInt16(1),xt.writeUInt32(12),xt.writeUInt16(4),xt.writeUInt16(16+8*ot+2*y.length),xt.writeUInt16(0),xt.writeUInt16(jt),xt.writeUInt16(bt),xt.writeUInt16(b),xt.writeUInt16(Ct),kt=0,P=g.length;kt<P;kt++)i=g[kt],xt.writeUInt16(i);for(xt.writeUInt16(0),qt=0,X=ct.length;qt<X;qt++)i=ct[qt],xt.writeUInt16(i);for(Zt=0,tt=f.length;Zt<tt;Zt++)c=f[Zt],xt.writeUInt16(c);for(Ae=0,gt=_t.length;Ae<gt;Ae++)W=_t[Ae],xt.writeUInt16(W);for(le=0,vt=y.length;le<vt;le++)C=y[le],xt.writeUInt16(C);return{charMap:r,subtable:xt.data,maxGlyphID:Y+1}}},n})(),d4=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="cmap",n.prototype.parse=function(t){var e,r,i;for(t.pos=this.offset,this.version=t.readUInt16(),i=t.readUInt16(),this.tables=[],this.unicode=null,r=0;0<=i?r<i:r>i;r=0<=i?++r:--r)e=new Lw(t,this.offset),this.tables.push(e),e.isUnicode&&this.unicode==null&&(this.unicode=e);return!0},n.encode=function(t,e){var r,i;return e==null&&(e="macroman"),r=Lw.encode(t,e),(i=new pf).writeUInt16(0),i.writeUInt16(1),r.table=i.data.concat(r.subtable),r},n})(),zN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="hhea",n.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},n})(),FN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="OS/2",n.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=(function(){var e,r;for(r=[],e=0;e<10;++e)r.push(t.readByte());return r})(),this.charRange=(function(){var e,r;for(r=[],e=0;e<4;++e)r.push(t.readInt());return r})(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=(function(){var e,r;for(r=[],e=0;e<2;e=++e)r.push(t.readInt());return r})(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},n})(),UN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="post",n.prototype.parse=function(t){var e,r,i;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var s;for(r=t.readUInt16(),this.glyphNameIndex=[],s=0;0<=r?s<r:s>r;s=0<=r?++s:--s)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],i=[];t.pos<this.offset+this.length;)e=t.readByte(),i.push(this.names.push(t.readString(e)));return i;case 151552:return r=t.readUInt16(),this.offsets=t.read(r);case 262144:return this.map=(function(){var l,c,f;for(f=[],s=l=0,c=this.file.maxp.numGlyphs;0<=c?l<c:l>c;s=0<=c?++l:--l)f.push(t.readUInt32());return f}).call(this)}},n})(),HN=function(n,t){this.raw=n,this.length=n.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},qN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="name",n.prototype.parse=function(t){var e,r,i,s,l,c,f,d,p,g,b;for(t.pos=this.offset,t.readShort(),e=t.readShort(),c=t.readShort(),r=[],s=0;0<=e?s<e:s>e;s=0<=e?++s:--s)r.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+c+t.readShort()});for(f={},s=p=0,g=r.length;p<g;s=++p)i=r[s],t.pos=i.offset,d=t.readString(i.length),l=new HN(d,i),f[b=i.nameID]==null&&(f[b]=[]),f[i.nameID].push(l);this.strings=f,this.copyright=f[0],this.fontFamily=f[1],this.fontSubfamily=f[2],this.uniqueSubfamily=f[3],this.fontName=f[4],this.version=f[5];try{this.postscriptName=f[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=f[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=f[7],this.manufacturer=f[8],this.designer=f[9],this.description=f[10],this.vendorUrl=f[11],this.designerUrl=f[12],this.license=f[13],this.licenseUrl=f[14],this.preferredFamily=f[15],this.preferredSubfamily=f[17],this.compatibleFull=f[18],this.sampleText=f[19]},n})(),YN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="maxp",n.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},n})(),$N=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="hmtx",n.prototype.parse=function(t){var e,r,i,s,l,c,f;for(t.pos=this.offset,this.metrics=[],e=0,c=this.file.hhea.numberOfMetrics;0<=c?e<c:e>c;e=0<=c?++e:--e)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(i=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var d,p;for(p=[],e=d=0;0<=i?d<i:d>i;e=0<=i?++d:--d)p.push(t.readInt16());return p})(),this.widths=(function(){var d,p,g,b;for(b=[],d=0,p=(g=this.metrics).length;d<p;d++)s=g[d],b.push(s.advance);return b}).call(this),r=this.widths[this.widths.length-1],f=[],e=l=0;0<=i?l<i:l>i;e=0<=i?++l:--l)f.push(this.widths.push(r));return f},n.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},n})(),h4=[].slice,VN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="glyf",n.prototype.parse=function(){return this.cache={}},n.prototype.glyphFor=function(t){var e,r,i,s,l,c,f,d,p,g;return t in this.cache?this.cache[t]:(s=this.file.loca,e=this.file.contents,r=s.indexOf(t),(i=s.lengthOf(t))===0?this.cache[t]=null:(e.pos=this.offset+r,l=(c=new pf(e.read(i))).readShort(),d=c.readShort(),g=c.readShort(),f=c.readShort(),p=c.readShort(),this.cache[t]=l===-1?new XN(c,d,g,f,p):new WN(c,l,d,g,f,p),this.cache[t]))},n.prototype.encode=function(t,e,r){var i,s,l,c,f;for(l=[],s=[],c=0,f=e.length;c<f;c++)i=t[e[c]],s.push(l.length),i&&(l=l.concat(i.encode(r)));return s.push(l.length),{table:l,offsets:s}},n})(),WN=(function(){function n(t,e,r,i,s,l){this.raw=t,this.numberOfContours=e,this.xMin=r,this.yMin=i,this.xMax=s,this.yMax=l,this.compound=!1}return n.prototype.encode=function(){return this.raw.data},n})(),XN=(function(){function n(t,e,r,i,s){var l,c;for(this.raw=t,this.xMin=e,this.yMin=r,this.xMax=i,this.yMax=s,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],l=this.raw;c=l.readShort(),this.glyphOffsets.push(l.pos),this.glyphIDs.push(l.readUInt16()),32&c;)l.pos+=1&c?4:2,128&c?l.pos+=8:64&c?l.pos+=4:8&c&&(l.pos+=2)}return n.prototype.encode=function(){var t,e,r;for(e=new pf(h4.call(this.raw.data)),t=0,r=this.glyphIDs.length;t<r;++t)e.pos=this.glyphOffsets[t];return e.data},n})(),GN=(function(){function n(){return n.__super__.constructor.apply(this,arguments)}return jc(n,sc),n.prototype.tag="loca",n.prototype.parse=function(t){var e,r;return t.pos=this.offset,e=this.file.head.indexToLocFormat,this.offsets=e===0?(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=2)s.push(2*t.readUInt16());return s}).call(this):(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=4)s.push(t.readUInt32());return s}).call(this)},n.prototype.indexOf=function(t){return this.offsets[t]},n.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},n.prototype.encode=function(t,e){for(var r=new Uint32Array(this.offsets.length),i=0,s=0,l=0;l<r.length;++l)if(r[l]=i,s<e.length&&e[s]==l){++s,r[l]=i;var c=this.offsets[l],f=this.offsets[l+1]-c;f>0&&(i+=f)}for(var d=new Array(4*r.length),p=0;p<r.length;++p)d[4*p+3]=255&r[p],d[4*p+2]=(65280&r[p])>>8,d[4*p+1]=(16711680&r[p])>>16,d[4*p]=(4278190080&r[p])>>24;return d},n})(),KN=(function(){function n(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return n.prototype.generateCmap=function(){var t,e,r,i,s;for(e in i=this.font.cmap.tables[0].codeMap,t={},s=this.subset)r=s[e],t[e]=i[r];return t},n.prototype.glyphsFor=function(t){var e,r,i,s,l,c,f;for(i={},l=0,c=t.length;l<c;l++)i[s=t[l]]=this.font.glyf.glyphFor(s);for(s in e=[],i)(r=i[s])!=null&&r.compound&&e.push.apply(e,r.glyphIDs);if(e.length>0)for(s in f=this.glyphsFor(e))r=f[s],i[s]=r;return i},n.prototype.encode=function(t,e){var r,i,s,l,c,f,d,p,g,b,y,M,C,D,L;for(i in r=d4.encode(this.generateCmap(),"unicode"),l=this.glyphsFor(t),y={0:0},L=r.charMap)y[(f=L[i]).old]=f.new;for(M in b=r.maxGlyphID,l)M in y||(y[M]=b++);return p=(function(H){var Y,W;for(Y in W={},H)W[H[Y]]=Y;return W})(y),g=Object.keys(p).sort(function(H,Y){return H-Y}),C=(function(){var H,Y,W;for(W=[],H=0,Y=g.length;H<Y;H++)c=g[H],W.push(p[c]);return W})(),s=this.font.glyf.encode(l,C,y),d=this.font.loca.encode(s.offsets,C),D={cmap:this.font.cmap.raw(),glyf:s.table,loca:d,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(e)},this.font.os2.exists&&(D["OS/2"]=this.font.os2.raw()),this.font.directory.encode(D)},n})();xn.API.PDFObject=(function(){var n;function t(){}return n=function(e,r){return(Array(r+1).join("0")+e).slice(-r)},t.convert=function(e){var r,i,s,l;if(Array.isArray(e))return"["+(function(){var c,f,d;for(d=[],c=0,f=e.length;c<f;c++)r=e[c],d.push(t.convert(r));return d})().join(" ")+"]";if(typeof e=="string")return"/"+e;if(e?.isString)return"("+e+")";if(e instanceof Date)return"(D:"+n(e.getUTCFullYear(),4)+n(e.getUTCMonth(),2)+n(e.getUTCDate(),2)+n(e.getUTCHours(),2)+n(e.getUTCMinutes(),2)+n(e.getUTCSeconds(),2)+"Z)";if({}.toString.call(e)==="[object Object]"){for(i in s=["<<"],e)l=e[i],s.push("/"+i+" "+t.convert(l));return s.push(">>"),s.join(`
86
- `)}return""+e},t})();const JN=new Set(["point","polygon","polyline","rectangle","ellipse","arrow","compass","numbering","image"]);function Rw(n){return JN.has(n.anchor.type)}function ay(n,t){if(n.anchor.type!=="linked")return n.anchor;const{pinId:e}=n.anchor,r=t.find(i=>i.id===e);return!r||r.anchor.type==="linked"?null:r.anchor}function u2(n,t){if(n.anchor.type!=="linked")return n;const{pinId:e}=n.anchor,r=t.find(i=>i.id===e);return r&&r.anchor.type!=="linked"?r:null}function u5(n,t){return t.filter(e=>e.anchor.type==="linked"&&e.anchor.pinId===n).map(e=>e.id)}function ZN(n,t){return new Set([n,...u5(n,t)])}const QN="1.15.0",Cl=["#FBD710","#F0462F","#FF8D28","#4FD553","#00C0E8","#0088FF","#E246A1","#FFFFFF","#A0522D","#888888","#000000"],t_="small",e_={small:{maxLogicalImageSize:1500,upscaleSmallImagesToLogicalSize:!0,minZoom:.25,maxZoom:20,zoomWheelFactor:1.07,zoomPrecision:3,contourScale:1.25},medium:{maxLogicalImageSize:1800,upscaleSmallImagesToLogicalSize:!0,minZoom:.25,maxZoom:20,zoomWheelFactor:1.08,zoomPrecision:3,contourScale:1.8},large:{maxLogicalImageSize:2400,upscaleSmallImagesToLogicalSize:!0,minZoom:.25,maxZoom:20,zoomWheelFactor:1.1,zoomPrecision:3,contourScale:2.4},xlarge:{maxLogicalImageSize:3200,upscaleSmallImagesToLogicalSize:!0,minZoom:.2,maxZoom:24,zoomWheelFactor:1.12,zoomPrecision:3,contourScale:3}},oh=e_[t_],f2=oh.maxLogicalImageSize,Mm=oh.minZoom,Cm=oh.maxZoom,Ow=oh.zoomWheelFactor,Em=oh.zoomPrecision,Zr=oh.contourScale,f5=1/1.25,p4=Zr*f5,m4=280*Zr,d2=100*Zr,Pw=12*Zr,Iw=12*Zr,$h=3*Zr,ng=1*Zr,jw=1*Zr,Bw=2*Zr,zw=1*Zr,Fw="rgba(0,0,0,0.45)",g4=2.5*Zr,Nf=2.5*Zr,Pc=.25,Qf=4,d5=.25,h5=1,n_=.5,r_=.6,Qh="solid",pg="filled",i_="44",Ud=[5*Zr,3*Zr],h2=4*Zr,y4=60*Zr,Fs=20,p2="iso";function Tm(n){return n.toString().padStart(2,"0")}function Pd(n=new Date,t=p2){const e=n.getFullYear(),r=Tm(n.getMonth()+1),i=Tm(n.getDate()),s=Tm(n.getHours()),l=Tm(n.getMinutes());return t==="ua_full"?`${i}.${r}.${e} ${s}:${l}`:`${e}-${r}-${i} ${s}:${l}`}const Qu="#E63946",b4=3*Zr,m2=2*Zr,g2=7*Zr,x4=0,tp=1.4,o_="image/png,image/jpeg,image/svg+xml,image/webp,image/gif,image/avif,image/bmp",s_=["PNG","JPG","SVG","WebP","GIF","AVIF","BMP"],a_=2,l_=40,c_=4,u_=48,f_="blur",d_=.5,h_=.05,Nm=12,ly=200*Zr,_m=16,v4=10*Zr,p_=.1,m_="#ffffff",g_="#000000",cy="<p>Текст</p>",y2=6,y_=5,mg=1,Uw=4,b_=18;function Hd(){return typeof navigator>"u"?"Ctrl+V":/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"⌘+V":"Ctrl+V"}function td(n){return typeof n!="number"||!Number.isFinite(n)?h5:Math.min(Qf,Math.max(Pc,n))}function Hw(n,t){return td(n.strokeWidthScale??td(t))}function p5(n){return td(n).toFixed(2).replace(/\.?0+$/,"")}function w4(n){const t=1+(td(n)-1)*n_;return Math.max(r_,t)}function x_(n){return n.type!=="text"}const S4=!1,k4="tyts-app-settings",b2={fontId:"road-ui",strokeWidthScale:h5},v_="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif";function w_(n){return`${n==="uaf-sans"&&S4?"'UAF Sans'":"'Road UI'"}, ${v_}`}function S_(n){return n==="road-ui"?n:b2.fontId}function k_(){try{const n=localStorage.getItem(k4);if(!n)return{...b2};const t=JSON.parse(n);return{fontId:S_(t.fontId),strokeWidthScale:td(t.strokeWidthScale)}}catch{}return{...b2}}function qw(n){localStorage.setItem(k4,JSON.stringify(n))}function A_(){const[n,t]=U.useState(()=>k_()),e=U.useMemo(()=>w_(n.fontId),[n.fontId]);U.useEffect(()=>{document.documentElement.style.setProperty("--tyts-font-family",e),document.body.style.fontFamily=e},[e]);const r=U.useCallback(s=>{t(l=>{const c={...l,fontId:s};return qw(c),c})},[]),i=U.useCallback(s=>{t(l=>{const c={...l,strokeWidthScale:td(s)};return qw(c),c})},[]);return{settings:n,fontFamily:e,setFontId:r,setStrokeWidthScale:i}}const M_=[{id:"road-ui",label:"Road UI"}];function C_({open:n,fontId:t,fontFamily:e,strokeWidthScale:r,onClose:i,onFontIdChange:s,onStrokeWidthScaleChange:l}){if(!n)return null;const c=(r-Pc)/(Qf-Pc)*100;return T.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"tyts-settings-title",style:{position:"fixed",inset:0,zIndex:5e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)"},onClick:i,children:T.jsxs("div",{onClick:f=>f.stopPropagation(),style:{width:"min(360px, calc(100vw - 32px))",background:"rgba(10,10,16,0.98)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:12,boxShadow:"0 16px 40px rgba(0,0,0,0.7)",padding:16,color:"#ddd",fontFamily:e},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:14},children:[T.jsx("h2",{id:"tyts-settings-title",style:{margin:0,fontSize:15,fontWeight:800,color:"#fff"},children:"Налаштування"}),T.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:20,lineHeight:1,padding:0},title:"Закрити","aria-label":"Закрити",children:"×"})]}),T.jsxs("fieldset",{style:{border:"none",margin:0,padding:0},children:[T.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Шрифт"}),T.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:M_.map(f=>T.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",background:t===f.id?"rgba(255,255,255,0.08)":"transparent",border:`1px solid ${t===f.id?"rgba(255,255,255,0.2)":"rgba(255,255,255,0.08)"}`,fontFamily:f.id==="uaf-sans"?"'UAF Sans', sans-serif":"'Road UI', sans-serif",fontSize:14},children:[T.jsx("input",{type:"radio",name:"tyts-font",value:f.id,checked:t===f.id,onChange:()=>s(f.id)}),f.label]},f.id))})]}),T.jsxs("fieldset",{style:{border:"none",margin:"16px 0 0",padding:0},children:[T.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Товщина ліній"}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[T.jsx("input",{type:"range",min:Pc,max:Qf,step:d5,value:r,"aria-label":"Товщина ліній",onChange:f=>l(Number(f.target.value)),className:"tyts-range",style:{flex:1,"--tyts-range-accent":Qu,"--tyts-range-fill":`${c}%`}}),T.jsxs("span",{style:{minWidth:42,textAlign:"right",fontVariantNumeric:"tabular-nums",fontSize:13},children:["×",p5(r)]}),T.jsx("button",{type:"button",onClick:()=>l(h5),title:"Скинути товщину","aria-label":"Скинути товщину",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.18)",borderRadius:6,color:"rgba(255,255,255,0.75)",cursor:"pointer",fontSize:12,padding:"4px 8px",fontFamily:"inherit"},children:"Скинути"})]}),T.jsx("p",{style:{margin:"8px 0 0",fontSize:11,lineHeight:1.4,color:"rgba(255,255,255,0.45)"},children:"Діє на контури, лінії-виноски й маркери. Обʼєкти з власною товщиною лишаються незмінними."})]})]})})}const A4=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],E_=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"];function T_(n){return(n.getDay()+6)%7}function Pf(n){return new Date(n.getFullYear(),n.getMonth(),1)}function x2(n,t){const e=n.getFullYear(),r=n.getMonth()+t,i=n.getDate(),s=new Date(e,r+1,0).getDate();return new Date(e,r,Math.min(i,s),n.getHours(),n.getMinutes(),0,0)}function Yw(n,t){return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()}function v2(n,t,e){return Number.isFinite(n)?Math.min(e,Math.max(t,Math.trunc(n))):t}function N_(n,t){const e=new Date(n,t,1),r=new Date(n,t+1,0).getDate(),i=T_(e),s=[];for(let l=0;l<i;l+=1)s.push({day:null,date:null});for(let l=1;l<=r;l+=1)s.push({day:l,date:new Date(n,t,l)});for(;s.length%7!==0;)s.push({day:null,date:null});for(;s.length<42;)s.push({day:null,date:null});return s}function __(n){const t=Pf(n);return[x2(t,-1),t,x2(t,1)]}function D_(n){const t=n.getMonth(),e=A4[t];return t===0||t===11?`${e} ${n.getFullYear()}`:e}function w2(n,t,e){return new Date(n.getFullYear(),n.getMonth(),n.getDate(),v2(t,0,23),v2(e,0,59),0,0)}function L_(n,t){return w2(t,n.getHours(),n.getMinutes())}function R_({monthDate:n,value:t,today:e,onSelectDay:r}){const i=n.getFullYear(),s=n.getMonth(),l=U.useMemo(()=>N_(i,s),[i,s]);return T.jsxs("div",{style:{minWidth:168,flex:"1 1 168px"},children:[T.jsx("div",{style:{textAlign:"center",fontSize:12,fontWeight:600,color:"#cfd3dc",marginBottom:6,textTransform:"capitalize"},children:D_(n)}),T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:E_.map(c=>T.jsx("div",{style:{textAlign:"center",fontSize:10,color:"rgba(255,255,255,0.45)",padding:"2px 0"},children:c},c))}),T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:l.map((c,f)=>{if(!c.date||c.day==null)return T.jsx("div",{style:{height:24}},`empty-${f}`);const d=Yw(c.date,t),p=Yw(c.date,e);return T.jsx("button",{type:"button",onClick:()=>r(c.date),style:{height:24,borderRadius:5,border:p&&!d?"1px solid rgba(230,57,70,0.7)":"1px solid transparent",background:d?"rgba(230,57,70,0.28)":"transparent",color:d?"#ffc2c8":"#ddd",fontSize:12,fontFamily:"inherit",cursor:"pointer",padding:0},children:c.day},`${i}-${s}-${c.day}`)})})]})}function $w({id:n,label:t,value:e,min:r,max:i,onChange:s}){const[l,c]=U.useState(null),f=l!==null,d=f?l:Bh(e),p=b=>{const y=b.replace(/\D/g,"");if(y===""){c(null);return}const M=v2(Number(y),r,i);s(M),c(null)},g=b=>{const y=i-r+1,M=((e-r+b)%y+y)%y+r;s(M),f&&c(Bh(M))};return T.jsxs("div",{style:{display:"inline-flex",alignItems:"stretch",height:30,borderRadius:6,border:f?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.06)",overflow:"hidden"},children:[T.jsx("label",{htmlFor:n,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:t}),T.jsx("input",{id:n,className:"tyts-time-input",type:"text",inputMode:"numeric",autoComplete:"off",spellCheck:!1,value:d,onFocus:()=>c(Bh(e)),onBlur:()=>p(l??Bh(e)),onChange:b=>{const y=b.target.value.replace(/\D/g,"").slice(0,2);c(y)},onKeyDown:b=>{b.key==="ArrowUp"?(b.preventDefault(),g(1)):b.key==="ArrowDown"?(b.preventDefault(),g(-1)):b.key==="Enter"&&(b.preventDefault(),p(l??Bh(e)),b.target.blur())},onWheel:b=>{document.activeElement===b.currentTarget&&(b.preventDefault(),g(b.deltaY<0?1:-1))},style:{width:34,border:"none",outline:"none",background:"transparent",color:"#fff",textAlign:"center",fontFamily:"inherit",fontSize:13,fontVariantNumeric:"tabular-nums",fontWeight:600,padding:"0 4px"}}),T.jsxs("div",{style:{display:"flex",flexDirection:"column",borderLeft:"1px solid rgba(255,255,255,0.1)",width:20},children:[T.jsx("button",{type:"button",tabIndex:-1,title:`${t}: +1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(1),style:Xw,children:T.jsx("i",{className:"bi bi-chevron-up",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})}),T.jsx("button",{type:"button",tabIndex:-1,title:`${t}: -1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(-1),style:{...Xw,borderTop:"1px solid rgba(255,255,255,0.1)"},children:T.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})})]})]})}function O_({year:n,selected:t,today:e,onSelectMonth:r}){return T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(120px, 1fr))",gap:8,minWidth:400,marginBottom:12},children:A4.map((i,s)=>{const l=t.getFullYear()===n&&t.getMonth()===s,c=e.getFullYear()===n&&e.getMonth()===s;return T.jsx("button",{type:"button",onClick:()=>r(s),style:{textAlign:"center",textTransform:"capitalize",borderRadius:8,border:c&&!l?"1px solid rgba(230,57,70,0.7)":"1px solid rgba(255,255,255,0.1)",background:l?"rgba(230,57,70,0.28)":"rgba(255,255,255,0.04)",color:l?"#ffc2c8":"#ddd",fontFamily:"inherit",fontSize:13,fontWeight:600,padding:"12px 8px",cursor:"pointer"},children:i},i)})})}function P_({value:n,viewMonth:t,format:e,locked:r,onChange:i,onViewMonthChange:s,onFormatChange:l,onLockedChange:c,onInsert:f,onNow:d,onClose:p}){const g=U.useId(),b=U.useId(),y=U.useMemo(()=>new Date,[]),M=U.useMemo(()=>__(t),[t]),C=Pd(n,e),[D,L]=U.useState(!1),[H,Y]=U.useState(()=>t.getFullYear()),W=D?H:t.getFullYear();U.useEffect(()=>{const bt=ot=>{if(ot.key==="Escape"){if(ot.preventDefault(),ot.stopPropagation(),D){L(!1);return}p()}};return window.addEventListener("keydown",bt,!0),()=>window.removeEventListener("keydown",bt,!0)},[p,D]);const St=()=>{Y(t.getFullYear()),L(!0)},_t=bt=>{if(D){Y(ot=>ot+bt);return}s(x2(t,bt))},Ct=bt=>{s(Pf(new Date(H,bt,1))),L(!1)};return T.jsxs("div",{role:"dialog","aria-label":"Вибір дати та часу",onClick:bt=>bt.stopPropagation(),style:{background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 12px 32px rgba(0,0,0,0.55)",padding:12,width:"max-content",maxWidth:"min(560px, calc(100vw - 24px))",zIndex:3200,color:"#ddd",fontFamily:"inherit"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:10},children:[T.jsx("button",{type:"button",title:D?"Попередній рік":"Попередній місяць",onClick:()=>_t(-1),style:Ww,children:T.jsx("i",{className:"bi bi-chevron-left","aria-hidden":!0})}),T.jsx("button",{type:"button",title:D?"Закрити вибір місяця":"Показати всі місяці року",onClick:()=>{D?L(!1):St()},style:{border:"none",background:"transparent",color:"#e8eaed",fontSize:15,fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"4px 10px",borderRadius:6,textDecoration:D?"underline":"none",textUnderlineOffset:3},children:W}),T.jsx("button",{type:"button",title:D?"Наступний рік":"Наступний місяць",onClick:()=>_t(1),style:Ww,children:T.jsx("i",{className:"bi bi-chevron-right","aria-hidden":!0})})]}),D?T.jsx(O_,{year:H,selected:t,today:y,onSelectMonth:Ct}):T.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap",marginBottom:12},children:M.map(bt=>T.jsx(R_,{monthDate:bt,value:n,today:y,onSelectDay:ot=>i(L_(n,ot))},`${bt.getFullYear()}-${bt.getMonth()}`))}),T.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,marginBottom:10,paddingTop:8,borderTop:"1px solid rgba(255,255,255,0.08)"},children:[T.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Час"}),T.jsx($w,{id:g,label:"Години",value:n.getHours(),min:0,max:23,onChange:bt=>i(w2(n,bt,n.getMinutes()))}),T.jsx("span",{style:{opacity:.6,fontWeight:600},children:":"}),T.jsx($w,{id:b,label:"Хвилини",value:n.getMinutes(),min:0,max:59,onChange:bt=>i(w2(n,n.getHours(),bt))})]}),T.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Формат"}),T.jsx(Vw,{active:e==="iso",label:"ISO",onClick:()=>l("iso")}),T.jsx(Vw,{active:e==="ua_full",label:"UA",onClick:()=>l("ua_full")})]}),T.jsx(I_,{locked:r,onToggle:()=>c(!r)}),T.jsx("button",{type:"button",onClick:d,style:{...j_,marginLeft:"auto"},children:"Зараз"})]}),T.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[T.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.55)",fontVariantNumeric:"tabular-nums"},children:C}),T.jsx("button",{type:"button",onClick:f,style:B_,children:"Вставити"})]})]})}function Vw({active:n,label:t,onClick:e}){return T.jsx("button",{type:"button",onClick:e,style:{border:n?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:n?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:n?"#ffc2c8":"#ccc",borderRadius:6,height:30,boxSizing:"border-box",padding:"0 8px",fontSize:12,fontFamily:"inherit",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:t})}function I_({locked:n,onToggle:t}){const[e,r]=U.useState(!1),i=n?"Дата й час зафіксовані — основна кнопка «Дата/час» вставляє їх. Натисніть, щоб зняти фіксацію":"Зафіксувати дату й час: основна кнопка «Дата/час» вставлятиме їх замість поточного моменту";return T.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[T.jsx("button",{type:"button",onClick:t,"aria-pressed":n,"aria-label":n?"Зняти фіксацію дати й часу":"Зафіксувати дату й час",style:{width:30,height:30,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:n?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:n?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:n?"#ffc2c8":"#ccc",cursor:"pointer",padding:0},children:T.jsx("i",{className:`bi ${n?"bi-lock-fill":"bi-unlock"}`,style:{fontSize:14},"aria-hidden":!0})}),e&&T.jsx("span",{role:"tooltip",style:{position:"absolute",left:"50%",bottom:"100%",transform:"translateX(-50%)",marginBottom:6,padding:"6px 10px",background:"rgba(0,0,0,0.9)",color:"#fff",borderRadius:6,fontSize:12,width:"max-content",maxWidth:280,whiteSpace:"normal",textAlign:"center",zIndex:1e3,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:i})]})}function Bh(n){return n.toString().padStart(2,"0")}const Ww={width:28,height:28,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:"1px solid rgba(255,255,255,0.1)",background:"rgba(255,255,255,0.06)",color:"#ddd",cursor:"pointer"},Xw={flex:1,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:"rgba(255,255,255,0.65)",padding:0,cursor:"pointer",minHeight:0},j_={borderRadius:6,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.06)",color:"#ddd",padding:"6px 12px",fontFamily:"inherit",fontSize:13,fontWeight:600,cursor:"pointer"},B_={borderRadius:6,border:"1px solid transparent",background:"linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))",color:"#fff",padding:"6px 14px",fontFamily:"inherit",fontSize:13,fontWeight:600,cursor:"pointer"},z_=20,uy=12,F_=12;function U_(n,t,e){if(n.length===0)return{};const i=m4,s=d2,l=z_,c=Math.max(0,e-2*l),f=Math.max(1,Math.floor((c+uy)/(s+uy))),d={};return n.forEach((p,g)=>{const b=Math.floor(g/f),y=g%f;let M=t-l-i-b*(i+F_),C=l+y*(s+uy);M=Math.max(l,Math.min(M,t-i-l)),C=Math.max(l,Math.min(C,e-s-l)),d[p]={x:M,y:C,width:i,height:s}}),d}function H_(n,t){const e=Math.min(f2/n,f2/t,Number.POSITIVE_INFINITY);return{w:Math.round(n*e),h:Math.round(t*e)}}function m5(n,t,e,r){const i=Math.max(1,e.width),s=Math.max(1,e.height);return{x:(n-e.x)*(r.w/i),y:(t-e.y)*(r.h/s)}}function Gw(n,t,e){const r=(i,s)=>m5(i,s,t,e);switch(n.type){case"linked":return n;case"point":case"standalone":return{...n,...r(n.x,n.y)};case"text":{const i=r(n.x,n.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...n,x:i.x,y:i.y,width:n.width*(e.w/s),height:n.height*(e.h/l),...n.point?{point:r(n.point.x,n.point.y)}:{}}}case"image":case"redact":case"rectangle":{const i=r(n.x,n.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...n,x:i.x,y:i.y,width:n.width*(e.w/s),height:n.height*(e.h/l)}}case"ellipse":{const i=r(n.cx,n.cy),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...n,cx:i.x,cy:i.y,rx:n.rx*(e.w/s),ry:n.ry*(e.h/l)}}case"compass":{const i=r(n.cx,n.cy),s=Math.max(1,t.width),l=Math.max(1,t.height),c=Math.min(e.w/s,e.h/l);return{...n,cx:i.x,cy:i.y,radius:n.radius*c}}case"polygon":case"polyline":return{...n,points:n.points.map(i=>r(i.x,i.y))};case"numbering":case"arrow":{const i=r(n.start.x,n.start.y),s=r(n.end.x,n.end.y);if(n.type==="numbering")return{...n,start:i,end:s};const l=r(n.control.x,n.control.y);return{...n,start:i,end:s,control:l}}default:return n}}function Kw(n){switch(n.type){case"linked":return{x:0,y:0,w:0,h:0};case"point":case"standalone":return{x:n.x,y:n.y,w:0,h:0};case"text":case"image":case"redact":case"rectangle":return{x:n.x,y:n.y,w:n.width,h:n.height};case"ellipse":return{x:n.cx-n.rx,y:n.cy-n.ry,w:n.rx*2,h:n.ry*2};case"compass":return{x:n.cx-n.radius,y:n.cy-n.radius,w:n.radius*2,h:n.radius*2};case"polygon":case"polyline":{if(n.points.length===0)return{x:0,y:0,w:0,h:0};const t=n.points.map(s=>s.x),e=n.points.map(s=>s.y),r=Math.min(...t),i=Math.min(...e);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...e)-i}}case"numbering":case"arrow":{const t=[n.start.x,n.end.x],e=[n.start.y,n.end.y];n.type==="arrow"&&(t.push(n.control.x),e.push(n.control.y));const r=Math.min(...t),i=Math.min(...e);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...e)-i}}default:return n}}function q_(n,t){const e=n.x+n.w,r=n.y+n.h,i=t.x+t.w,s=t.y+t.h;return n.x<=i&&e>=t.x&&n.y<=s&&r>=t.y}function Dm(n,t){return q_(n,{x:0,y:0,w:t.w,h:t.h})}function Jw(n,t,e){const r=m5(n.x,n.y,t,e),i=Math.max(1,t.width),s=Math.max(1,t.height);return{x:r.x,y:r.y,width:n.width*(e.w/i),height:n.height*(e.h/s)}}function Y_(n,t,e,r){const i=[],s={},l=new Set;for(const c of n){if(c.anchor.type==="linked")continue;const f=Gw(c.anchor,e,r),d=t[c.id],p=d?Jw(d,e,r):null;(Dm(Kw(f),r)||p!==null&&Dm({x:p.x,y:p.y,w:p.width,h:p.height},r))&&l.add(c.id)}for(const c of n){if(c.anchor.type==="linked"&&!l.has(c.anchor.pinId))continue;const f=Gw(c.anchor,e,r),d=Kw(f),p=c.anchor.type==="linked"?!0:Dm(d,r),g=t[c.id],b=g?Jw(g,e,r):null,y=b?Dm({x:b.x,y:b.y,w:b.width,h:b.height},r):!1;if(!p&&!y)continue;const M=c.leaderPoints?.map(C=>m5(C.x,C.y,e,r));i.push(M?{...c,anchor:f,leaderPoints:M}:{...c,anchor:f}),b&&(s[c.id]=b)}return{pins:i,cardPositions:s}}function M4(n){const e=(n||"").replace(/<br\s*\/?>/gi,`
87
- `).replace(/<\/p>/gi,`
88
- `).replace(/<\/div>/gi,`
89
- `).replace(/<[^>]+>/g,"").split(`
90
- `);for(;e.length>1&&e[e.length-1].trim()==="";)e.pop();return e}function C4(n,t){const e=t*tp;return Math.ceil(n*e+mg*2)}function $_(n,t,e){const r=M4(n),i=e?.fontSize??Fs,s=y2*2+mg*2,l=Math.max(1,...r.map(d=>Math.ceil(t(d||" ")))),c=Math.max(24,l+s),f=Math.max(b_,C4(r.length,i));return{width:c,height:f}}function V_(n,t,e){const r=n.width/2,i=n.height/2,s=Math.abs(Math.cos(t)),l=Math.abs(Math.sin(t));if(s>1e-9){const d=(r+e)/s;if(d*l<=i)return d}if(l>1e-9){const d=(i+e)/l;if(d*s<=r)return d}const c=s*r+l*i,f=r*r+i*i-e*e;return c+Math.sqrt(Math.max(0,c*c-f))}function E4(n,t,e,r=v4){const i=V_(e,t,r);return{x:n.x+Math.cos(t)*i-e.width/2,y:n.y+Math.sin(t)*i-e.height/2}}function W_(n,t,e,r=v4){const i=Math.atan2(t.y-n.y,t.x-n.x);return E4(n,i,e,r)}function X_(n,t,e){const r=e.x+e.width/2,i=e.y+e.height/2,s=n-r,l=t-i,c=e.width/2/Math.abs(s||.001),f=e.height/2/Math.abs(l||.001),d=Math.min(c,f);return{x:r+s*d,y:i+l*d}}function u0(n,t,e,r,i,s){const l=i-e,c=s-r,f=l*l+c*c;if(f===0)return{x:e,y:r,dist2:(n-e)**2+(t-r)**2};let d=((n-e)*l+(t-r)*c)/f;d=Math.max(0,Math.min(1,d));const p=e+d*l,g=r+d*c;return{x:p,y:g,dist2:(n-p)**2+(t-g)**2}}function G_(n,t,e){if(n.length===0)return{x:t,y:e};if(n.length===1)return{x:n[0].x,y:n[0].y};let r={x:n[0].x,y:n[0].y,dist2:1/0};for(let i=0;i<n.length;i++){const s=n[i],l=n[(i+1)%n.length],c=u0(t,e,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function K_(n,t,e){if(n.length===0)return{x:t,y:e};if(n.length===1)return{x:n[0].x,y:n[0].y};let r={x:n[0].x,y:n[0].y,dist2:1/0};for(let i=0;i<n.length-1;i++){const s=n[i],l=n[i+1],c=u0(t,e,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function J_(n,t,e,r,i){let l={x:n.x,y:n.y,dist2:1/0},c=n;for(let f=1;f<=24;f+=1){const d=f/24,p=1-d,g={x:p*p*n.x+2*p*d*t.x+d*d*e.x,y:p*p*n.y+2*p*d*t.y+d*d*e.y},b=u0(r,i,c.x,c.y,g.x,g.y);b.dist2<l.dist2&&(l=b),c=g}return{x:l.x,y:l.y}}function T4(n,t,e){const r=Math.cos(-e),i=Math.sin(-e);return{x:n*r-t*i,y:n*i+t*r}}function N4(n,t,e){const r=Math.cos(e),i=Math.sin(e);return{x:n*r-t*i,y:n*i+t*r}}function fy(n,t,e,r=0){const{x:i,y:s,width:l,height:c}=n,f=i+l/2,d=s+c/2,p=r*Math.PI/180,g=T4(t-f,e-d,p),b=l/2,y=c/2,M=[[[-b,-y],[b,-y]],[[b,-y],[b,y]],[[b,y],[-b,y]],[[-b,y],[-b,-y]]];let C={x:0,y:0,dist2:1/0};for(const[L,H]of M){const Y=u0(g.x,g.y,L[0],L[1],H[0],H[1]);Y.dist2<C.dist2&&(C=Y)}const D=N4(C.x,C.y,p);return{x:f+D.x,y:d+D.y}}function Zw(n,t,e,r=0){const{cx:i,cy:s,rx:l,ry:c}=n;if(l<=0||c<=0)return{x:i,y:s};const f=r*Math.PI/180,d=T4(t-i,e-s,f),p=Math.atan2(d.y*l,d.x*c),g=l*Math.cos(p),b=c*Math.sin(p),y=N4(g,b,f);return{x:i+y.x,y:s+y.y}}function Z_(n,t){const e=t.x+t.width/2,r=t.y+t.height/2;return n.type==="point"?{x:n.x,y:n.y}:n.type==="standalone"?{x:n.x,y:n.y}:n.type==="polygon"?G_(n.points,e,r):n.type==="polyline"?K_(n.points,e,r):n.type==="arrow"?J_(n.start,n.control,n.end,e,r):n.type==="rectangle"?fy(n,e,r,n.rotation??0):n.type==="image"||n.type==="redact"?fy(n,e,r):n.type==="ellipse"?Zw(n,e,r,n.rotation??0):n.type==="compass"?Zw({cx:n.cx,cy:n.cy,rx:n.radius,ry:n.radius},e,r,n.rotation??0):{x:e,y:r}}function S2(n,t,e=[]){const r=(Array.isArray(e)?e:[]).filter(f=>!!f&&Number.isFinite(f.x)&&Number.isFinite(f.y)),i=r[0],s=Z_(n,i?{x:i.x,y:i.y,width:0,height:0}:t),l=r.length>0?r[r.length-1]:s,c=X_(l.x,l.y,t);return[s,...r,c]}function Q_(n){return n.map((t,e)=>`${e===0?"M":"L"} ${t.x} ${t.y}`).join(" ")}function t8(n){const t=[];for(let e=0;e<n.length-1;e+=1)t.push({x:(n[e].x+n[e+1].x)/2,y:(n[e].y+n[e+1].y)/2});return t}function Qw(n){return n.z??Number.POSITIVE_INFINITY}function gg(n){return n.map((t,e)=>({pin:t,index:e})).sort((t,e)=>Qw(t.pin)-Qw(e.pin)||t.index-e.index).map(t=>t.pin)}function e8(n,t,e){switch(n){case"front":return e;case"back":return 0;case"up":return Math.min(e,t+1);case"down":return Math.max(0,t-1);default:return n}}function _4(n,t){const e=n.find(i=>i.id===t);if(!e)return new Set;const r=u2(e,n)??e;return new Set([r.id,...u5(r.id,n)])}function n8(n,t,e){if(!n.some(b=>b.id===t))return[...n];const r=_4(n,t),i=gg(n),s=i.filter(b=>r.has(b.id)),l=i.filter(b=>!r.has(b.id));if(s.length===0)return[...n];const c=i.findIndex(b=>r.has(b.id)),f=i.slice(0,c).filter(b=>!r.has(b.id)).length,d=e8(e,f,l.length),p=[...l.slice(0,d),...s,...l.slice(d)],g=new Map(p.map((b,y)=>[b.id,y]));return n.every(b=>!g.has(b.id)||b.z===g.get(b.id))?[...n]:n.map(b=>g.has(b.id)?{...b,z:g.get(b.id)}:b)}function r8(n,t,e){if(!n.some(f=>f.id===t))return!1;const r=_4(n,t),i=gg(n),s=i.findIndex(f=>r.has(f.id));if(s<0)return!1;const l=i.filter(f=>!r.has(f.id)).length,c=i.slice(0,s).filter(f=>!r.has(f.id)).length;return e==="front"||e==="up"?c<l:c>0}function i8(n){if(n.type==="linked")return{x:0,y:0};if(n.type==="point")return{x:n.x,y:n.y};if(n.type==="numbering")return{x:n.end.x,y:n.end.y};if(n.type==="standalone")return{x:n.x,y:n.y};if(n.type==="rectangle")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="text")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="image")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="redact")return{x:n.x+n.width/2,y:n.y+n.height/2};if(n.type==="ellipse")return{x:n.cx,y:n.cy};if(n.type==="compass")return{x:n.cx,y:n.cy};if(n.type==="arrow")return{x:(n.start.x+n.end.x+n.control.x)/3,y:(n.start.y+n.end.y+n.control.y)/3};if(n.type==="polygon"||n.type==="polyline"){const t=n.points;if(t.length===0)return{x:0,y:0};const e=t.reduce((i,s)=>i+s.x,0),r=t.reduce((i,s)=>i+s.y,0);return{x:e/t.length,y:r/t.length}}return{x:0,y:0}}function o8(n,t,e){const r=i=>({x:i.x+t,y:i.y+e});switch(n.type){case"linked":return n;case"point":case"standalone":return{...n,...r(n)};case"text":return{...n,...r(n),...n.point?{point:r(n.point)}:{}};case"image":case"redact":case"rectangle":return{...n,...r(n)};case"ellipse":case"compass":{const i=r({x:n.cx,y:n.cy});return{...n,cx:i.x,cy:i.y}}case"polygon":case"polyline":return{...n,points:n.points.map(r)};case"numbering":return{...n,start:r(n.start),end:r(n.end)};case"arrow":return{...n,start:r(n.start),end:r(n.end),control:r(n.control)};default:return n}}function tS(n,t){return{pin:{...n},card:t?{...t}:null}}function s8(n,t,e){const r=i8(n.pin.anchor),i=t.x-r.x,s=t.y-r.y;return D4(n,i,s,e)}function D4(n,t,e,r){return{pin:{...n.pin,id:r,anchor:o8(n.pin.anchor,t,e)},card:n.card?{...n.card,x:n.card.x+t,y:n.card.y+e}:null}}function g5(n){switch(n.type){case"polygon":case"polyline":case"rectangle":case"ellipse":return!0;case"point":case"numbering":case"standalone":case"arrow":case"compass":case"text":case"image":case"redact":case"linked":return!1;default:return n}}function L4(n){switch(n.type){case"polygon":case"rectangle":case"ellipse":return!0;case"point":case"numbering":case"standalone":case"polyline":case"arrow":case"compass":case"text":case"image":case"redact":case"linked":return!1;default:return n}}function Xu(n){return g5(n.anchor)&&(n.strokeStyle??Qh)==="dashed"}function rg(n,t){return(t??pg)==="none"?null:`${n}${i_}`}function dy(n,t){return rg(n,t)??"transparent"}const R4=24*Zr,a8=12,l8=12*Zr,ig=1.25*Zr;function c8(n,t,e,r=R4,i=l8){const s=i+r;switch(n){case"nw":return{cx:s,cy:s};case"ne":return{cx:Math.max(s,t-s),cy:s};case"se":return{cx:Math.max(s,t-s),cy:Math.max(s,e-s)};case"sw":return{cx:s,cy:Math.max(s,e-s)};default:return n}}function y5(n){const t=Math.max(1,n),e=-t*.72,r=-t*.12,i=t*.18,s=Math.max(8,t*.42),l=Math.max(.28,Math.min(.55,s*.55/t)),c=-Math.PI/2;return{arrowPoints:[{x:0,y:e},{x:i,y:r},{x:-i,y:r}],letterY:-t,fontSize:s,arcGapHalfRad:l,arcStartRad:c+l,arcEndRad:c-l+Math.PI*2}}function u8(n,t,e){const{arcStartRad:r,arcEndRad:i}=y5(e),s=n+e*Math.cos(r),l=t+e*Math.sin(r),c=n+e*Math.cos(i),f=t+e*Math.sin(i);return`M ${s} ${l} A ${e} ${e} 0 1 1 ${c} ${f}`}function f8(n,t){const{cx:e,cy:r,radius:i,rotation:s=0,color:l,strokeWidth:c=ig}=t,f=s*Math.PI/180,d=y5(i);n.save(),n.translate(e,r),n.rotate(f),n.beginPath(),n.arc(0,0,i,d.arcStartRad,d.arcEndRad,!1),n.strokeStyle=l,n.lineWidth=c,n.lineCap="round",n.stroke();const[p,g,b]=d.arrowPoints;n.beginPath(),n.moveTo(p.x,p.y),n.lineTo(g.x,g.y),n.lineTo(b.x,b.y),n.closePath(),n.fillStyle=l,n.fill(),n.fillStyle=l,n.font=`700 ${d.fontSize}px sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText("N",0,d.letterY),n.restore()}const d8=Cu.memo(function({x:t,y:e,color:r,widthScale:i=1,onClick:s,onMouseDown:l,onPointerDown:c}){const f=$h*i;return T.jsx("g",{transform:`translate(${t}, ${e})`,onClick:s,onPointerDown:c,onMouseDown:l,style:{cursor:l?"grab":"pointer"},children:T.jsx("circle",{r:f,fill:r,stroke:"white",strokeWidth:ng*i})})},(n,t)=>n.x===t.x&&n.y===t.y&&n.color===t.color&&n.label===t.label&&n.active===t.active&&n.widthScale===t.widthScale),O4=(n,t,e)=>n+(t-n)*Math.min(1,Math.max(0,e));function h8(n){return O4(a_,l_,n)}function p8(n){return O4(c_,u_,n)}function m8(n,t,e){const r=e.w/Math.max(1,t.w),i=e.h/Math.max(1,t.h);return{sx:n.x*r,sy:n.y*i,sw:Math.max(1,n.width*r),sh:Math.max(1,n.height*i)}}function g8(n,t){let e=0,r=0,i=0,s=0;for(let l=0;l<t;l+=1)for(let c=0;c<t;c+=1){if(l!==0&&l!==t-1&&c!==0&&c!==t-1)continue;const f=(l*t+c)*4;e+=n[f],r+=n[f+1],i+=n[f+2],s+=1}return s?{r:Math.round(e/s),g:Math.round(r/s),b:Math.round(i/s)}:null}const y8=24;function b8(n,t,e,r){const{sx:i,sy:s,sw:l,sh:c}=m8(t,e,r),f=y8,d=document.createElement("canvas");d.width=f,d.height=f;const p=d.getContext("2d",{willReadFrequently:!0});if(!p)return null;try{p.imageSmoothingEnabled=!0,p.drawImage(n,i,s,l,c,0,0,f,f);const g=g8(p.getImageData(0,0,f,f).data,f);return g?`rgb(${g.r}, ${g.g}, ${g.b})`:null}catch{return null}}function eS(n,t,e,r,i){const s=Math.max(1,Math.round(r)),l=Math.max(1,Math.round(i)),c=document.createElement("canvas");c.width=s,c.height=l;const f=c.getContext("2d");if(!f)return null;try{f.drawImage(n,t,e,r,i,0,0,s,l)}catch{return null}return c}function P4(n,t,e){const{rect:r,mode:i,strength:s,imageSize:l,sourceSize:c}=e;if(r.width<=0||r.height<=0)return;const f=c.w/Math.max(1,l.w),d=c.h/Math.max(1,l.h);if(i==="fill"){const D=b8(t,r,l,c);n.save(),n.fillStyle=D??"#808080",n.fillRect(r.x,r.y,r.width,r.height),n.restore();return}if(i==="blur"){const D=h8(s),L=D*2,H=eS(t,(r.x-L)*f,(r.y-L)*d,(r.width+L*2)*f,(r.height+L*2)*d);if(!H)return;n.save(),n.beginPath(),n.rect(r.x,r.y,r.width,r.height),n.clip(),n.filter=`blur(${D}px)`,n.drawImage(H,r.x-L,r.y-L,r.width+L*2,r.height+L*2),n.filter="none",n.restore();return}const p=eS(t,r.x*f,r.y*d,r.width*f,r.height*d);if(!p)return;const g=p8(s),b=Math.max(1,Math.round(r.width/g)),y=Math.max(1,Math.round(r.height/g)),M=document.createElement("canvas");M.width=b,M.height=y;const C=M.getContext("2d");C&&(C.imageSmoothingEnabled=!0,C.drawImage(p,0,0,b,y),n.save(),n.beginPath(),n.rect(r.x,r.y,r.width,r.height),n.clip(),n.imageSmoothingEnabled=!1,n.drawImage(M,0,0,b,y,r.x,r.y,r.width,r.height),n.imageSmoothingEnabled=!0,n.restore())}const x8=U.memo(function({x:t,y:e,width:r,height:i,mode:s,strength:l,source:c,imageSize:f,resolution:d=2}){const p=U.useRef(null);return U.useEffect(()=>{const g=p.current;if(!g||!c||r<=0||i<=0)return;const b={w:c.naturalWidth,h:c.naturalHeight};if(!b.w||!b.h)return;g.width=Math.max(1,Math.round(r*d)),g.height=Math.max(1,Math.round(i*d));const y=g.getContext("2d");y&&(y.setTransform(d,0,0,d,-t*d,-e*d),y.clearRect(t,e,r,i),P4(y,c,{rect:{x:t,y:e,width:r,height:i},mode:s,strength:l,imageSize:f,sourceSize:b}))},[t,e,r,i,s,l,c,f,d]),T.jsx("foreignObject",{x:t,y:e,width:r,height:i,style:{overflow:"hidden"},children:T.jsx("canvas",{xmlns:"http://www.w3.org/1999/xhtml",ref:p,style:{width:"100%",height:"100%",display:"block",pointerEvents:"none"}})})});var I4=Sk();const v8=wk(I4);var hy={exports:{}},py={};var nS;function w8(){if(nS)return py;nS=1;var n=Cp();function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var e=typeof Object.is=="function"?Object.is:t,r=n.useState,i=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(g,b){var y=b(),M=r({inst:{value:y,getSnapshot:b}}),C=M[0].inst,D=M[1];return s(function(){C.value=y,C.getSnapshot=b,f(C)&&D({inst:C})},[g,y,b]),i(function(){return f(C)&&D({inst:C}),g(function(){f(C)&&D({inst:C})})},[g]),l(y),y}function f(g){var b=g.getSnapshot;g=g.value;try{var y=b();return!e(g,y)}catch{return!0}}function d(g,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return py.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:p,py}var rS;function j4(){return rS||(rS=1,hy.exports=w8()),hy.exports}var B4=j4(),iS=Object.defineProperty,S8=(n,t)=>{let e={};for(var r in n)iS(e,r,{get:n[r],enumerable:!0});return iS(e,Symbol.toStringTag,{value:"Module"}),e};function bs(n){this.content=n}bs.prototype={constructor:bs,find:function(n){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===n)return t;return-1},get:function(n){var t=this.find(n);return t==-1?void 0:this.content[t+1]},update:function(n,t,e){var r=e&&e!=n?this.remove(e):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(e||n,t):(s[i+1]=t,e&&(s[i]=e)),new bs(s)},remove:function(n){var t=this.find(n);if(t==-1)return this;var e=this.content.slice();return e.splice(t,2),new bs(e)},addToStart:function(n,t){return new bs([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new bs(e)},addBefore:function(n,t,e){var r=this.remove(t),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,t,e),new bs(i)},forEach:function(n){for(var t=0;t<this.content.length;t+=2)n(this.content[t],this.content[t+1])},prepend:function(n){return n=bs.from(n),n.size?new bs(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=bs.from(n),n.size?new bs(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=bs.from(n);for(var e=0;e<n.content.length;e+=2)t=t.remove(n.content[e]);return t},toObject:function(){var n={};return this.forEach(function(t,e){n[t]=e}),n},get size(){return this.content.length>>1}};bs.from=function(n){if(n instanceof bs)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new bs(t)};function z4(n,t,e){for(let r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;let i=n.child(r),s=t.child(r);if(i==s){e+=i.nodeSize;continue}if(!i.sameMarkup(s))return e;if(i.isText&&i.text!=s.text){let l=i.text,c=s.text,f=0;for(;l[f]==c[f];f++)e++;return f&&f<l.length&&f<c.length&&H4(l.charCodeAt(f-1))&&U4(l.charCodeAt(f))&&e--,e}if(i.content.size||s.content.size){let l=z4(i.content,s.content,e+1);if(l!=null)return l}e+=i.nodeSize}}function F4(n,t,e,r){for(let i=n.childCount,s=t.childCount;;){if(i==0||s==0)return i==s?null:{a:e,b:r};let l=n.child(--i),c=t.child(--s),f=l.nodeSize;if(l==c){e-=f,r-=f;continue}if(!l.sameMarkup(c))return{a:e,b:r};if(l.isText&&l.text!=c.text){let d=l.text,p=c.text,g=d.length,b=p.length;for(;g>0&&b>0&&d[g-1]==p[b-1];)g--,b--,e--,r--;return g&&b&&g<d.length&&H4(d.charCodeAt(g-1))&&U4(d.charCodeAt(g))&&(e++,r++),{a:e,b:r}}if(l.content.size||c.content.size){let d=F4(l.content,c.content,e-1,r-1);if(d)return d}e-=f,r-=f}}function U4(n){return n>=56320&&n<57344}function H4(n){return n>=55296&&n<56320}class Ce{constructor(t,e){if(this.content=t,this.size=e||0,e==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,e,r,i=0,s){for(let l=0,c=0;c<e;l++){let f=this.content[l],d=c+f.nodeSize;if(d>t&&r(f,i+c,s||null,l)!==!1&&f.content.size){let p=c+1;f.nodesBetween(Math.max(0,t-p),Math.min(f.content.size,e-p),r,i+p)}c=d}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,i){let s="",l=!0;return this.nodesBetween(t,e,(c,f)=>{let d=c.isText?c.text.slice(Math.max(t,f)-f,e-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&d||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=d},0),s}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,i=this.content.slice(),s=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),s=1);s<t.content.length;s++)i.push(t.content[s]);return new Ce(i,this.size+t.size)}cut(t,e=this.size){if(t==0&&e==this.size)return this;let r=[],i=0;if(e>t)for(let s=0,l=0;l<e;s++){let c=this.content[s],f=l+c.nodeSize;f>t&&((l<t||f>e)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,e-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,e-l-1))),r.push(c),i+=c.nodeSize),l=f}return new Ce(r,i)}cutByIndex(t,e){return t==e?Ce.empty:t==0&&e==this.content.length?this:new Ce(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),s=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new Ce(i,s)}addToStart(t){return new Ce([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Ce(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let i=this.content[e];t(i,r,e),r+=i.nodeSize}}findDiffStart(t,e=0){return z4(this,t,e)}findDiffEnd(t,e=this.size,r=t.size){return F4(this,t,e,r)}findIndex(t){if(t==0)return Lm(0,t);if(t==this.size)return Lm(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,r=0;;e++){let i=this.child(e),s=r+i.nodeSize;if(s>=t)return s==t?Lm(e+1,s):Lm(e,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return Ce.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return Ce.fromArray(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Ce.empty;let e,r=0;for(let i=0;i<t.length;i++){let s=t[i];r+=s.nodeSize,i&&s.isText&&t[i-1].sameMarkup(s)?(e||(e=t.slice(0,i)),e[e.length-1]=s.withText(e[e.length-1].text+s.text)):e&&e.push(s)}return new Ce(e||t,r)}static from(t){if(!t)return Ce.empty;if(t instanceof Ce)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Ce([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ce.empty=new Ce([],0);const my={index:0,offset:0};function Lm(n,t){return my.index=n,my.offset=t,my}function yg(n,t){if(n===t)return!0;if(!(n&&typeof n=="object")||!(t&&typeof t=="object"))return!1;let e=Array.isArray(n);if(Array.isArray(t)!=e)return!1;if(e){if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(!yg(n[r],t[r]))return!1}else{for(let r in n)if(!(r in t)||!yg(n[r],t[r]))return!1;for(let r in t)if(!(r in n))return!1}return!0}let li=class k2{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,r=!1;for(let i=0;i<t.length;i++){let s=t[i];if(this.eq(s))return t;if(this.type.excludes(s.type))e||(e=t.slice(0,i));else{if(s.type.excludes(this.type))return t;!r&&s.type.rank>this.type.rank&&(e||(e=t.slice(0,i)),e.push(this),r=!0),e&&e.push(s)}}return e||(e=t.slice()),r||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&yg(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);let i=r.create(e.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return k2.none;if(t instanceof k2)return[t];let e=t.slice();return e.sort((r,i)=>r.type.rank-i.type.rank),e}};li.none=[];class mp extends Error{}class Ke{constructor(t,e,r){this.content=t,this.openStart=e,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=Y4(this.content,t+this.openStart,e,this.openStart+1,this.openEnd+1);return r&&new Ke(r,this.openStart,this.openEnd)}removeBetween(t,e){return new Ke(q4(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return Ke.empty;let r=e.openStart||0,i=e.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ke(Ce.fromJSON(t,e.content),r,i)}static maxOpen(t,e=!0){let r=0,i=0;for(let s=t.firstChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=t.lastChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.lastChild)i++;return new Ke(t,r,i)}}Ke.empty=new Ke(Ce.empty,0,0);function q4(n,t,e){let{index:r,offset:i}=n.findIndex(t),s=n.maybeChild(r),{index:l,offset:c}=n.findIndex(e);if(i==t||s.isText){if(c!=e&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(r!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(q4(s.content,t-i-1,e-i-1)))}function Y4(n,t,e,r,i,s){let{index:l,offset:c}=n.findIndex(t),f=n.maybeChild(l);if(c==t||f.isText)return s&&r<=0&&i<=0&&!s.canReplace(l,l,e)?null:n.cut(0,t).append(e).append(n.cut(t));let d=Y4(f.content,t-c-1,e,l==0?r-1:0,l==n.childCount-1?i-1:0,f);return d&&n.replaceChild(l,f.copy(d))}function k8(n,t,e){if(e.openStart>n.depth)throw new mp("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new mp("Inconsistent open depths");return $4(n,t,e,0)}function $4(n,t,e,r){let i=n.index(r),s=n.node(r);if(i==t.index(r)&&r<n.depth-e.openStart){let l=$4(n,t,e,r+1);return s.copy(s.content.replaceChild(i,l))}else if(e.content.size)if(!e.openStart&&!e.openEnd&&n.depth==r&&t.depth==r){let l=n.parent,c=l.content;return Yf(l,c.cut(0,n.parentOffset).append(e.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=A8(e,n);return Yf(s,W4(n,l,c,t,r))}else return Yf(s,bg(n,t,r))}function V4(n,t){if(!t.type.compatibleContent(n.type))throw new mp("Cannot join "+t.type.name+" onto "+n.type.name)}function A2(n,t,e){let r=n.node(e);return V4(r,t.node(e)),r}function qf(n,t){let e=t.length-1;e>=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function ep(n,t,e,r){let i=(t||n).node(e),s=0,l=t?t.index(e):i.childCount;n&&(s=n.index(e),n.depth>e?s++:n.textOffset&&(qf(n.nodeAfter,r),s++));for(let c=s;c<l;c++)qf(i.child(c),r);t&&t.depth==e&&t.textOffset&&qf(t.nodeBefore,r)}function Yf(n,t){if(!n.type.validContent(t))throw new mp("Invalid content for node "+n.type.name);return n.copy(t)}function W4(n,t,e,r,i){let s=n.depth>i&&A2(n,t,i+1),l=r.depth>i&&A2(e,r,i+1),c=[];return ep(null,n,i,c),s&&l&&t.index(i)==e.index(i)?(V4(s,l),qf(Yf(s,W4(n,t,e,r,i+1)),c)):(s&&qf(Yf(s,bg(n,t,i+1)),c),ep(t,e,i,c),l&&qf(Yf(l,bg(e,r,i+1)),c)),ep(r,null,i,c),new Ce(c)}function bg(n,t,e){let r=[];if(ep(null,n,e,r),n.depth>e){let i=A2(n,t,e+1);qf(Yf(i,bg(n,t,e+1)),r)}return ep(t,null,e,r),new Ce(r)}function A8(n,t){let e=t.depth-n.openStart,i=t.node(e).copy(n.content);for(let s=e-1;s>=0;s--)i=t.node(s).copy(Ce.from(i));return{start:i.resolveNoCache(n.openStart+e),end:i.resolveNoCache(i.content.size-n.openEnd-e)}}class gp{constructor(t,e,r){this.pos=t,this.path=e,this.parentOffset=r,this.depth=e.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(e);return r?t.child(e).cut(r):i}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):t==0?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[e*3],i=e==0?0:this.path[e*3-1]+1;for(let s=0;s<t;s++)i+=r.child(s).nodeSize;return i}marks(){let t=this.parent,e=this.index();if(t.content.size==0)return li.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),i=t.maybeChild(e);if(!r){let c=r;r=i,i=c}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!i||!s[l].isInSet(i.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.marks,i=t.parent.maybeChild(t.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new xg(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[],i=0,s=e;for(let l=t;;){let{index:c,offset:f}=l.content.findIndex(s),d=s-f;if(r.push(l,c,i+f),!d||(l=l.child(c),l.isText))break;s=d-1,i+=f+1}return new gp(e,r,s)}static resolveCached(t,e){let r=oS.get(t);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==e)return l}else oS.set(t,r=new M8);let i=r.elts[r.i]=gp.resolve(t,e);return r.i=(r.i+1)%C8,i}}class M8{constructor(){this.elts=[],this.i=0}}const C8=12,oS=new WeakMap;class xg{constructor(t,e,r){this.$from=t,this.$to=e,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const E8=Object.create(null);let $f=class M2{constructor(t,e,r,i=li.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||Ce.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,r,i=0){this.content.nodesBetween(t,e,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,r,i){return this.content.textBetween(t,e,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,r){return this.type==t&&yg(this.attrs,e||t.defaultAttrs||E8)&&li.sameSet(this.marks,r||li.none)}copy(t=null){return t==this.content?this:new M2(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new M2(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return t==0&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=!1){if(t==e)return Ke.empty;let i=this.resolve(t),s=this.resolve(e),l=r?0:i.sharedDepth(e),c=i.start(l),d=i.node(l).content.cut(i.pos-c,s.pos-c);return new Ke(d,i.depth-l,s.depth-l)}replace(t,e,r){return k8(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:i}=e.content.findIndex(t);if(e=e.maybeChild(r),!e)return null;if(i==t||e.isText)return e;t-=i+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let i=this.content.child(e-1);return{node:i,index:e-1,offset:r-i.nodeSize}}resolve(t){return gp.resolveCached(this,t)}resolveNoCache(t){return gp.resolve(this,t)}rangeHasMark(t,e,r){let i=!1;return e>t&&this.nodesBetween(t,e,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),X4(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=Ce.empty,i=0,s=r.childCount){let l=this.contentMatchAt(t).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,e);if(!c||!c.validEnd)return!1;for(let f=i;f<s;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(t,e,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(t).matchType(r),l=s&&s.matchFragment(this.content,e);return l?l.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=li.none;for(let e=0;e<this.marks.length;e++){let r=this.marks[e];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!li.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(e=>e.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if(e.type=="text"){if(typeof e.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=Ce.fromJSON(t,e.content),s=t.nodeType(e.type).create(e.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};$f.prototype.text=void 0;class vg extends $f{constructor(t,e,r,i){if(super(t,e,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):X4(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new vg(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new vg(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return t==0&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function X4(n,t){for(let e=n.length-1;e>=0;e--)t=n[e].type.name+"("+t+")";return t}class ed{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new T8(t,e);if(r.next==null)return ed.empty;let i=G4(r);r.next&&r.err("Unexpected trailing text");let s=P8(O8(i));return I8(s,r),s}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let i=this;for(let s=e;i&&s<r;s++)i=i.matchType(t.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!(e.isText||e.hasRequiredAttrs()))return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return!0;return!1}fillBefore(t,e=!1,r=0){let i=[this];function s(l,c){let f=l.matchFragment(t,r);if(f&&(!e||f.validEnd))return Ce.from(c.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:p,next:g}=l.next[d];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(g)==-1){i.push(g);let b=s(g,c.concat(p));if(b)return b}}return null}return s(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(t)){let l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:f}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in e)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),e[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function e(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&e(r.next[i].next)}return e(this),t.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+t.indexOf(r.next[l].next);return s}).join(`
91
- `)}}ed.empty=new ed(!0);class T8{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function G4(n){let t=[];do t.push(N8(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function N8(n){let t=[];do t.push(_8(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function _8(n){let t=R8(n);for(;;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=D8(n,t);else break;return t}function sS(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let t=Number(n.next);return n.pos++,t}function D8(n,t){let e=sS(n),r=e;return n.eat(",")&&(n.next!="}"?r=sS(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function L8(n,t){let e=n.nodeTypes,r=e[t];if(r)return[r];let i=[];for(let s in e){let l=e[s];l.isInGroup(t)&&i.push(l)}return i.length==0&&n.err("No node type or group '"+t+"' found"),i}function R8(n){if(n.eat("(")){let t=G4(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let t=L8(n,n.next).map(e=>(n.inline==null?n.inline=e.isInline:n.inline!=e.isInline&&n.err("Mixing inline and block content"),{type:"name",value:e}));return n.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function O8(n){let t=[[]];return i(s(n,0),e()),t;function e(){return t.push([])-1}function r(l,c,f){let d={term:f,to:c};return t[l].push(d),d}function i(l,c){l.forEach(f=>f.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((f,d)=>f.concat(s(d,c)),[]);if(l.type=="seq")for(let f=0;;f++){let d=s(l.exprs[f],c);if(f==l.exprs.length-1)return d;i(d,c=e())}else if(l.type=="star"){let f=e();return r(c,f),i(s(l.expr,f),f),[r(f)]}else if(l.type=="plus"){let f=e();return i(s(l.expr,c),f),i(s(l.expr,f),f),[r(f)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let f=c;for(let d=0;d<l.min;d++){let p=e();i(s(l.expr,f),p),f=p}if(l.max==-1)i(s(l.expr,f),f);else for(let d=l.min;d<l.max;d++){let p=e();r(f,p),i(s(l.expr,f),p),f=p}return[r(f)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function K4(n,t){return t-n}function aS(n,t){let e=[];return r(t),e.sort(K4);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);e.push(i);for(let l=0;l<s.length;l++){let{term:c,to:f}=s[l];!c&&e.indexOf(f)==-1&&r(f)}}}function P8(n){let t=Object.create(null);return e(aS(n,0));function e(r){let i=[];r.forEach(l=>{n[l].forEach(({term:c,to:f})=>{if(!c)return;let d;for(let p=0;p<i.length;p++)i[p][0]==c&&(d=i[p][1]);aS(n,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=t[r.join(",")]=new ed(r.indexOf(n.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(K4);s.next.push({type:i[l][0],next:t[c.join(",")]||e(c)})}return s}}function I8(n,t){for(let e=0,r=[n];e<r.length;e++){let i=r[e],s=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:f,next:d}=i.next[c];l.push(f.name),s&&!(f.isText||f.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&t.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function J4(n){let t=Object.create(null);for(let e in n){let r=n[e];if(!r.hasDefault)return null;t[e]=r.default}return t}function Z4(n,t){let e=Object.create(null);for(let r in n){let i=t&&t[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}e[r]=i}return e}function Q4(n,t,e,r){for(let i in t)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${e} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(t[i])}function tA(n,t){let e=Object.create(null);if(t)for(let r in t)e[r]=new B8(n,r,t[r]);return e}let lS=class eA{constructor(t,e,r){this.name=t,this.schema=e,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=tA(t,r.attrs),this.defaultAttrs=J4(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ed.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:Z4(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new $f(this,this.computeAttrs(t),Ce.from(e),li.setFrom(r))}createChecked(t=null,e,r){return e=Ce.from(e),this.checkContent(e),new $f(this,this.computeAttrs(t),e,li.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),e=Ce.from(e),e.size){let l=this.contentMatch.fillBefore(e);if(!l)return null;e=l.append(e)}let i=this.contentMatch.matchFragment(e),s=i&&i.fillBefore(Ce.empty,!0);return s?new $f(this,t,e.append(s),li.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){Q4(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let e;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?e&&e.push(t[r]):e||(e=t.slice(0,r));return e?e.length?e:li.none:t}static compile(t,e){let r=Object.create(null);t.forEach((s,l)=>r[s]=new eA(s,e,l));let i=e.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function j8(n,t,e){let r=e.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${n}, got ${s}`)}}class B8{constructor(t,e,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?j8(t,e,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class f0{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=tA(t,i.attrs),this.excluded=null;let s=J4(this.attrs);this.instance=s?new li(this,s):null}create(t=null){return!t&&this.instance?this.instance:new li(this,Z4(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach((s,l)=>r[s]=new f0(s,i++,e,l)),r}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){Q4(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class nA{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let i in t)e[i]=t[i];e.nodes=bs.from(t.nodes),e.marks=bs.from(t.marks||{}),this.nodes=lS.compile(this.spec.nodes,this),this.marks=f0.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],l=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=ed.parse(l,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=c=="_"?null:c?cS(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:cS(this,l.split(" "))}this.nodeFromJSON=i=>$f.fromJSON(this,i),this.markFromJSON=i=>li.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof lS){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(e,r,i)}text(t,e){let r=this.nodes.text;return new vg(r,r.defaultAttrs,t,li.setFrom(e))}mark(t,e){return typeof t=="string"&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function cS(n,t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],s=n.marks[i],l=s;if(s)e.push(s);else for(let c in n.marks){let f=n.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&e.push(l=f)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return e}function z8(n){return n.tag!=null}function F8(n){return n.style!=null}let np=class C2{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let r=this.matchedStyles=[];e.forEach(i=>{if(z8(i))this.tags.push(i);else if(F8(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=t.nodes[i.node];return s.contentMatch.matchType(s)})}parse(t,e={}){let r=new fS(this,e,!1);return r.addAll(t,li.none,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new fS(this,e,!0);return r.addAll(t,li.none,e.from,e.to),Ke.maxOpen(r.finish())}matchTag(t,e,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(q8(t,s.tag)&&(s.namespace===void 0||t.namespaceURI==s.namespace)&&(!s.context||e.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(t,e,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let l=this.styles[s],c=l.style;if(!(c.indexOf(t)!=0||l.context&&!r.matchesContext(l.context)||c.length>t.length&&(c.charCodeAt(t.length)!=61||c.slice(t.length+1)!=e))){if(l.getAttrs){let f=l.getAttrs(e);if(f===!1)continue;l.attrs=f||void 0}return l}}}static schemaRules(t){let e=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<e.length;l++){let c=e[l];if((c.priority==null?50:c.priority)<s)break}e.splice(l,0,i)}for(let i in t.marks){let s=t.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=dS(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in t.nodes){let s=t.nodes[i].spec.parseDOM;s&&s.forEach(l=>{r(l=dS(l)),l.node||l.ignore||l.mark||(l.node=i)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new C2(t,C2.schemaRules(t)))}};const rA={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},U8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},iA={ol:!0,ul:!0},yp=1,E2=2,rp=4;function uS(n,t,e){return t!=null?(t?yp:0)|(t==="full"?E2:0):n&&n.whitespace=="pre"?yp|E2:e&~rp}class Rm{constructor(t,e,r,i,s,l){this.type=t,this.attrs=e,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=li.none,this.match=s||(l&rp?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(Ce.from(t));if(e)this.match=this.type.contentMatch.matchFragment(e);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&yp)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let e=Ce.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(Ce.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!rA.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class fS{constructor(t,e,r){this.parser=t,this.options=e,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=e.topNode,s,l=uS(null,e.preserveWhitespace,0)|(r?rp:0);i?s=new Rm(i.type,i.attrs,li.none,!0,e.topMatch||i.type.contentMatch,l):r?s=new Rm(null,null,li.none,!0,null,l):s=new Rm(t.schema.topNodeType,null,li.none,!0,null,l),this.nodes=[s],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){t.nodeType==3?this.addTextNode(t,e):t.nodeType==1&&this.addElement(t,e)}addTextNode(t,e){let r=t.nodeValue,i=this.top,s=i.options&E2?"full":this.localPreserveWS||(i.options&yp)>0,{schema:l}=this.parser;if(s==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
92
- `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let f=0;f<c.length;f++)f&&this.insertNode(l.linebreakReplacement.create(),e,!0),c[f]&&this.insertNode(l.text(c[f]),e,!/\S/.test(c[f]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=i.content[i.content.length-1],f=t.previousSibling;(!c||f&&f.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),e,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,e,r){let i=this.localPreserveWS,s=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let l=t.nodeName.toLowerCase(),c;iA.hasOwnProperty(l)&&this.parser.normalizeLists&&H8(t);let f=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(c=this.parser.matchTag(t,this,r));t:if(f?f.ignore:U8.hasOwnProperty(l))this.findInside(t),this.ignoreFallback(t,e);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(t=f.skip);let d,p=this.needsBlock;if(rA.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let g=f&&f.skip?e:this.readStyles(t,e);g&&this.addAll(t,g),d&&this.sync(s),this.needsBlock=p}else{let d=this.readStyles(t,e);d&&this.addElementByRule(t,f,d,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(t,e){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
93
- `),e)}ignoreFallback(t,e){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),e,!0)}readStyles(t,e){let r=t.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],l=r.getPropertyValue(s);if(l)for(let c=void 0;;){let f=this.parser.matchStyle(s,l,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?e=e.filter(d=>!f.clearMark(d)):e=e.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return e}addElementByRule(t,e,r,i){let s,l;if(e.node)if(l=this.parser.schema.nodes[e.node],l.isLeaf)this.insertNode(l.create(e.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let f=this.enter(l,e.attrs||null,r,e.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[e.mark];r=r.concat(f.create(e.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(f=>this.insertNode(f,r,!1));else{let f=t;typeof e.contentElement=="string"?f=t.querySelector(e.contentElement):typeof e.contentElement=="function"?f=e.contentElement(t):e.contentElement&&(f=e.contentElement),this.findAround(t,f,!0),this.addAll(f,r),this.findAround(t,f,!1)}s&&this.sync(c)&&this.open--}addAll(t,e,r,i){let s=r||0;for(let l=r?t.childNodes[r]:t.firstChild,c=i==null?null:t.childNodes[i];l!=c;l=l.nextSibling,++s)this.findAtPoint(t,s),this.addDOM(l,e);this.findAtPoint(t,s)}findPlace(t,e,r){let i,s;for(let l=this.open,c=0;l>=0;l--){let f=this.nodes[l],d=f.findWrapping(t);if(d&&(!i||i.length>d.length+c)&&(i=d,s=f,!d.length))break;if(f.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)e=this.enterInner(i[l],null,e,!1);return e}insertNode(t,e,r){if(t.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(e=this.enterInner(s,null,e))}let i=this.findPlace(t,e,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(t.type));let l=li.none;for(let c of i.concat(t.marks))(s.type?s.type.allowsMarkType(c.type):hS(c.type,t.type))&&(l=c.addToSet(l));return s.content.push(t.mark(l)),!0}return!1}enter(t,e,r,i){let s=this.findPlace(t.create(e),r,!1);return s&&(s=this.enterInner(t,e,r,!0,i)),s}enterInner(t,e,r,i=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(t);let c=uS(t,s,l.options);l.options&rp&&l.content.length==0&&(c|=rp);let f=li.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):hS(d.type,t))?(f=d.addToSet(f),!1):!0),this.nodes.push(new Rm(t,e,f,i,null,c)),this.open++,r}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=yp)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==e&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].pos==null&&t.nodeType==1&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,r){if(t!=e&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&e.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),l=(c,f)=>{for(;c>=0;c--){let d=e[c];if(d==""){if(c==e.length-1||c==0)continue;for(;f>=s;f--)if(l(c-1,f))return!0;return!1}else{let p=f>0||f==0&&i?this.nodes[f].type:r&&f>=s?r.node(f-s).type:null;if(!p||p.name!=d&&!p.isInGroup(d))return!1;f--}}return!0};return l(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let r=this.parser.schema.nodes[e];if(r.isTextblock&&r.defaultAttrs)return r}}}function H8(n){for(let t=n.firstChild,e=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&iA.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function q8(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function dS(n){let t={};for(let e in n)t[e]=n[e];return t}function hS(n,t){let e=t.schema.nodes;for(let r in e){let i=e[r];if(!i.allowsMarkType(n))continue;let s=[],l=c=>{s.push(c);for(let f=0;f<c.edgeCount;f++){let{type:d,next:p}=c.edge(f);if(d==t||s.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class ad{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=Om(e).createDocumentFragment());let i=r,s=[];return t.forEach(l=>{if(s.length||l.marks.length){let c=0,f=0;for(;c<s.length&&f<l.marks.length;){let d=l.marks[f];if(!this.marks[d.type.name]){f++;continue}if(!d.eq(s[c][0])||d.type.spec.spanning===!1)break;c++,f++}for(;c<s.length;)i=s.pop()[1];for(;f<l.marks.length;){let d=l.marks[f++],p=this.serializeMark(d,l.isInline,e);p&&(s.push([d,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,e))}),r}serializeNodeInner(t,e){if(t.isText)return Om(e).createTextNode(t.text);let{dom:r,contentDOM:i}=og(Om(e),this.nodes[t.type.name](t),null,t.attrs);if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,i)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let i=t.marks.length-1;i>=0;i--){let s=this.serializeMark(t.marks[i],t.isInline,e);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(t,e,r={}){let i=this.marks[t.type.name];return i&&og(Om(r),i(t,e),null,t.attrs)}static renderSpec(t,e,r=null,i){return typeof e=="string"?{dom:t.createTextNode(e)}:og(t,e,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ad(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=pS(t.nodes);return e.text||(e.text=r=>r.text),e}static marksFromSchema(t){return pS(t.marks)}}function pS(n){let t={};for(let e in n){let r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function Om(n){return n.document||window.document}const mS=new WeakMap;function Y8(n){let t=mS.get(n);return t===void 0&&mS.set(n,t=$8(n)),t}function $8(n){let t=null;function e(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let i=0;i<r.length;i++)e(r[i]);else for(let i in r)e(r[i])}return e(n),t}function og(n,t,e,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Y8(r))&&s.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(e=i.slice(0,l),i=i.slice(l+1));let c,f=e?n.createElementNS(e,i):n.createElement(i),d=t[1],p=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){p=2;for(let g in d)if(d[g]!=null){let b=g.indexOf(" ");b>0?f.setAttributeNS(g.slice(0,b),g.slice(b+1),d[g]):g=="style"&&f.style?f.style.cssText=d[g]:f.setAttribute(g,d[g])}}for(let g=p;g<t.length;g++){let b=t[g];if(b===0){if(g<t.length-1||g>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else if(typeof b=="string")f.appendChild(n.createTextNode(b));else{let{dom:y,contentDOM:M}=og(n,b,e,r);if(f.appendChild(y),M){if(c)throw new RangeError("Multiple content holes");c=M}}}return{dom:f,contentDOM:c}}const oA=65535,sA=Math.pow(2,16);function V8(n,t){return n+t*sA}function gS(n){return n&oA}function W8(n){return(n-(n&oA))/sA}const aA=1,lA=2,sg=4,cA=8;class T2{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(this.delInfo&cA)>0}get deletedBefore(){return(this.delInfo&(aA|sg))>0}get deletedAfter(){return(this.delInfo&(lA|sg))>0}get deletedAcross(){return(this.delInfo&sg)>0}}class Ga{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&Ga.empty)return Ga.empty}recover(t){let e=0,r=gS(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+e+W8(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?i:0);if(f>t)break;let d=this.ranges[c+s],p=this.ranges[c+l],g=f+d;if(t<=g){let b=d?t==f?-1:t==g?1:e:e,y=f+i+(b<0?0:p);if(r)return y;let M=t==(e<0?f:g)?null:V8(c/3,t-f),C=t==f?lA:t==g?aA:sg;return(e<0?t!=f:t!=g)&&(C|=cA),new T2(y,C,M)}i+=p-d}return r?t+i:new T2(t+i,0,null)}touches(t,e){let r=0,i=gS(e),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>t)break;let d=this.ranges[c+s],p=f+d;if(t<=p&&c==i*3)return!0;r+=this.ranges[c+l]-d}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?s:0),f=l+(this.inverted?0:s),d=this.ranges[i+e],p=this.ranges[i+r];t(c,c+d,f,f+p),s+=p-d}}invert(){return new Ga(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Ga.empty:new Ga(t<0?[0,-t,0]:[0,0,t])}}Ga.empty=new Ga([]);class bp{constructor(t,e,r=0,i=t?t.length:0){this.mirror=e,this.from=r,this.to=i,this._maps=t||[],this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new bp(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),e!=null&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,r=this._maps.length;e<t._maps.length;e++){let i=t.getMirror(e);this.appendMap(t._maps[e],i!=null&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this._maps.length+t._maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t._maps[e].invert(),i!=null&&i>e?r-i-1:void 0)}}invert(){let t=new bp;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(t,e);if(c.recover!=null){let f=this.getMirror(s);if(f!=null&&f>s&&f<this.to){s=f,t=this._maps[f].recover(c.recover);continue}}i|=c.delInfo,t=c.pos}return r?t:new T2(t,i,null)}}const gy=Object.create(null);class qs{getMap(){return Ga.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=gy[e.stepType];if(!r)throw new RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in gy)throw new RangeError("Duplicate use of step JSON ID "+t);return gy[t]=e,e.prototype.jsonID=t,e}}class Mo{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new Mo(t,null)}static fail(t){return new Mo(null,t)}static fromReplace(t,e,r,i){try{return Mo.ok(t.replace(e,r,i))}catch(s){if(s instanceof mp)return Mo.fail(s.message);throw s}}}function b5(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(b5(s.content,t,s))),s.isInline&&(s=t(s,e,i)),r.push(s)}return Ce.fromArray(r)}class lf extends qs{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new Ke(b5(e.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),e.openStart,e.openEnd);return Mo.fromReplace(t,this.from,this.to,s)}invert(){return new nc(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new lf(e.pos,r.pos,this.mark)}merge(t){return t instanceof lf&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new lf(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new lf(e.from,e.to,t.markFromJSON(e.mark))}}qs.jsonID("addMark",lf);class nc extends qs{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new Ke(b5(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return Mo.fromReplace(t,this.from,this.to,r)}invert(){return new lf(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new nc(e.pos,r.pos,this.mark)}merge(t){return t instanceof nc&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new nc(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nc(e.from,e.to,t.markFromJSON(e.mark))}}qs.jsonID("removeMark",nc);class cf extends qs{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Mo.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Mo.fromReplace(t,this.pos,this.pos+1,new Ke(Ce.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new cf(this.pos,e.marks[i]);return new cf(this.pos,this.mark)}}return new nd(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new cf(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new cf(e.pos,t.markFromJSON(e.mark))}}qs.jsonID("addNodeMark",cf);class nd extends qs{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Mo.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Mo.fromReplace(t,this.pos,this.pos+1,new Ke(Ce.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return!e||!this.mark.isInSet(e.marks)?this:new cf(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new nd(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new nd(e.pos,t.markFromJSON(e.mark))}}qs.jsonID("removeNodeMark",nd);class uo extends qs{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&N2(t,this.from,this.to)?Mo.fail("Structure replace would overwrite content"):Mo.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Ga([this.from,this.to-this.from,this.slice.size])}invert(t){return new uo(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.to,-1),r=this.from==this.to&&uo.MAP_BIAS<0?e:t.mapResult(this.from,1);return r.deletedAcross&&e.deletedAcross?null:new uo(r.pos,Math.max(r.pos,e.pos),this.slice,this.structure)}merge(t){if(!(t instanceof uo)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let e=this.slice.size+t.slice.size==0?Ke.empty:new Ke(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new uo(this.from,this.to+(t.to-t.from),e,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let e=this.slice.size+t.slice.size==0?Ke.empty:new Ke(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new uo(t.from,this.to,e,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new uo(e.from,e.to,Ke.fromJSON(t,e.slice),!!e.structure)}}uo.MAP_BIAS=1;qs.jsonID("replace",uo);class Vo extends qs{constructor(t,e,r,i,s,l,c=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=l,this.structure=c}apply(t){if(this.structure&&(N2(t,this.from,this.gapFrom)||N2(t,this.gapTo,this.to)))return Mo.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Mo.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?Mo.fromReplace(t,this.from,this.to,r):Mo.fail("Content does not fit in gap")}getMap(){return new Ga([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Vo(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||s>r.pos?null:new Vo(e.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Vo(e.from,e.to,e.gapFrom,e.gapTo,Ke.fromJSON(t,e.slice),e.insert,!!e.structure)}}qs.jsonID("replaceAround",Vo);function N2(n,t,e){let r=n.resolve(t),i=e-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function X8(n,t,e,r){let i=[],s=[],l,c;n.doc.nodesBetween(t,e,(f,d,p)=>{if(!f.isInline)return;let g=f.marks;if(!r.isInSet(g)&&p.type.allowsMarkType(r.type)){let b=Math.max(d,t),y=Math.min(d+f.nodeSize,e),M=r.addToSet(g);for(let C=0;C<g.length;C++)g[C].isInSet(M)||(l&&l.to==b&&l.mark.eq(g[C])?l.to=y:i.push(l=new nc(b,y,g[C])));c&&c.to==b?c.to=y:s.push(c=new lf(b,y,r))}}),i.forEach(f=>n.step(f)),s.forEach(f=>n.step(f))}function G8(n,t,e,r){let i=[],s=0;n.doc.nodesBetween(t,e,(l,c)=>{if(!l.isInline)return;s++;let f=null;if(r instanceof f0){let d=l.marks,p;for(;p=r.isInSet(d);)(f||(f=[])).push(p),d=p.removeFromSet(d)}else r?r.isInSet(l.marks)&&(f=[r]):f=l.marks;if(f&&f.length){let d=Math.min(c+l.nodeSize,e);for(let p=0;p<f.length;p++){let g=f[p],b;for(let y=0;y<i.length;y++){let M=i[y];M.step==s-1&&g.eq(i[y].style)&&(b=M)}b?(b.to=d,b.step=s):i.push({style:g,from:Math.max(c,t),to:d,step:s})}}}),i.forEach(l=>n.step(new nc(l.from,l.to,l.style)))}function x5(n,t,e,r=e.contentMatch,i=!0){let s=n.doc.nodeAt(t),l=[],c=t+1;for(let f=0;f<s.childCount;f++){let d=s.child(f),p=c+d.nodeSize,g=r.matchType(d.type);if(!g)l.push(new uo(c,p,Ke.empty));else{r=g;for(let b=0;b<d.marks.length;b++)e.allowsMarkType(d.marks[b].type)||n.step(new nc(c,p,d.marks[b]));if(i&&d.isText&&e.whitespace!="pre"){let b,y=/\r?\n|\r/g,M;for(;b=y.exec(d.text);)M||(M=new Ke(Ce.from(e.schema.text(" ",e.allowedMarks(d.marks))),0,0)),l.push(new uo(c+b.index,c+b.index+b[0].length,M))}}c=p}if(!r.validEnd){let f=r.fillBefore(Ce.empty,!0);n.replace(c,c,new Ke(f,0,0))}for(let f=l.length-1;f>=0;f--)n.step(l[f])}function K8(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function sh(n){let e=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let l=n.$from.node(r),c=n.$from.index(r)+i,f=n.$to.indexAfter(r)-s;if(r<n.depth&&l.canReplace(c,f,e))return r;if(r==0||l.type.spec.isolating||!K8(l,c,f))break;c&&(i=1),f<l.childCount&&(s=1)}return null}function J8(n,t,e){let{$from:r,$to:i,depth:s}=t,l=r.before(s+1),c=i.after(s+1),f=l,d=c,p=Ce.empty,g=0;for(let M=s,C=!1;M>e;M--)C||r.index(M)>0?(C=!0,p=Ce.from(r.node(M).copy(p)),g++):f--;let b=Ce.empty,y=0;for(let M=s,C=!1;M>e;M--)C||i.after(M+1)<i.end(M)?(C=!0,b=Ce.from(i.node(M).copy(b)),y++):d++;n.step(new Vo(f,d,l,c,new Ke(p.append(b),g,y),p.size-g,!0))}function v5(n,t,e=null,r=n){let i=Z8(n,t),s=i&&Q8(r,t);return s?i.map(yS).concat({type:t,attrs:e}).concat(s.map(yS)):null}function yS(n){return{type:n,attrs:null}}function Z8(n,t){let{parent:e,startIndex:r,endIndex:i}=n,s=e.contentMatchAt(r).findWrapping(t);if(!s)return null;let l=s.length?s[0]:t;return e.canReplaceWith(r,i,l)?s:null}function Q8(n,t){let{parent:e,startIndex:r,endIndex:i}=n,s=e.child(r),l=t.contentMatch.findWrapping(s.type);if(!l)return null;let f=(l.length?l[l.length-1]:t).contentMatch;for(let d=r;f&&d<i;d++)f=f.matchType(e.child(d).type);return!f||!f.validEnd?null:l}function tD(n,t,e){let r=Ce.empty;for(let l=e.length-1;l>=0;l--){if(r.size){let c=e[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ce.from(e[l].type.create(e[l].attrs,r))}let i=t.start,s=t.end;n.step(new Vo(i,s,i,s,new Ke(r,0,0),e.length,!0))}function eD(n,t,e,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(t,e,(l,c)=>{let f=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,f)&&nD(n.doc,n.mapping.slice(s).map(c),r)){let d=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",M=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!M?d=!1:!y&&M&&(d=!0)}d===!1&&fA(n,l,c,s),x5(n,n.mapping.slice(s).map(c,1),r,void 0,d===null);let p=n.mapping.slice(s),g=p.map(c,1),b=p.map(c+l.nodeSize,1);return n.step(new Vo(g,b,g+1,b-1,new Ke(Ce.from(r.create(f,null,l.marks)),0,0),1,!0)),d===!0&&uA(n,l,c,s),!1}})}function uA(n,t,e,r){t.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let f=n.mapping.slice(r).map(e+1+s+l.index);n.replaceWith(f,f+1,t.type.schema.linebreakReplacement.create())}}})}function fA(n,t,e,r){t.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=n.mapping.slice(r).map(e+1+s);n.replaceWith(l,l+1,t.type.schema.text(`
94
- `))}})}function nD(n,t,e){let r=n.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,e)}function rD(n,t,e,r,i){let s=n.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");e||(e=s.type);let l=e.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(t,t+s.nodeSize,l);if(!e.validContent(s.content))throw new RangeError("Invalid content for node type "+e.name);n.step(new Vo(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new Ke(Ce.from(l),0,0),1,!0))}function Au(n,t,e=1,r){let i=n.resolve(t),s=i.depth-e,l=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,p=e-2;d>s;d--,p--){let g=i.node(d),b=i.index(d);if(g.type.spec.isolating)return!1;let y=g.content.cutByIndex(b,g.childCount),M=r&&r[p+1];M&&(y=y.replaceChild(0,M.type.create(M.attrs)));let C=r&&r[p]||g;if(!g.canReplace(b+1,g.childCount)||!C.type.validContent(y))return!1}let c=i.indexAfter(s),f=r&&r[0];return i.node(s).canReplaceWith(c,c,f?f.type:i.node(s+1).type)}function iD(n,t,e=1,r){let i=n.doc.resolve(t),s=Ce.empty,l=Ce.empty;for(let c=i.depth,f=i.depth-e,d=e-1;c>f;c--,d--){s=Ce.from(i.node(c).copy(s));let p=r&&r[d];l=Ce.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}n.step(new uo(t,t,new Ke(s.append(l),e,e),!0))}function yf(n,t){let e=n.resolve(t),r=e.index();return dA(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function oD(n,t){t.content.size||n.type.compatibleContent(t.type);let e=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),l=s.type==r?n.type.schema.nodes.text:s.type;if(e=e.matchType(l),!e||!n.type.allowsMarks(s.marks))return!1}return e.validEnd}function dA(n,t){return!!(n&&t&&!n.isLeaf&&oD(n,t))}function d0(n,t,e=-1){let r=n.resolve(t);for(let i=r.depth;;i--){let s,l,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,l=r.nodeAfter):e>0?(s=r.node(i+1),c++,l=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),l=r.node(i+1)),s&&!s.isTextblock&&dA(s,l)&&r.node(i).canReplace(c,c+1))return t;if(i==0)break;t=e<0?r.before(i):r.after(i)}}function sD(n,t,e){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(t-e),l=s.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",g=!!l.contentMatch.matchType(i);p&&!g?r=!1:!p&&g&&(r=!0)}let c=n.steps.length;if(r===!1){let p=n.doc.resolve(t+e);fA(n,p.node(),p.before(),c)}l.inlineContent&&x5(n,t+e-1,l,s.node().contentMatchAt(s.index()),r==null);let f=n.mapping.slice(c),d=f.map(t-e);if(n.step(new uo(d,f.map(t+e,-1),Ke.empty,!0)),r===!0){let p=n.doc.resolve(d);uA(n,p.node(),p.before(),n.steps.length)}return n}function aD(n,t,e){let r=n.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),e))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,e))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,e))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function hA(n,t,e){let r=n.resolve(t);if(!e.content.size)return t;let i=e.content;for(let s=0;s<e.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(e.openStart==0&&e.size?2:1);s++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,f=r.index(l)+(c>0?1:0),d=r.node(l),p=!1;if(s==1)p=d.canReplace(f,f,i);else{let g=d.contentMatchAt(f).findWrapping(i.firstChild.type);p=g&&d.canReplaceWith(f,f,g[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function h0(n,t,e=t,r=Ke.empty){if(t==e&&!r.size)return null;let i=n.resolve(t),s=n.resolve(e);return pA(i,s,r)?new uo(t,e,r):new lD(i,s,r).fit()}function pA(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}class lD{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=Ce.empty;for(let i=0;i<=t.depth;i++){let s=t.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=Ce.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let s=this.placed,l=r.depth,c=i.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let f=new Ke(s,l,c);return t>-1?new Vo(r.pos,t,this.$to.pos,this.$to.end(),f,e):f.size||r.pos!=this.$to.pos?new uo(r.pos,i.pos,f):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let s=e.firstChild;if(e.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){t=r;break}e=s.content}for(let e=1;e<=2;e++)for(let r=e==1?t:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=bS(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:f,match:d}=this.frontier[c],p,g=null;if(e==1&&(l?d.matchType(l.type)||(g=d.fillBefore(Ce.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:g};if(e==2&&l&&(p=d.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&d.matchType(s.type))break}}}openMore(){let{content:t,openStart:e,openEnd:r}=this.unplaced;return xS(t,-1)<=e?!1:(this.unplaced.size>1&&xS(t,1)>r&&r++,this.unplaced=new Ke(t,e+1,r),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=bS(t,e);if(i.childCount<=1&&e>0){let s=t.size-e<=e+i.size;this.unplaced=new Ke(Vh(t,e-1,1),e-1,s?e-1:r)}else this.unplaced=new Ke(Vh(t,e,1),e,r)}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:i,wrap:s}){for(;this.depth>e;)this.closeFrontierNode();if(s)for(let C=0;C<s.length;C++)this.openFrontierNode(s[C]);let l=this.unplaced,c=r?r.content:l.content,f=l.openStart-t,d=0,p=[],{match:g,type:b}=this.frontier[e];if(i){for(let C=0;C<i.childCount;C++)p.push(i.child(C));g=g.matchFragment(i)}let y=c.size+t-(l.content.size-l.openEnd);for(;d<c.childCount;){let C=c.child(d),D=g.matchType(C.type);if(!D)break;d++,(d>1||f==0||C.content.size)&&(g=D,p.push(mA(C.mark(b.allowedMarks(C.marks)),d==1?f:0,d==c.childCount?y:-1)))}let M=d==c.childCount;M||(y=-1),this.placed=Wh(this.placed,e,Ce.from(p)),this.frontier[e].match=g,M&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let C=0,D=c;C<y;C++){let L=D.lastChild;this.frontier.push({type:L.type,match:L.contentMatchAt(L.childCount)}),D=L.content}this.unplaced=M?t==0?Ke.empty:new Ke(Vh(l.content,t-1,1),t-1,y<0?l.openEnd:t-1):new Ke(Vh(l.content,t,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],e;if(!t.type.isTextblock||!yy(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:i}=this.frontier[e],s=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),l=yy(t,e,i,r,s);if(l){for(let c=e-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=yy(t,c,d,f,!0);if(!p||p.childCount)continue t}return{depth:e,fit:l,move:s?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Wh(this.placed,e.depth,e.fit)),t=e.move;for(let r=e.depth+1;r<=t.depth;r++){let i=t.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,s)}return t}openFrontierNode(t,e=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Wh(this.placed,this.depth,Ce.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Ce.empty,!0);e.childCount&&(this.placed=Wh(this.placed,this.frontier.length,e))}}function Vh(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(Vh(n.firstChild.content,t-1,e)))}function Wh(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(Wh(n.lastChild.content,t-1,e)))}function bS(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function mA(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,mA(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(Ce.empty,!0)))),n.copy(r)}function yy(n,t,e,r,i){let s=n.node(t),l=i?n.indexAfter(t):n.index(t);if(l==s.childCount&&!e.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!cD(e,s.content,l)?c:null}function cD(n,t,e){for(let r=e;r<t.childCount;r++)if(!n.allowsMarks(t.child(r).marks))return!0;return!1}function uD(n){return n.spec.defining||n.spec.definingForContent}function xS(n,t){for(let e=0;;e++){let r=t<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return e;n=r.content}}function fD(n,t,e,r){if(!r.size)return n.deleteRange(t,e);let i=n.doc.resolve(t),s=n.doc.resolve(e);if(pA(i,s,r))return n.step(new uo(t,e,r));let l=yA(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let b=i.depth,y=i.pos-1;b>0;b--,y--){let M=i.node(b).type.spec;if(M.defining||M.definingAsContext||M.isolating)break;l.indexOf(b)>-1?c=b:i.before(b)==y&&l.splice(1,0,-b)}let f=l.indexOf(c),d=[],p=r.openStart;for(let b=r.content,y=0;;y++){let M=b.firstChild;if(d.push(M),y==r.openStart)break;b=M.content}for(let b=p-1;b>=0;b--){let y=d[b],M=uD(y.type);if(M&&!y.sameMarkup(i.node(Math.abs(c)-1)))p=b;else if(M||!y.type.isTextblock)break}for(let b=r.openStart;b>=0;b--){let y=(b+p+1)%(r.openStart+1),M=d[y];if(M)for(let C=0;C<l.length;C++){let D=l[(C+f)%l.length],L=!0;D<0&&(L=!1,D=-D);let H=i.node(D-1),Y=i.index(D-1);if(H.canReplaceWith(Y,Y,M.type,M.marks))return n.replace(i.before(D),L?s.after(D):e,new Ke(gA(r.content,0,r.openStart,y),y,r.openEnd))}}let g=n.steps.length;for(let b=l.length-1;b>=0&&(n.replace(t,e,r),!(n.steps.length>g));b--){let y=l[b];y<0||(t=i.before(y),e=s.after(y))}}function gA(n,t,e,r,i){if(t<e){let s=n.firstChild;n=n.replaceChild(0,s.copy(gA(s.content,t+1,e,r,s)))}if(t>r){let s=i.contentMatchAt(0),l=s.fillBefore(n).append(n);n=l.append(s.matchFragment(l).fillBefore(Ce.empty,!0))}return n}function dD(n,t,e,r){if(!r.isInline&&t==e&&n.doc.resolve(t).parent.content.size){let i=aD(n.doc,t,r.type);i!=null&&(t=e=i)}n.replaceRange(t,e,new Ke(Ce.from(r),0,0))}function hD(n,t,e){let r=n.doc.resolve(t),i=n.doc.resolve(e);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let l=r.sharedDepth(e),c=!1;for(let f=r.depth;f>l;f--)r.node(f).type.spec.isolating&&(c=!0);for(let f=i.depth;f>l;f--)i.node(f).type.spec.isolating&&(c=!0);if(!c){for(let f=r.depth;f>0&&t==r.start(f);f--)t=r.before(f);for(let f=i.depth;f>0&&e==i.start(f);f--)e=i.before(f);r=n.doc.resolve(t),i=n.doc.resolve(e)}}let s=yA(r,i);for(let l=0;l<s.length;l++){let c=s[l],f=l==s.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return n.delete(r.start(c),i.end(c));if(c>0&&(f||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return n.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(t-r.start(l)==r.depth-l&&e>r.end(l)&&i.end(l)-e!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return n.delete(r.before(l),e);n.delete(t,e)}function yA(n,t){let e=[],r=Math.min(n.depth,t.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||t.end(i)>t.pos+(t.depth-i)||n.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(s==t.start(i)||i==n.depth&&i==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==s-1)&&e.push(i)}return e}class Wd extends qs{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return Mo.fail("No node at attribute step's position");let r=Object.create(null);for(let s in e.attrs)r[s]=e.attrs[s];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return Mo.fromReplace(t,this.pos,this.pos+1,new Ke(Ce.from(i),0,e.isLeaf?0:1))}getMap(){return Ga.empty}invert(t){return new Wd(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Wd(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Wd(e.pos,e.attr,e.value)}}qs.jsonID("attr",Wd);class xp extends qs{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return Mo.ok(r)}getMap(){return Ga.empty}invert(t){return new xp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xp(e.attr,e.value)}}qs.jsonID("docAttr",xp);let Gd=class extends Error{};Gd=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e};Gd.prototype=Object.create(Error.prototype);Gd.prototype.constructor=Gd;Gd.prototype.name="TransformError";class bA{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new bp}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Gd(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,e=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(t=i.map(t,1),e=i.map(e,-1)),i.forEach((s,l,c,f)=>{t=Math.min(t,c),e=Math.max(e,f)})}return t==1e9?null:{from:t,to:e}}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,r=Ke.empty){let i=h0(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new Ke(Ce.from(r),0,0))}delete(t,e){return this.replace(t,e,Ke.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return fD(this,t,e,r),this}replaceRangeWith(t,e,r){return dD(this,t,e,r),this}deleteRange(t,e){return hD(this,t,e),this}lift(t,e){return J8(this,t,e),this}join(t,e=1){return sD(this,t,e),this}wrap(t,e){return tD(this,t,e),this}setBlockType(t,e=t,r,i=null){return eD(this,t,e,r,i),this}setNodeMarkup(t,e,r=null,i){return rD(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new Wd(t,e,r)),this}setDocAttribute(t,e){return this.step(new xp(t,e)),this}addNodeMark(t,e){return this.step(new cf(t,e)),this}removeNodeMark(t,e){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(e instanceof li)e.isInSet(r.marks)&&this.step(new nd(t,e));else{let i=r.marks,s,l=[];for(;s=e.isInSet(i);)l.push(new nd(t,s)),i=s.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(t,e=1,r){return iD(this,t,e,r),this}addMark(t,e,r){return X8(this,t,e,r),this}removeMark(t,e,r){return G8(this,t,e,r),this}clearIncompatible(t,e,r){return x5(this,t,e,r),this}}const by=Object.create(null);class Qn{constructor(t,e,r){this.$anchor=t,this.$head=e,this.ranges=r||[new pD(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=Ke.empty){let r=e.content.lastChild,i=null;for(let c=0;c<e.openEnd;c++)i=r,r=r.lastChild;let s=t.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:f,$to:d}=l[c],p=t.mapping.slice(s);t.replaceRange(p.map(f.pos),p.map(d.pos),c?Ke.empty:e),c==0&&SS(t,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,e){let r=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:c}=i[s],f=t.mapping.slice(r),d=f.map(l.pos),p=f.map(c.pos);s?t.deleteRange(d,p):(t.replaceRangeWith(d,p,e),SS(t,r,e.isInline?-1:1))}}static findFrom(t,e,r=!1){let i=t.parent.inlineContent?new Rn(t):Id(t.node(0),t.parent,t.pos,t.index(),e,r);if(i)return i;for(let s=t.depth-1;s>=0;s--){let l=e<0?Id(t.node(0),t.node(s),t.before(s+1),t.index(s),e,r):Id(t.node(0),t.node(s),t.after(s+1),t.index(s)+1,e,r);if(l)return l}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Ja(t.node(0))}static atStart(t){return Id(t,t,0,0,1)||new Ja(t)}static atEnd(t){return Id(t,t,t.content.size,t.childCount,-1)||new Ja(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=by[e.type];if(!r)throw new RangeError(`No selection type ${e.type} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in by)throw new RangeError("Duplicate use of selection JSON ID "+t);return by[t]=e,e.prototype.jsonID=t,e}getBookmark(){return Rn.between(this.$anchor,this.$head).getBookmark()}}Qn.prototype.visible=!0;class pD{constructor(t,e){this.$from=t,this.$to=e}}let vS=!1;function wS(n){!vS&&!n.parent.inlineContent&&(vS=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Rn extends Qn{constructor(t,e=t){wS(t),wS(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let r=t.resolve(e.map(this.head));if(!r.parent.inlineContent)return Qn.near(r);let i=t.resolve(e.map(this.anchor));return new Rn(i.parent.inlineContent?i:r,r)}replace(t,e=Ke.empty){if(super.replace(t,e),e==Ke.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Rn&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new p0(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if(typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Rn(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){let i=t.resolve(e);return new this(i,r==e?i:t.resolve(r))}static between(t,e,r){let i=t.pos-e.pos;if((!r||i)&&(r=i>=0?1:-1),!e.parent.inlineContent){let s=Qn.findFrom(e,r,!0)||Qn.findFrom(e,-r,!0);if(s)e=s.$head;else return Qn.near(e,r)}return t.parent.inlineContent||(i==0?t=e:(t=(Qn.findFrom(t,-r,!0)||Qn.findFrom(t,r,!0)).$anchor,t.pos<e.pos!=i<0&&(t=e))),new Rn(t,e)}}Qn.jsonID("text",Rn);class p0{constructor(t,e){this.anchor=t,this.head=e}map(t){return new p0(t.map(this.anchor),t.map(this.head))}resolve(t){return Rn.between(t.resolve(this.anchor),t.resolve(this.head))}}class Cn extends Qn{constructor(t){let e=t.nodeAfter,r=t.node(0).resolve(t.pos+e.nodeSize);super(t,r),this.node=e}map(t,e){let{deleted:r,pos:i}=e.mapResult(this.anchor),s=t.resolve(i);return r?Qn.near(s):new Cn(s)}content(){return new Ke(Ce.from(this.node),0,0)}eq(t){return t instanceof Cn&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new w5(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Cn(t.resolve(e.anchor))}static create(t,e){return new Cn(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Cn.prototype.visible=!1;Qn.jsonID("node",Cn);class w5{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new p0(r,r):new w5(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;return r&&Cn.isSelectable(r)?new Cn(e):Qn.near(e)}}class Ja extends Qn{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=Ke.empty){if(e==Ke.empty){t.delete(0,t.doc.content.size);let r=Qn.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new Ja(t)}map(t){return new Ja(t)}eq(t){return t instanceof Ja}getBookmark(){return mD}}Qn.jsonID("all",Ja);const mD={map(){return this},resolve(n){return new Ja(n)}};function Id(n,t,e,r,i,s=!1){if(t.inlineContent)return Rn.create(n,e);for(let l=r-(i>0?0:1);i>0?l<t.childCount:l>=0;l+=i){let c=t.child(l);if(c.isAtom){if(!s&&Cn.isSelectable(c))return Cn.create(n,e-(i<0?c.nodeSize:0))}else{let f=Id(n,c,e+i,i<0?c.childCount:0,i,s);if(f)return f}e+=c.nodeSize*i}return null}function SS(n,t,e){let r=n.steps.length-1;if(r<t)return;let i=n.steps[r];if(!(i instanceof uo||i instanceof Vo))return;let s=n.mapping.maps[r],l;s.forEach((c,f,d,p)=>{l==null&&(l=p)}),n.setSelection(Qn.near(n.doc.resolve(l),e))}const kS=1,Pm=2,AS=4;class gD extends bA{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|kS)&~Pm,this.storedMarks=null,this}get selectionSet(){return(this.updated&kS)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Pm,this}ensureMarks(t){return li.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Pm)>0}addStep(t,e){super.addStep(t,e),this.updated=this.updated&~Pm,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let r=this.selection;return e&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||li.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,r){let i=this.doc.type.schema;if(e==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=e),!t)return this.deleteRange(e,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(e);s=r==e?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(e,r,i.text(t,s)),!this.selection.empty&&this.selection.to==e+t.length&&this.setSelection(Qn.near(this.selection.$to)),this}}setMeta(t,e){return this.meta[typeof t=="string"?t:t.key]=e,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=AS,this}get scrolledIntoView(){return(this.updated&AS)>0}}function MS(n,t){return!t||!n?n:n.bind(t)}class Xh{constructor(t,e,r){this.name=t,this.init=MS(e.init,r),this.apply=MS(e.apply,r)}}const yD=[new Xh("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Xh("selection",{init(n,t){return n.selection||Qn.atStart(t.doc)},apply(n){return n.selection}}),new Xh("storedMarks",{init(n){return n.storedMarks||null},apply(n,t,e,r){return r.selection.$cursor?n.storedMarks:null}}),new Xh("scrollToSelection",{init(){return 0},apply(n,t){return n.scrolledIntoView?t+1:t}})];class xy{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=yD.slice(),e&&e.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Xh(r.key,r.spec.state,r))})}}class jf{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=e){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],r=this.applyInner(t),i=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let f=i?i[l].n:0,d=i?i[l].state:this,p=f<e.length&&c.spec.appendTransaction.call(c,f?e.slice(f):e,d,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",t),!i){i=[];for(let g=0;g<this.config.plugins.length;g++)i.push(g<l?{state:r,n:e.length}:{state:this,n:0})}e.push(p),r=r.applyInner(p),s=!0}i&&(i[l]={state:r,n:e.length})}}if(!s)return{state:r,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new jf(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];e[s.name]=s.apply(t,this[s.name],this,e)}return e}get tr(){return new gD(this)}static create(t){let e=new xy(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new jf(e);for(let i=0;i<e.fields.length;i++)r[e.fields[i].name]=e.fields[i].init(t,r);return r}reconfigure(t){let e=new xy(this.schema,t.plugins),r=e.fields,i=new jf(e);for(let s=0;s<r.length;s++){let l=r[s].name;i[l]=this.hasOwnProperty(l)?this[l]:r[s].init(t,i)}return i}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],s=i.spec.state;s&&s.toJSON&&(e[r]=s.toJSON.call(i,this[i.key]))}return e}static fromJSON(t,e,r){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new xy(t.schema,t.plugins),s=new jf(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=$f.fromJSON(t.schema,e.doc);else if(l.name=="selection")s.selection=Qn.fromJSON(s.doc,e.selection);else if(l.name=="storedMarks")e.storedMarks&&(s.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let c in r){let f=r[c],d=f.spec.state;if(f.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(e,c)){s[l.name]=d.fromJSON.call(f,t,e[c],s);return}}s[l.name]=l.init(t,s)}}),s}}function xA(n,t,e){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=xA(i,t,{})),e[r]=i}return e}class Oi{constructor(t){this.spec=t,this.props={},t.props&&xA(t.props,this,this.props),this.key=t.key?t.key.key:vA("plugin")}getState(t){return t[this.key]}}const vy=Object.create(null);function vA(n){return n in vy?n+"$"+ ++vy[n]:(vy[n]=0,n+"$")}class Eo{constructor(t="key"){this.key=vA(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const wA=(n,t)=>n.selection.empty?!1:(t&&t(n.tr.deleteSelection().scrollIntoView()),!0);function SA(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("backward",n):e.parentOffset>0)?null:e}const kA=(n,t,e)=>{let r=SA(n,e);if(!r)return!1;let i=S5(r);if(!i){let l=r.blockRange(),c=l&&sh(l);return c==null?!1:(t&&t(n.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(LA(n,i,t,-1))return!0;if(r.parent.content.size==0&&(Kd(s,"end")||Cn.isSelectable(s)))for(let l=r.depth;;l--){let c=h0(n.doc,r.before(l),r.after(l),Ke.empty);if(c&&c.slice.size<c.to-c.from){if(t){let f=n.tr.step(c);f.setSelection(Kd(s,"end")?Qn.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Cn.create(f.doc,i.pos-s.nodeSize)),t(f.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(t&&t(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},bD=(n,t,e)=>{let r=SA(n,e);if(!r)return!1;let i=S5(r);return i?AA(n,i,t):!1},xD=(n,t,e)=>{let r=CA(n,e);if(!r)return!1;let i=k5(r);return i?AA(n,i,t):!1};function AA(n,t,e){let r=t.nodeBefore,i=r,s=t.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let l=t.nodeAfter,c=l,f=t.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let d=h0(n.doc,s,f,Ke.empty);if(!d||d.from!=s||d instanceof uo&&d.slice.size>=f-s)return!1;if(e){let p=n.tr.step(d);p.setSelection(Rn.create(p.doc,s)),e(p.scrollIntoView())}return!0}function Kd(n,t,e=!1){for(let r=n;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(e&&r.childCount!=1)return!1}return!1}const MA=(n,t,e)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=S5(r)}let l=s&&s.nodeBefore;return!l||!Cn.isSelectable(l)?!1:(t&&t(n.tr.setSelection(Cn.create(n.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function S5(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function CA(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("forward",n):e.parentOffset<e.parent.content.size)?null:e}const EA=(n,t,e)=>{let r=CA(n,e);if(!r)return!1;let i=k5(r);if(!i)return!1;let s=i.nodeAfter;if(LA(n,i,t,1))return!0;if(r.parent.content.size==0&&(Kd(s,"start")||Cn.isSelectable(s))){let l=h0(n.doc,r.before(),r.after(),Ke.empty);if(l&&l.slice.size<l.to-l.from){if(t){let c=n.tr.step(l);c.setSelection(Kd(s,"start")?Qn.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Cn.create(c.doc,c.mapping.map(i.pos))),t(c.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(t&&t(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},TA=(n,t,e)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=k5(r)}let l=s&&s.nodeAfter;return!l||!Cn.isSelectable(l)?!1:(t&&t(n.tr.setSelection(Cn.create(n.doc,s.pos)).scrollIntoView()),!0)};function k5(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){let e=n.node(t);if(n.index(t)+1<e.childCount)return n.doc.resolve(n.after(t+1));if(e.type.spec.isolating)break}return null}const vD=(n,t)=>{let e=n.selection,r=e instanceof Cn,i;if(r){if(e.node.isTextblock||!yf(n.doc,e.from))return!1;i=e.from}else if(i=d0(n.doc,e.from,-1),i==null)return!1;if(t){let s=n.tr.join(i);r&&s.setSelection(Cn.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),t(s.scrollIntoView())}return!0},wD=(n,t)=>{let e=n.selection,r;if(e instanceof Cn){if(e.node.isTextblock||!yf(n.doc,e.to))return!1;r=e.to}else if(r=d0(n.doc,e.to,1),r==null)return!1;return t&&t(n.tr.join(r).scrollIntoView()),!0},SD=(n,t)=>{let{$from:e,$to:r}=n.selection,i=e.blockRange(r),s=i&&sh(i);return s==null?!1:(t&&t(n.tr.lift(i,s).scrollIntoView()),!0)},NA=(n,t)=>{let{$head:e,$anchor:r}=n.selection;return!e.parent.type.spec.code||!e.sameParent(r)?!1:(t&&t(n.tr.insertText(`
95
- `).scrollIntoView()),!0)};function A5(n){for(let t=0;t<n.edgeCount;t++){let{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}const kD=(n,t)=>{let{$head:e,$anchor:r}=n.selection;if(!e.parent.type.spec.code||!e.sameParent(r))return!1;let i=e.node(-1),s=e.indexAfter(-1),l=A5(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(t){let c=e.after(),f=n.tr.replaceWith(c,c,l.createAndFill());f.setSelection(Qn.near(f.doc.resolve(c),1)),t(f.scrollIntoView())}return!0},_A=(n,t)=>{let e=n.selection,{$from:r,$to:i}=e;if(e instanceof Ja||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=A5(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let l=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=n.tr.insert(l,s.createAndFill());c.setSelection(Rn.create(c.doc,l+1)),t(c.scrollIntoView())}return!0},DA=(n,t)=>{let{$cursor:e}=n.selection;if(!e||e.parent.content.size)return!1;if(e.depth>1&&e.after()!=e.end(-1)){let s=e.before();if(Au(n.doc,s))return t&&t(n.tr.split(s).scrollIntoView()),!0}let r=e.blockRange(),i=r&&sh(r);return i==null?!1:(t&&t(n.tr.lift(r,i).scrollIntoView()),!0)};function AD(n){return(t,e)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof Cn&&t.selection.node.isBlock)return!r.parentOffset||!Au(t.doc,r.pos)?!1:(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,f=!1,d=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){f=r.end(y)==r.pos+(r.depth-y),d=r.start(y)==r.pos-(r.depth-y),c=A5(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),s.unshift(f&&c?{type:c}:null),l=y;break}else{if(y==1)return!1;s.unshift(null)}let p=t.tr;(t.selection instanceof Rn||t.selection instanceof Ja)&&p.deleteSelection();let g=p.mapping.map(r.pos),b=Au(p.doc,g,s.length,s);if(b||(s[0]=c?{type:c}:null,b=Au(p.doc,g,s.length,s)),!b)return!1;if(p.split(g,s.length,s),!f&&d&&r.node(l).type!=c){let y=p.mapping.map(r.before(l)),M=p.doc.resolve(y);c&&r.node(l-1).canReplaceWith(M.index(),M.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return e&&e(p.scrollIntoView()),!0}}const MD=AD(),CD=(n,t)=>{let{$from:e,to:r}=n.selection,i,s=e.sharedDepth(r);return s==0?!1:(i=e.before(s),t&&t(n.tr.setSelection(Cn.create(n.doc,i))),!0)};function ED(n,t,e){let r=t.nodeBefore,i=t.nodeAfter,s=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(s-1,s)?(e&&e(n.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(s,s+1)||!(i.isTextblock||yf(n.doc,t.pos))?!1:(e&&e(n.tr.join(t.pos).scrollIntoView()),!0)}function LA(n,t,e,r){let i=t.nodeBefore,s=t.nodeAfter,l,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&ED(n,t,e))return!0;let d=!f&&t.parent.canReplace(t.index(),t.index()+1);if(d&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(e){let y=t.pos+s.nodeSize,M=Ce.empty;for(let L=l.length-1;L>=0;L--)M=Ce.from(l[L].create(null,M));M=Ce.from(i.copy(M));let C=n.tr.step(new Vo(t.pos-1,y,t.pos,y,new Ke(M,1,0),l.length,!0)),D=C.doc.resolve(y+2*l.length);D.nodeAfter&&D.nodeAfter.type==i.type&&yf(C.doc,D.pos)&&C.join(D.pos),e(C.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:Qn.findFrom(t,1),g=p&&p.$from.blockRange(p.$to),b=g&&sh(g);if(b!=null&&b>=t.depth)return e&&e(n.tr.lift(g,b).scrollIntoView()),!0;if(d&&Kd(s,"start",!0)&&Kd(i,"end")){let y=i,M=[];for(;M.push(y),!y.isTextblock;)y=y.lastChild;let C=s,D=1;for(;!C.isTextblock;C=C.firstChild)D++;if(y.canReplace(y.childCount,y.childCount,C.content)){if(e){let L=Ce.empty;for(let Y=M.length-1;Y>=0;Y--)L=Ce.from(M[Y].copy(L));let H=n.tr.step(new Vo(t.pos-M.length,t.pos+s.nodeSize,t.pos+D,t.pos+s.nodeSize-D,new Ke(L,M.length,0),0,!0));e(H.scrollIntoView())}return!0}}return!1}function RA(n){return function(t,e){let r=t.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(e&&e(t.tr.setSelection(Rn.create(t.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const TD=RA(-1),ND=RA(1);function _D(n,t=null){return function(e,r){let{$from:i,$to:s}=e.selection,l=i.blockRange(s),c=l&&v5(l,n,t);return c?(r&&r(e.tr.wrap(l,c).scrollIntoView()),!0):!1}}function CS(n,t=null){return function(e,r){let i=!1;for(let s=0;s<e.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=e.selection.ranges[s];e.doc.nodesBetween(l,c,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,t)))if(f.type==n)i=!0;else{let p=e.doc.resolve(d),g=p.index();i=p.parent.canReplaceWith(g,g+1,n)}})}if(!i)return!1;if(r){let s=e.tr;for(let l=0;l<e.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:f}}=e.selection.ranges[l];s.setBlockType(c,f,n,t)}r(s.scrollIntoView())}return!0}}function M5(...n){return function(t,e,r){for(let i=0;i<n.length;i++)if(n[i](t,e,r))return!0;return!1}}M5(wA,kA,MA);M5(wA,EA,TA);M5(NA,_A,DA,MD);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function DD(n,t=null){return function(e,r){let{$from:i,$to:s}=e.selection,l=i.blockRange(s);if(!l)return!1;let c=r?e.tr:null;return LD(c,l,n,t)?(r&&r(c.scrollIntoView()),!0):!1}}function LD(n,t,e,r=null){let i=!1,s=t,l=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(e)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let f=l.resolve(t.start-2);s=new xg(f,f,t.depth),t.endIndex<t.parent.childCount&&(t=new xg(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let c=v5(s,e,r,t);return c?(n&&RD(n,t,c,i,e),!0):!1}function RD(n,t,e,r,i){let s=Ce.empty;for(let p=e.length-1;p>=0;p--)s=Ce.from(e[p].type.create(e[p].attrs,s));n.step(new Vo(t.start-(r?2:0),t.end,t.start,t.end,new Ke(s,0,0),e.length,!0));let l=0;for(let p=0;p<e.length;p++)e[p].type==i&&(l=p+1);let c=e.length-l,f=t.start+e.length-(r?2:0),d=t.parent;for(let p=t.startIndex,g=t.endIndex,b=!0;p<g;p++,b=!1)!b&&Au(n.doc,f,c)&&(n.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return n}function OD(n){return function(t,e){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==n);return s?e?r.node(s.depth-1).type==n?PD(t,e,n,s):ID(t,e,s):!0:!1}}function PD(n,t,e,r){let i=n.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new Vo(s-1,l,s,l,new Ke(Ce.from(e.create(null,r.parent.copy())),1,0),1,!0)),r=new xg(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=sh(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return yf(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),t(i.scrollIntoView()),!0}function ID(n,t,e){let r=n.tr,i=e.parent;for(let y=e.end,M=e.endIndex-1,C=e.startIndex;M>C;M--)y-=i.child(M).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(e.start),l=s.nodeAfter;if(r.mapping.map(e.end)!=e.start+s.nodeAfter.nodeSize)return!1;let c=e.startIndex==0,f=e.endIndex==i.childCount,d=s.node(-1),p=s.index(-1);if(!d.canReplace(p+(c?0:1),p+1,l.content.append(f?Ce.empty:Ce.from(i))))return!1;let g=s.pos,b=g+l.nodeSize;return r.step(new Vo(g-(c?1:0),b+(f?1:0),g+1,b-1,new Ke((c?Ce.empty:Ce.from(i.copy(Ce.empty))).append(f?Ce.empty:Ce.from(i.copy(Ce.empty))),c?0:1,f?0:1),c?0:1)),t(r.scrollIntoView()),!0}function jD(n){return function(t,e){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==n);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,f=c.child(l-1);if(f.type!=n)return!1;if(e){let d=f.lastChild&&f.lastChild.type==c.type,p=Ce.from(d?n.create():null),g=new Ke(Ce.from(n.create(null,Ce.from(c.type.create(null,p)))),d?3:1,0),b=s.start,y=s.end;e(t.tr.step(new Vo(b-(d?3:1),y,b,y,g,1,!0)).scrollIntoView())}return!0}}const xs=function(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t},Jd=function(n){let t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t};let _2=null;const vu=function(n,t,e){let r=_2||(_2=document.createRange());return r.setEnd(n,e??n.nodeValue.length),r.setStart(n,t||0),r},BD=function(){_2=null},rd=function(n,t,e,r){return e&&(ES(n,t,e,r,-1)||ES(n,t,e,r,1))},zD=/^(img|br|input|textarea|hr)$/i;function ES(n,t,e,r,i){for(var s;;){if(n==e&&t==r)return!0;if(t==(i<0?0:Tl(n))){let l=n.parentNode;if(!l||l.nodeType!=1||Tp(n)||zD.test(n.nodeName)||n.contentEditable=="false")return!1;t=xs(n)+(i<0?0:1),n=l}else if(n.nodeType==1){let l=n.childNodes[t+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)t+=i;else return!1;else n=l,t=i<0?Tl(n):0}else return!1}}function Tl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function FD(n,t){for(;;){if(n.nodeType==3&&t)return n;if(n.nodeType==1&&t>0){if(n.contentEditable=="false")return null;n=n.childNodes[t-1],t=Tl(n)}else if(n.parentNode&&!Tp(n))t=xs(n),n=n.parentNode;else return null}}function UD(n,t){for(;;){if(n.nodeType==3&&t<n.nodeValue.length)return n;if(n.nodeType==1&&t<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[t],t=0}else if(n.parentNode&&!Tp(n))t=xs(n)+1,n=n.parentNode;else return null}}function HD(n,t,e){for(let r=t==0,i=t==Tl(n);r||i;){if(n==e)return!0;let s=xs(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Tl(n)}}function Tp(n){let t;for(let e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}const m0=function(n){return n.focusNode&&rd(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function If(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}function qD(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function YD(n,t,e){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(t,e);if(r)return{node:r.offsetNode,offset:Math.min(Tl(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(t,e);if(r)return{node:r.startContainer,offset:Math.min(Tl(r.startContainer),r.startOffset)}}}const Ic=typeof navigator<"u"?navigator:null,TS=typeof document<"u"?document:null,bf=Ic&&Ic.userAgent||"",D2=/Edge\/(\d+)/.exec(bf),OA=/MSIE \d/.exec(bf),L2=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bf),La=!!(OA||L2||D2),uf=OA?document.documentMode:L2?+L2[1]:D2?+D2[1]:0,Nl=!La&&/gecko\/(\d+)/i.test(bf);Nl&&+(/Firefox\/(\d+)/.exec(bf)||[0,0])[1];const R2=!La&&/Chrome\/(\d+)/.exec(bf),ws=!!R2,PA=R2?+R2[1]:0,Hs=!La&&!!Ic&&/Apple Computer/.test(Ic.vendor),Zd=Hs&&(/Mobile\/\w+/.test(bf)||!!Ic&&Ic.maxTouchPoints>2),El=Zd||(Ic?/Mac/.test(Ic.platform):!1),IA=Ic?/Win/.test(Ic.platform):!1,Su=/Android \d/.test(bf),Np=!!TS&&"webkitFontSmoothing"in TS.documentElement.style,$D=Np?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function VD(n){let t=n.defaultView&&n.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function mu(n,t){return typeof n=="number"?n:n[t]}function WD(n){let t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*r}}function NS(n,t,e){if(!O2(t)&&t.left==0)return;let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let l=e||n.dom;l;){if(l.nodeType!=1){l=Jd(l);continue}let c=l,f=c==s.body,d=f?VD(s):WD(c),p=0,g=0;if(t.top<d.top+mu(r,"top")?g=-(d.top-t.top+mu(i,"top")):t.bottom>d.bottom-mu(r,"bottom")&&(g=t.bottom-t.top>d.bottom-d.top?t.top+mu(i,"top")-d.top:t.bottom-d.bottom+mu(i,"bottom")),t.left<d.left+mu(r,"left")?p=-(d.left-t.left+mu(i,"left")):t.right>d.right-mu(r,"right")&&(p=t.right-d.right+mu(i,"right")),p||g)if(f)s.defaultView.scrollBy(p,g);else{let y=c.scrollLeft,M=c.scrollTop;g&&(c.scrollTop+=g),p&&(c.scrollLeft+=p);let C=c.scrollLeft-y,D=c.scrollTop-M;t={left:t.left-C,top:t.top-D,right:t.right-C,bottom:t.bottom-D}}let b=f?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(b))break;l=b=="absolute"?l.offsetParent:Jd(l)}}function XD(n){let t=n.dom.getBoundingClientRect(),e=Math.max(0,t.top),r,i;for(let s=(t.left+t.right)/2,l=e+1;l<Math.min(innerHeight,t.bottom);l+=5){let c=n.root.elementFromPoint(s,l);if(!c||c==n.dom||!n.dom.contains(c))continue;let f=c.getBoundingClientRect();if(f.top>=e-20){r=c,i=f.top;break}}return{refDOM:r,refTop:i,stack:jA(n.dom)}}function jA(n){let t=[],e=n.ownerDocument;for(let r=n;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=e);r=Jd(r));return t}function GD({refDOM:n,refTop:t,stack:e}){let r=n?n.getBoundingClientRect().top:0;BA(e,r==0?0:r-t)}function BA(n,t){for(let e=0;e<n.length;e++){let{dom:r,top:i,left:s}=n[e];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ed=null;function KD(n){if(n.setActive)return n.setActive();if(Ed)return n.focus(Ed);let t=jA(n);n.focus(Ed==null?{get preventScroll(){return Ed={preventScroll:!0},!0}}:void 0),Ed||(Ed=!1,BA(t,0))}function zA(n,t){let e,r=2e8,i,s=0,l=t.top,c=t.top,f,d;for(let p=n.firstChild,g=0;p;p=p.nextSibling,g++){let b;if(p.nodeType==1)b=p.getClientRects();else if(p.nodeType==3)b=vu(p).getClientRects();else continue;for(let y=0;y<b.length;y++){let M=b[y];if(M.top<=l&&M.bottom>=c){l=Math.max(M.bottom,l),c=Math.min(M.top,c);let C=M.left>t.left?M.left-t.left:M.right<t.left?t.left-M.right:0;if(C<r){e=p,r=C,i=C&&e.nodeType==3?{left:M.right<t.left?M.right:M.left,top:t.top}:t,p.nodeType==1&&C&&(s=g+(t.left>=(M.left+M.right)/2?1:0));continue}}else M.top>t.top&&!f&&M.left<=t.left&&M.right>=t.left&&(f=p,d={left:Math.max(M.left,Math.min(M.right,t.left)),top:M.top});!e&&(t.left>=M.right&&t.top>=M.top||t.left>=M.left&&t.top>=M.bottom)&&(s=g+1)}}return!e&&f&&(e=f,i=d,r=0),e&&e.nodeType==3?JD(e,i):!e||r&&e.nodeType==1?{node:n,offset:s}:zA(e,i)}function JD(n,t){let e=n.nodeValue.length,r=document.createRange(),i;for(let s=0;s<e;s++){r.setEnd(n,s+1),r.setStart(n,s);let l=tf(r,1);if(l.top!=l.bottom&&C5(t,l)){i={node:n,offset:s+(t.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function C5(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function ZD(n,t){let e=n.parentNode;return e&&/^li$/i.test(e.nodeName)&&t.left<n.getBoundingClientRect().left?e:n}function QD(n,t,e){let{node:r,offset:i}=zA(t,e),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&e.left>(l.left+l.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function tL(n,t,e,r){let i=-1;for(let s=t,l=!1;s!=n.dom;){let c=n.docView.nearestDesc(s,!0),f;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((f=c.dom.getBoundingClientRect()).width||f.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&f.left>r.left||f.top>r.top?i=c.posBefore:(!l&&f.right<r.left||f.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(f.top+f.bottom)/2:r.left<(f.left+f.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:n.docView.posFromDOM(t,e,-1)}function FA(n,t,e){let r=n.childNodes.length;if(r&&e.top<e.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-e.top)/(e.bottom-e.top))-2)),s=i;;){let l=n.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let f=0;f<c.length;f++){let d=c[f];if(C5(t,d))return FA(l,t,d)}}if((s=(s+1)%r)==i)break}return n}function eL(n,t){let e=n.dom.ownerDocument,r,i=0,s=YD(e,t.left,t.top);s&&({node:r,offset:i}=s);let l=(n.root.elementFromPoint?n.root:e).elementFromPoint(t.left,t.top),c;if(!l||!n.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=n.dom.getBoundingClientRect();if(!C5(t,d)||(l=FA(n.dom,t,d),!l))return null}if(Hs)for(let d=l;r&&d;d=Jd(d))d.draggable&&(r=void 0);if(l=ZD(l,t),r){if(Nl&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],g;p.nodeName=="IMG"&&(g=p.getBoundingClientRect()).right<=t.left&&g.bottom>t.top&&i++}let d;Np&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=t.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?c=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=tL(n,r,i,t))}c==null&&(c=QD(n,l,t));let f=n.docView.nearestDesc(l,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function O2(n){return n.top<n.bottom||n.left<n.right}function tf(n,t){let e=n.getClientRects();if(e.length){let r=e[t<0?0:e.length-1];if(O2(r))return r}return Array.prototype.find.call(e,O2)||n.getBoundingClientRect()}const nL=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function UA(n,t,e){let{node:r,offset:i,atom:s}=n.docView.domFromPos(t,e<0?-1:1),l=Np||Nl;if(r.nodeType==3)if(l&&(nL.test(r.nodeValue)||(e<0?!i:i==r.nodeValue.length))){let f=tf(vu(r,i,i),e);if(Nl&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=tf(vu(r,i-1,i-1),-1);if(d.top==f.top){let p=tf(vu(r,i,i+1),-1);if(p.top!=f.top)return zh(p,p.left<d.left)}}return f}else{let f=i,d=i,p=e<0?1:-1;return e<0&&!i?(d++,p=-1):e>=0&&i==r.nodeValue.length?(f--,p=1):e<0?f--:d++,zh(tf(vu(r,f,d),p),p<0)}if(!n.state.doc.resolve(t-(s||0)).parent.inlineContent){if(s==null&&i&&(e<0||i==Tl(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return wy(f.getBoundingClientRect(),!1)}if(s==null&&i<Tl(r)){let f=r.childNodes[i];if(f.nodeType==1)return wy(f.getBoundingClientRect(),!0)}return wy(r.getBoundingClientRect(),e>=0)}if(s==null&&i&&(e<0||i==Tl(r))){let f=r.childNodes[i-1],d=f.nodeType==3?vu(f,Tl(f)-(l?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return zh(tf(d,1),!1)}if(s==null&&i<Tl(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?vu(f,0,l?0:1):f.nodeType==1?f:null:null;if(d)return zh(tf(d,-1),!0)}return zh(tf(r.nodeType==3?vu(r):r,-e),e>=0)}function zh(n,t){if(n.width==0)return n;let e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function wy(n,t){if(n.height==0)return n;let e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function HA(n,t,e){let r=n.state,i=n.root.activeElement;r!=t&&n.updateState(t),i!=n.dom&&n.focus();try{return e()}finally{r!=t&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function rL(n,t,e){let r=t.selection,i=e=="up"?r.$from:r.$to;return HA(n,t,()=>{let{node:s}=n.docView.domFromPos(i.pos,e=="up"?-1:1);for(;;){let c=n.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=UA(n,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=vu(c,0,c.nodeValue.length).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];if(p.bottom>p.top+1&&(e=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const iL=/[\u0590-\u08ac]/;function oL(n,t,e){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,l=i==r.parent.content.size,c=n.domSelection();return c?!iL.test(r.parent.textContent)||!c.modify?e=="left"||e=="backward"?s:l:HA(n,t,()=>{let{focusNode:f,focusOffset:d,anchorNode:p,anchorOffset:g}=n.domSelectionRange(),b=c.caretBidiLevel;c.modify("move",e,"character");let y=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:M,focusOffset:C}=n.domSelectionRange(),D=M&&!y.contains(M.nodeType==1?M:M.parentNode)||f==M&&d==C;try{c.collapse(p,g),f&&(f!=p||d!=g)&&c.extend&&c.extend(f,d)}catch{}return b!=null&&(c.caretBidiLevel=b),D}):r.pos==r.start()||r.pos==r.end()}let _S=null,DS=null,LS=!1;function sL(n,t,e){return _S==t&&DS==e?LS:(_S=t,DS=e,LS=e=="up"||e=="down"?rL(n,t,e):oL(n,t,e))}const _l=0,RS=1,Bf=2,rc=3;class _p{constructor(t,e,r,i){this.parent=t,this.children=e,this.dom=r,this.contentDOM=i,this.dirty=_l,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,r){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,r=this.posAtStart;;e++){let i=this.children[e];if(i==t)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let s,l;if(t==this.contentDOM)s=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;s=t.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(t==this.contentDOM)s=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;s=t.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let i;if(t==this.dom&&this.contentDOM)i=e>xs(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(e==0)for(let s=t;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&e==t.childNodes.length)for(let s=t;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let r=!0,i=t;i;i=i.parentNode){let s=this.getDesc(i),l;if(s&&(!e||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(t.nodeType==1?t:t.parentNode):l==t))r=!1;else return s}}getDesc(t){let e=t.pmViewDesc;for(let r=e;r;r=r.parent)if(r==this)return e}posFromDOM(t,e,r){for(let i=t;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(t,e,r)}return-1}descAt(t){for(let e=0,r=0;e<this.children.length;e++){let i=this.children[e],s=r+i.size;if(r==t&&s!=r){for(;!i.border&&i.children.length;)for(let l=0;l<i.children.length;l++){let c=i.children[l];if(c.size){i=c;break}}return i}if(t<s)return i.descAt(t-r-i.border);r=s}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let l=this.children[r],c=s+l.size;if(c>t||l instanceof YA){i=t-s;break}s=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,e);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof qA&&s.side>=0;r--);if(e<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&e&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,e):{node:this.contentDOM,offset:s?xs(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,e):{node:this.contentDOM,offset:s?xs(s.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let l=r,c=0;;c++){let f=this.children[c],d=l+f.size;if(i==-1&&t<=d){let p=l+f.border;if(t>=p&&e<=d-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(t,e,p);t=l;for(let g=c;g>0;g--){let b=this.children[g-1];if(b.size&&b.dom.parentNode==this.contentDOM&&!b.emptyChildAt(1)){i=xs(b.dom)+1;break}t-=b.size}i==-1&&(i=0)}if(i>-1&&(d>e||c==this.children.length-1)){e=d;for(let p=c+1;p<this.children.length;p++){let g=this.children[p];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(-1)){s=xs(g.dom);break}e+=g.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:t,to:e,fromOffset:i,toOffset:s}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return e.size==0||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:r}=this.domFromPos(t,0);if(e.nodeType!=1||r==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[r]}setSelection(t,e,r,i=!1){let s=Math.min(t,e),l=Math.max(t,e);for(let y=0,M=0;y<this.children.length;y++){let C=this.children[y],D=M+C.size;if(s>M&&l<D)return C.setSelection(t-M-C.border,e-M-C.border,r,i);M=D}let c=this.domFromPos(t,t?-1:1),f=e==t?c:this.domFromPos(e,e?-1:1),d=r.root.getSelection(),p=r.domSelectionRange(),g=!1;if((Nl||Hs)&&t==e){let{node:y,offset:M}=c;if(y.nodeType==3){if(g=!!(M&&y.nodeValue[M-1]==`
96
- `),g&&M==y.nodeValue.length)for(let C=y,D;C;C=C.parentNode){if(D=C.nextSibling){D.nodeName=="BR"&&(c=f={node:D.parentNode,offset:xs(D)+1});break}let L=C.pmViewDesc;if(L&&L.node&&L.node.isBlock)break}}else{let C=y.childNodes[M-1];g=C&&(C.nodeName=="BR"||C.contentEditable=="false")}}if(Nl&&p.focusNode&&p.focusNode!=f.node&&p.focusNode.nodeType==1){let y=p.focusNode.childNodes[p.focusOffset];y&&y.contentEditable=="false"&&(i=!0)}if(!(i||g&&Hs)&&rd(c.node,c.offset,p.anchorNode,p.anchorOffset)&&rd(f.node,f.offset,p.focusNode,p.focusOffset))return;let b=!1;if((d.extend||t==e)&&!(g&&Nl)){d.collapse(c.node,c.offset);try{t!=e&&d.extend(f.node,f.offset),b=!0}catch{}}if(!b){if(t>e){let M=c;c=f,f=M}let y=document.createRange();y.setEnd(f.node,f.offset),y.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(y)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],l=r+s.size;if(r==l?t<=l&&e>=r:t<l&&e>r){let c=r+s.border,f=l-s.border;if(t>=c&&e<=f){this.dirty=t==r||e==l?Bf:RS,t==c&&e==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=rc:s.markDirty(t-c,e-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Bf:rc}r=l}this.dirty=Bf}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let r=t==1?Bf:RS;e.dirty<r&&(e.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class qA extends _p{constructor(t,e,r,i){let s,l=e.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!e.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(t,[],l,null),this.widget=e,this.widget=e,s=this}matchesWidget(t){return this.dirty==_l&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return e?e(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class aL extends _p{constructor(t,e,r,i){super(t,[],e,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ff extends _p{constructor(t,e,r,i,s){super(t,[],r,i),this.mark=e,this.spec=s}static create(t,e,r,i){let s=i.nodeViews[e.type.name],l=s&&s(e,i,r);return(!l||!l.dom)&&(l=ad.renderSpec(document,e.type.spec.toDOM(e,r),null,e.attrs)),new ff(t,e,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&rc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=rc&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=_l){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=_l}}slice(t,e,r){let i=ff.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;e<l&&(s=I2(s,e,l,r)),t>0&&(s=I2(s,0,t,r));for(let c=0;c<s.length;c++)s[c].parent=i;return i.children=s,i}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class df extends _p{constructor(t,e,r,i,s,l,c){super(t,[],s,l),this.node=e,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(t,e,r,i,s,l){let c=s.nodeViews[e.type.name],f,d=c&&c(e,s,()=>{if(!f)return l;if(f.parent)return f.parent.posBeforeChild(f)},r,i),p=d&&d.dom,g=d&&d.contentDOM;if(e.isText){if(!p)p=document.createTextNode(e.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:g}=ad.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs));!g&&!e.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),e.type.spec.draggable&&(p.draggable=!0));let b=p;return p=WA(p,r,e),d?f=new lL(t,e,r,i,p,g||null,b,d):e.isText?new g0(t,e,r,i,p,b):new df(t,e,r,i,p,g||null,b)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}if(!e.contentElement){let r=t&&t.find(i=>i.nodeType==1&&t.indexOf(i.parentNode)<0&&this.dom.contains(i));r?e.contentElement=r:e.getContent=()=>Ce.empty}}return e}matchesNode(t,e,r){return this.dirty==_l&&t.eq(this.node)&&wg(e,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let r=this.node.inlineContent,i=e,s=t.composing?this.localCompositionInfo(t,e):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,f=new uL(this,l&&l.node,t);hL(this.node,this.innerDeco,(d,p,g)=>{d.spec.marks?f.syncToMarks(d.spec.marks,r,t,p):d.type.side>=0&&!g&&f.syncToMarks(p==this.node.childCount?li.none:this.node.child(p).marks,r,t,p),f.placeWidget(d,t,i)},(d,p,g,b)=>{f.syncToMarks(d.marks,r,t,b);let y;f.findNodeMatch(d,p,g,b)||c&&t.state.selection.from>i&&t.state.selection.to<i+d.nodeSize&&(y=f.findIndexWithChild(s.node))>-1&&f.updateNodeAt(d,p,g,y,t)||f.updateNextNode(d,p,g,t,b,i)||f.addNode(d,p,g,t,i),i+=d.nodeSize}),f.syncToMarks([],r,t,0),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==Bf)&&(l&&this.protectLocalComposition(t,l),$A(this.contentDOM,this.children,t),Zd&&pL(this.dom))}localCompositionInfo(t,e){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof Rn)||r<e||i>e+this.node.content.size)return null;let s=t.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,c=mL(this.node.content,l,r-e,i-e);return c<0?null:{node:s,pos:c,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:r,text:i}){if(this.getDesc(e))return;let s=e;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let l=new aL(this,s,e,i);t.input.compositionNodes.push(l),this.children=I2(this.children,r,r+i.length,t,l)}update(t,e,r,i){return this.dirty==rc||!t.sameMarkup(this.node)?!1:(this.updateInner(t,e,r,i),!0)}updateInner(t,e,r,i){this.updateOuterDeco(e),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=_l}updateOuterDeco(t){if(wg(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=VA(this.dom,this.nodeDOM,P2(this.outerDeco,this.node,e),P2(t,this.node,e)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function OS(n,t,e,r,i){WA(r,t,n);let s=new df(void 0,n,t,e,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class g0 extends df{constructor(t,e,r,i,s,l){super(t,e,r,i,s,null,l)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,r,i){return this.dirty==rc||this.dirty!=_l&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(e),(this.dirty!=_l||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=_l,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,r){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,e,r){let i=this.node.cut(t,e),s=document.createTextNode(i.text);return new g0(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(t,e){super.markDirty(t,e),this.dom!=this.nodeDOM&&(t==0||e==this.nodeDOM.nodeValue.length)&&(this.dirty=rc)}get domAtom(){return!1}isText(t){return this.node.text==t}}class YA extends _p{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==_l&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class lL extends df{constructor(t,e,r,i,s,l,c,f){super(t,e,r,i,s,l,c),this.spec=f}update(t,e,r,i){if(this.dirty==rc)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let s=this.spec.update(t,e,r);return s&&this.updateInner(t,e,r,i),s}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,e,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,r,i){this.spec.setSelection?this.spec.setSelection(t,e,r.root):super.setSelection(t,e,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function $A(n,t,e){let r=n.firstChild,i=!1;for(let s=0;s<t.length;s++){let l=t[s],c=l.dom;if(c.parentNode==n){for(;c!=r;)r=PS(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(c,r);if(l instanceof ff){let f=r?r.previousSibling:n.lastChild;$A(l.contentDOM,l.children,e),r=f?f.nextSibling:n.firstChild}}for(;r;)r=PS(r),i=!0;i&&e.trackWrites==n&&(e.trackWrites=null)}const ip=function(n){n&&(this.nodeName=n)};ip.prototype=Object.create(null);const zf=[new ip];function P2(n,t,e){if(n.length==0)return zf;let r=e?zf[0]:new ip,i=[r];for(let s=0;s<n.length;s++){let l=n[s].type.attrs;if(l){l.nodeName&&i.push(r=new ip(l.nodeName));for(let c in l){let f=l[c];f!=null&&(e&&i.length==1&&i.push(r=new ip(t.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+f:c=="style"?r.style=(r.style?r.style+";":"")+f:c!="nodeName"&&(r[c]=f))}}}return i}function VA(n,t,e,r){if(e==zf&&r==zf)return t;let i=t;for(let s=0;s<r.length;s++){let l=r[s],c=e[s];if(s){let f;c&&c.nodeName==l.nodeName&&i!=n&&(f=i.parentNode)&&f.nodeName.toLowerCase()==l.nodeName||(f=document.createElement(l.nodeName),f.pmIsDeco=!0,f.appendChild(i),c=zf[0]),i=f}cL(i,c||zf[0],l)}return i}function cL(n,t,e){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in e)&&n.removeAttribute(r);for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&e[r]!=t[r]&&n.setAttribute(r,e[r]);if(t.class!=e.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=e.class?e.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(t.style!=e.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(t.style);)n.style.removeProperty(i[1])}e.style&&(n.style.cssText+=e.style)}}function WA(n,t,e){return VA(n,n,zf,P2(t,e,n.nodeType!=1))}function wg(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(!n[e].type.eq(t[e].type))return!1;return!0}function PS(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class uL{constructor(t,e,r){this.lock=e,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=fL(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let r=t;r<e;r++)this.top.children[r].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,r,i){let s=0,l=this.stack.length>>1,c=Math.min(l,t.length);for(;s<c&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(t[s])&&t[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=_l,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<t.length;){this.stack.push(this.top,this.index+1);let f=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let p=this.index;p<d;p++){let g=this.top.children[p];if(g.matchesMark(t[l])&&!this.isLocked(g.dom)){f=p;break}}if(f<0&&this.index<this.top.children.length){let p=this.top.children[this.index];p instanceof ff&&p.dirty!=rc&&p.mark.type==t[l].type&&p.spec.update&&!this.isLocked(p.dom)&&p.spec.update(t[l])&&(p.mark=t[l],f=this.index,this.changed=!0)}if(f>-1)f>this.index&&(this.changed=!0,this.destroyBetween(this.index,f)),this.top=this.top.children[this.index];else{let p=ff.create(this.top,t[l],e,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(t,e,r,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(t,e,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,f=Math.min(this.top.children.length,c+5);c<f;c++){let d=this.top.children[c];if(d.matchesNode(t,e,r)&&!this.preMatch.matched.has(d)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,e,r,i,s){let l=this.top.children[i];return l.dirty==rc&&l.dom==l.contentDOM&&(l.dirty=Bf),l.update(t,e,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}t=e}}updateNextNode(t,e,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let f=this.top.children[c];if(f instanceof df){let d=this.preMatch.matched.get(f);if(d!=null&&d!=s)return!1;let p=f.dom,g,b=this.isLocked(p)&&!(t.isText&&f.node&&f.node.isText&&f.nodeDOM.nodeValue==t.text&&f.dirty!=rc&&wg(e,f.outerDeco));if(!b&&f.update(t,e,r,i))return this.destroyBetween(this.index,c),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!b&&(g=this.recreateWrapper(f,t,e,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=Bf,g.updateChildren(i,l+1),g.dirty=_l),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,r,i,s,l){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!wg(r,t.outerDeco)||!i.eq(t.innerDeco))return null;let c=df.create(this.top,e,r,i,s,l);if(c.contentDOM){c.children=t.children,t.children=[];for(let f of c.children)f.parent=c}return t.destroy(),c}addNode(t,e,r,i,s){let l=df.create(this.top,t,e,r,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(t,e,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(t)&&(t==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new qA(this.top,t,e,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof ff;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof g0)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Hs||ws)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new YA(this.top,[],r,null);e!=this.top?e.children.push(i):e.children.splice(this.index++,0,i),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function fL(n,t){let e=t,r=e.children.length,i=n.childCount,s=new Map,l=[];t:for(;i>0;){let c;for(;;)if(r){let d=e.children[r-1];if(d instanceof ff)e=d,r=d.children.length;else{c=d,r--;break}}else{if(e==t)break t;r=e.parent.children.indexOf(e),e=e.parent}let f=c.node;if(f){if(f!=n.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function dL(n,t){return n.type.side-t.type.side}function hL(n,t,e,r){let i=t.locals(n),s=0;if(i.length==0){for(let d=0;d<n.childCount;d++){let p=n.child(d);r(p,i,t.forChild(s,p),d),s+=p.nodeSize}return}let l=0,c=[],f=null;for(let d=0;;){let p,g;for(;l<i.length&&i[l].to==s;){let D=i[l++];D.widget&&(p?(g||(g=[p])).push(D):p=D)}if(p)if(g){g.sort(dL);for(let D=0;D<g.length;D++)e(g[D],d,!!f)}else e(p,d,!!f);let b,y;if(f)y=-1,b=f,f=null;else if(d<n.childCount)y=d,b=n.child(d++);else break;for(let D=0;D<c.length;D++)c[D].to<=s&&c.splice(D--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)c.push(i[l++]);let M=s+b.nodeSize;if(b.isText){let D=M;l<i.length&&i[l].from<D&&(D=i[l].from);for(let L=0;L<c.length;L++)c[L].to<D&&(D=c[L].to);D<M&&(f=b.cut(D-s),b=b.cut(0,D-s),M=D,y=-1)}else for(;l<i.length&&i[l].to<M;)l++;let C=b.isInline&&!b.isLeaf?c.filter(D=>!D.inline):c.slice();r(b,C,t.forChild(s,b),y),s=M}}function pL(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let t=n.style.cssText;n.style.cssText=t+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=t}}function mL(n,t,e,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let l=n.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let f=l.text;for(;i<n.childCount;){let d=n.child(i++);if(s+=d.nodeSize,!d.isText)break;f+=d.text}if(s>=e){if(s>=r&&f.slice(r-t.length-c,r-c)==t)return r-t.length;let d=c<r?f.lastIndexOf(t,r-c-1):-1;if(d>=0&&d+t.length+c>=e)return c+d;if(e==r&&f.length>=r+t.length-c&&f.slice(r-c,r-c+t.length)==t)return r}}return-1}function I2(n,t,e,r,i){let s=[];for(let l=0,c=0;l<n.length;l++){let f=n[l],d=c,p=c+=f.size;d>=e||p<=t?s.push(f):(d<t&&s.push(f.slice(0,t-d,r)),i&&(s.push(i),i=void 0),p>e&&s.push(f.slice(e-d,f.size,r)))}return s}function E5(n,t=null){let e=n.domSelectionRange(),r=n.state.doc;if(!e.focusNode)return null;let i=n.docView.nearestDesc(e.focusNode),s=i&&i.size==0,l=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(l<0)return null;let c=r.resolve(l),f,d;if(m0(e)){for(f=l;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&Cn.isSelectable(g)&&i.parent&&!(g.isInline&&HD(e.focusNode,e.focusOffset,i.dom))){let b=i.posBefore;d=new Cn(l==b?c:r.resolve(b))}}else{if(e instanceof n.dom.ownerDocument.defaultView.Selection&&e.rangeCount>1){let g=l,b=l;for(let y=0;y<e.rangeCount;y++){let M=e.getRangeAt(y);g=Math.min(g,n.docView.posFromDOM(M.startContainer,M.startOffset,1)),b=Math.max(b,n.docView.posFromDOM(M.endContainer,M.endOffset,-1))}if(g<0)return null;[f,l]=b==n.state.selection.anchor?[b,g]:[g,b],c=r.resolve(l)}else f=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(f<0)return null}let p=r.resolve(f);if(!d){let g=t=="pointer"||n.state.selection.head<c.pos&&!s?1:-1;d=T5(n,p,c,g)}return d}function XA(n){return n.editable?n.hasFocus():KA(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Mu(n,t=!1){let e=n.state.selection;if(GA(n,e),!XA(n))return;let r=n.input.mouseDown;if(!t&&ws&&r){let i=n.domSelectionRange(),s=n.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&rd(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)yL(n);else{let{anchor:i,head:s}=e,l,c;IS&&!(e instanceof Rn)&&(e.$from.parent.inlineContent||(l=jS(n,e.from)),!e.empty&&!e.$from.parent.inlineContent&&(c=jS(n,e.to))),n.docView.setSelection(i,s,n,t),IS&&(l&&BS(l),c&&BS(c)),e.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&gL(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const IS=Hs||ws&&PA<63;function jS(n,t){let{node:e,offset:r}=n.docView.domFromPos(t,0),i=r<e.childNodes.length?e.childNodes[r]:null,s=r?e.childNodes[r-1]:null;if(Hs&&i&&i.contentEditable=="false")return Sy(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Sy(i);if(s)return Sy(s)}}function Sy(n){return n.contentEditable="true",Hs&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function BS(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function gL(n){let t=n.dom.ownerDocument;t.removeEventListener("selectionchange",n.input.hideSelectionGuard);let e=n.domSelectionRange(),r=e.anchorNode,i=e.anchorOffset;t.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(e.anchorNode!=r||e.anchorOffset!=i)&&(t.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!XA(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function yL(n){let t=n.domSelection();if(!t)return;let e=n.cursorWrapper.dom,r=e.nodeName=="IMG";r?t.collapse(e.parentNode,xs(e)+1):t.collapse(e,0),!r&&!n.state.selection.visible&&La&&uf<=11&&(e.disabled=!0,e.disabled=!1)}function GA(n,t){if(t instanceof Cn){let e=n.docView.descAt(t.from);e!=n.lastSelectedViewDesc&&(zS(n),e&&e.selectNode(),n.lastSelectedViewDesc=e)}else zS(n)}function zS(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function T5(n,t,e,r){return n.someProp("createSelectionBetween",i=>i(n,t,e))||Rn.between(t,e,r)}function FS(n){return n.editable&&!n.hasFocus()?!1:KA(n)}function KA(n){let t=n.domSelectionRange();if(!t.anchorNode)return!1;try{return n.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(n.editable||n.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function bL(n){let t=n.docView.domFromPos(n.state.selection.anchor,0),e=n.domSelectionRange();return rd(t.node,t.offset,e.anchorNode,e.anchorOffset)}function j2(n,t){let{$anchor:e,$head:r}=n.selection,i=t>0?e.max(r):e.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(t>0?i.after():i.before()):null:i;return s&&Qn.findFrom(s,t)}function ef(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function US(n,t,e){let r=n.state.selection;if(r instanceof Rn)if(e.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let l=n.state.doc.resolve(i.pos+s.nodeSize*(t<0?-1:1));return ef(n,new Rn(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(t>0?"forward":"backward")){let i=j2(n.state,t);return i&&i instanceof Cn?ef(n,i):!1}else if(!(El&&e.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,l;if(!s||s.isText)return!1;let c=t<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(l=n.docView.descAt(c))&&!l.contentDOM?Cn.isSelectable(s)?ef(n,new Cn(t<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Np?ef(n,new Rn(n.state.doc.resolve(t<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Cn&&r.node.isInline)return ef(n,new Rn(t>0?r.$to:r.$from));{let i=j2(n.state,t);return i?ef(n,i):!1}}}function Sg(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function op(n,t){let e=n.pmViewDesc;return e&&e.size==0&&(t<0||n.nextSibling||n.nodeName!="BR")}function Td(n,t){return t<0?xL(n):vL(n)}function xL(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i,s,l=!1;for(Nl&&e.nodeType==1&&r<Sg(e)&&op(e.childNodes[r],-1)&&(l=!0);;)if(r>0){if(e.nodeType!=1)break;{let c=e.childNodes[r-1];if(op(c,-1))i=e,s=--r;else if(c.nodeType==3)e=c,r=e.nodeValue.length;else break}}else{if(JA(e))break;{let c=e.previousSibling;for(;c&&op(c,-1);)i=e.parentNode,s=xs(c),c=c.previousSibling;if(c)e=c,r=Sg(e);else{if(e=e.parentNode,e==n.dom)break;r=0}}}l?B2(n,e,r):i&&B2(n,i,s)}function vL(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i=Sg(e),s,l;for(;;)if(r<i){if(e.nodeType!=1)break;let c=e.childNodes[r];if(op(c,1))s=e,l=++r;else break}else{if(JA(e))break;{let c=e.nextSibling;for(;c&&op(c,1);)s=c.parentNode,l=xs(c)+1,c=c.nextSibling;if(c)e=c,r=0,i=Sg(e);else{if(e=e.parentNode,e==n.dom)break;r=i=0}}}s&&B2(n,s,l)}function JA(n){let t=n.pmViewDesc;return t&&t.node&&t.node.isBlock}function wL(n,t){for(;n&&t==n.childNodes.length&&!Tp(n);)t=xs(n)+1,n=n.parentNode;for(;n&&t<n.childNodes.length;){let e=n.childNodes[t];if(e.nodeType==3)return e;if(e.nodeType==1&&e.contentEditable=="false")break;n=e,t=0}}function SL(n,t){for(;n&&!t&&!Tp(n);)t=xs(n),n=n.parentNode;for(;n&&t;){let e=n.childNodes[t-1];if(e.nodeType==3)return e;if(e.nodeType==1&&e.contentEditable=="false")break;n=e,t=n.childNodes.length}}function B2(n,t,e){if(t.nodeType!=3){let s,l;(l=wL(t,e))?(t=l,e=0):(s=SL(t,e))&&(t=s,e=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(m0(r)){let s=document.createRange();s.setEnd(t,e),s.setStart(t,e),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(t,e);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Mu(n)},50)}function HS(n,t){let e=n.state.doc.resolve(t);if(!(ws||IA)&&e.parent.inlineContent){let i=n.coordsAtPos(t);if(t>e.start()){let s=n.coordsAtPos(t-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(t<e.end()){let s=n.coordsAtPos(t+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function qS(n,t,e){let r=n.state.selection;if(r instanceof Rn&&!r.empty||e.indexOf("s")>-1||El&&e.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let l=j2(n.state,t);if(l&&l instanceof Cn)return ef(n,l)}if(!i.parent.inlineContent){let l=t<0?i:s,c=r instanceof Ja?Qn.near(l,t):Qn.findFrom(l,t);return c?ef(n,c):!1}return!1}function YS(n,t){if(!(n.state.selection instanceof Rn))return!0;let{$head:e,$anchor:r,empty:i}=n.state.selection;if(!e.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!e.textOffset&&(t<0?e.nodeBefore:e.nodeAfter);if(s&&!s.isText){let l=n.state.tr;return t<0?l.delete(e.pos-s.nodeSize,e.pos):l.delete(e.pos,e.pos+s.nodeSize),n.dispatch(l),!0}return!1}function $S(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function kL(n){if(!Hs||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:e}=n.domSelectionRange();if(t&&t.nodeType==1&&e==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;$S(n,r,"true"),setTimeout(()=>$S(n,r,"false"),20)}return!1}function AL(n){let t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}function ML(n,t){let e=t.keyCode,r=AL(t);if(e==8||El&&e==72&&r=="c")return YS(n,-1)||Td(n,-1);if(e==46&&!t.shiftKey||El&&e==68&&r=="c")return YS(n,1)||Td(n,1);if(e==13||e==27)return!0;if(e==37||El&&e==66&&r=="c"){let i=e==37?HS(n,n.state.selection.from)=="ltr"?-1:1:-1;return US(n,i,r)||Td(n,i)}else if(e==39||El&&e==70&&r=="c"){let i=e==39?HS(n,n.state.selection.from)=="ltr"?1:-1:1;return US(n,i,r)||Td(n,i)}else{if(e==38||El&&e==80&&r=="c")return qS(n,-1,r)||Td(n,-1);if(e==40||El&&e==78&&r=="c")return kL(n)||qS(n,1,r)||Td(n,1);if(r==(El?"m":"c")&&(e==66||e==73||e==89||e==90))return!0}return!1}function N5(n,t){n.someProp("transformCopied",y=>{t=y(t,n)});let e=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let y=r.firstChild;e.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let l=n.someProp("clipboardSerializer")||ad.fromSchema(n.state.schema),c=rM(),f=c.createElement("div");f.appendChild(l.serializeFragment(r,{document:c}));let d=f.firstChild,p,g=0;for(;d&&d.nodeType==1&&(p=nM[d.nodeName.toLowerCase()]);){for(let y=p.length-1;y>=0;y--){let M=c.createElement(p[y]);for(;f.firstChild;)M.appendChild(f.firstChild);f.appendChild(M),g++}d=f.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${s}${g?` -${g}`:""} ${JSON.stringify(e)}`);let b=n.someProp("clipboardTextSerializer",y=>y(t,n))||t.content.textBetween(0,t.content.size,`
97
-
98
- `);return{dom:f,text:b,slice:t}}function ZA(n,t,e,r,i){let s=i.parent.type.spec.code,l,c;if(!e&&!t)return null;let f=!!t&&(r||s||!e);if(f){if(n.someProp("transformPastedText",b=>{t=b(t,s||r,n)}),s)return c=new Ke(Ce.from(n.state.schema.text(t.replace(/\r\n?/g,`
99
- `))),0,0),n.someProp("transformPasted",b=>{c=b(c,n,!0)}),c;let g=n.someProp("clipboardTextParser",b=>b(t,i,r,n));if(g)c=g;else{let b=i.marks(),{schema:y}=n.state,M=ad.fromSchema(y);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(C=>{let D=l.appendChild(document.createElement("p"));C&&D.appendChild(M.serializeNode(y.text(C,b)))})}}else n.someProp("transformPastedHTML",g=>{e=g(e,n)}),l=NL(e),Np&&_L(l);let d=l&&l.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let g=+p[3];g>0;g--){let b=l.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;l=b}if(c||(c=(n.someProp("clipboardParser")||n.someProp("domParser")||np.fromSchema(n.state.schema)).parseSlice(l,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!CL.test(b.parentNode.nodeName)?{ignore:!0}:null}})),p)c=DL(VS(c,+p[1],+p[2]),p[4]);else if(c=Ke.maxOpen(EL(c.content,i),!0),c.openStart||c.openEnd){let g=0,b=0;for(let y=c.content.firstChild;g<c.openStart&&!y.type.spec.isolating;g++,y=y.firstChild);for(let y=c.content.lastChild;b<c.openEnd&&!y.type.spec.isolating;b++,y=y.lastChild);c=VS(c,g,b)}return n.someProp("transformPasted",g=>{c=g(c,n,f)}),c}const CL=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function EL(n,t){if(n.childCount<2)return n;for(let e=t.depth;e>=0;e--){let i=t.node(e).contentMatchAt(t.index(e)),s,l=[];if(n.forEach(c=>{if(!l)return;let f=i.findWrapping(c.type),d;if(!f)return l=null;if(d=l.length&&s.length&&tM(f,s,c,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=eM(l[l.length-1],s.length));let p=QA(c,f);l.push(p),i=i.matchType(p.type),s=f}}),l)return Ce.from(l)}return n}function QA(n,t,e=0){for(let r=t.length-1;r>=e;r--)n=t[r].create(null,Ce.from(n));return n}function tM(n,t,e,r,i){if(i<n.length&&i<t.length&&n[i]==t[i]){let s=tM(n,t,e,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?e.type:n[i+1]))return r.copy(r.content.append(Ce.from(QA(e,n,i+1))))}}function eM(n,t){if(t==0)return n;let e=n.content.replaceChild(n.childCount-1,eM(n.lastChild,t-1)),r=n.contentMatchAt(n.childCount).fillBefore(Ce.empty,!0);return n.copy(e.append(r))}function z2(n,t,e,r,i,s){let l=t<0?n.firstChild:n.lastChild,c=l.content;return n.childCount>1&&(s=0),i<r-1&&(c=z2(c,t,e,r,i+1,s)),i>=e&&(c=t<0?l.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(Ce.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,l.copy(c))}function VS(n,t,e){return t<n.openStart&&(n=new Ke(z2(n.content,-1,t,n.openStart,0,n.openEnd),t,n.openEnd)),e<n.openEnd&&(n=new Ke(z2(n.content,1,e,n.openEnd,0,0),n.openStart,e)),n}const nM={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function rM(){return document.implementation.createHTMLDocument("title")}let Fh=null;function TL(n){let t=window.trustedTypes;if(!t)return n;if(!Fh){if(Fh=t.defaultPolicy)try{return Fh.createHTML(n)}catch{}Fh=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})}return Fh.createHTML(n)}function NL(n){let t=/^(\s*<meta [^>]*>)*/.exec(n);t&&(n=n.slice(t[0].length));let e=rM(),r=e.body,i=/<([a-z][^>\s]+)/i.exec(n),s;if((s=i&&nM[i[1].toLowerCase()])&&(n=s.map(l=>"<"+l+">").join("")+n+s.map(l=>"</"+l+">").reverse().join("")),r.innerHTML=TL(n),s)for(let l=0;l<s.length;l++)r=r.querySelector(s[l])||r;for(let l=0;l<e.styleSheets.length;l++){let c=e.styleSheets[l];for(let f=0;f<c.rules.length;f++){let d=c.rules[f];if(d instanceof CSSStyleRule){let p=r.querySelectorAll(d.selectorText);for(let g=0;g<p.length;g++)p[g].style.cssText+=d.style.cssText}}}return r}function _L(n){let t=n.querySelectorAll(ws?"span:not([class]):not([style])":"span.Apple-converted-space");for(let e=0;e<t.length;e++){let r=t[e];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function DL(n,t){if(!n.size)return n;let e=n.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return n}let{content:i,openStart:s,openEnd:l}=n;for(let c=r.length-2;c>=0;c-=2){let f=e.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;try{f.checkAttrs(r[c+1])}catch{break}i=Ce.from(f.create(r[c+1],i)),s++,l++}return new Ke(i,s,l)}const aa={},la={},LL={touchstart:!0,touchmove:!0};class RL{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function OL(n){for(let t in aa){let e=aa[t];n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>{IL(n,r)&&!_5(n,r)&&(n.editable||!(r.type in la))&&e(n,r)},LL[t]?{passive:!0}:void 0)}Hs&&n.dom.addEventListener("input",()=>null),F2(n)}function ku(n,t){n.input.lastSelectionOrigin=t,n.input.lastSelectionTime=Date.now()}function PL(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let t in n.input.eventHandlers)n.dom.removeEventListener(t,n.input.eventHandlers[t]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function F2(n){n.someProp("handleDOMEvents",t=>{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>_5(n,r))})}function _5(n,t){return n.someProp("handleDOMEvents",e=>{let r=e[t.type];return r?r(n,t)||t.defaultPrevented:!1})}function IL(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target;e!=n.dom;e=e.parentNode)if(!e||e.nodeType==11||e.pmViewDesc&&e.pmViewDesc.stopEvent(t))return!1;return!0}function jL(n,t){!_5(n,t)&&aa[t.type]&&(n.editable||!(t.type in la))&&aa[t.type](n,t)}la.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=e.keyCode==16||e.shiftKey,!aM(n)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Su&&ws&&e.keyCode==13)))if(e.keyCode!=229&&n.domObserver.forceFlush(),Zd&&e.keyCode==13&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,If(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,e))||ML(n,e)?e.preventDefault():ku(n,"key")};la.keyup=(n,t)=>{t.keyCode==16&&(n.input.shiftKey=!1)};la.keypress=(n,t)=>{let e=t;if(aM(n)||!e.charCode||e.ctrlKey&&!e.altKey||El&&e.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,e))){e.preventDefault();return}let r=n.state.selection;if(!(r instanceof Rn)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(e.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",l=>l(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),e.preventDefault()}};function Dp(n){return{left:n.clientX,top:n.clientY}}function BL(n,t){let e=t.x-n.clientX,r=t.y-n.clientY;return e*e+r*r<100}function D5(n,t,e,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(n.someProp(t,c=>l>s.depth?c(n,e,s.nodeAfter,s.before(l),i,!0):c(n,e,s.node(l),s.before(l),i,!1)))return!0;return!1}function Lp(n,t,e){if(n.focused||n.focus(),n.state.selection.eq(t))return;let r=n.state.tr.setSelection(t);r.setMeta("pointer",!0),n.dispatch(r)}function zL(n,t){if(t==-1)return!1;let e=n.state.doc.resolve(t),r=e.nodeAfter;return r&&r.isAtom&&Cn.isSelectable(r)?(Lp(n,new Cn(e)),!0):!1}function FL(n,t){if(t==-1)return!1;let e=n.state.selection,r,i;e instanceof Cn&&(r=e.node);let s=n.state.doc.resolve(t);for(let l=s.depth+1;l>0;l--){let c=l>s.depth?s.nodeAfter:s.node(l);if(Cn.isSelectable(c)){r&&e.$from.depth>0&&l>=e.$from.depth&&s.before(e.$from.depth+1)==e.$from.pos?i=s.before(e.$from.depth):i=s.before(l);break}}return i!=null?(Lp(n,Cn.create(n.state.doc,i)),!0):!1}function UL(n,t,e,r,i){return D5(n,"handleClickOn",t,e,r)||n.someProp("handleClick",s=>s(n,t,r))||(i?FL(n,e):zL(n,e))}function HL(n,t,e,r){return D5(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",i=>i(n,t,r))}function qL(n,t,e,r){return D5(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",i=>i(n,t,r))||YL(n,e,r)}function YL(n,t,e){if(e.button!=0)return!1;let r=iM(n,t,!0),i=n.state.doc;return r?(Lp(n,r),r instanceof Rn&&i.eq(n.state.doc)&&(n.input.mouseDown=new VL(n,r)),!0):!1}function iM(n,t,e){let r=n.state.doc;if(t==-1)return r.inlineContent?Rn.create(r,0,r.content.size):null;let i=r.resolve(t);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(l.inlineContent)return Rn.create(r,c+1,c+1+l.content.size);if(e&&Cn.isSelectable(l))return Cn.create(r,c)}return null}function L5(n){return kg(n)}const oM=El?"metaKey":"ctrlKey";aa.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let r=L5(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&BL(e,n.input.lastClick)&&!e[oM]&&n.input.lastClick.button==e.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:e.clientX,y:e.clientY,type:s,button:e.button},n.input.mouseDown&&n.input.mouseDown.done();let l=n.posAtCoords(Dp(e));l&&(s=="singleClick"?n.input.mouseDown=new $L(n,l,e,!!r):(s=="doubleClick"?HL:qL)(n,l.pos,l.inside,e)?e.preventDefault():ku(n,"pointer"))};class sM{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class $L extends sM{constructor(t,e,r,i){super(t),this.pos=e,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!r[oM],this.allowDefault=r.shiftKey;let s,l;if(e.inside>-1)s=t.state.doc.nodeAt(e.inside),l=e.inside;else{let p=t.state.doc.resolve(e.pos);s=p.parent,l=p.depth?p.before():0}const c=i?null:r.target,f=c?t.docView.nearestDesc(c,!0):null;this.target=f&&f.nodeDOM.nodeType==1?f.nodeDOM:null;let{selection:d}=t.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof Cn&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Nl&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),ku(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Mu(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Dp(t))),this.updateAllowDefault(t),this.allowDefault||!e?ku(this.view,"pointer"):UL(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Hs&&this.mightDrag&&!this.mightDrag.node.isAtom||ws&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Lp(this.view,Qn.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):ku(this.view,"pointer")}move(t){this.updateAllowDefault(t),ku(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class VL extends sM{constructor(t,e){super(t),this.startSelection=e,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),ku(this.view,"pointer");let e=this.view.posAtCoords(Dp(t)),r=e&&iM(this.view,e.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[l,c]=r.from<s.from?[s.to,r.from]:[s.from,r.to];Lp(this.view,Rn.create(i,l,c))}}aa.touchstart=n=>{n.input.lastTouch=Date.now(),L5(n),ku(n,"pointer")};aa.touchmove=n=>{n.input.lastTouch=Date.now(),ku(n,"pointer")};aa.contextmenu=n=>L5(n);function aM(n,t){return n.composing?!0:Hs&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const WL=Su?5e3:-1;la.compositionstart=la.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$to;if(t.selection instanceof Rn&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ws&&IA&&XL(n)))n.markCursor=n.state.storedMarks||e.marks(),kg(n,!0),n.markCursor=null;else if(kg(n,!t.selection.empty),Nl&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let l=s<0?i.lastChild:i.childNodes[s-1];if(!l)break;if(l.nodeType==3){let c=n.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}n.input.composing=!0}lM(n,WL)};function XL(n){let{focusNode:t,focusOffset:e}=n.domSelectionRange();if(!t||t.nodeType!=1||e>=t.childNodes.length)return!1;let r=t.childNodes[e];return r.nodeType==1&&r.contentEditable=="false"}la.compositionend=(n,t)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,lM(n,20))};function lM(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>kg(n),t))}function cM(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function GL(n){let t=n.domSelectionRange();if(!t.focusNode)return null;let e=FD(t.focusNode,t.focusOffset),r=UD(t.focusNode,t.focusOffset);if(e&&r&&e!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(e==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let l=e.pmViewDesc;if(!(!l||!l.isText(e.nodeValue)))return r}}return e||r}function kg(n,t=!1){if(!(Su&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),cM(n),t||n.docView&&n.docView.dirty){let e=E5(n),r=n.state.selection;return e&&!e.eq(r)?n.dispatch(n.state.tr.setSelection(e)):(n.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function KL(n,t){if(!n.dom.parentNode)return;let e=n.dom.parentNode.appendChild(document.createElement("div"));e.appendChild(t),e.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e),n.focus()},50)}const vp=La&&uf<15||Zd&&$D<604;aa.copy=la.cut=(n,t)=>{let e=t,r=n.state.selection,i=e.type=="cut";if(r.empty)return;let s=vp?null:e.clipboardData,l=r.content(),{dom:c,text:f}=N5(n,l);s?(e.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):KL(n,c),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function JL(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function ZL(n,t){if(!n.dom.parentNode)return;let e=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(e?"textarea":"div"));e||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),e?wp(n,r.value,null,i,t):wp(n,r.textContent,r.innerHTML,i,t)},50)}function wp(n,t,e,r,i){let s=ZA(n,t,e,r,n.state.selection.$from);if(n.someProp("handlePaste",f=>f(n,i,s||Ke.empty)))return!0;if(!s)return!1;let l=JL(s),c=l?n.state.tr.replaceSelectionWith(l,r):n.state.tr.replaceSelection(s);return n.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function uM(n){let t=n.getData("text/plain")||n.getData("Text");if(t)return t;let e=n.getData("text/uri-list");return e?e.replace(/\r?\n/g," "):""}la.paste=(n,t)=>{let e=t;if(n.composing&&!Su)return;let r=vp?null:e.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&wp(n,uM(r),r.getData("text/html"),i,e)?e.preventDefault():ZL(n,e)};class fM{constructor(t,e,r){this.slice=t,this.move=e,this.node=r}}const QL=El?"altKey":"ctrlKey";function dM(n,t){let e;return n.someProp("dragCopies",r=>{e=e||r(t)}),e!=null?!e:!t[QL]}aa.dragstart=(n,t)=>{let e=t,r=n.input.mouseDown;if(r&&r.done(),!e.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Dp(e)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Cn?i.to-1:i.to))){if(r&&r.mightDrag)l=Cn.create(n.state.doc,r.mightDrag.pos);else if(e.target&&e.target.nodeType==1){let g=n.docView.nearestDesc(e.target,!0);g&&g.node.type.spec.draggable&&g!=n.docView&&(l=Cn.create(n.state.doc,g.posBefore))}}let c=(l||n.state.selection).content(),{dom:f,text:d,slice:p}=N5(n,c);(!e.dataTransfer.files.length||!ws||PA>120)&&e.dataTransfer.clearData(),e.dataTransfer.setData(vp?"Text":"text/html",f.innerHTML),e.dataTransfer.effectAllowed="copyMove",vp||e.dataTransfer.setData("text/plain",d),n.dragging=new fM(p,dM(n,e),l)};aa.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)};la.dragover=la.dragenter=(n,t)=>t.preventDefault();la.drop=(n,t)=>{try{tR(n,t,n.dragging)}finally{n.dragging=null}};function tR(n,t,e){if(!t.dataTransfer)return;let r=n.posAtCoords(Dp(t));if(!r)return;let i=n.state.doc.resolve(r.pos),s=e&&e.slice;s?n.someProp("transformPasted",y=>{s=y(s,n,!1)}):s=ZA(n,uM(t.dataTransfer),vp?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(e&&dM(n,t));if(n.someProp("handleDrop",y=>y(n,t,s||Ke.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let c=s?hA(n.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let f=n.state.tr;if(l){let{node:y}=e;y?y.replace(f):f.deleteSelection()}let d=f.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=f.doc;if(p?f.replaceRangeWith(d,d,s.content.firstChild):f.replaceRange(d,d,s),f.doc.eq(g))return;let b=f.doc.resolve(d);if(p&&Cn.isSelectable(s.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(s.content.firstChild))f.setSelection(new Cn(b));else{let y=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((M,C,D,L)=>y=L),f.setSelection(T5(n,b,f.doc.resolve(y)))}n.focus(),n.dispatch(f.setMeta("uiEvent","drop"))}aa.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Mu(n)},20))};aa.blur=(n,t)=>{let e=t;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),e.relatedTarget&&n.dom.contains(e.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};aa.beforeinput=(n,t)=>{if(Su&&t.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,If(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in la)aa[n]=la[n];function Sp(n,t){if(n==t)return!0;for(let e in n)if(n[e]!==t[e])return!1;for(let e in t)if(!(e in n))return!1;return!0}class Ag{constructor(t,e){this.toDOM=t,this.spec=e||Vf,this.side=this.spec.side||0}map(t,e,r,i){let{pos:s,deleted:l}=t.mapResult(e.from+i,this.side<0?-1:1);return l?null:new sa(s-r,s-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Ag&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Sp(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class hf{constructor(t,e){this.attrs=t,this.spec=e||Vf}map(t,e,r,i){let s=t.map(e.from+i,this.spec.inclusiveStart?-1:1)-r,l=t.map(e.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new sa(s,l,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof hf&&Sp(this.attrs,t.attrs)&&Sp(this.spec,t.spec)}static is(t){return t.type instanceof hf}destroy(){}}class R5{constructor(t,e){this.attrs=t,this.spec=e||Vf}map(t,e,r,i){let s=t.mapResult(e.from+i,1);if(s.deleted)return null;let l=t.mapResult(e.to+i,-1);return l.deleted||l.pos<=s.pos?null:new sa(s.pos-r,l.pos-r,this)}valid(t,e){let{index:r,offset:i}=t.content.findIndex(e.from),s;return i==e.from&&!(s=t.child(r)).isText&&i+s.nodeSize==e.to}eq(t){return this==t||t instanceof R5&&Sp(this.attrs,t.attrs)&&Sp(this.spec,t.spec)}destroy(){}}class sa{constructor(t,e,r){this.from=t,this.to=e,this.type=r}copy(t,e){return new sa(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,r){return this.type.map(t,this,e,r)}static widget(t,e,r){return new sa(t,t,new Ag(e,r))}static inline(t,e,r,i){return new sa(t,e,new hf(r,i))}static node(t,e,r,i){return new sa(t,e,new R5(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof hf}get widget(){return this.type instanceof Ag}}const jd=[],Vf={};class Jr{constructor(t,e){this.local=t.length?t:jd,this.children=e.length?e:jd}static create(t,e){return e.length?Mg(e,t,0,Vf):Us}find(t,e,r){let i=[];return this.findInner(t??0,e??1e9,i,0,r),i}findInner(t,e,r,i,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=e&&c.to>=t&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<e&&this.children[l+1]>t){let c=this.children[l]+1;this.children[l+2].findInner(t-c,e-c,r,i+c,s)}}map(t,e,r){return this==Us||t.maps.length==0?this:this.mapInner(t,e,0,0,r||Vf)}mapInner(t,e,r,i,s){let l;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(t,r,i);f&&f.type.valid(e,f)?(l||(l=[])).push(f):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?eR(this.children,l||[],t,e,r,i,s):l?new Jr(l.sort(Wf),jd):Us}add(t,e){return e.length?this==Us?Jr.create(t,e):this.addInner(t,e,0):this}addInner(t,e,r){let i,s=0;t.forEach((c,f)=>{let d=f+r,p;if(p=pM(e,c,d)){for(i||(i=this.children.slice());s<i.length&&i[s]<f;)s+=3;i[s]==f?i[s+2]=i[s+2].addInner(c,p,d+1):i.splice(s,0,f,f+c.nodeSize,Mg(p,c,d+1,Vf)),s+=3}});let l=hM(s?mM(e):e,-r);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||l.splice(c--,1);return new Jr(l.length?this.local.concat(l).sort(Wf):this.local,i||this.children)}remove(t){return t.length==0||this==Us?this:this.removeInner(t,0)}removeInner(t,e){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+e,f=r[s+1]+e;for(let p=0,g;p<t.length;p++)(g=t[p])&&g.from>c&&g.to<f&&(t[p]=null,(l||(l=[])).push(g));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,c+1);d!=Us?r[s+2]=d:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,l;s<t.length;s++)if(l=t[s])for(let c=0;c<i.length;c++)i[c].eq(l,e)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Jr(i,r):Us}forChild(t,e){if(this==Us)return this;if(e.isLeaf)return Jr.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=t){this.children[c]==t&&(r=this.children[c+2]);break}let s=t+1,l=s+e.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<l&&f.to>s&&f.type instanceof hf){let d=Math.max(s,f.from)-s,p=Math.min(l,f.to)-s;d<p&&(i||(i=[])).push(f.copy(d,p))}}if(i){let c=new Jr(i.sort(Wf),jd);return r?new of([c,r]):c}return r||Us}eq(t){if(this==t)return!0;if(!(t instanceof Jr)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return O5(this.localsInner(t))}localsInner(t){if(this==Us)return jd;if(t.inlineContent||!this.local.some(hf.is))return this.local;let e=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof hf||e.push(this.local[r]);return e}forEachSet(t){t(this)}}Jr.empty=new Jr([],[]);Jr.removeOverlap=O5;const Us=Jr.empty;class of{constructor(t){this.members=t}map(t,e){const r=this.members.map(i=>i.map(t,e,Vf));return of.from(r)}forChild(t,e){if(e.isLeaf)return Jr.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(t,e);s!=Us&&(s instanceof of?r=r.concat(s.members):r.push(s))}return of.from(r)}eq(t){if(!(t instanceof of)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(t);if(s.length)if(!e)e=s;else{r&&(e=e.slice(),r=!1);for(let l=0;l<s.length;l++)e.push(s[l])}}return e?O5(r?e:e.sort(Wf)):jd}static from(t){switch(t.length){case 0:return Us;case 1:return t[0];default:return new of(t.every(e=>e instanceof Jr)?t:t.reduce((e,r)=>e.concat(r instanceof Jr?r:r.members),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function eR(n,t,e,r,i,s,l){let c=n.slice();for(let d=0,p=s;d<e.maps.length;d++){let g=0;e.maps[d].forEach((b,y,M,C)=>{let D=C-M-(y-b);for(let L=0;L<c.length;L+=3){let H=c[L+1];if(H<0||b>H+p-g)continue;let Y=c[L]+p-g;y>=Y?c[L+1]=b<=Y?-2:-1:b>=p&&D&&(c[L]+=D,c[L+1]+=D)}g+=D}),p=e.maps[d].map(p,-1)}let f=!1;for(let d=0;d<c.length;d+=3)if(c[d+1]<0){if(c[d+1]==-2){f=!0,c[d+1]=-1;continue}let p=e.map(n[d]+s),g=p-i;if(g<0||g>=r.content.size){f=!0;continue}let b=e.map(n[d+1]+s,-1),y=b-i,{index:M,offset:C}=r.content.findIndex(g),D=r.maybeChild(M);if(D&&C==g&&C+D.nodeSize==y){let L=c[d+2].mapInner(e,D,p+1,n[d]+s+1,l);L!=Us?(c[d]=g,c[d+1]=y,c[d+2]=L):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=nR(c,n,t,e,i,s,l),p=Mg(d,r,0,l);t=p.local;for(let g=0;g<c.length;g+=3)c[g+1]<0&&(c.splice(g,3),g-=3);for(let g=0,b=0;g<p.children.length;g+=3){let y=p.children[g];for(;b<c.length&&c[b]<y;)b+=3;c.splice(b,0,p.children[g],p.children[g+1],p.children[g+2])}}return new Jr(t.sort(Wf),c)}function hM(n,t){if(!t||!n.length)return n;let e=[];for(let r=0;r<n.length;r++){let i=n[r];e.push(new sa(i.from+t,i.to+t,i.type))}return e}function nR(n,t,e,r,i,s,l){function c(f,d){for(let p=0;p<f.local.length;p++){let g=f.local[p].map(r,i,d);g?e.push(g):l.onRemove&&l.onRemove(f.local[p].spec)}for(let p=0;p<f.children.length;p+=3)c(f.children[p+2],f.children[p]+d+1)}for(let f=0;f<n.length;f+=3)n[f+1]==-1&&c(n[f+2],t[f]+s+1);return e}function pM(n,t,e){if(t.isLeaf)return null;let r=e+t.nodeSize,i=null;for(let s=0,l;s<n.length;s++)(l=n[s])&&l.from>e&&l.to<r&&((i||(i=[])).push(l),n[s]=null);return i}function mM(n){let t=[];for(let e=0;e<n.length;e++)n[e]!=null&&t.push(n[e]);return t}function Mg(n,t,e,r){let i=[],s=!1;t.forEach((c,f)=>{let d=pM(n,c,f+e);if(d){s=!0;let p=Mg(d,c,e+f+1,r);p!=Us&&i.push(f,f+c.nodeSize,p)}});let l=hM(s?mM(n):n,-e).sort(Wf);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||i.length?new Jr(l,i):Us}function Wf(n,t){return n.from-t.from||n.to-t.to}function O5(n){let t=n;for(let e=0;e<t.length-1;e++){let r=t[e];if(r.from!=r.to)for(let i=e+1;i<t.length;i++){let s=t[i];if(s.from==r.from){s.to!=r.to&&(t==n&&(t=n.slice()),t[i]=s.copy(s.from,r.to),WS(t,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(t==n&&(t=n.slice()),t[e]=r.copy(r.from,s.from),WS(t,i,r.copy(s.from,r.to)));break}}}return t}function WS(n,t,e){for(;t<n.length&&Wf(e,n[t])>0;)t++;n.splice(t,0,e)}function ky(n){let t=[];return n.someProp("decorations",e=>{let r=e(n.state);r&&r!=Us&&t.push(r)}),n.cursorWrapper&&t.push(Jr.create(n.state.doc,[n.cursorWrapper.deco])),of.from(t)}const rR={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},iR=La&&uf<=11;class oR{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class sR{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new oR,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);La&&uf<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Hs&&t.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),iR&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rR)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(FS(this.view)){if(this.suppressingSelectionUpdates)return Mu(this.view);if(La&&uf<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&rd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e=new Set,r;for(let s=t.focusNode;s;s=Jd(s))e.add(s);for(let s=t.anchorNode;s;s=Jd(s))if(e.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&FS(t)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,f=[];if(t.editable)for(let p=0;p<e.length;p++){let g=this.registerMutation(e[p],f);g&&(s=s<0?g.from:Math.min(g.from,s),l=l<0?g.to:Math.max(g.to,l),g.typeOver&&(c=!0))}if(f.some(p=>p.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||ws&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&e.some(p=>p.type=="childList"&&p.removedNodes.length))){for(let p of f)if(p.nodeName=="BR"&&p.parentNode){let g=p.nextSibling;for(;g&&g.nodeType==1;){if(g.contentEditable=="false"){p.parentNode.removeChild(p);break}g=g.firstChild}}}else if(Nl&&f.length){let p=f.filter(g=>g.nodeName=="BR");if(p.length==2){let[g,b]=p;g.parentNode&&g.parentNode.parentNode==b.parentNode?b.remove():g.remove()}else{let{focusNode:g}=this.currentSelection;for(let b of p){let y=b.parentNode;y&&y.nodeName=="LI"&&(!g||cR(t,g)!=y)&&b.remove()}}}let d=null;s<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&m0(r)&&(d=E5(t))&&d.eq(Qn.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Mu(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,l),aR(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,uR(t,f)),this.handleDOMChange(s,l,c,f),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Mu(t),this.currentSelection.set(r))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let p=0;p<t.addedNodes.length;p++){let g=t.addedNodes[p];e.push(g),g.nodeType==3&&(this.lastChangedTextNode=g)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let i=t.previousSibling,s=t.nextSibling;if(La&&uf<=11&&t.addedNodes.length)for(let p=0;p<t.addedNodes.length;p++){let{previousSibling:g,nextSibling:b}=t.addedNodes[p];(!g||Array.prototype.indexOf.call(t.addedNodes,g)<0)&&(i=g),(!b||Array.prototype.indexOf.call(t.addedNodes,b)<0)&&(s=b)}let l=i&&i.parentNode==t.target?xs(i)+1:0,c=r.localPosFromDOM(t.target,l,-1),f=s&&s.parentNode==t.target?xs(s):t.target.childNodes.length,d=r.localPosFromDOM(t.target,f,1);return{from:c,to:d}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let XS=new WeakMap,GS=!1;function aR(n){if(!XS.has(n)&&(XS.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Nl,GS)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),GS=!0}}function KS(n,t){let e=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,l=n.domAtPos(n.state.selection.anchor);return rd(l.node,l.offset,i,s)&&([e,r,i,s]=[i,s,e,r]),{anchorNode:e,anchorOffset:r,focusNode:i,focusOffset:s}}function lR(n,t){if(t.getComposedRanges){let i=t.getComposedRanges(n.root)[0];if(i)return KS(n,i)}let e;function r(i){i.preventDefault(),i.stopImmediatePropagation(),e=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),e?KS(n,e):null}function cR(n,t){for(let e=t.parentNode;e&&e!=n.dom;e=e.parentNode){let r=n.docView.nearestDesc(e,!0);if(r&&r.node.isBlock)return e}return null}function uR(n,t){var e;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let s of t)if(((e=s.parentNode)===null||e===void 0?void 0:e.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let f=c.firstChild;if(!f||f.nodeType!=1||f.contentEditable=="false"||/^(BR|IMG)$/.test(f.nodeName))break;c=f}c.insertBefore(s,c.firstChild),r==s&&n.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function fR(n,t,e,r){let{node:i,fromOffset:s,toOffset:l,from:c,to:f}=n.docView.parseRange(t,e),d=n.domSelectionRange(),p,g=d.anchorNode;if(g&&n.dom.contains(g.nodeType==1?g:g.parentNode)&&(p=[{node:g,offset:d.anchorOffset}],m0(d)||p.push({node:d.focusNode,offset:d.focusOffset})),ws&&n.input.lastKeyCode===8)for(let L=l;L>s;L--){let H=i.childNodes[L-1],Y=H.pmViewDesc;if(H.nodeName=="BR"&&!Y){l=L;break}if(!Y||Y.size)break}let b=n.state.doc,y=n.someProp("domParser")||np.fromSchema(n.state.schema),M=b.resolve(c),C=null,D=y.parse(i,{topNode:M.parent,topMatch:M.parent.contentMatchAt(M.index()),topOpen:!0,from:s,to:l,preserveWhitespace:M.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:dR(r),context:M});if(p&&p[0].pos!=null){let L=p[0].pos,H=p[1]&&p[1].pos;H==null&&(H=L),C={anchor:L+c,head:H+c}}return{doc:D,sel:C,from:c,to:f}}const dR=n=>t=>{let e=t.pmViewDesc;if(e)return e.parseRule(n);if(t.nodeName=="BR"&&t.parentNode){if(Hs&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(t.parentNode.lastChild==t||Hs&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},hR=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function pR(n,t,e,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,t<0){let Ct=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,bt=E5(n,Ct);if(bt&&!n.state.selection.eq(bt)){if(ws&&Su&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",jt=>jt(n,If(13,"Enter"))))return;let ot=n.state.tr.setSelection(bt);Ct=="pointer"?ot.setMeta("pointer",!0):Ct=="key"&&ot.scrollIntoView(),s&&ot.setMeta("composition",s),n.dispatch(ot)}return}let l=n.state.doc.resolve(t),c=l.sharedDepth(e);t=l.before(c+1),e=n.state.doc.resolve(e).after(c+1);let f=n.state.selection,d=fR(n,t,e,i),p=n.state.doc,g=p.slice(d.from,d.to),b,y;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(b=n.state.selection.to,y="end"):(b=n.state.selection.from,y="start"),n.input.lastKeyCode=null;let M=yR(g.content,d.doc.content,d.from,b,y);if(M&&n.input.domChangeCount++,(Zd&&n.input.lastIOSEnter>Date.now()-225||Su)&&i.some(Ct=>Ct.nodeType==1&&!hR.test(Ct.nodeName))&&(!M||M.endA>=M.endB)&&n.someProp("handleKeyDown",Ct=>Ct(n,If(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!M)if(r&&f instanceof Rn&&!f.empty&&f.$head.sameParent(f.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))M={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let Ct=JS(n,n.state.doc,d.sel);if(Ct&&!Ct.eq(n.state.selection)){let bt=n.state.tr.setSelection(Ct);s&&bt.setMeta("composition",s),n.dispatch(bt)}}return}n.state.selection.from<n.state.selection.to&&M.start==M.endB&&n.state.selection instanceof Rn&&(M.start>n.state.selection.from&&M.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?M.start=n.state.selection.from:M.endA<n.state.selection.to&&M.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(M.endB+=n.state.selection.to-M.endA,M.endA=n.state.selection.to)),La&&uf<=11&&M.endB==M.start+1&&M.endA==M.start&&M.start>d.from&&d.doc.textBetween(M.start-d.from-1,M.start-d.from+1)=="  "&&(M.start--,M.endA--,M.endB--);let C=d.doc.resolveNoCache(M.start-d.from),D=d.doc.resolveNoCache(M.endB-d.from),L=p.resolve(M.start),H=C.sameParent(D)&&C.parent.inlineContent&&L.end()>=M.endA;if((Zd&&n.input.lastIOSEnter>Date.now()-225&&(!H||i.some(Ct=>Ct.nodeName=="DIV"||Ct.nodeName=="P"))||!H&&C.pos<d.doc.content.size&&(!C.sameParent(D)||!C.parent.inlineContent)&&C.pos<D.pos&&!/\S/.test(d.doc.textBetween(C.pos,D.pos,"","")))&&n.someProp("handleKeyDown",Ct=>Ct(n,If(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>M.start&&gR(p,M.start,M.endA,C,D)&&n.someProp("handleKeyDown",Ct=>Ct(n,If(8,"Backspace")))){Su&&ws&&n.domObserver.suppressSelectionUpdates();return}ws&&M.endB==M.start&&(n.input.lastChromeDelete=Date.now()),Su&&!H&&C.start()!=D.start()&&D.parentOffset==0&&C.depth==D.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==M.endA&&(M.endB-=2,D=d.doc.resolveNoCache(M.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(Ct){return Ct(n,If(13,"Enter"))})},20));let Y=M.start,W=M.endA,St=Ct=>{let bt=Ct||n.state.tr.replace(Y,W,d.doc.slice(M.start-d.from,M.endB-d.from));if(d.sel){let ot=JS(n,bt.doc,d.sel);ot&&!(ws&&n.composing&&ot.empty&&(M.start!=M.endB||n.input.lastChromeDelete<Date.now()-100)&&(ot.head==Y||ot.head==bt.mapping.map(W)-1)||La&&ot.empty&&ot.head==Y)&&bt.setSelection(ot)}return s&&bt.setMeta("composition",s),bt.scrollIntoView()},_t;if(H)if(C.pos==D.pos){La&&uf<=11&&C.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Mu(n),20));let Ct=St(n.state.tr.delete(Y,W)),bt=p.resolve(M.start).marksAcross(p.resolve(M.endA));bt&&Ct.ensureMarks(bt),n.dispatch(Ct)}else if(M.endA==M.endB&&(_t=mR(C.parent.content.cut(C.parentOffset,D.parentOffset),L.parent.content.cut(L.parentOffset,M.endA-L.start())))){let Ct=St(n.state.tr);_t.type=="add"?Ct.addMark(Y,W,_t.mark):Ct.removeMark(Y,W,_t.mark),n.dispatch(Ct)}else if(C.parent.child(C.index()).isText&&C.index()==D.index()-(D.textOffset?0:1)){let Ct=C.parent.textBetween(C.parentOffset,D.parentOffset),bt=()=>St(n.state.tr.insertText(Ct,Y,W));n.someProp("handleTextInput",ot=>ot(n,Y,W,Ct,bt))||n.dispatch(bt())}else n.dispatch(St());else n.dispatch(St())}function JS(n,t,e){return Math.max(e.anchor,e.head)>t.content.size?null:T5(n,t.resolve(e.anchor),t.resolve(e.head))}function mR(n,t){let e=n.firstChild.marks,r=t.firstChild.marks,i=e,s=r,l,c,f;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<e.length;p++)s=e[p].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",f=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",f=p=>p.mark(c.removeFromSet(p.marks));else return null;let d=[];for(let p=0;p<t.childCount;p++)d.push(f(t.child(p)));if(Ce.from(d).eq(n))return{mark:c,type:l}}function gR(n,t,e,r,i){if(e-t<=i.pos-r.pos||Ay(r,!0,!1)<i.pos)return!1;let s=n.resolve(t);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&e==t+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=n.resolve(Ay(s,!0,!0));return!l.parent.isTextblock||l.pos>e||Ay(l,!0,!1)<e?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Ay(n,t,e){let r=n.depth,i=t?n.end():n.pos;for(;r>0&&(t||n.indexAfter(r)==n.node(r).childCount);)r--,i++,t=!1;if(e){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function yR(n,t,e,r,i){let s=n.findDiffStart(t,e),l=e+n.size,c=e+t.size;if(s==null)return null;let{a:f,b:d}=n.findDiffEnd(t,l,c);if(i=="end"){let p=Math.max(0,s-Math.min(f,d));r-=f+p-s}if(f<s&&l<c){let p=r<=s&&r>=f?s-r:0;s-=p,d=s+(d-f),f=s}else if(d<s){let p=r<=s&&r>=d?s-r:0;s-=p,f=s+(f-d),d=s}return{start:s,endA:f,endB:d}}class gM{constructor(t,e){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new RL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(n3),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=t3(this),QS(this),this.nodeViews=e3(this),this.docView=OS(this.state.doc,ZS(this),ky(this),this.dom,this),this.domObserver=new sR(this,(r,i,s,l)=>pR(this,r,i,s,l)),this.domObserver.start(),OL(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&F2(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(n3),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let r in this._props)e[r]=this._props[r];e.state=this.state;for(let r in t)e[r]=t[r];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var r;let i=this.state,s=!1,l=!1;t.storedMarks&&this.composing&&(cM(this),l=!0),this.state=t;let c=i.plugins!=t.plugins||this._props.plugins!=e.plugins;if(c||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let y=e3(this);xR(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||e.handleDOMEvents!=this._props.handleDOMEvents)&&F2(this),this.editable=t3(this),QS(this);let f=ky(this),d=ZS(this),p=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",g=s||!this.docView.matchesNode(t.doc,d,f);(g||!t.selection.eq(i.selection))&&(l=!0);let b=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&XD(this);if(l){this.domObserver.stop();let y=g&&(La||ws)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&bR(i.selection,t.selection);if(g){let C=ws?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=GL(this)),(s||!this.docView.update(t.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=OS(t.doc,d,f,this.dom,this)),C&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}let M=this.input.mouseDown;y||!(M&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&bL(this)&&M.delaySelUpdate())?Mu(this,y):(GA(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():b&&GD(b)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",e=>e(this)))if(this.state.selection instanceof Cn){let e=this.docView.domAfterPos(this.state.selection.from);e.nodeType==1&&NS(this,e.getBoundingClientRect(),t)}else NS(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let r=this.directPlugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let r=this.state.plugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let e=0;e<this.pluginViews.length;e++){let r=this.pluginViews[e];r.update&&r.update(this,t)}}updateDraggedNode(t,e){let r=t.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-e.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new fM(t.slice,t.move,i<0?void 0:Cn.create(this.state.doc,i))}someProp(t,e){let r=this._props&&this._props[t],i;if(r!=null&&(i=e?e(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[t];if(c!=null&&(i=e?e(c):c))return i}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let c=s[l].props[t];if(c!=null&&(i=e?e(c):c))return i}}hasFocus(){if(La){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&KD(this.dom),Mu(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return t||document}updateRoot(){this._root=null}posAtCoords(t){return eL(this,t)}coordsAtPos(t,e=1){return UA(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,r=-1){let i=this.docView.posFromDOM(t,e,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,e){return sL(this,e||this.state,t)}pasteHTML(t,e){return wp(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return wp(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return N5(this,t)}destroy(){this.docView&&(PL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ky(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,BD())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return jL(this,t)}domSelectionRange(){let t=this.domSelection();return t?Hs&&this.root.nodeType===11&&qD(this.dom.ownerDocument)==this.dom&&lR(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}gM.prototype.dispatch=function(n){let t=this._props.dispatchTransaction;t?t.call(this,n):this.updateState(this.state.apply(n))};function ZS(n){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(n.editable),n.someProp("attributes",e=>{if(typeof e=="function"&&(e=e(n.state)),e)for(let r in e)r=="class"?t.class+=" "+e[r]:r=="style"?t.style=(t.style?t.style+";":"")+e[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(e[r]))}),t.translate||(t.translate="no"),[sa.node(0,n.state.doc.content.size,t)]}function QS(n){if(n.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),n.cursorWrapper={dom:t,deco:sa.widget(n.state.selection.from,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function t3(n){return!n.someProp("editable",t=>t(n.state)===!1)}function bR(n,t){let e=Math.min(n.$anchor.sharedDepth(n.head),t.$anchor.sharedDepth(t.head));return n.$anchor.start(e)!=t.$anchor.start(e)}function e3(n){let t=Object.create(null);function e(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return n.someProp("nodeViews",e),n.someProp("markViews",e),t}function xR(n,t){let e=0,r=0;for(let i in n){if(n[i]!=t[i])return!0;e++}for(let i in t)r++;return e!=r}function n3(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var mf={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Cg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vR=typeof navigator<"u"&&/Mac/.test(navigator.platform),wR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var vs=0;vs<10;vs++)mf[48+vs]=mf[96+vs]=String(vs);for(var vs=1;vs<=24;vs++)mf[vs+111]="F"+vs;for(var vs=65;vs<=90;vs++)mf[vs]=String.fromCharCode(vs+32),Cg[vs]=String.fromCharCode(vs);for(var My in mf)Cg.hasOwnProperty(My)||(Cg[My]=mf[My]);function SR(n){var t=vR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||wR&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?Cg:mf)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}const kR=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),AR=typeof navigator<"u"&&/Win/.test(navigator.platform);function MR(n){let t=n.split(/-(?!$)/),e=t[t.length-1];e=="Space"&&(e=" ");let r,i,s,l;for(let c=0;c<t.length-1;c++){let f=t[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))kR?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),l&&(e="Meta-"+e),s&&(e="Shift-"+e),e}function CR(n){let t=Object.create(null);for(let e in n)t[MR(e)]=n[e];return t}function Cy(n,t,e=!0){return t.altKey&&(n="Alt-"+n),t.ctrlKey&&(n="Ctrl-"+n),t.metaKey&&(n="Meta-"+n),e&&t.shiftKey&&(n="Shift-"+n),n}function ER(n){return new Oi({props:{handleKeyDown:yM(n)}})}function yM(n){let t=CR(n);return function(e,r){let i=SR(r),s,l=t[Cy(i,r)];if(l&&l(e.state,e.dispatch,e))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=t[Cy(i,r,!1)];if(c&&c(e.state,e.dispatch,e))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(AR&&r.ctrlKey&&r.altKey)&&(s=mf[r.keyCode])&&s!=i){let c=t[Cy(s,r)];if(c&&c(e.state,e.dispatch,e))return!0}}return!1}}function y0(n){const{state:t,transaction:e}=n;let{selection:r}=e,{doc:i}=e,{storedMarks:s}=e;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=e.selection,i=e.doc,s=e.storedMarks,e}}}var Xd=class bM{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:r}=this,{view:i}=e,{tr:s}=r,l=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([c,f])=>[c,(...p)=>{const g=f(...p)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),g}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],f=!!t,d=t||s.tr,p=()=>(!f&&e&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(d),c.every(b=>b===!0)),g={...Object.fromEntries(Object.entries(r).map(([b,y])=>[b,(...C)=>{const D=this.buildProps(d,e),L=y(...C)(D);return c.push(L),g}])),run:p};return g}static createFakeChain(){const t=new Proxy({},{get:(e,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>t}});return t}createCan(t){const{rawCommands:e,state:r}=this,i=!1,s=t||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...d)=>f(...d)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}static createFallbackCan(){const t=bM.createFakeChain();return new Proxy({chain:()=>t},{get:(e,r)=>{if(r!=="then")return r==="chain"?e.chain:()=>!1}})}buildProps(t,e=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:t,editor:i,view:l,state:y0({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([f,d])=>[f,(...p)=>d(...p)(c)]))}};return c}};const TR=()=>({editor:n,view:t})=>(requestAnimationFrame(()=>{if(!n.isDestroyed){var e;t.dom.blur(),(e=window)===null||e===void 0||(e=e.getSelection())===null||e===void 0||e.removeAllRanges()}}),!0),NR=(n=!0)=>({commands:t})=>t.setContent("",{emitUpdate:n}),_R=()=>({state:n,tr:t,dispatch:e})=>{const{selection:r}=t,{ranges:i}=r;return e&&i.forEach(({$from:s,$to:l})=>{n.doc.nodesBetween(s.pos,l.pos,(c,f)=>{if(c.type.isText)return;const{doc:d,mapping:p}=t,g=d.resolve(p.map(f)),b=d.resolve(p.map(f+c.nodeSize)),y=g.blockRange(b);if(!y)return;const M=sh(y);if(c.type.isTextblock){const{defaultType:C}=g.parent.contentMatchAt(g.index());t.setNodeMarkup(y.start,C)}(M||M===0)&&t.lift(y,M)})}),!0},DR=n=>t=>n(t),LR=()=>({state:n,dispatch:t})=>_A(n,t),RR=(n,t)=>({editor:e,tr:r})=>{const{state:i}=e,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const l=r.mapping.map(t);return r.insert(l,s.content),r.setSelection(new Rn(r.doc.resolve(Math.max(l-1,0)))),!0},OR=()=>({tr:n,dispatch:t})=>{const{selection:e}=n,r=e.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(t){const l=i.before(s),c=i.after(s);n.delete(l,c).scrollIntoView()}return!0}return!1};function Co(n,t){if(typeof n=="string"){if(!t.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return t.nodes[n]}return n}const PR=n=>({tr:t,state:e,dispatch:r})=>{const i=Co(n,e.schema),s=t.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const c=s.before(l),f=s.after(l);t.delete(c,f).scrollIntoView()}return!0}return!1},IR=n=>({tr:t,dispatch:e})=>{const{from:r,to:i}=n;return e&&t.delete(r,i),!0},jR=n=>n.content?/^text(\*|\+)/.test(n.content):!1,r3=(n,t,e)=>{if(!n.parent.isInline||e==="left"&&n.pos>n.start()||e==="right"&&n.pos<n.end())return n.pos;const r=t.nodes[n.parent.type.name].spec;return jR(r)?e==="left"?n.start()-1:n.end()+1:n.pos},BR=(n,t,e)=>({from:r3(n,e,"left"),to:r3(t,e,"right")}),zR=()=>({state:n,dispatch:t})=>{if(n.selection.empty)return!1;if(t){const e=n.tr,{ranges:r}=n.selection,i=e.steps.length;r.forEach(s=>{const l=e.mapping.slice(i),c=e.doc.resolve(l.map(s.$from.pos)),f=e.doc.resolve(l.map(s.$to.pos)),{from:d,to:p}=BR(c,f,n.schema);e.deleteRange(d,p)}),e.selection.empty||e.setSelection(Rn.near(e.doc.resolve(e.selection.from))),e.scrollIntoView(),t(e)}return!0},FR=()=>({commands:n})=>n.keyboardShortcut("Enter"),UR=()=>({state:n,dispatch:t})=>kD(n,t);function P5(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Eg(n,t,e={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>e.strict?t[i]===n[i]:P5(t[i])?t[i].test(n[i]):t[i]===n[i]):!0}function xM(n,t,e={}){return n.find(r=>r.type===t&&Eg(Object.fromEntries(Object.keys(e).map(i=>[i,r.attrs[i]])),e))}function i3(n,t,e={}){return!!xM(n,t,e)}function I5(n,t,e){if(!n||!t)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(f=>f.type===t))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(f=>f.type===t))return;if(!e){const f=r.node.marks.find(d=>d.type===t);f&&(e=f.attrs)}if(!xM([...r.node.marks],t,e))return;let i=r.index,s=n.start()+r.offset,l=i+1,c=s+r.node.nodeSize;for(;i>0&&i3([...n.parent.child(i-1).marks],t,e);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&i3([...n.parent.child(l).marks],t,e);)c+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:c}}function Eu(n,t){if(typeof n=="string"){if(!t.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return t.marks[n]}return n}const HR=(n,t)=>({tr:e,state:r,dispatch:i})=>{const s=Eu(n,r.schema),{doc:l,selection:c}=e,{$from:f,from:d,to:p}=c;if(i){const g=I5(f,s,t);if(g&&g.from<=d&&g.to>=p){const b=Rn.create(l,g.from,g.to);e.setSelection(b)}}return!0},qR=n=>t=>{const e=typeof n=="function"?n(t):n;for(let r=0;r<e.length;r+=1)if(e[r](t))return!0;return!1};function vM(n){return n instanceof Rn}function Ff(n=0,t=0,e=0){return Math.min(Math.max(n,t),e)}function U2(n,t=null){if(!t)return null;const e=Qn.atStart(n),r=Qn.atEnd(n);if(t==="start"||t===!0)return e;if(t==="end")return r;const i=e.from,s=r.to;return t==="all"?Rn.create(n,Ff(0,i,s),Ff(n.content.size,i,s)):Rn.create(n,Ff(t,i,s),Ff(t,i,s))}function o3(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Tg(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function YR(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const $R=(n=null,t={})=>({editor:e,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};const l=()=>{(Tg()||o3())&&r.dom.focus(),YR()&&!Tg()&&!o3()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{e.isDestroyed||(r.focus(),t?.scrollIntoView&&e.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(s&&n===null&&!vM(e.state.selection))return l(),!0;const c=U2(i.doc,n)||e.state.selection,f=e.state.selection.eq(c);return s&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},VR=(n,t)=>e=>n.every((r,i)=>t(r,{...e,index:i})),WR=(n,t)=>({tr:e,commands:r})=>r.insertContentAt({from:e.selection.from,to:e.selection.to},n,t),wM=n=>{const t=n.childNodes;for(let e=t.length-1;e>=0;e-=1){const r=t[e];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&wM(r)}return n};function Im(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${n}</body>`,e=new window.DOMParser().parseFromString(t,"text/html").body;return wM(e)}function SM(n){return typeof n?.nodesBetween=="function"}function Qd(n,t,e){if(SM(n))return n;const r=typeof n=="object"&&n!==null;e={slice:!0,parseOptions:{},...e};const i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return Ce.fromArray(n.map(l=>t.nodeFromJSON(l)));const s=t.nodeFromJSON(n);return e.errorOnInvalidContent&&s.check(),s}catch(s){if(e.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),Qd("",t,e)}if(i){if(e.errorOnInvalidContent){let l=!1,c="";const f=new nA({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(l=!0,c=typeof d=="string"?d:d.outerHTML,null)}]}})});if(e.slice?np.fromSchema(f).parseSlice(Im(n),e.parseOptions):np.fromSchema(f).parse(Im(n),e.parseOptions),e.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=np.fromSchema(t);return e.slice?s.parseSlice(Im(n),e.parseOptions).content:s.parse(Im(n),e.parseOptions)}return Qd("",t,e)}function kM(n){return!("type"in n)}function AM(n,t,e){const r=n.steps.length-1;if(r<t)return;const i=n.steps[r];if(!(i instanceof uo||i instanceof Vo))return;const s=n.mapping.maps[r];let l=0;s.forEach((c,f,d,p)=>{l===0&&(l=p)}),n.setSelection(Qn.near(n.doc.resolve(l),e))}const XR=(n,t,e)=>({tr:r,dispatch:i,editor:s})=>{if(i){e={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...e};let c;const f=D=>{s.emit("contentError",{editor:s,error:D,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...e.parseOptions};if(!e.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Qd(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(D){f(D)}try{var l;c=Qd(t,s.schema,{parseOptions:d,errorOnInvalidContent:(l=e.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(D){return f(D),!1}let{from:p,to:g}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},b=!0,y=!0;const M=kM(c)?c.content:[c];if(M.forEach(D=>{D.check(),b=b?D.isText&&D.marks.length===0:!1,y=y?D.isBlock:!1}),p===g&&y){const{parent:D}=r.doc.resolve(p);D.isTextblock&&!D.type.spec.code&&!D.childCount&&(p-=1,g+=1)}let C;if(b)Array.isArray(t)?C=t.map(D=>D.text||"").join(""):SM(t)?C=M.map(D=>{var L;return(L=D.text)!==null&&L!==void 0?L:""}).join(""):typeof t=="object"&&t&&t.text?C=t.text:C=t,r.insertText(C,p,g);else{C=Ce.from(M);const D=r.doc.resolve(p),L=D.node(),H=D.parentOffset===0,Y=L.isText||L.isTextblock,W=L.content.size>0;H&&Y&&W&&y&&(p=Math.max(0,p-1)),r.replaceWith(p,g,M)}e.updateSelection&&AM(r,r.steps.length-1,-1),e.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:C}),e.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:C})}return!0};function MM(n){for(let t=0;t<n.edgeCount;t+=1){const{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}const GR=(n={})=>({tr:t,dispatch:e,editor:r})=>{const{pos:i,attrs:s,content:l,updateSelection:c=!0}=n;let f;typeof i=="number"?f=t.doc.resolve(i):i?f=i:f=t.selection.$from;const d=MM(f.parent.contentMatchAt(f.index()));if(!d)return!1;const p=Object.keys(d.spec.attrs||{}),g=s?Object.fromEntries(Object.entries(s).filter(([y])=>p.includes(y))):{};let b;if(l){const y=Qd(l,r.schema);b=d.createAndFill(g,y)}else b=d.createAndFill(g);return b?(e&&(t.insert(f.pos,b),c&&AM(t,t.steps.length-1,-1)),!0):!1},KR=()=>({state:n,dispatch:t})=>vD(n,t),JR=()=>({state:n,dispatch:t})=>wD(n,t),ZR=()=>({state:n,dispatch:t})=>kA(n,t),QR=()=>({state:n,dispatch:t})=>EA(n,t),tO=()=>({state:n,dispatch:t,tr:e})=>{try{const r=d0(n.doc,n.selection.$from.pos,-1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},eO=()=>({state:n,dispatch:t,tr:e})=>{try{const r=d0(n.doc,n.selection.$from.pos,1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},nO=()=>({state:n,dispatch:t})=>bD(n,t),rO=()=>({state:n,dispatch:t})=>xD(n,t);function CM(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function iO(n){const t=n.split(/-(?!$)/);let e=t[t.length-1];e==="Space"&&(e=" ");let r,i,s,l;for(let c=0;c<t.length-1;c+=1){const f=t[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))Tg()||CM()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(e=`Alt-${e}`),i&&(e=`Ctrl-${e}`),l&&(e=`Meta-${e}`),s&&(e=`Shift-${e}`),e}const oO=n=>({editor:t,view:e,tr:r,dispatch:i})=>{const s=iO(n).split(/-(?!$)/),l=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),f=t.captureTransaction(()=>{e.someProp("handleKeyDown",d=>d(e,c))});return f?.steps.forEach(d=>{const p=d.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function gf(n,t,e={}){const{from:r,to:i,empty:s}=n.selection,l=t?Co(t,n.schema):null,c=[];n.doc.nodesBetween(r,i,(p,g)=>{if(p.isText)return;const b=Math.max(r,g),y=Math.min(i,g+p.nodeSize);c.push({node:p,from:b,to:y})});const f=i-r,d=c.filter(p=>l?l.name===p.node.type.name:!0).filter(p=>Eg(p.node.attrs,e,{strict:!1}));return s?!!d.length:d.reduce((p,g)=>p+g.to-g.from,0)>=f}const sO=(n,t={})=>({state:e,dispatch:r})=>gf(e,Co(n,e.schema),t)?SD(e,r):!1,aO=()=>({state:n,dispatch:t})=>DA(n,t),lO=n=>({state:t,dispatch:e})=>{const r=Co(n,t.schema);return OD(r)(t,e)},cO=()=>({state:n,dispatch:t})=>NA(n,t);function b0(n,t){return t.nodes[n]?"node":t.marks[n]?"mark":null}function s3(n,t){const e=typeof t=="string"?[t]:t;return Object.keys(n).reduce((r,i)=>(e.includes(i)||(r[i]=n[i]),r),{})}const uO=(n,t)=>({tr:e,state:r,dispatch:i})=>{let s=null,l=null;const c=b0(typeof n=="string"?n:n.name,r.schema);if(!c)return!1;c==="node"&&(s=Co(n,r.schema)),c==="mark"&&(l=Eu(n,r.schema));let f=!1;return e.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(p,g)=>{s&&s===p.type&&(f=!0,i&&e.setNodeMarkup(g,void 0,s3(p.attrs,t))),l&&p.marks.length&&p.marks.forEach(b=>{l===b.type&&(f=!0,i&&e.addMark(g,g+p.nodeSize,l.create(s3(b.attrs,t))))})})}),f},fO=()=>({tr:n,dispatch:t})=>(t&&n.scrollIntoView(),!0),dO=()=>({tr:n,dispatch:t})=>{if(t){const e=new Ja(n.doc);n.setSelection(e)}return!0},hO=()=>({state:n,dispatch:t})=>MA(n,t),pO=()=>({state:n,dispatch:t})=>TA(n,t),mO=()=>({state:n,dispatch:t})=>CD(n,t),gO=()=>({state:n,dispatch:t})=>ND(n,t),yO=()=>({state:n,dispatch:t})=>TD(n,t);function H2(n,t,e={},r={}){return Qd(n,t,{slice:!1,parseOptions:e,errorOnInvalidContent:r.errorOnInvalidContent})}const bO=(n,{errorOnInvalidContent:t,emitUpdate:e=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{const{doc:f}=s;if(r.preserveWhitespace!=="full"){const d=H2(n,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(l){const p=kM(d)?d.content:[d];s.replaceWith(0,f.content.size,p).setMeta("preventUpdate",!e)}return!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:f.content.size},n,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function EM(n,t){const e=Eu(t,n.schema),{from:r,to:i,empty:s}=n.selection,l=[];s?(n.storedMarks&&l.push(...n.storedMarks),l.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{l.push(...f.marks)});const c=l.find(f=>f.type.name===e.name);return c?{...c.attrs}:{}}function TM(n,t){const e=new bA(n);return t.forEach(r=>{r.steps.forEach(i=>{e.step(i)})}),e}function xO(n,t,e){const r=[];return n.nodesBetween(t.from,t.to,(i,s)=>{e(i)&&r.push({node:i,pos:s})}),r}function vO(n,t){for(let e=n.depth;e>0;e-=1){const r=n.node(e);if(t(r))return{pos:e>0?n.before(e):0,start:n.start(e),depth:e,node:r}}}function x0(n){return t=>vO(t.$from,n)}function yn(n,t,e){return n.config[t]===void 0&&n.parent?yn(n.parent,t,e):typeof n.config[t]=="function"?n.config[t].bind({...e,parent:n.parent?yn(n.parent,t,e):null}):n.config[t]}function j5(n){return n.map(t=>{const e=yn(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...j5(e())]:t}).flat(10)}function B5(n,t){const e=ad.fromSchema(t).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(e),r.innerHTML}function NM(n){return typeof n=="function"}function Pr(n,t=void 0,...e){return NM(n)?t?n.bind(t)(...e):n(...e):n}function wO(n={}){return Object.keys(n).length===0&&n.constructor===Object}function th(n){return{baseExtensions:n.filter(t=>t.type==="extension"),nodeExtensions:n.filter(t=>t.type==="node"),markExtensions:n.filter(t=>t.type==="mark")}}function _M(n){const t=[],{nodeExtensions:e,markExtensions:r}=th(n),i=[...e,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=e.filter(d=>d.name!=="text").map(d=>d.name),c=r.map(d=>d.name),f=[...l,...c];return n.forEach(d=>{const p=yn(d,"addGlobalAttributes",{name:d.name,options:d.options,storage:d.storage,extensions:i});p&&p().forEach(g=>{let b;Array.isArray(g.types)?b=g.types:g.types==="*"?b=f:g.types==="nodes"?b=l:g.types==="marks"?b=c:b=[],b.forEach(y=>{Object.entries(g.attributes).forEach(([M,C])=>{t.push({type:y,name:M,attribute:{...s,...C}})})})})}),i.forEach(d=>{const p=yn(d,"addAttributes",{name:d.name,options:d.options,storage:d.storage});if(!p)return;const g=p();Object.entries(g).forEach(([b,y])=>{const M={...s,...y};typeof M?.default=="function"&&(M.default=M.default()),M?.isRequired&&M?.default===void 0&&delete M.default,t.push({type:d.name,name:b,attribute:M})})}),t}function SO(n){const t=[];let e="",r=!1,i=!1,s=0;const l=n.length;for(let c=0;c<l;c+=1){const f=n[c];if(f==="'"&&!i){r=!r,e+=f;continue}if(f==='"'&&!r){i=!i,e+=f;continue}if(!r&&!i){if(f==="("){s+=1,e+=f;continue}if(f===")"&&s>0){s-=1,e+=f;continue}if(f===";"&&s===0){t.push(e),e="";continue}}e+=f}return e&&t.push(e),t}function a3(n){const t=[],e=SO(n||""),r=e.length;for(let i=0;i<r;i+=1){const s=e[i],l=s.indexOf(":");if(l===-1)continue;const c=s.slice(0,l).trim(),f=s.slice(l+1).trim();c&&f&&t.push([c,f])}return t}function mo(...n){return n.filter(t=>!!t).reduce((t,e)=>{const r={...t};return Object.entries(e).forEach(([i,s])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:s,writable:!0});return}if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],c=r[i]?r[i].split(" "):[],f=l.filter(d=>!c.includes(d));r[i]=[...c,...f].join(" ")}else if(i==="style"){const l=new Map([...a3(r[i]),...a3(s)]);r[i]=Array.from(l.entries()).map(([c,f])=>`${c}: ${f}`).join("; ")}else r[i]=s}),r},{})}function kp(n,t){return t.filter(e=>e.type===n.type.name).filter(e=>e.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(n.attrs)||{}:{[e.name]:n.attrs[e.name]}).reduce((e,r)=>mo(e,r),{})}function kO(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function l3(n,t){return"style"in n?n:{...n,getAttrs:e=>{const r=n.getAttrs?n.getAttrs(e):n.attrs;if(r===!1)return!1;const i=t.reduce((s,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(e):kO(e.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function c3(n){return Object.fromEntries(Object.entries(n).filter(([t,e])=>t==="attrs"&&wO(e)?!1:e!=null))}function u3(n){var t,e;const r={};return!(!(n==null||(t=n.attribute)===null||t===void 0)&&t.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),(n==null||(e=n.attribute)===null||e===void 0?void 0:e.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function AO(n,t){var e;const r=_M(n),{nodeExtensions:i,markExtensions:s}=th(n),l=(e=i.find(d=>yn(d,"topNode")))===null||e===void 0?void 0:e.name,c=Object.fromEntries(i.map(d=>{const p=r.filter(D=>D.type===d.name),g={name:d.name,options:d.options,storage:d.storage,editor:t},b=c3({...n.reduce((D,L)=>{const H=yn(L,"extendNodeSchema",g);return{...D,...H?H(d):{}}},{}),content:Pr(yn(d,"content",g)),marks:Pr(yn(d,"marks",g)),group:Pr(yn(d,"group",g)),inline:Pr(yn(d,"inline",g)),atom:Pr(yn(d,"atom",g)),selectable:Pr(yn(d,"selectable",g)),draggable:Pr(yn(d,"draggable",g)),code:Pr(yn(d,"code",g)),whitespace:Pr(yn(d,"whitespace",g)),linebreakReplacement:Pr(yn(d,"linebreakReplacement",g)),defining:Pr(yn(d,"defining",g)),isolating:Pr(yn(d,"isolating",g)),attrs:Object.fromEntries(p.map(u3))}),y=Pr(yn(d,"parseHTML",g));y&&(b.parseDOM=y.map(D=>l3(D,p)));const M=yn(d,"renderHTML",g);M&&(b.toDOM=D=>M({node:D,HTMLAttributes:kp(D,p)}));const C=yn(d,"renderText",g);return C&&(b.toText=C),[d.name,b]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(C=>C.type===d.name),g={name:d.name,options:d.options,storage:d.storage,editor:t},b=c3({...n.reduce((C,D)=>{const L=yn(D,"extendMarkSchema",g);return{...C,...L?L(d):{}}},{}),inclusive:Pr(yn(d,"inclusive",g)),excludes:Pr(yn(d,"excludes",g)),group:Pr(yn(d,"group",g)),spanning:Pr(yn(d,"spanning",g)),code:Pr(yn(d,"code",g)),attrs:Object.fromEntries(p.map(u3))}),y=Pr(yn(d,"parseHTML",g));y&&(b.parseDOM=y.map(C=>l3(C,p)));const M=yn(d,"renderHTML",g);return M&&(b.toDOM=C=>M({mark:C,HTMLAttributes:kp(C,p)})),[d.name,b]}));return new nA({topNode:l,nodes:c,marks:f})}function MO(n){const t=n.filter((e,r)=>n.indexOf(e)!==r);return Array.from(new Set(t))}function sp(n){return n.sort((e,r)=>{const i=yn(e,"priority")||100,s=yn(r,"priority")||100;return i>s?-1:i<s?1:0})}function DM(n){const t=sp(j5(n)),e=MO(t.map(r=>r.name));return e.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${e.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function LM(n,t,e){const{from:r,to:i}=t,{blockSeparator:s=`
100
-
101
- `,textSerializers:l={}}=e||{};let c="";return n.nodesBetween(r,i,(f,d,p,g)=>{f.isBlock&&d>r&&(c+=s);const b=l?.[f.type.name];if(b)return p&&(c+=b({node:f,pos:d,parent:p,index:g,range:t})),!1;if(f.isText){var y;c+=f==null||(y=f.text)===null||y===void 0?void 0:y.slice(Math.max(r,d)-d,i-d)}}),c}function CO(n,t){return LM(n,{from:0,to:n.content.size},t)}function RM(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}function EO(n,t){const e=Co(t,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===e.name);return l?{...l.attrs}:{}}function OM(n,t){const e=b0(typeof t=="string"?t:t.name,n.schema);return e==="node"?EO(n,t):e==="mark"?EM(n,t):{}}function TO(n,t=JSON.stringify){const e={};return n.filter(r=>{const i=t(r);return Object.prototype.hasOwnProperty.call(e,i)?!1:e[i]=!0})}function NO(n){const t=TO(n);return t.length===1?t:t.filter((e,r)=>!t.filter((i,s)=>s!==r).some(i=>e.oldRange.from>=i.oldRange.from&&e.oldRange.to<=i.oldRange.to&&e.newRange.from>=i.newRange.from&&e.newRange.to<=i.newRange.to))}function z5(n){const{mapping:t,steps:e}=n,r=[];return t.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,f)=>{l.push({from:c,to:f})});else{const{from:c,to:f}=e[s];if(c===void 0||f===void 0)return;l.push({from:c,to:f})}l.forEach(({from:c,to:f})=>{const d=t.slice(s).map(c,-1),p=t.slice(s).map(f),g=t.invert().map(d,-1),b=t.invert().map(p);r.push({oldRange:{from:g,to:b},newRange:{from:d,to:p}})})}),NO(r)}function F5(n,t,e){const r=[];return n===t?e.resolve(n).marks().forEach(i=>{const s=I5(e.resolve(n),i.type);s&&r.push({mark:i,...s})}):e.nodesBetween(n,t,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),r}const _O=(n,t,e,r=20)=>{const i=n.doc.resolve(e);let s=r,l=null;for(;s>0&&l===null;){const c=i.node(s);c?.type.name===t?l=c:s-=1}return[l,s]};function Nd(n,t){return t.nodes[n]||t.marks[n]||null}function ag(n,t,e){return Object.fromEntries(Object.entries(e).filter(([r])=>{const i=n.find(s=>s.type===t&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const DO=(n,t=500)=>{let e="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-t),r,(i,s,l,c)=>{var f,d;const p=((f=(d=i.type.spec).toText)===null||f===void 0?void 0:f.call(d,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";e+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),e};function q2(n,t,e={}){const{empty:r,ranges:i}=n.selection,s=t?Eu(t,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>Eg(p.attrs,e,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:p,$to:g})=>{const b=p.pos,y=g.pos;n.doc.nodesBetween(b,y,(M,C)=>{if(s&&M.inlineContent&&!M.type.allowsMarkType(s))return!1;if(!M.isText&&!M.marks.length)return;const D=Math.max(b,C),L=Math.min(y,C+M.nodeSize),H=L-D;l+=H,c.push(...M.marks.map(Y=>({mark:Y,from:D,to:L})))})}),l===0)return!1;const f=c.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>Eg(p.mark.attrs,e,{strict:!1})).reduce((p,g)=>p+g.to-g.from,0),d=c.filter(p=>s?p.mark.type!==s&&p.mark.type.excludes(s):!0).reduce((p,g)=>p+g.to-g.from,0);return(f>0?f+d:f)>=l}function LO(n,t,e={}){if(!t)return gf(n,null,e)||q2(n,null,e);const r=b0(t,n.schema);return r==="node"?gf(n,t,e):r==="mark"?q2(n,t,e):!1}const RO=(n,t)=>{const{$from:e,$to:r,$anchor:i}=n.selection;if(t){const s=x0(c=>c.type.name===t)(n.selection);if(!s)return!1;const l=n.doc.resolve(s.pos+1);return i.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||e.pos!==r.pos)},OO=n=>{const{$from:t,$to:e}=n.selection;return!(t.parentOffset>0||t.pos!==e.pos)};function f3(n,t){return Array.isArray(t)?t.some(e=>(typeof e=="string"?e:e.name)===n.name):t}function Ey(n,t){const{nodeExtensions:e}=th(t),r=e.find(s=>s.name===n);if(!r)return!1;const i=Pr(yn(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function v0(n,{checkChildren:t=!0,ignoreWhitespace:e=!1}={}){if(e){if(n.type.name==="hardBreak")return!0;if(n.isText){var r;return!/\S/.test((r=n.text)!==null&&r!==void 0?r:"")}}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(t){let i=!0;return n.content.forEach(s=>{i!==!1&&(v0(s,{ignoreWhitespace:e,checkChildren:t})||(i=!1))}),i}return!1}function PM(n){return n instanceof Cn}var IM=class jM{constructor(t){this.position=t}static fromJSON(t){return new jM(t.position)}toJSON(){return{position:this.position}}};function PO(n,t){const e=t.mapping.mapResult(n.position);return{position:new IM(e.pos),mapResult:e}}function IO(n){return new IM(n)}function jO(n,t,e){const{selection:r}=t;let i=null;if(vM(r)&&(i=r.$cursor),i){var s;const c=(s=n.storedMarks)!==null&&s!==void 0?s:i.marks();return i.parent.type.allowsMarkType(e)&&(!!e.isInSet(c)||!c.some(f=>f.type.excludes(e)))}const{ranges:l}=r;return l.some(({$from:c,$to:f})=>{let d=c.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(e):!1;return n.doc.nodesBetween(c.pos,f.pos,(p,g,b)=>{if(d)return!1;if(p.isInline){const y=!b||b.type.allowsMarkType(e),M=!!e.isInSet(p.marks)||!p.marks.some(C=>C.type.excludes(e));d=y&&M}return!d}),d})}const BO=(n,t={})=>({tr:e,state:r,dispatch:i})=>{const{selection:s}=e,{empty:l,ranges:c}=s,f=Eu(n,r.schema);if(i)if(l){const d=EM(r,f);e.addStoredMark(f.create({...d,...t}))}else c.forEach(d=>{const p=d.$from.pos,g=d.$to.pos;r.doc.nodesBetween(p,g,(b,y)=>{const M=Math.max(y,p),C=Math.min(y+b.nodeSize,g);b.marks.find(D=>D.type===f)?b.marks.forEach(D=>{f===D.type&&e.addMark(M,C,f.create({...D.attrs,...t}))}):e.addMark(M,C,f.create(t))})});return jO(r,e,f)},zO=(n,t)=>({tr:e})=>(e.setMeta(n,t),!0),FO=(n,t={})=>({state:e,dispatch:r,chain:i})=>{const s=Co(n,e.schema);let l;return e.selection.$anchor.sameParent(e.selection.$head)&&(l=e.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>CS(s,{...l,...t})(e)?!0:c.clearNodes()).command(({state:c})=>CS(s,{...l,...t})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},UO=n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,i=Ff(n,0,r.content.size),s=Cn.create(r,i);t.setSelection(s)}return!0},HO=(n,t)=>({tr:e,state:r,dispatch:i})=>{const{selection:s}=r;let l,c;return typeof t=="number"?(l=t,c=t):t&&"from"in t&&"to"in t?(l=t.from,c=t.to):(l=s.from,c=s.to),i&&e.doc.nodesBetween(l,c,(f,d)=>{f.isText||e.setNodeMarkup(d,void 0,{...f.attrs,dir:n})}),!0},qO=n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,l=Rn.atStart(r).from,c=Rn.atEnd(r).to,f=Ff(i,l,c),d=Ff(s,l,c),p=Rn.create(r,f,d);t.setSelection(p)}return!0},YO=n=>({state:t,dispatch:e})=>{const r=Co(n,t.schema);return jD(r)(t,e)};function d3(n,t){const e=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(e){const r=e.filter(i=>t?.includes(i.type.name));n.tr.ensureMarks(r)}}const $O=({keepMarks:n=!0}={})=>({tr:t,state:e,dispatch:r,editor:i})=>{const{selection:s,doc:l}=t,{$from:c,$to:f}=s,d=i.extensionManager.attributes,p=ag(d,c.node().type.name,c.node().attrs);if(s instanceof Cn&&s.node.isBlock)return!c.parentOffset||!Au(l,c.pos)?!1:(r&&(n&&d3(e,i.extensionManager.splittableMarks),t.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const g=f.parentOffset===f.parent.content.size,b=c.depth===0?void 0:MM(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=g&&b?[{type:b,attrs:p}]:void 0,M=Au(t.doc,t.mapping.map(c.pos),1,y);if(!y&&!M&&Au(t.doc,t.mapping.map(c.pos),1,b?[{type:b}]:void 0)&&(M=!0,y=b?[{type:b,attrs:p}]:void 0),r){if(M&&(s instanceof Rn&&t.deleteSelection(),t.split(t.mapping.map(c.pos),1,y),b&&!g&&!c.parentOffset&&c.parent.type!==b)){const C=t.mapping.map(c.before()),D=t.doc.resolve(C);c.node(-1).canReplaceWith(D.index(),D.index()+1,b)&&t.setNodeMarkup(t.mapping.map(c.before()),b)}n&&d3(e,i.extensionManager.splittableMarks),t.scrollIntoView()}return M},VO=(n,t={})=>({tr:e,state:r,dispatch:i,editor:s})=>{const l=Co(n,r.schema),{$from:c,$to:f}=r.selection,d=r.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(f))return!1;const p=c.node(-1);if(p.type!==l)return!1;const g=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){var b;let L=Ce.empty;const H=c.index(-1)?1:c.index(-2)?2:3;for(let bt=c.depth-H;bt>=c.depth-3;bt-=1)L=Ce.from(c.node(bt).copy(L));const Y=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,W={...ag(g,c.node().type.name,c.node().attrs),...t},St=((b=l.contentMatch.defaultType)===null||b===void 0?void 0:b.createAndFill(W))||void 0;L=L.append(Ce.from(l.createAndFill(null,St)||void 0));const _t=c.before(c.depth-(H-1));e.replace(_t,c.after(-Y),new Ke(L,4-H,0));let Ct=-1;e.doc.nodesBetween(_t,e.doc.content.size,(bt,ot)=>{if(Ct>-1)return!1;bt.isTextblock&&bt.content.size===0&&(Ct=ot+1)}),Ct>-1&&e.setSelection(Rn.near(e.doc.resolve(Ct))),e.scrollIntoView()}return!0}const y=f.pos===c.end()?p.contentMatchAt(0).defaultType:null,M={...ag(g,p.type.name,p.attrs),...t},C={...ag(g,c.node().type.name,c.node().attrs),...t};e.delete(c.pos,f.pos);const D=y?[{type:l,attrs:M},{type:y,attrs:C}]:[{type:l,attrs:M}];if(!Au(e.doc,c.pos,2))return!1;if(i){const{selection:L,storedMarks:H}=r,{splittableMarks:Y}=s.extensionManager,W=H||L.$to.parentOffset&&L.$from.marks();if(e.split(c.pos,2,D).scrollIntoView(),!W||!i)return!0;const St=W.filter(_t=>Y.includes(_t.type.name));e.ensureMarks(St)}return!0};function h3(n){return!n||n==="1"?null:n}function BM(n,t){return h3(n)===h3(t)}const Ty=(n,t)=>{const e=x0(s=>s.type===t)(n.selection);if(!e)return!0;const r=n.doc.resolve(Math.max(0,e.pos-1)).before(e.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return!(e.node.type===i?.type&&yf(n.doc,e.pos))||!BM(e.node.attrs.type,i?.attrs.type)||n.join(e.pos),!0},Ny=(n,t)=>{const e=x0(s=>s.type===t)(n.selection);if(!e)return!0;const r=n.doc.resolve(e.start).after(e.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return!(e.node.type===i?.type&&yf(n.doc,r))||!BM(e.node.attrs.type,i?.attrs.type)||n.join(r),!0};function WO(n){const t=n.doc,e=t.firstChild;if(!e)return null;const r=t.resolve(1),i=t.resolve(e.nodeSize-1);return Rn.between(r,i)}const XO=(n,t,e,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:f,commands:d,can:p})=>{const{extensions:g,splittableMarks:b}=i.extensionManager,y=Co(n,l.schema),M=Co(t,l.schema),{selection:C,storedMarks:D}=l,{$from:L,$to:H}=C,Y=L.blockRange(H),W=D||C.$to.parentOffset&&C.$from.marks();if(!Y)return!1;const St=x0(V=>Ey(V.type.name,g))(C),_t=C.from===0&&C.to===l.doc.content.size,Ct=l.doc.content.content,bt=Ct.length===1?Ct[0]:null,ot=_t&&bt&&Ey(bt.type.name,g)?{node:bt,pos:0}:null,jt=St??ot,Z=!!St&&Y.depth>=1&&Y.depth-St.depth<=1,ct=!!ot;if((Z||ct)&&jt){if(jt.node.type===y)return _t&&ct?f().command(({tr:V,dispatch:xt})=>{const Lt=WO(V);return Lt?(V.setSelection(Lt),xt&&xt(V),!0):!1}).liftListItem(M).run():d.liftListItem(M);if(Ey(jt.node.type.name,g)&&y.validContent(jt.node.content))return f().command(()=>(s.setNodeMarkup(jt.pos,y),!0)).command(()=>Ty(s,y)).command(()=>Ny(s,y)).run()}return!e||!W||!c?f().command(()=>p().wrapInList(y,r)?!0:d.clearNodes()).wrapInList(y,r).command(()=>Ty(s,y)).command(()=>Ny(s,y)).run():f().command(()=>{const V=p().wrapInList(y,r),xt=W.filter(Lt=>b.includes(Lt.type.name));return s.ensureMarks(xt),V?!0:d.clearNodes()}).wrapInList(y,r).command(()=>Ty(s,y)).command(()=>Ny(s,y)).run()},GO=(n,t={},e={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=e,l=Eu(n,r.schema);return q2(r,l,t)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,t)},KO=(n,t,e={})=>({state:r,commands:i})=>{const s=Co(n,r.schema),l=Co(t,r.schema),c=gf(r,s,e);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(l,f):i.setNode(s,{...f,...e})},JO=(n,t={})=>({state:e,commands:r})=>{const i=Co(n,e.schema);return gf(e,i,t)?r.lift(i):r.wrapIn(i,t)},ZO=()=>({state:n,dispatch:t})=>{const e=n.plugins;for(let r=0;r<e.length;r+=1){const i=e[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(t){const l=n.tr,c=s.transform;for(let f=c.steps.length-1;f>=0;f-=1)l.step(c.steps[f].invert(c.docs[f]));if(s.text){const f=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,n.schema.text(s.text,f))}else l.delete(s.from,s.to)}return!0}}return!1},QO=(n={})=>({tr:t,dispatch:e,editor:r})=>{const{ignoreClearable:i=!1}=n,{selection:s}=t,{empty:l,ranges:c}=s;if(l)return!0;const{nonClearableMarks:f}=r.extensionManager;if(e){const d=Object.values(r.schema.marks).filter(p=>i||!f.includes(p.name));c.forEach(p=>{for(const g of d)t.removeMark(p.$from.pos,p.$to.pos,g)})}return!0},t7=(n,t={})=>({tr:e,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=t,{selection:l}=e,c=Eu(n,r.schema),{$from:f,empty:d,ranges:p}=l;if(!i)return!0;if(d&&s){var g;let{from:b,to:y}=l;const M=I5(f,c,(g=f.marks().find(C=>C.type===c))===null||g===void 0?void 0:g.attrs);M&&(b=M.from,y=M.to),e.removeMark(b,y,c)}else p.forEach(b=>{e.removeMark(b.$from.pos,b.$to.pos,c)});return e.removeStoredMark(c),!0},e7=n=>({tr:t,state:e,dispatch:r})=>{const{selection:i}=e;let s,l;return typeof n=="number"?(s=n,l=n):n&&"from"in n&&"to"in n?(s=n.from,l=n.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(c,f)=>{if(c.isText)return;const d={...c.attrs};delete d.dir,t.setNodeMarkup(f,void 0,d)}),!0},n7=(n,t={})=>({tr:e,state:r,dispatch:i})=>{let s=null,l=null;const c=b0(typeof n=="string"?n:n.name,r.schema);if(!c)return!1;c==="node"&&(s=Co(n,r.schema)),c==="mark"&&(l=Eu(n,r.schema));let f=!1;return e.selection.ranges.forEach(d=>{const p=d.$from.pos,g=d.$to.pos;let b,y,M,C;e.selection.empty?r.doc.nodesBetween(p,g,(D,L)=>{s&&s===D.type&&(f=!0,M=Math.max(L,p),C=Math.min(L+D.nodeSize,g),b=L,y=D)}):r.doc.nodesBetween(p,g,(D,L)=>{L<p&&s&&s===D.type&&(f=!0,M=Math.max(L,p),C=Math.min(L+D.nodeSize,g),b=L,y=D),L>=p&&L<=g&&(s&&s===D.type&&(f=!0,i&&e.setNodeMarkup(L,void 0,{...D.attrs,...t})),l&&D.marks.length&&D.marks.forEach(H=>{if(l===H.type&&(f=!0,i)){const Y=Math.max(L,p),W=Math.min(L+D.nodeSize,g);e.addMark(Y,W,l.create({...H.attrs,...t}))}}))}),y&&(b!==void 0&&i&&e.setNodeMarkup(b,void 0,{...y.attrs,...t}),l&&y.marks.length&&y.marks.forEach(D=>{l===D.type&&i&&e.addMark(M,C,l.create({...D.attrs,...t}))}))}),f},Bd=new Eo("__tiptap_decorations__"),r7=n=>({tr:t,dispatch:e})=>(e&&t.setMeta(Bd,{type:"force",name:n}),!0),i7=(n,t={})=>({state:e,dispatch:r})=>{const i=Co(n,e.schema);return _D(i,t)(e,r)},o7=(n,t={})=>({state:e,dispatch:r})=>{const i=Co(n,e.schema);return DD(i,t)(e,r)};var s7=S8({blur:()=>TR,clearContent:()=>NR,clearNodes:()=>_R,command:()=>DR,createParagraphNear:()=>LR,cut:()=>RR,deleteCurrentNode:()=>OR,deleteNode:()=>PR,deleteRange:()=>IR,deleteSelection:()=>zR,enter:()=>FR,exitCode:()=>UR,extendMarkRange:()=>HR,first:()=>qR,focus:()=>$R,forEach:()=>VR,insertContent:()=>WR,insertContentAt:()=>XR,insertDefaultBlock:()=>GR,joinBackward:()=>ZR,joinDown:()=>JR,joinForward:()=>QR,joinItemBackward:()=>tO,joinItemForward:()=>eO,joinTextblockBackward:()=>nO,joinTextblockForward:()=>rO,joinUp:()=>KR,keyboardShortcut:()=>oO,lift:()=>sO,liftEmptyBlock:()=>aO,liftListItem:()=>lO,newlineInCode:()=>cO,resetAttributes:()=>uO,scrollIntoView:()=>fO,selectAll:()=>dO,selectNodeBackward:()=>hO,selectNodeForward:()=>pO,selectParentNode:()=>mO,selectTextblockEnd:()=>gO,selectTextblockStart:()=>yO,setContent:()=>bO,setMark:()=>BO,setMeta:()=>zO,setNode:()=>FO,setNodeSelection:()=>UO,setTextDirection:()=>HO,setTextSelection:()=>qO,sinkListItem:()=>YO,splitBlock:()=>$O,splitListItem:()=>VO,toggleList:()=>XO,toggleMark:()=>GO,toggleNode:()=>KO,toggleWrap:()=>JO,undoInputRule:()=>ZO,unsetAllMarks:()=>QO,unsetMark:()=>t7,unsetTextDirection:()=>e7,updateAttributes:()=>n7,updateDecorations:()=>r7,wrapIn:()=>i7,wrapInList:()=>o7});const Uh=new WeakMap;function a7(n,t){var e;Uh.set(n,((e=Uh.get(n))!==null&&e!==void 0?e:0)+1);try{return t()}finally{var r;const i=((r=Uh.get(n))!==null&&r!==void 0?r:1)-1;i>0?Uh.set(n,i):Uh.delete(n)}}var l7=class{constructor(){this.callbacks={}}on(n,t){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(t),this}emit(n,...t){const e=this.callbacks[n];return e&&e.forEach(r=>r.apply(this,t)),this}off(n,t){const e=this.callbacks[n];return e&&(t?this.callbacks[n]=e.filter(r=>r!==t):delete this.callbacks[n]),this}once(n,t){const e=(...r)=>{this.off(n,e),t.apply(this,r)};return this.on(n,e)}removeAllListeners(){this.callbacks={}}};function c7(n){return n.kind==="widget"}function zM(n,t){const e=[],r=new Set;for(const i of n)i.kind==="widget"&&c7(i)&&r.add(i.key),e.push(i.toPMDecoration(t));return{decorations:e,widgetKeys:r}}function u7(n,t,e){const{decorations:r,widgetKeys:i}=zM(t,e);return{set:Jr.create(n,r),widgetKeys:i}}function FM({position:n,from:t,to:e,docSize:r}){return n<t?!1:n<e?!0:n===e&&e===r}function f7({decorations:n,from:t,to:e,docSize:r,extensionName:i,warnedExtensions:s}){return n.filter(l=>FM({position:l.anchor,from:t,to:e,docSize:r})?!0:(l.anchor===e||s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${e}). It was ignored.`)),!1))}function d7(n){var t;const e=(t=n.spec)===null||t===void 0?void 0:t.key;return typeof e=="string"?e:void 0}function UM(n){return n.jsonID==="attr"}function h7(n){let t=!1;if(n.getMap().forEach(()=>{t=!0}),t||UM(n))return!0;const e=n;return typeof e.from=="number"&&typeof e.to=="number"}function p7(n,t){let e=null,r=0,i=0;for(let s=0;s<n.childCount&&!(i>t.to);s+=1){const l=i+n.child(s).nodeSize;l>=t.from&&(e===null&&(e=i),r=l),i=l}return e===null?null:{from:e,to:r}}function m7(n,t){if(n.steps.some(s=>!h7(s)))return{type:"full"};const e=z5(n).map(({newRange:s})=>s);n.steps.forEach((s,l)=>{if(!UM(s))return;const c=n.mapping.slice(l);e.push({from:c.map(s.pos,-1),to:c.map(s.pos+1)})});const r=[];for(const s of e){const l=p7(t,s);l&&r.push(l)}r.sort((s,l)=>s.from-l.from);const i=[];for(const s of r){const l=i[i.length-1];l&&s.from<=l.to?l.to=Math.max(l.to,s.to):i.push({...s})}return{type:"ranges",ranges:i}}function HM(n,t,e,r){return n.map(t,e,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function g7(n,t,e){var r,i;const s=(r=t.decorationSetsByExtension[n])!==null&&r!==void 0?r:Jr.empty,l=new Set((i=t.widgetKeysByExtension[n])!==null&&i!==void 0?i:[]);return{set:HM(s,e.mapping,e.doc,l),widgetKeys:l}}function p3(n,t){const e=Object.values(t).flatMap(r=>r.find());return Jr.create(n,e)}function m3(n){const t=new Set;for(const e of Object.values(n))for(const r of e)t.add(r);return t}function y7(n,t){var e;switch((e=t.update)!==null&&e!==void 0?e:"document"){case"document":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${n}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!t.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw new Error(`[tiptap error]: Extension "${n}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${n}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function b7(n,t,e){return e?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(t):t.tr.docChanged}const x7=new Set;var v7=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:t})=>{const e=Bd.getState(t);e&&this.warnDuplicateWidgetKeys(e)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:t,spec:e})=>y7(t,e)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,t;return(n=(t=Bd.getState(this.editor.state))===null||t===void 0?void 0:t.widgetKeys)!==null&&n!==void 0?n:x7}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(n){const t=[];for(const{name:e,addDecorations:r}of n){const i=r();i&&t.push({name:e,spec:i})}return t}createPlugin(){const{editor:n,entries:t}=this;return new Oi({key:Bd,state:{init:(e,r)=>{const i={},s={};for(const{name:c,spec:f}of t){const{set:d,widgetKeys:p}=this.buildFullSet(c,f,r);i[c]=d,s[c]=p}const l={decorationSetsByExtension:i,widgetKeysByExtension:s,mergedDecorationSet:this.buildMergedSet(r.doc,i),widgetKeys:m3(s)};return this.warnDuplicateWidgetKeys(l),l},apply:(e,r,i,s)=>{const l=e.getMeta(Bd),c=l?.type==="force"&&!l.name,f=l?.type==="force"?l.name:void 0,d={},p={},g=new Set;return a7(n,()=>{for(const{name:b,spec:y}of t){const M=c||f===b;if(b7(y,{editor:n,tr:e,oldState:i,newState:s},M))if(y.update==="changedRanges"&&e.docChanged&&!M){const C=this.applyChangedRangesRecompute(b,y,r,e,s);d[b]=C.set,p[b]=C.widgetKeys,g.add(b)}else{const{set:C,widgetKeys:D}=this.buildFullSet(b,y,s);d[b]=C,p[b]=D,g.add(b)}else{const C=g7(b,r,e);d[b]=C.set,p[b]=C.widgetKeys}}}),g.size===0&&!e.docChanged?r:{decorationSetsByExtension:d,widgetKeysByExtension:p,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:e,decorationSetsByExtension:d,recomputedNames:g}),widgetKeys:m3(p)}}},props:{decorations(e){var r,i;return(r=(i=Bd.getState(e))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:Jr.empty}}})}applyChangedRangesRecompute(n,t,e,r,i){const s=m7(r,i.doc);return s.type==="full"?this.buildFullSet(n,t,i):this.rebuildRanges(n,t,e,r,i,s.ranges)}rebuildRanges(n,t,e,r,i,s){var l,c;const f=(l=e.decorationSetsByExtension[n])!==null&&l!==void 0?l:Jr.empty,d=new Set((c=e.widgetKeysByExtension[n])!==null&&c!==void 0?c:[]);let p=HM(f,r.mapping,r.doc,d);const g=i.doc.content.size;for(const{from:b,to:y}of s){const M=p.find(b,y).filter(L=>FM({position:L.from,from:b,to:y,docSize:g}));for(const L of M){const H=d7(L);H&&d.delete(H)}p=p.remove(M);const{decorations:C,widgetKeys:D}=zM(f7({decorations:this.runCreate(n,"createInRange",()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:b,to:y})),from:b,to:y,docSize:g,extensionName:n,warnedExtensions:this.warnedOutOfRangeExtensions}),n);p=p.add(i.doc,C);for(const L of D)d.add(L)}return{set:p,widgetKeys:d}}buildFullSet(n,t,e){const r=this.runCreate(n,"create",()=>t.create({editor:this.editor,state:e,view:this.mountedView}));return u7(e.doc,r,n)}runCreate(n,t,e){try{return e()}catch(r){return console.error(`[tiptap error]: Extension "${n}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(n){}buildMergedSet(n,t){const e=Object.keys(t);return e.length===1?t[e[0]]:p3(n,t)}mergeAfterApply({entries:n,previous:t,tr:e,decorationSetsByExtension:r,recomputedNames:i}){return n.length===1?r[n[0].name]:i.size===0?t.mergedDecorationSet.map(e.mapping,e.doc):p3(e.doc,r)}};function w7(n,t){const{selection:e}=n,{$from:r}=e;if(e instanceof Cn){const s=r.index();return r.parent.canReplaceWith(s,s+1,t)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(t))return!0;i-=1}return!1}function S7(n,t,e){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}function k7(n){return typeof n=="number"}function A7(n){return Object.prototype.toString.call(n).slice(8,-1)}function jm(n){return A7(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function g3(n,t,e){const r=n.split(`
102
- `),i=[];let s="",l=0;const c=t.baseIndentSize||2;for(;l<r.length;){const p=r[l],g=p.match(t.itemPattern);if(!g){if(i.length>0)break;if(p.trim()===""){l+=1,s=`${s}${p}
103
- `;continue}else return}const b=t.extractItemData(g),{indentLevel:y,mainContent:M}=b;s=`${s}${p}
104
- `;const C=[M];for(l+=1;l<r.length;){var f;const Y=r[l];if(Y.trim()===""){var d;const W=r.slice(l+1).findIndex(St=>St.trim()!=="");if(W===-1)break;if((((d=r[l+1+W].match(/^(\s*)/))===null||d===void 0||(d=d[1])===null||d===void 0?void 0:d.length)||0)>y){C.push(Y),s=`${s}${Y}
105
- `,l+=1;continue}else break}if((((f=Y.match(/^(\s*)/))===null||f===void 0||(f=f[1])===null||f===void 0?void 0:f.length)||0)>y)C.push(Y),s=`${s}${Y}
106
- `,l+=1;else break}let D;const L=C.slice(1);if(L.length>0){const Y=L.map(W=>W.slice(y+c)).join(`
107
- `);Y.trim()&&(t.customNestedParser?D=t.customNestedParser(Y):D=e.blockTokens(Y))}const H=t.createToken(b,D);i.push(H)}if(i.length!==0)return{items:i,raw:s}}function qM(n,t,e,r,i){if(!n||!Array.isArray(n.content))return"";const s=typeof e=="function"?e(r):e,[l,...c]=n.content;let f=`${s}${t.renderChildren([l])}`;return c&&c.length>0&&c.forEach((d,p)=>{var g,b;const y=(g=(b=t.renderChild)===null||b===void 0?void 0:b.call(t,d,p+1))!==null&&g!==void 0?g:t.renderChildren([d]);if(y!=null){const M=D=>t.indent(D),C=y.split(`
108
- `).map(D=>M(D||"")).join(`
109
- `);f+=d.type==="paragraph"?`
110
-
111
- ${C}`:`
112
- ${C}`}}),f}function YM(n,t){const e={...n};return jm(n)&&jm(t)&&Object.keys(t).forEach(r=>{jm(t[r])&&jm(n[r])?e[r]=YM(n[r],t[r]):e[r]=t[r]}),e}function M7(n,t,e={}){const{state:r}=t,{doc:i,tr:s}=r,l=n;i.descendants((c,f)=>{const d=s.mapping.map(f),p=s.mapping.map(f)+c.nodeSize;let g=null;if(c.marks.forEach(y=>{if(y!==l)return!1;g=y}),!g)return;let b=!1;if(Object.keys(e).forEach(y=>{e[y]!==g.attrs[y]&&(b=!0)}),b){const y=n.type.create({...n.attrs,...e});s.removeMark(d,p,n.type),s.addMark(d,p,y)}}),s.docChanged&&t.view.dispatch(s)}var w0=class{constructor(n){var t;this.find=n.find,this.handler=n.handler,this.undoable=(t=n.undoable)!==null&&t!==void 0?t:!0}};const C7=(n,t)=>{if(P5(t))return t.exec(n);const e=t(n);if(!e)return null;const r=[e.text];return r.index=e.index,r.input=n,r.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(e.replaceWith)),r};function Bm(n){var t;const{editor:e,from:r,to:i,text:s,rules:l,plugin:c}=n,{view:f}=e;if(f.composing)return!1;const d=f.state.doc.resolve(r);if(d.parent.type.spec.code||!((t=d.nodeBefore||d.nodeAfter)===null||t===void 0)&&t.marks.find(b=>b.type.spec.code))return!1;let p=!1;const g=DO(d)+s;return l.forEach(b=>{if(p)return;const y=C7(g,b.find);if(!y)return;const M=y[0].length-s.length;if(M>0){const St=d.parentOffset-M;if(St<0||d.parent.textBetween(St,d.parentOffset)!==y[0].slice(0,M))return}const C=f.state.tr,D=y0({state:f.state,transaction:C}),L={from:r-(y[0].length-s.length),to:i},{commands:H,chain:Y,can:W}=new Xd({editor:e,state:D});b.handler({state:D,range:L,match:y,commands:H,chain:Y,can:W})===null||!C.steps.length||(b.undoable&&C.setMeta(c,{transform:C,from:r,to:i,text:s}),f.dispatch(C),p=!0)}),p}function E7(n){const{editor:t,rules:e}=n,r=new Oi({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return f&&setTimeout(()=>{let{text:d}=f;typeof d=="string"?d=d:d=B5(Ce.from(d),l.schema);const{from:p}=f,g=p+d.length;Bm({editor:t,from:p,to:g,text:d,rules:e,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return Bm({editor:t,from:s,to:l,text:c,rules:e,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Bm({editor:t,from:s.pos,to:s.pos,text:"",rules:e,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?Bm({editor:t,from:l.pos,to:l.pos,text:`
113
- `,rules:e,plugin:r}):!1}},isInputRules:!0});return r}var U5=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Pr(yn(this,"addOptions",{name:this.name}))}}get storage(){return{...Pr(yn(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const t=this.extend({...this.config,addOptions:()=>YM(this.options,n)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(n={}){const t=new this.constructor({...this.config,...n});return t.parent=this,this.child=t,t.name="name"in n?n.name:t.parent.name,t}},xf=class $M extends U5{constructor(...t){super(...t),this.type="mark"}static create(t={}){const e=typeof t=="function"?t():t;return new $M(e)}static handleExit({editor:t,mark:e}){const{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!s.find(c=>c?.type.name===e.name))return!1;const l=s.find(c=>c?.type.name===e.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const e=typeof t=="function"?t():t;return super.extend(e)}},T7=class{constructor(n){this.find=n.find,this.handler=n.handler}};const N7=(n,t,e)=>{if(P5(t))return[...n.matchAll(t)];const r=t(n,e);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function _7(n){const{editor:t,state:e,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=n,{commands:f,chain:d,can:p}=new Xd({editor:t,state:e}),g=[];return e.doc.nodesBetween(r,i,(b,y)=>{var M,C,D,L;if(!((M=b.type)===null||M===void 0||(M=M.spec)===null||M===void 0)&&M.code||!(b.isText||b.isTextblock||b.isInline))return;const H=(C=(D=(L=b.content)===null||L===void 0?void 0:L.size)!==null&&D!==void 0?D:b.nodeSize)!==null&&C!==void 0?C:0,Y=Math.max(r,y),W=Math.min(i,y+H);if(Y>=W)return;const St=b.isText?b.text||"":b.textBetween(Y-y,W-y,void 0,"");N7(St,s.find,l).forEach(_t=>{if(_t.index===void 0)return;const Ct=Y+_t.index+1,bt=Ct+_t[0].length,ot={from:e.tr.mapping.map(Ct),to:e.tr.mapping.map(bt)},jt=s.handler({state:e,range:ot,match:_t,commands:f,chain:d,can:p,pasteEvent:l,dropEvent:c});g.push(jt)})}),g.every(b=>b!==null)}let zm=null;const D7=n=>{var t;const e=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=e.clipboardData)===null||t===void 0||t.setData("text/html",n),e};function L7(n){const{editor:t,rules:e}=n;let r=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const f=({state:d,from:p,to:g,rule:b,pasteEvt:y})=>{const M=d.tr,C=y0({state:d,transaction:M});if(!(!_7({editor:t,state:C,from:Math.max(p-1,0),to:g.b-1,rule:b,pasteEvent:y,dropEvent:c})||!M.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,M}};return e.map(d=>new Oi({view(p){const g=y=>{var M;r=!((M=p.dom.parentElement)===null||M===void 0)&&M.contains(y.target)?p.dom.parentElement:null,r&&(zm=t)},b=()=>{zm&&(zm=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(p,g)=>{if(s=r===p.dom.parentElement,c=g,!s){const b=zm;b?.isEditable&&setTimeout(()=>{const y=b.state.selection;y&&b.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(p,g)=>{var b;const y=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=g,i=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(p,g,b)=>{const y=p[0],M=y.getMeta("uiEvent")==="paste"&&!i,C=y.getMeta("uiEvent")==="drop"&&!s,D=y.getMeta("applyPasteRules"),L=!!D;if(!M&&!C&&!L)return;if(L){let{text:W}=D;typeof W=="string"?W=W:W=B5(Ce.from(W),b.schema);const{from:St}=D,_t=St+W.length,Ct=D7(W);return f({rule:d,state:b,from:St,to:{b:_t},pasteEvt:Ct})}const H=g.doc.content.findDiffStart(b.doc.content),Y=g.doc.content.findDiffEnd(b.doc.content);if(!(!k7(H)||!Y||H===Y.b))return f({rule:d,state:b,from:H,to:Y,pasteEvt:l})}}))}var S0=class{constructor(n,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=n,this.extensions=DM(n),this.schema=AO(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((n,t)=>{const e=yn(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Nd(t.name,this.schema)});return e?{...n,...e()}:n},{})}get plugins(){const{editor:n}=this,t=sp([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Nd(r.name,this.schema)},s=[],l=yn(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&yn(r,"exitable",i)&&(c.ArrowRight=()=>xf.handleExit({editor:n,mark:r})),l){const b=Object.fromEntries(Object.entries(l()).map(([y,M])=>[y,()=>M({editor:n})]));c={...c,...b}}const f=ER(c);s.push(f);const d=yn(r,"addInputRules",i);if(f3(r,n.options.enableInputRules)&&d){const b=d();if(b&&b.length){const y=E7({editor:n,rules:b}),M=Array.isArray(y)?y:[y];s.push(...M)}}const p=yn(r,"addPasteRules",i);if(f3(r,n.options.enablePasteRules)&&p){const b=p();if(b&&b.length){const y=L7({editor:n,rules:b});s.push(...y)}}const g=yn(r,"addProseMirrorPlugins",i);if(g){const b=g();s.push(...b)}return s}),e=this.createDecorationPlugin();return e&&t.push(e),t}createDecorationPlugin(){var n;const{editor:t}=this;(n=this.decorationManager)===null||n===void 0||n.destroy();const e=[];return this.extensions.forEach(r=>{const i=yn(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Nd(r.name,this.schema)});i&&e.push({name:r.name,addDecorations:i})}),this.decorationManager=new v7({editor:t,entries:e}),this.decorationManager.plugin}get attributes(){return _M(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:t}=th(this.extensions);return Object.fromEntries(t.filter(e=>!!yn(e,"addNodeView")).map(e=>{const r=this.attributes.filter(c=>c.type===e.name),i=yn(e,"addNodeView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:n,type:Co(e.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const l=(c,f,d,p,g)=>{const b=kp(c,r);return s({node:c,view:f,getPos:d,decorations:p,innerDecorations:g,editor:n,extension:e,HTMLAttributes:b})};return[e.name,l]}))}dispatchTransaction(n){const{editor:t}=this;return sp([...this.extensions].reverse()).reduceRight((e,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Nd(r.name,this.schema)},s=yn(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:e})}:e},n)}transformPastedHTML(n){const{editor:t}=this;return sp([...this.extensions]).reduce((e,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Nd(r.name,this.schema)},s=yn(r,"transformPastedHTML",i);return s?(l,c)=>{const f=e(l,c);return s.call(i,f)}:e},n||(e=>e))}get markViews(){const{editor:n}=this,{markExtensions:t}=th(this.extensions);return Object.fromEntries(t.filter(e=>!!yn(e,"addMarkView")).map(e=>{const r=this.attributes.filter(l=>l.type===e.name),i=yn(e,"addMarkView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:n,type:Eu(e.name,this.schema)});if(!i)return[];const s=(l,c,f)=>{const d=kp(l,r);return i()({mark:l,view:c,inline:f,editor:n,extension:e,HTMLAttributes:d,updateAttributes:p=>{M7(l,n,p)}})};return[e.name,s]}))}destroy(){var n;(n=this.decorationManager)===null||n===void 0||n.destroy(),this.extensions.forEach(t=>{let e=t;for(;e.parent;){const r=e.parent;r.child===e&&(r.child=null),e=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(t=>[t.name,t.storage])),n.forEach(t=>{const e={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Nd(t.name,this.schema)};if(t.type==="mark"){var r,i;(!((r=Pr(yn(t,"keepOnSplit",e)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(t.name),!((i=Pr(yn(t,"clearable",e)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(t.name)}const s=yn(t,"onBeforeCreate",e),l=yn(t,"onCreate",e),c=yn(t,"onUpdate",e),f=yn(t,"onSelectionUpdate",e),d=yn(t,"onTransaction",e),p=yn(t,"onFocus",e),g=yn(t,"onBlur",e),b=yn(t,"onDestroy",e);s&&this.editor.on("beforeCreate",s),l&&this.editor.on("create",l),c&&this.editor.on("update",c),f&&this.editor.on("selectionUpdate",f),d&&this.editor.on("transaction",d),p&&this.editor.on("focus",p),g&&this.editor.on("blur",g),b&&this.editor.on("destroy",b)})}};S0.resolve=DM;S0.sort=sp;S0.flatten=j5;var ci=class VM extends U5{constructor(...t){super(...t),this.type="extension"}static create(t={}){const e=typeof t=="function"?t():t;return new VM(e)}configure(t){return super.configure(t)}extend(t){const e=typeof t=="function"?t():t;return super.extend(e)}};const R7=ci.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Oi({key:new Eo("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:t,schema:e}=n,{doc:r,selection:i}=t,s=RM(e),{blockSeparator:l}=this.options,c={...l!==void 0?{blockSeparator:l}:{},textSerializers:s};return[...i.ranges].sort((f,d)=>f.$from.pos-d.$from.pos).map(({$from:f,$to:d})=>LM(r,{from:f.pos,to:d.pos},c)).join(l??`
114
-
115
- `)}}})]}}),O7=ci.create({name:"commands",addCommands(){return{...s7}}}),P7=ci.create({name:"delete",onUpdate({transaction:n,appendedTransactions:t}){var e,r;const i=()=>{var s,l,c;if((s=(l=this.editor.options.coreExtensionOptions)===null||l===void 0||(l=l.delete)===null||l===void 0||(c=l.filterTransaction)===null||c===void 0?void 0:c.call(l,n))!==null&&s!==void 0?s:n.getMeta("y-sync$"))return;const f=TM(n.before,[n,...t]);z5(f).forEach(p=>{f.mapping.mapResult(p.oldRange.from).deletedAfter&&f.mapping.mapResult(p.oldRange.to).deletedBefore&&f.before.nodesBetween(p.oldRange.from,p.oldRange.to,(g,b)=>{const y=b+g.nodeSize-2,M=p.oldRange.from<=b&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:b,to:y,newFrom:f.mapping.map(b),newTo:f.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!M,editor:this.editor,transaction:n,combinedTransform:f})})});const d=f.mapping;f.steps.forEach((p,g)=>{if(p instanceof nc){var b,y;const M=d.slice(g).map(p.from,-1),C=d.slice(g).map(p.to),D=d.invert().map(M,-1),L=d.invert().map(C),H=M>0?(b=f.doc.nodeAt(M-1))===null||b===void 0?void 0:b.marks.some(W=>W.eq(p.mark)):!1,Y=(y=f.doc.nodeAt(C))===null||y===void 0?void 0:y.marks.some(W=>W.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:D,to:L},newRange:{from:M,to:C},partial:!!(Y||H),editor:this.editor,transaction:n,combinedTransform:f})}})};!((e=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&e!==void 0)||e?setTimeout(i,0):i()}}),I7=ci.create({name:"drop",addProseMirrorPlugins(){return[new Oi({key:new Eo("tiptapDrop"),props:{handleDrop:(n,t,e,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:e,moved:r})}}})]}}),j7=ci.create({name:"editable",addProseMirrorPlugins(){return[new Oi({key:new Eo("editable"),props:{editable:()=>this.editor.options.editable}})]}}),B7=new Eo("focusEvents"),z7=ci.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Oi({key:B7,props:{handleDOMEvents:{focus:(t,e)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,e)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),F7=ci.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:f,doc:d}=c,{empty:p,$anchor:g}=f,{pos:b,parent:y}=g,M=g.parent.isTextblock&&b>0?c.doc.resolve(b-1):g,C=M.parent.type.spec.isolating,D=g.pos-g.parentOffset,L=C&&M.parent.childCount===1?D===g.pos:Qn.atStart(d).from===b;return!p||!y.type.isTextblock||y.textContent.length||!L||L&&g.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Tg()||CM()?s:i},addProseMirrorPlugins(){return[new Oi({key:new Eo("clearDocument"),appendTransaction:(n,t,e)=>{if(n.some(y=>y.getMeta("composition")))return;const r=n.some(y=>y.docChanged)&&!t.doc.eq(e.doc),i=n.some(y=>y.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=t.selection,f=Qn.atStart(t.doc).from,d=Qn.atEnd(t.doc).to;if(s||!(l===f&&c===d)||!v0(e.doc))return;const p=e.tr,g=y0({state:e,transaction:p}),{commands:b}=new Xd({editor:this.editor,state:g});if(b.clearNodes(),!!p.steps.length)return p}})]}}),U7=ci.create({name:"paste",addProseMirrorPlugins(){return[new Oi({key:new Eo("tiptapPaste"),props:{handlePaste:(n,t,e)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:e})}}})]}}),H7=ci.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Oi({key:new Eo("tabindex"),props:{attributes:()=>{var n;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(n=this.options.value)!==null&&n!==void 0?n:"0"}}}})]}}),q7=ci.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=th(this.extensions);return[{types:n.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const e=t.getAttribute("dir");return e&&(e==="ltr"||e==="rtl"||e==="auto")?e:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Oi({key:new Eo("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let y3=!1;function Y7(n){if(y3)return;y3=!0;let t;try{t=uo.fromJSON(n,{from:0,to:0}).slice.content}catch{return}t instanceof Ce||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var $7=class Gh{get name(){return this.node.type.name}constructor(t,e,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=e,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}e=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:e,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(t);return new Gh(e,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Gh(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Gh(t,this.editor)}get children(){const t=[];return this.node.content.forEach((e,r)=>{const i=e.isBlock&&!e.isTextblock,s=e.isAtom&&!e.isText,l=e.isInline,c=this.pos+r+(s?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const f=this.resolvedPos.doc.resolve(c);if(!i&&!l&&f.depth<=this.depth)return;const d=new Gh(f,this.editor,i,i||l?e:null);i&&(d.actualDepth=this.depth+1),t.push(d)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===t)if(Object.keys(e).length>0){const s=i.node.attrs,l=Object.keys(e);for(let c=0;c<l.length;c+=1){const f=l[c];if(s[f]!==e[f])break}}else r=i;i=i.parent}return r}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(e);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===t&&s.every(c=>e[c]===l.node.attrs[c])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(t,e,r))))}),i}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}};const V7=`.ProseMirror {
116
- position: relative;
117
- }
118
-
119
- .ProseMirror {
120
- word-wrap: break-word;
121
- white-space: pre-wrap;
122
- white-space: break-spaces;
123
- -webkit-font-variant-ligatures: none;
124
- font-variant-ligatures: none;
125
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
126
- }
127
-
128
- .ProseMirror [contenteditable="false"] {
129
- white-space: normal;
130
- }
131
-
132
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
133
- white-space: pre-wrap;
134
- }
135
-
136
- .ProseMirror pre {
137
- white-space: pre-wrap;
138
- }
139
-
140
- img.ProseMirror-separator {
141
- display: inline !important;
142
- border: none !important;
143
- margin: 0 !important;
144
- width: 0 !important;
145
- height: 0 !important;
146
- }
147
-
148
- .ProseMirror-gapcursor {
149
- display: none;
150
- pointer-events: none;
151
- position: absolute;
152
- margin: 0;
153
- }
154
-
155
- .ProseMirror-gapcursor:after {
156
- content: "";
157
- display: block;
158
- position: absolute;
159
- top: -2px;
160
- width: 20px;
161
- border-top: 1px solid black;
162
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
163
- }
164
-
165
- @keyframes ProseMirror-cursor-blink {
166
- to {
167
- visibility: hidden;
168
- }
169
- }
170
-
171
- .ProseMirror-hideselection *::selection {
172
- background: transparent;
173
- }
174
-
175
- .ProseMirror-hideselection *::-moz-selection {
176
- background: transparent;
177
- }
178
-
179
- .ProseMirror-hideselection * {
180
- caret-color: transparent;
181
- }
182
-
183
- .ProseMirror-focused .ProseMirror-gapcursor {
184
- display: block;
185
- }`;var W7=class extends l7{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:PO,createMappablePosition:IO},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:r,moved:i})=>this.options.onDrop(e,r,i)),this.on("paste",({event:e,slice:r})=>this.options.onPaste(e,r)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const e=U2(t,this.options.autofocus);this.editorState=jf.create({doc:t,schema:this.schema,selection:e||void 0})}Y7(this.schema),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Xd.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Xd.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=S7(V7,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,t=!0){this.setOptions({editable:n}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in n)return Reflect.get(n,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,t){const e=NM(t)?t(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:e});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const t=this.state.plugins;let e=t;if([].concat(n).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;e=e.filter(l=>!l.key.startsWith(s))}),t.length===e.length)return;const r=this.state.reconfigure({plugins:e});return this.view.updateState(r),r}createExtensionManager(){var n,t;const e=[...this.options.enableCoreExtensions?[j7,R7.configure({blockSeparator:(n=this.options.coreExtensionOptions)===null||n===void 0||(n=n.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),O7,z7,F7,H7.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),I7,U7,P7,q7.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new S0(e,this)}createCommandManager(){this.commandManager=new Xd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=H2(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;const e=H2(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=jf.create({doc:e,schema:this.schema,selection:U2(e,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return n}createView(n){const{editorProps:t,enableExtensionDispatchTransaction:e}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=e?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(s);this.editorView=new gM(n,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const f=this.view.dom;f.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(d=>{var p;return(p=this.capturedTransaction)===null||p===void 0?void 0:p.step(d)});return}const{state:t,transactions:e}=this.state.applyTransaction(n),r=!this.state.selection.eq(t.selection),i=e.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:e.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const l=e.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),c=l?.getMeta("focus"),f=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),f&&this.emit("blur",{editor:this,event:f.event,transaction:l}),!(n.getMeta("preventUpdate")||!e.some(d=>d.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:e.slice(1)})}getAttributes(n){return OM(this.state,n)}isActive(n,t){const e=typeof n=="string"?n:null,r=typeof n=="string"?t:n;return LO(this.state,e,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return B5(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:t=`
186
-
187
- `,textSerializers:e={}}=n||{};return CO(this.state.doc,{blockSeparator:t,textSerializers:{...RM(this.schema),...e}})}get isEmpty(){return v0(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var n,t;return(n=(t=this.editorView)===null||t===void 0?void 0:t.isDestroyed)!==null&&n!==void 0?n:!0}$node(n,t){var e;return((e=this.$doc)===null||e===void 0?void 0:e.querySelector(n,t))||null}$nodes(n,t){var e;return((e=this.$doc)===null||e===void 0?void 0:e.querySelectorAll(n,t))||null}$pos(n){const t=this.state.doc.resolve(n),e=n>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new $7(t,this,!1,e)}get $doc(){return this.$pos(0)}};function eh(n){return new w0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=Pr(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=t,l=r[r.length-1],c=r[0];if(l){const f=c.search(/\S/),d=e.from+c.indexOf(l),p=d+l.length;if(F5(e.from,e.to,t.doc).filter(b=>b.mark.type.excluded.find(y=>y===n.type&&y!==b.mark.type)).filter(b=>b.to>d).length)return null;p<e.to&&s.delete(p,e.to),d>e.from&&s.delete(e.from+f,d);const g=e.from+f+l.length;s.addMark(e.from+f,g,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function X7(n){return new w0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=Pr(n.getAttributes,void 0,r)||{},{tr:s}=t,l=e.from;let c=e.to;const f=n.type.create(i);if(r[1]){let d=l+r[0].lastIndexOf(r[1]);d>c?d=c:c=d+r[1].length;const p=r[0][r[0].length-1];s.insertText(p,l+r[0].length-1),s.replaceWith(d,c,f)}else if(r[0]){const d=n.type.isInline?l:l-1;s.insert(d,n.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()},undoable:n.undoable})}function Y2(n){return new w0({find:n.find,handler:({state:t,range:e,match:r})=>{const i=t.doc.resolve(e.from),s=Pr(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;t.tr.delete(e.from,e.to).setBlockType(e.from,e.from,n.type,s)},undoable:n.undoable})}function nh(n){return new w0({find:n.find,handler:({state:t,range:e,match:r,chain:i})=>{const s=Pr(n.getAttributes,void 0,r)||{},l=t.tr.delete(e.from,e.to),c=l.doc.resolve(e.from).blockRange(),f=c&&v5(c,n.type,s);if(!f)return null;if(l.wrap(c,f),n.keepMarks&&n.editor){const{selection:p,storedMarks:g}=t,{splittableMarks:b}=n.editor.extensionManager,y=g||p.$to.parentOffset&&p.$from.marks();if(y){const M=y.filter(C=>b.includes(C.type.name));l.ensureMarks(M)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,s).run()}const d=l.doc.resolve(e.from-1).nodeBefore;d&&d.type===n.type&&yf(l.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&l.join(e.from-1)},undoable:n.undoable})}var Za=class WM extends U5{constructor(...t){super(...t),this.type="node"}static create(t={}){const e=typeof t=="function"?t():t;return new WM(e)}configure(t){return super.configure(t)}extend(t){const e=typeof t=="function"?t():t;return super.extend(e)}};function id(n){return new T7({find:n.find,handler:({state:t,range:e,match:r,pasteEvent:i})=>{const s=Pr(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=t,c=r[r.length-1],f=r[0];let d=e.to;if(c){const p=f.search(/\S/),g=e.from+f.indexOf(c),b=g+c.length;if(F5(e.from,e.to,t.doc).filter(y=>y.mark.type.excluded.find(M=>M===n.type&&M!==y.mark.type)).filter(y=>y.to>g).length)return null;b<e.to&&l.delete(b,e.to),g>e.from&&l.delete(e.from+p,g),d=e.from+p+c.length,l.addMark(e.from+p,d,n.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||l.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:G7,getOwnPropertySymbols:K7}=Object,{hasOwnProperty:J7}=Object.prototype;function _y(n,t){return function(r,i,s){return n(r,i,s)&&t(r,i,s)}}function Fm(n){return function(e,r,i){if(!e||!r||typeof e!="object"||typeof r!="object")return n(e,r,i);const{cache:s}=i,l=s.get(e),c=s.get(r);if(l&&c)return l===r&&c===e;s.set(e,r),s.set(r,e);const f=n(e,r,i);return s.delete(e),s.delete(r),f}}function Z7(n){return n?.[Symbol.toStringTag]}function b3(n){return G7(n).concat(K7(n))}const Q7=Object.hasOwn||((n,t)=>J7.call(n,t));function ld(n,t){return n===t||!n&&!t&&n!==n&&t!==t}const tP="__v",eP="__o",nP="_owner",{getOwnPropertyDescriptor:x3,keys:v3}=Object;function rP(n,t){return n.byteLength===t.byteLength&&Ng(new Uint8Array(n),new Uint8Array(t))}function iP(n,t,e){let r=n.length;if(t.length!==r)return!1;for(;r-- >0;)if(!e.equals(n[r],t[r],r,r,n,t,e))return!1;return!0}function oP(n,t){return n.byteLength===t.byteLength&&Ng(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function sP(n,t){return ld(n.getTime(),t.getTime())}function aP(n,t){return n.name===t.name&&n.message===t.message&&n.cause===t.cause&&n.stack===t.stack}function lP(n,t){return n===t}function w3(n,t,e){const r=n.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=n.entries();let l,c,f=0;for(;(l=s.next())&&!l.done;){const d=t.entries();let p=!1,g=0;for(;(c=d.next())&&!c.done;){if(i[g]){g++;continue}const b=l.value,y=c.value;if(e.equals(b[0],y[0],f,g,n,t,e)&&e.equals(b[1],y[1],b[0],y[0],n,t,e)){p=i[g]=!0;break}g++}if(!p)return!1;f++}return!0}const cP=ld;function uP(n,t,e){const r=v3(n);let i=r.length;if(v3(t).length!==i)return!1;for(;i-- >0;)if(!XM(n,t,e,r[i]))return!1;return!0}function Hh(n,t,e){const r=b3(n);let i=r.length;if(b3(t).length!==i)return!1;let s,l,c;for(;i-- >0;)if(s=r[i],!XM(n,t,e,s)||(l=x3(n,s),c=x3(t,s),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function fP(n,t){return ld(n.valueOf(),t.valueOf())}function dP(n,t){return n.source===t.source&&n.flags===t.flags}function S3(n,t,e){const r=n.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=n.values();let l,c;for(;(l=s.next())&&!l.done;){const f=t.values();let d=!1,p=0;for(;(c=f.next())&&!c.done;){if(!i[p]&&e.equals(l.value,c.value,l.value,c.value,n,t,e)){d=i[p]=!0;break}p++}if(!d)return!1}return!0}function Ng(n,t){let e=n.byteLength;if(t.byteLength!==e||n.byteOffset!==t.byteOffset)return!1;for(;e-- >0;)if(n[e]!==t[e])return!1;return!0}function hP(n,t){return n.hostname===t.hostname&&n.pathname===t.pathname&&n.protocol===t.protocol&&n.port===t.port&&n.hash===t.hash&&n.username===t.username&&n.password===t.password}function XM(n,t,e,r){return(r===nP||r===eP||r===tP)&&(n.$$typeof||t.$$typeof)?!0:Q7(t,r)&&e.equals(n[r],t[r],r,r,n,t,e)}const pP="[object ArrayBuffer]",mP="[object Arguments]",gP="[object Boolean]",yP="[object DataView]",bP="[object Date]",xP="[object Error]",vP="[object Map]",wP="[object Number]",SP="[object Object]",kP="[object RegExp]",AP="[object Set]",MP="[object String]",CP={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},EP="[object URL]",TP=Object.prototype.toString;function NP({areArrayBuffersEqual:n,areArraysEqual:t,areDataViewsEqual:e,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:l,areNumbersEqual:c,areObjectsEqual:f,arePrimitiveWrappersEqual:d,areRegExpsEqual:p,areSetsEqual:g,areTypedArraysEqual:b,areUrlsEqual:y,unknownTagComparators:M}){return function(D,L,H){if(D===L)return!0;if(D==null||L==null)return!1;const Y=typeof D;if(Y!==typeof L)return!1;if(Y!=="object")return Y==="number"?c(D,L,H):Y==="function"?s(D,L,H):!1;const W=D.constructor;if(W!==L.constructor)return!1;if(W===Object)return f(D,L,H);if(Array.isArray(D))return t(D,L,H);if(W===Date)return r(D,L,H);if(W===RegExp)return p(D,L,H);if(W===Map)return l(D,L,H);if(W===Set)return g(D,L,H);const St=TP.call(D);if(St===bP)return r(D,L,H);if(St===kP)return p(D,L,H);if(St===vP)return l(D,L,H);if(St===AP)return g(D,L,H);if(St===SP)return typeof D.then!="function"&&typeof L.then!="function"&&f(D,L,H);if(St===EP)return y(D,L,H);if(St===xP)return i(D,L,H);if(St===mP)return f(D,L,H);if(CP[St])return b(D,L,H);if(St===pP)return n(D,L,H);if(St===yP)return e(D,L,H);if(St===gP||St===wP||St===MP)return d(D,L,H);if(M){let _t=M[St];if(!_t){const Ct=Z7(D);Ct&&(_t=M[Ct])}if(_t)return _t(D,L,H)}return!1}}function _P({circular:n,createCustomConfig:t,strict:e}){let r={areArrayBuffersEqual:rP,areArraysEqual:e?Hh:iP,areDataViewsEqual:oP,areDatesEqual:sP,areErrorsEqual:aP,areFunctionsEqual:lP,areMapsEqual:e?_y(w3,Hh):w3,areNumbersEqual:cP,areObjectsEqual:e?Hh:uP,arePrimitiveWrappersEqual:fP,areRegExpsEqual:dP,areSetsEqual:e?_y(S3,Hh):S3,areTypedArraysEqual:e?_y(Ng,Hh):Ng,areUrlsEqual:hP,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),n){const i=Fm(r.areArraysEqual),s=Fm(r.areMapsEqual),l=Fm(r.areObjectsEqual),c=Fm(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return r}function DP(n){return function(t,e,r,i,s,l,c){return n(t,e,c)}}function LP({circular:n,comparator:t,createState:e,equals:r,strict:i}){if(e)return function(c,f){const{cache:d=n?new WeakMap:void 0,meta:p}=e();return t(c,f,{cache:d,equals:r,meta:p,strict:i})};if(n)return function(c,f){return t(c,f,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,f){return t(c,f,s)}}const RP=vf();vf({strict:!0});vf({circular:!0});vf({circular:!0,strict:!0});vf({createInternalComparator:()=>ld});vf({strict:!0,createInternalComparator:()=>ld});vf({circular:!0,createInternalComparator:()=>ld});vf({circular:!0,createInternalComparator:()=>ld,strict:!0});function vf(n={}){const{circular:t=!1,createInternalComparator:e,createState:r,strict:i=!1}=n,s=_P(n),l=NP(s),c=e?e(l):DP(l);return LP({circular:t,comparator:l,createState:r,equals:c,strict:i})}var Dy={exports:{}},Ly={};var k3;function OP(){if(k3)return Ly;k3=1;var n=Cp(),t=j4();function e(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:e,i=t.useSyncExternalStore,s=n.useRef,l=n.useEffect,c=n.useMemo,f=n.useDebugValue;return Ly.useSyncExternalStoreWithSelector=function(d,p,g,b,y){var M=s(null);if(M.current===null){var C={hasValue:!1,value:null};M.current=C}else C=M.current;M=c(function(){function L(_t){if(!H){if(H=!0,Y=_t,_t=b(_t),y!==void 0&&C.hasValue){var Ct=C.value;if(y(Ct,_t))return W=Ct}return W=_t}if(Ct=W,r(Y,_t))return Ct;var bt=b(_t);return y!==void 0&&y(Ct,bt)?(Y=_t,Ct):(Y=_t,W=bt)}var H=!1,Y,W,St=g===void 0?null:g;return[function(){return L(p())},St===null?void 0:function(){return L(St())}]},[p,g,b,y]);var D=i(d,M[0],M[1]);return l(function(){C.hasValue=!0,C.value=D},[D]),f(D),D},Ly}var A3;function PP(){return A3||(A3=1,Dy.exports=OP()),Dy.exports}var IP=PP(),jP=(...n)=>t=>{n.forEach(e=>{typeof e=="function"?e(t):e&&(e.current=t)})},BP=({contentComponent:n})=>{const t=B4.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return T.jsx(T.Fragment,{children:Object.values(t)})};function zP(){const n=new Set;let t={};return{subscribe(e){return n.add(e),()=>{n.delete(e)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,r){t={...t,[e]:v8.createPortal(r.reactElement,r.element,e)},n.forEach(i=>i())},removeRenderer(e){const r={...t};delete r[e],t=r,n.forEach(i=>i())}}}var FP=class extends Cu.Component{constructor(n){var t;super(n),this.editorContentRef=Cu.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=n.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const t=this.props.editor;if(t&&!t.isDestroyed&&((n=t.view.dom)!=null&&n.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=zP(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var n;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((n=t.view.dom)!=null&&n.parentNode))return;const e=document.createElement("div");e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e})}catch{}}}render(){const{editor:n,innerRef:t,...e}=this.props;return T.jsxs(T.Fragment,{children:[T.jsx("div",{ref:jP(t,this.editorContentRef),...e}),n?.contentComponent&&T.jsx(BP,{contentComponent:n.contentComponent})]})}},UP=U.forwardRef((n,t)=>{const e=Cu.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return Cu.createElement(FP,{key:e,innerRef:t,...n})}),GM=Cu.memo(UP),HP=typeof window<"u"?U.useLayoutEffect:U.useEffect,qP=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},e=this.editor;return e.on("transaction",t),()=>{e.off("transaction",t)}}}};function YP(n){var t;const[e]=U.useState(()=>new qP(n.editor)),r=IP.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getServerSnapshot,n.selector,(t=n.equalityFn)!=null?t:RP);return HP(()=>e.watch(n.editor),[n.editor,e]),U.useDebugValue(r),r}var $P=!1,$2=typeof window>"u",VP=$2||!!(typeof window<"u"&&window.next),WP=class KM{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?$2||VP?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new W7(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,e){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&e.extensions?t.extensions.length!==e.extensions.length?!1:t.extensions.every((i,s)=>{var l;return i===((l=e.extensions)==null?void 0:l[s])}):t[r]===e[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?KM.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,i)=>r===t[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,e=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){e&&e.setOptions(this.options.current);return}e&&!e.isDestroyed&&(e.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function XP(n={},t=[]){const e=U.useRef(n);e.current=n;const[r]=U.useState(()=>new WP(e)),i=B4.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return U.useDebugValue(i),U.useEffect(r.onRender(t)),YP({editor:i,selector:({transactionNumber:s})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&s===0?0:s+1}),i}var JM=U.createContext({editor:null});JM.Consumer;var GP=U.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),KP=()=>U.useContext(GP);Cu.forwardRef((n,t)=>{const{onDragStart:e}=KP(),r=n.as||"div";return T.jsx(r,{...n,ref:t,"data-node-view-wrapper":"",onDragStart:e,style:{whiteSpace:"normal",...n.style}})});Cu.createContext({markViewContentRef:()=>{}});var H5=U.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});H5.displayName="TiptapContext";var JP=()=>U.useContext(H5);function ZM({editor:n,instance:t,children:e}){const r=n??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=U.useMemo(()=>({editor:r}),[r]),s=U.useMemo(()=>({editor:r}),[r]);return T.jsx(JM.Provider,{value:s,children:T.jsx(H5.Provider,{value:i,children:e})})}ZM.displayName="Tiptap";function QM({...n}){const{editor:t}=JP();return T.jsx(GM,{editor:t,...n})}QM.displayName="Tiptap.Content";Object.assign(ZM,{Content:QM});const tC=new WeakSet,eC=new WeakSet;function _f(n){const t=n;return tC.add(t),t}function V2(n){return Array.isArray(n)&&tC.has(n)}function nC(n){return n.flatMap(t=>t==null?[]:Array.isArray(t)&&eC.has(t)&&!V2(t)?nC(t):[t])}function ZP(n,t){if(n==="slot")return 0;if(n instanceof Function){const i=n(t);return Array.isArray(i)&&!V2(i)&&!eC.has(i)?_f(i):i}const{children:e,...r}=t??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(e)){if(V2(e))return _f([n,r,e]);if(e.length===0)return _f([n,r]);const i=nC(e);return i.length===0?_f([n,r]):_f([n,r,...i])}return e!=null?_f([n,r,e]):_f([n,r])}const _g=(n,t)=>ZP(n,t);var QP=/^\s*>\s$/,tI=Za.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return _g("blockquote",{...mo(this.options.HTMLAttributes,n),children:_g("slot",{})})},parseMarkdown:(n,t)=>t.createNode("blockquote",void 0,t.parseChildren(n.tokens||[])),renderMarkdown:(n,t)=>{if(!n.content)return"";const e=">",r=[];return n.content.forEach(i=>{const c=t.renderChildren([i]).split(`
188
- `).map(f=>f.trim()===""?e:`${e} ${f}`);r.push(c.join(`
189
- `))}),r.join(`
190
- ${e}
191
- `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[nh({find:QP,type:this.type})]}}),eI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,rI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,iI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,oI=xf.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return _g("strong",{...mo(this.options.HTMLAttributes,n),children:_g("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,t)=>t.applyMark("bold",t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>`**${t.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[eh({find:eI,type:this.type}),eh({find:rI,type:this.type})]},addPasteRules(){return[id({find:nI,type:this.type}),id({find:iI,type:this.type})]}}),sI=/(^|[^`])`([^`]+)`(?!`)$/,aI=/(^|[^`])`([^`]+)`(?!`)/g,lI=xf.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,t)=>t.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,t)=>n.content?`\`${t.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[eh({find:sI,type:this.type})]},addPasteRules(){return[id({find:aI,type:this.type})]}}),Ry=4,cI=/^```([a-z]+)?[\s\n]$/,uI=/^~~~([a-z]+)?[\s\n]$/,fI=Za.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ry,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var t;const{languageClassPrefix:e}=this.options;if(!e)return null;const s=[...((t=n.firstElementChild)==null?void 0:t.classList)||[]].filter(l=>l.startsWith(e)).map(l=>l.replace(e,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:t}){return["pre",mo(this.options.HTMLAttributes,t),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,t)=>{var e,r;return((e=n.raw)==null?void 0:e.startsWith("```"))===!1&&((r=n.raw)==null?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:n.lang||null},n.text?[t.createTextNode(n.text)]:[])},renderMarkdown:(n,t)=>{var e;let r="";const i=((e=n.attrs)==null?void 0:e.language)||"";return n.content?r=[`\`\`\`${i}`,t.renderChildren(n.content),"```"].join(`
192
- `):r=`\`\`\`${i}
193
-
194
- \`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:t})=>t.setNode(this.name,n),toggleCodeBlock:n=>({commands:t})=>t.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:t}=this.editor.state.selection,e=t.pos===1;return!n||t.parent.type.name!==this.name?!1:e||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var t;if(!this.options.enableTabIndentation)return!1;const e=(t=this.options.tabSize)!=null?t:Ry,{state:r}=n,{selection:i}=r,{$from:s,empty:l}=i;if(s.parent.type!==this.type)return!1;const c=" ".repeat(e);return l?n.commands.insertContent(c):n.commands.command(({tr:f})=>{const{from:d,to:p}=i,y=r.doc.textBetween(d,p,`
195
- `,`
196
- `).split(`
197
- `).map(M=>c+M).join(`
198
- `);return f.replaceWith(d,p,r.schema.text(y)),!0})},"Shift-Tab":({editor:n})=>{var t;if(!this.options.enableTabIndentation)return!1;const e=(t=this.options.tabSize)!=null?t:Ry,{state:r}=n,{selection:i}=r,{$from:s,empty:l}=i;return s.parent.type!==this.type?!1:l?n.commands.command(({tr:c})=>{var f;const{pos:d}=s,p=s.start(),g=s.end(),y=r.doc.textBetween(p,g,`
199
- `,`
200
- `).split(`
201
- `);let M=0,C=0;const D=d-p;for(let _t=0;_t<y.length;_t+=1){if(C+y[_t].length>=D){M=_t;break}C+=y[_t].length+1}const H=((f=y[M].match(/^ */))==null?void 0:f[0])||"",Y=Math.min(H.length,e);if(Y===0)return!0;let W=p;for(let _t=0;_t<M;_t+=1)W+=y[_t].length+1;return c.delete(W,W+Y),d-W<=Y&&c.setSelection(Rn.create(c.doc,W)),!0}):n.commands.command(({tr:c})=>{const{from:f,to:d}=i,b=r.doc.textBetween(f,d,`
202
- `,`
203
- `).split(`
204
- `).map(y=>{var M;const C=((M=y.match(/^ */))==null?void 0:M[0])||"",D=Math.min(C.length,e);return y.slice(D)}).join(`
205
- `);return c.replaceWith(f,d,r.schema.text(b)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=n,{selection:e}=t,{$from:r,empty:i}=e;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
206
-
207
- `);return!s||!l?!1:n.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=n,{selection:e,doc:r}=t,{$from:i,empty:s}=e;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?n.commands.command(({tr:d})=>(d.setSelection(Qn.near(r.resolve(c))),!0)):n.commands.exitCode()}}},addInputRules(){return[Y2({find:cI,type:this.type,getAttributes:n=>({language:n[1]})}),Y2({find:uI,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Oi({key:new Eo("codeBlockVSCodeHandler"),props:{handlePaste:(n,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const e=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!e||!s)return!1;const{tr:l,schema:c}=n.state,f=c.text(e.replace(/\r\n?/g,`
208
- `));return l.replaceSelectionWith(this.type.create({language:s},f)),l.selection.$from.parent.type!==this.type&&l.setSelection(Rn.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),dI=Za.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
209
-
210
- `):""}),hI=Za.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",mo(this.options.HTMLAttributes,n)]},renderText(){return`
211
- `},renderMarkdown:()=>`
212
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:t,state:e,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=e;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,f=s||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:d,dispatch:p})=>{if(p&&f&&l){const g=f.filter(b=>c.includes(b.type.name));d.ensureMarks(g)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pI=Za.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:t}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,mo(this.options.HTMLAttributes,t),0]},parseMarkdown:(n,t)=>t.createNode("heading",{level:n.depth||1},t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>{var e;const r=(e=n.attrs)!=null&&e.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${t.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.setNode(this.name,n):!1,toggleHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,t)=>({...n,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(n=>Y2({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),mI=Za.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",mo(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:t})=>{if(!w7(t,t.schema.nodes[this.name]))return!1;const{selection:e}=t,{$to:r}=e,i=n();return PM(e)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:l,dispatch:c})=>{if(c){const{$to:f}=l.selection,d=f.end();if(f.nodeAfter)f.nodeAfter.isTextblock?l.setSelection(Rn.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(Cn.create(l.doc,f.pos)):l.setSelection(Rn.create(l.doc,f.pos));else{const p=s.schema.nodes[this.options.nextNodeType]||f.parent.type.contentMatch.defaultType,g=p?.create();g&&(l.insert(d,g),l.setSelection(Rn.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[X7({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),gI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,yI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,bI=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,xI=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,vI=xf.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",mo(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,t)=>t.applyMark("italic",t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>`*${t.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[eh({find:gI,type:this.type}),eh({find:bI,type:this.type})]},addPasteRules(){return[id({find:yI,type:this.type}),id({find:xI,type:this.type})]}});const wI="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",SI="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",W2="numeric",X2="ascii",G2="alpha",ap="asciinumeric",Kh="alphanumeric",K2="domain",rC="emoji",kI="scheme",AI="slashscheme",Oy="whitespace";function MI(n,t){return n in t||(t[n]=[]),t[n]}function Uf(n,t,e){t[W2]&&(t[ap]=!0,t[Kh]=!0),t[X2]&&(t[ap]=!0,t[G2]=!0),t[ap]&&(t[Kh]=!0),t[G2]&&(t[Kh]=!0),t[Kh]&&(t[K2]=!0),t[rC]&&(t[K2]=!0);for(const r in t){const i=MI(r,e);i.indexOf(n)<0&&i.push(n)}}function CI(n,t){const e={};for(const r in t)t[r].indexOf(n)>=0&&(e[r]=!0);return e}function Da(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Da.groups={};Da.prototype={accepts(){return!!this.t},go(n){const t=this,e=t.j[n];if(e)return e;for(let r=0;r<t.jr.length;r++){const i=t.jr[r][0],s=t.jr[r][1];if(s&&i.test(n))return s}return t.jd},has(n,t=!1){return t?n in this.j:!!this.go(n)},ta(n,t,e,r){for(let i=0;i<n.length;i++)this.tt(n[i],t,e,r)},tr(n,t,e,r){r=r||Da.groups;let i;return t&&t.j?i=t:(i=new Da(t),e&&r&&Uf(t,e,r)),this.jr.push([n,i]),i},ts(n,t,e,r){let i=this;const s=n.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(n[l]);return i.tt(n[s-1],t,e,r)},tt(n,t,e,r){r=r||Da.groups;const i=this;if(t&&t.j)return i.j[n]=t,t;const s=t;let l,c=i.go(n);if(c?(l=new Da,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Da,s){if(r)if(l.t&&typeof l.t=="string"){const f=Object.assign(CI(l.t,r),e);Uf(s,f,r)}else e&&Uf(s,e,r);l.t=s}return i.j[n]=l,l}};const Zn=(n,t,e,r,i)=>n.ta(t,e,r,i),Ji=(n,t,e,r,i)=>n.tr(t,e,r,i),M3=(n,t,e,r,i)=>n.ts(t,e,r,i),Ne=(n,t,e,r,i)=>n.tt(t,e,r,i),xu="WORD",J2="UWORD",iC="ASCIINUMERICAL",oC="ALPHANUMERICAL",Ap="LOCALHOST",Z2="TLD",Q2="UTLD",lg="SCHEME",zd="SLASH_SCHEME",q5="NUM",t5="WS",Y5="NL",lp="OPENBRACE",cp="CLOSEBRACE",Dg="OPENBRACKET",Lg="CLOSEBRACKET",Rg="OPENPAREN",Og="CLOSEPAREN",Pg="OPENANGLEBRACKET",Ig="CLOSEANGLEBRACKET",jg="FULLWIDTHLEFTPAREN",Bg="FULLWIDTHRIGHTPAREN",zg="LEFTCORNERBRACKET",Fg="RIGHTCORNERBRACKET",Ug="LEFTWHITECORNERBRACKET",Hg="RIGHTWHITECORNERBRACKET",qg="FULLWIDTHLESSTHAN",Yg="FULLWIDTHGREATERTHAN",$g="AMPERSAND",Vg="APOSTROPHE",Wg="ASTERISK",nf="AT",Xg="BACKSLASH",Gg="BACKTICK",Kg="CARET",sf="COLON",$5="COMMA",Jg="DOLLAR",Dc="DOT",Zg="EQUALS",V5="EXCLAMATION",Ml="HYPHEN",up="PERCENT",Qg="PIPE",t0="PLUS",e0="POUND",fp="QUERY",W5="QUOTE",sC="FULLWIDTHMIDDLEDOT",X5="SEMI",Lc="SLASH",dp="TILDE",n0="UNDERSCORE",aC="EMOJI",r0="SYM";var lC=Object.freeze({__proto__:null,ALPHANUMERICAL:oC,AMPERSAND:$g,APOSTROPHE:Vg,ASCIINUMERICAL:iC,ASTERISK:Wg,AT:nf,BACKSLASH:Xg,BACKTICK:Gg,CARET:Kg,CLOSEANGLEBRACKET:Ig,CLOSEBRACE:cp,CLOSEBRACKET:Lg,CLOSEPAREN:Og,COLON:sf,COMMA:$5,DOLLAR:Jg,DOT:Dc,EMOJI:aC,EQUALS:Zg,EXCLAMATION:V5,FULLWIDTHGREATERTHAN:Yg,FULLWIDTHLEFTPAREN:jg,FULLWIDTHLESSTHAN:qg,FULLWIDTHMIDDLEDOT:sC,FULLWIDTHRIGHTPAREN:Bg,HYPHEN:Ml,LEFTCORNERBRACKET:zg,LEFTWHITECORNERBRACKET:Ug,LOCALHOST:Ap,NL:Y5,NUM:q5,OPENANGLEBRACKET:Pg,OPENBRACE:lp,OPENBRACKET:Dg,OPENPAREN:Rg,PERCENT:up,PIPE:Qg,PLUS:t0,POUND:e0,QUERY:fp,QUOTE:W5,RIGHTCORNERBRACKET:Fg,RIGHTWHITECORNERBRACKET:Hg,SCHEME:lg,SEMI:X5,SLASH:Lc,SLASH_SCHEME:zd,SYM:r0,TILDE:dp,TLD:Z2,UNDERSCORE:n0,UTLD:Q2,UWORD:J2,WORD:xu,WS:t5});const gu=/[a-z]/,qh=new RegExp("\\p{L}","u"),Py=new RegExp("\\p{Emoji}","u"),yu=/\d/,Iy=/\s/,C3="\r",jy=`
213
- `,EI="️",TI="‍",By="";let Um=null,Hm=null;function NI(n=[]){const t={};Da.groups=t;const e=new Da;Um==null&&(Um=E3(wI)),Hm==null&&(Hm=E3(SI)),Ne(e,"'",Vg),Ne(e,"{",lp),Ne(e,"}",cp),Ne(e,"[",Dg),Ne(e,"]",Lg),Ne(e,"(",Rg),Ne(e,")",Og),Ne(e,"<",Pg),Ne(e,">",Ig),Ne(e,"(",jg),Ne(e,")",Bg),Ne(e,"「",zg),Ne(e,"」",Fg),Ne(e,"『",Ug),Ne(e,"』",Hg),Ne(e,"<",qg),Ne(e,">",Yg),Ne(e,"&",$g),Ne(e,"*",Wg),Ne(e,"@",nf),Ne(e,"`",Gg),Ne(e,"^",Kg),Ne(e,":",sf),Ne(e,",",$5),Ne(e,"$",Jg),Ne(e,".",Dc),Ne(e,"=",Zg),Ne(e,"!",V5),Ne(e,"-",Ml),Ne(e,"%",up),Ne(e,"|",Qg),Ne(e,"+",t0),Ne(e,"#",e0),Ne(e,"?",fp),Ne(e,'"',W5),Ne(e,"/",Lc),Ne(e,";",X5),Ne(e,"~",dp),Ne(e,"_",n0),Ne(e,"\\",Xg),Ne(e,"・",sC);const r=Ji(e,yu,q5,{[W2]:!0});Ji(r,yu,r);const i=Ji(r,gu,iC,{[ap]:!0}),s=Ji(r,qh,oC,{[Kh]:!0}),l=Ji(e,gu,xu,{[X2]:!0});Ji(l,yu,i),Ji(l,gu,l),Ji(i,yu,i),Ji(i,gu,i);const c=Ji(e,qh,J2,{[G2]:!0});Ji(c,gu),Ji(c,yu,s),Ji(c,qh,c),Ji(s,yu,s),Ji(s,gu),Ji(s,qh,s);const f=Ne(e,jy,Y5,{[Oy]:!0}),d=Ne(e,C3,t5,{[Oy]:!0}),p=Ji(e,Iy,t5,{[Oy]:!0});Ne(e,By,p),Ne(d,jy,f),Ne(d,By,p),Ji(d,Iy,p),Ne(p,C3),Ne(p,jy),Ji(p,Iy,p),Ne(p,By,p);const g=Ji(e,Py,aC,{[rC]:!0});Ne(g,"#"),Ji(g,Py,g),Ne(g,EI,g);const b=Ne(g,TI);Ne(b,"#"),Ji(b,Py,g);const y=[[gu,l],[yu,i]],M=[[gu,null],[qh,c],[yu,s]];for(let C=0;C<Um.length;C++)Gu(e,Um[C],Z2,xu,y);for(let C=0;C<Hm.length;C++)Gu(e,Hm[C],Q2,J2,M);Uf(Z2,{tld:!0,ascii:!0},t),Uf(Q2,{utld:!0,alpha:!0},t),Gu(e,"file",lg,xu,y),Gu(e,"mailto",lg,xu,y),Gu(e,"http",zd,xu,y),Gu(e,"https",zd,xu,y),Gu(e,"ftp",zd,xu,y),Gu(e,"ftps",zd,xu,y),Uf(lg,{scheme:!0,ascii:!0},t),Uf(zd,{slashscheme:!0,ascii:!0},t),n=n.sort((C,D)=>C[0]>D[0]?1:-1);for(let C=0;C<n.length;C++){const D=n[C][0],H=n[C][1]?{[kI]:!0}:{[AI]:!0};D.indexOf("-")>=0?H[K2]=!0:gu.test(D)?yu.test(D)?H[ap]=!0:H[X2]=!0:H[W2]=!0,M3(e,D,D,H)}return M3(e,"localhost",Ap,{ascii:!0}),e.jd=new Da(r0),{start:e,tokens:Object.assign({groups:t},lC)}}function cC(n,t){const e=_I(t.replace(/[A-Z]/g,c=>c.toLowerCase())),r=e.length,i=[];let s=0,l=0;for(;l<r;){let c=n,f=null,d=0,p=null,g=-1,b=-1;for(;l<r&&(f=c.go(e[l]));)c=f,c.accepts()?(g=0,b=0,p=c):g>=0&&(g+=e[l].length,b++),d+=e[l].length,s+=e[l].length,l++;s-=g,l-=b,d-=g,i.push({t:p.t,v:t.slice(s-d,s),s:s-d,e:s})}return i}function _I(n){const t=[],e=n.length;let r=0;for(;r<e;){let i=n.charCodeAt(r),s,l=i<55296||i>56319||r+1===e||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);t.push(l),r+=l.length}return t}function Gu(n,t,e,r,i){let s;const l=t.length;for(let c=0;c<l-1;c++){const f=t[c];n.j[f]?s=n.j[f]:(s=new Da(r),s.jr=i.slice(),n.j[f]=s),n=s}return s=new Da(e),s.jr=i.slice(),n.j[t[l-1]]=s,s}function E3(n){const t=[],e=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){t.push(e.join(""));for(let l=parseInt(n.substring(r,r+s),10);l>0;l--)e.pop();r+=s}else e.push(n[r]),r++}return t}const Mp={defaultProtocol:"http",events:null,format:T3,formatHref:T3,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function G5(n,t=null){let e=Object.assign({},Mp);n&&(e=Object.assign(e,n instanceof G5?n.o:n));const r=e.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=e,t&&(this.defaultRender=t),this.ignoreTags=i}G5.prototype={o:Mp,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,t,e){const r=t!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=e.t in i?i[e.t]:Mp[n],typeof i=="function"&&r&&(i=i(t,e))):typeof i=="function"&&r&&(i=i(t,e.t,e)),i)},getObj(n,t,e){let r=this.o[n];return typeof r=="function"&&t!=null&&(r=r(t,e.t,e)),r},render(n){const t=n.render(this);return(this.get("render",null,n)||this.defaultRender)(t,n.t,n)}};function T3(n){return n}function uC(n,t){this.t="token",this.v=n,this.tk=t}uC.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const t=this.toString(),e=n.get("truncate",t,this),r=n.get("format",t,this);return e&&r.length>e?r.substring(0,e)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Mp.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const t=this,e=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",e,this),i=n.get("tagName",e,t),s=this.toFormattedString(n),l={},c=n.get("className",e,t),f=n.get("target",e,t),d=n.get("rel",e,t),p=n.getObj("attributes",e,t),g=n.getObj("events",e,t);return l.href=r,c&&(l.class=c),f&&(l.target=f),d&&(l.rel=d),p&&Object.assign(l,p),{tagName:i,attributes:l,content:s,eventListeners:g}}};function k0(n,t){class e extends uC{constructor(i,s){super(i,s),this.t=n}}for(const r in t)e.prototype[r]=t[r];return e.t=n,e}const N3=k0("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),_3=k0("text"),DI=k0("nl"),qm=k0("url",{isLink:!0,toHref(n=Mp.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ap&&n[1].t===sf}}),Sl=n=>new Da(n);function LI({groups:n}){const t=n.domain.concat([$g,Wg,nf,Xg,Gg,Kg,Jg,Zg,Ml,q5,up,Qg,t0,e0,Lc,r0,dp,n0]),e=[Vg,sf,$5,Dc,V5,up,fp,W5,X5,Pg,Ig,lp,cp,Lg,Dg,Rg,Og,jg,Bg,zg,Fg,Ug,Hg,qg,Yg],r=[$g,Vg,Wg,Xg,Gg,Kg,Jg,Zg,Ml,lp,cp,up,Qg,t0,e0,fp,Lc,r0,dp,n0],i=Sl(),s=Ne(i,dp);Zn(s,r,s),Zn(s,n.domain,s);const l=Sl(),c=Sl(),f=Sl();Zn(i,n.domain,l),Zn(i,n.scheme,c),Zn(i,n.slashscheme,f),Zn(l,r,s),Zn(l,n.domain,l);const d=Ne(l,nf);Ne(s,nf,d),Ne(c,nf,d),Ne(f,nf,d);const p=Ne(s,Dc);Zn(p,r,s),Zn(p,n.domain,s);const g=Sl();Zn(d,n.domain,g),Zn(g,n.domain,g);const b=Ne(g,Dc);Zn(b,n.domain,g);const y=Sl(N3);Zn(b,n.tld,y),Zn(b,n.utld,y),Ne(d,Ap,y);const M=Ne(g,Ml);Ne(M,Ml,M),Zn(M,n.domain,g),Zn(y,n.domain,g),Ne(y,Dc,b),Ne(y,Ml,M);const C=Ne(y,sf);Zn(C,n.numeric,N3);const D=Ne(l,Ml),L=Ne(l,Dc);Ne(D,Ml,D),Zn(D,n.domain,l),Zn(L,r,s),Zn(L,n.domain,l);const H=Sl(qm);Zn(L,n.tld,H),Zn(L,n.utld,H),Zn(H,n.domain,l),Zn(H,r,s),Ne(H,Dc,L),Ne(H,Ml,D),Ne(H,nf,d);const Y=Ne(H,sf),W=Sl(qm);Zn(Y,n.numeric,W);const St=Sl(qm),_t=Sl();Zn(St,t,St),Zn(St,e,_t),Zn(_t,t,St),Zn(_t,e,_t),Ne(H,Lc,St),Ne(W,Lc,St);const Ct=Ne(c,sf),bt=Ne(f,sf),ot=Ne(bt,Lc),jt=Ne(ot,Lc);Zn(c,n.domain,l),Ne(c,Dc,L),Ne(c,Ml,D),Zn(f,n.domain,l),Ne(f,Dc,L),Ne(f,Ml,D),Zn(Ct,n.domain,St),Ne(Ct,Lc,St),Ne(Ct,fp,St),Zn(jt,n.domain,St),Zn(jt,t,St),Ne(jt,Lc,St);const Z=[[lp,cp],[Dg,Lg],[Rg,Og],[Pg,Ig],[jg,Bg],[zg,Fg],[Ug,Hg],[qg,Yg]];for(let ct=0;ct<Z.length;ct++){const[V,xt]=Z[ct],Lt=Ne(St,V);Ne(_t,V,Lt),Ne(Lt,xt,St);const dt=Sl(qm);Zn(Lt,t,dt);const st=Sl();Zn(Lt,e),Zn(dt,t,dt),Zn(dt,e,st),Zn(st,t,dt),Zn(st,e,st),Ne(dt,xt,St),Ne(st,xt,St)}return Ne(i,Ap,H),Ne(i,Y5,DI),{start:i,tokens:lC}}function RI(n,t,e){let r=e.length,i=0,s=[],l=[];for(;i<r;){let c=n,f=null,d=null,p=0,g=null,b=-1;for(;i<r&&!(f=c.go(e[i].t));)l.push(e[i++]);for(;i<r&&(d=f||c.go(e[i].t));)f=null,c=d,c.accepts()?(b=0,g=c):b>=0&&b++,i++,p++;if(b<0)i-=p,i<r&&(l.push(e[i]),i++);else{l.length>0&&(s.push(zy(_3,t,l)),l=[]),i-=b,p-=b;const y=g.t,M=e.slice(i-p,i);s.push(zy(y,t,M))}}return l.length>0&&s.push(zy(_3,t,l)),s}function zy(n,t,e){const r=e[0].s,i=e[e.length-1].e,s=t.slice(r,i);return new n(s,e)}const OI=typeof console<"u"&&console&&console.warn||(()=>{}),PI="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Mi={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function II(){return Da.groups={},Mi.scanner=null,Mi.parser=null,Mi.tokenQueue=[],Mi.pluginQueue=[],Mi.customSchemes=[],Mi.initialized=!1,Mi}function D3(n,t=!1){if(Mi.initialized&&OI(`linkifyjs: already initialized - will not register custom scheme "${n}" ${PI}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
214
- 1. Must only contain digits, lowercase ASCII letters or "-"
215
- 2. Cannot start or end with "-"
216
- 3. "-" cannot repeat`);Mi.customSchemes.push([n,t])}function jI(){Mi.scanner=NI(Mi.customSchemes);for(let n=0;n<Mi.tokenQueue.length;n++)Mi.tokenQueue[n][1]({scanner:Mi.scanner});Mi.parser=LI(Mi.scanner.tokens);for(let n=0;n<Mi.pluginQueue.length;n++)Mi.pluginQueue[n][1]({scanner:Mi.scanner,parser:Mi.parser});return Mi.initialized=!0,Mi}function K5(n){return Mi.initialized||jI(),RI(Mi.parser.start,n,cC(Mi.scanner.start,n))}K5.scan=cC;function fC(n,t=null,e=null){if(t&&typeof t=="object"){if(e)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);e=t,t=null}const r=new G5(e),i=K5(n),s=[];for(let l=0;l<i.length;l++){const c=i[l];c.isLink&&(!t||c.t===t)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}var J5="[\0-   ᠎ -\u2029  ]",BI=new RegExp(J5),zI=new RegExp(`${J5}$`),FI=new RegExp(J5,"g");function UI(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function HI(n){return new Oi({key:new Eo("autolink"),appendTransaction:(t,e,r)=>{const i=t.some(d=>d.docChanged)&&!e.doc.eq(r.doc),s=t.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=TM(e.doc,[...t]);if(z5(c).forEach(({newRange:d})=>{const p=xO(r.doc,d,y=>y.isTextblock);let g,b;if(p.length>1)g=p[0],b=r.doc.textBetween(g.pos,g.pos+g.node.nodeSize,void 0," ");else if(p.length){const y=r.doc.textBetween(d.from,d.to," "," ");if(!zI.test(y))return;g=p[0],b=r.doc.textBetween(g.pos,d.to,void 0," ")}if(g&&b){const y=b.split(BI).filter(Boolean);if(y.length<=0)return!1;const M=y[y.length-1],C=g.pos+b.lastIndexOf(M);if(!M)return!1;const D=K5(M).map(L=>L.toObject(n.defaultProtocol));if(!UI(D))return!1;D.filter(L=>L.isLink).map(L=>({...L,from:C+L.start+1,to:C+L.end+1})).filter(L=>r.schema.marks.code?!r.doc.rangeHasMark(L.from,L.to,r.schema.marks.code):!0).filter(L=>n.validate(L.value)).filter(L=>n.shouldAutoLink(L.value)).forEach(L=>{F5(L.from,L.to,r.doc).some(H=>H.mark.type===n.type)||l.addMark(L.from,L.to,n.type.create({href:L.href}))})}}),!!l.steps.length)return l}})}function qI(n){return new Oi({key:new Eo("handleClickLink"),props:{handleClick:(t,e,r)=>{var i,s;if(r.button!==0||!t.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{const f=r.target;if(!f)return!1;const d=n.editor.view.dom;l=f.closest("a"),l&&!d.contains(l)&&(l=null)}if(!l)return!1;let c=!1;if(n.enableClickSelection&&(c=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const f=OM(t.state,n.type.name),d=(i=l.href)!=null?i:f.href,p=(s=l.target)!=null?s:f.target;d&&(window.open(d,p),c=!0)}return c}}})}function YI(n){return new Oi({key:new Eo("handlePasteLink"),props:{handlePaste:(t,e,r)=>{const{shouldAutoLink:i}=n,{state:s}=t,{selection:l}=s,{empty:c}=l;if(c)return!1;let f="";r.content.forEach(p=>{f+=p.textContent});const d=fC(f,{defaultProtocol:n.defaultProtocol}).find(p=>p.isLink&&p.value===f);return!f||!d||i!==void 0&&!i(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function Df(n,t){const e=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&e.push(i)}),!n||n.replace(FI,"").match(new RegExp(`^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var $I=xf.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){D3(n);return}D3(n.scheme,n.optionalSlashes)})},onDestroy(){II()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,t)=>!!Df(n,t.protocols),validate:n=>!!n,shouldAutoLink:n=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),e=/^[a-z][a-z0-9+.-]*:/i.test(n);if(t||e&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const t=n.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Df(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:t=>!!Df(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",mo(this.options.HTMLAttributes,n),0]:["a",mo(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,t)=>t.applyMark("link",t.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,t)=>{var e,r,i,s;const l=(r=(e=n.attrs)==null?void 0:e.href)!=null?r:"",c=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"",f=t.renderChildren(n);return c?`[${f}](${l} "${c}")`:`[${f}](${l})`},addCommands(){return{setLink:n=>({chain:t})=>{const{href:e}=n;return this.options.isAllowedUri(e,{defaultValidate:r=>!!Df(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:t})=>{const{href:e}=n||{};return e&&!this.options.isAllowedUri(e,{defaultValidate:r=>!!Df(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[id({find:n=>{const t=[];if(n){const{protocols:e,defaultProtocol:r}=this.options,i=fC(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Df(l,e),protocols:e,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&t.push({text:s.value,data:{href:s.href},index:s.start})})}return t},type:this.type,getAttributes:n=>{var t;return{href:(t=n.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:t,defaultProtocol:e}=this.options;return this.options.autolink&&n.push(HI({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Df(i,t),protocols:t,defaultProtocol:e}),shouldAutoLink:this.options.shouldAutoLink})),n.push(qI({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(YI({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),VI=Object.defineProperty,WI=(n,t)=>{for(var e in t)VI(n,e,{get:t[e],enumerable:!0})},XI="listItem",L3="textStyle",R3=/^\s*([-+*])\s$/,dC=Za.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,t)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?t.parseChildren(n.items):[]},renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
217
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(XI,this.editor.getAttributes(L3)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=nh({find:R3,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=nh({find:R3,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(L3),editor:this.editor})),[n]}}),hC=Za.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,t)=>{if(n.type!=="list_item")return[];let e=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))e=t.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(e=[{type:"paragraph",content:t.parseInline(i.tokens)}],n.tokens.length>1){const l=n.tokens.slice(1),c=t.parseChildren(l);e.push(...c)}}else e=t.parseChildren(n.tokens)}return e.length===0&&(e=[{type:"paragraph",content:[]}]),{type:"listItem",content:e}},renderMarkdown:(n,t,e)=>qM(n,t,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},e),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),GI={};WI(GI,{findListItemPos:()=>Rp,getNextListDepth:()=>Z5,handleBackspace:()=>e5,handleDelete:()=>n5,hasListBefore:()=>pC,hasListItemAfter:()=>KI,hasListItemBefore:()=>mC,listItemHasSubList:()=>gC,nextListIsDeeper:()=>yC,nextListIsHigher:()=>bC});var Rp=(n,t)=>{const{$from:e}=t.selection,r=Co(n,t.schema);let i=null,s=e.depth,l=e.pos,c=null;for(;s>0&&c===null;)i=e.node(s),i.type===r?c=s:(s-=1,l-=1);return c===null?null:{$pos:t.doc.resolve(l),depth:c}},Z5=(n,t)=>{const e=Rp(n,t);if(!e)return!1;const[,r]=_O(t,n,e.$pos.pos+4);return r},pC=(n,t,e)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!e.includes(s.type.name))},mC=(n,t)=>{var e;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return!(i.index()===0||((e=i.nodeBefore)==null?void 0:e.type.name)!==n)},gC=(n,t,e)=>{if(!e)return!1;const r=Co(n,t.schema);let i=!1;return e.descendants(s=>{s.type===r&&(i=!0)}),i},e5=(n,t,e)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!gf(n.state,t)&&pC(n.state,t,e)){const{$anchor:c}=n.state.selection,f=n.state.doc.resolve(c.before()-1),d=[];f.node().descendants((b,y)=>{b.type.name===t&&d.push({node:b,pos:y})});const p=d.at(-1);if(!p)return!1;const g=n.state.doc.resolve(f.start()+p.pos+1);return n.chain().cut({from:c.start()-1,to:c.end()+1},g.end()).joinForward().run()}if(!gf(n.state,t)||!OO(n.state))return!1;const r=Rp(t,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=gC(t,n.state,s);return mC(t,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(t).run()},yC=(n,t)=>{const e=Z5(n,t),r=Rp(n,t);return!r||!e?!1:e>r.depth},bC=(n,t)=>{const e=Z5(n,t),r=Rp(n,t);return!r||!e?!1:e<r.depth},n5=(n,t)=>{if(!gf(n.state,t)||!RO(n.state,t))return!1;const{selection:e}=n.state,{$from:r,$to:i}=e;return!e.empty&&r.sameParent(i)?!1:yC(t,n.state)?n.chain().focus(n.state.selection.from+4).lift(t).joinBackward().run():bC(t,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},KI=(n,t)=>{var e;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((e=i.nodeAfter)==null?void 0:e.type.name)!==n)},xC=ci.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e})=>{n.state.schema.nodes[e]!==void 0&&n5(n,e)&&(t=!0)}),t},"Mod-Delete":({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e})=>{n.state.schema.nodes[e]!==void 0&&n5(n,e)&&(t=!0)}),t},Backspace:({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e,wrapperNames:r})=>{n.state.schema.nodes[e]!==void 0&&e5(n,e,r)&&(t=!0)}),t},"Mod-Backspace":({editor:n})=>{let t=!1;return this.options.listTypes.forEach(({itemName:e,wrapperNames:r})=>{n.state.schema.nodes[e]!==void 0&&e5(n,e,r)&&(t=!0)}),t}}}}),O3=/^(\s*)(\d+)\.\s+(.*)$/,JI=/^\s/;function ZI(n){const t=[];let e=0,r=0;for(;e<n.length;){const i=n[e],s=i.match(O3);if(!s)break;const[,l,c,f]=s,d=l.length;let p=f,g=e+1;const b=[i];for(;g<n.length;){const y=n[g];if(y.match(O3))break;if(y.trim()==="")b.push(y),p+=`
218
- `,g+=1;else if(y.match(JI))b.push(y),p+=`
219
- ${y.slice(d+2)}`,g+=1;else break}t.push({indent:d,number:parseInt(c,10),content:p.trim(),raw:b.join(`
220
- `)}),r=g,e=g}return[t,r]}function vC(n,t,e){var r;const i=[];let s=0;for(;s<n.length;){const l=n[s];if(l.indent===t){const c=l.content.split(`
221
- `),f=((r=c[0])==null?void 0:r.trim())||"",d=[];f&&d.push({type:"paragraph",raw:f,tokens:e.inlineTokens(f)});const p=c.slice(1).join(`
222
- `).trim();if(p){const y=e.blockTokens(p);d.push(...y)}let g=s+1;const b=[];for(;g<n.length&&n[g].indent>t;)b.push(n[g]),g+=1;if(b.length>0){const y=Math.min(...b.map(C=>C.indent)),M=vC(b,y,e);d.push({type:"list",ordered:!0,start:b[0].number,items:M,raw:b.map(C=>C.raw).join(`
223
- `)})}i.push({type:"list_item",raw:l.raw,tokens:d}),s=g}else s+=1}return i}function QI(n,t){return n.map(e=>{if(e.type!=="list_item")return t.parseChildren([e])[0];const r=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...t.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=t.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=t.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var tj="listItem",P3="textStyle",I3=/^(\d+)\.\s$/,wC=Za.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:t,...e}=n;return t===1?["ol",mo(this.options.HTMLAttributes,e),0]:["ol",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,t)=>{if(n.type!=="list"||!n.ordered)return[];const e=n.start||1,r=n.items?QI(n.items,t):[];return e!==1?{type:"orderedList",attrs:{start:e},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
224
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const t=n.match(/^(\s*)(\d+)\.\s+/),e=t?.index;return e!==void 0?e:-1},tokenize:(n,t,e)=>{var r;const i=n.split(`
225
- `),[s,l]=ZI(i);if(s.length===0)return;const c=vC(s,0,e);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:c,raw:i.slice(0,l).join(`
226
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tj,this.editor.getAttributes(P3)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=nh({find:I3,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=nh({find:I3,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(P3)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[n]}}),ej=/^\s*(\[([( |x])?\])\s$/,nj=Za.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const t=n.getAttribute("data-checked");return t===""||t==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:t}){return["li",mo(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,t)=>{const e=[];if(n.tokens&&n.tokens.length>0?e.push(t.createNode("paragraph",{},t.parseInline(n.tokens))):n.text?e.push(t.createNode("paragraph",{},[t.createNode("text",{text:n.text})])):e.push(t.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=t.parseChildren(n.nestedTokens);e.push(...r)}return t.createNode("taskItem",{checked:n.checked||!1},e)},renderMarkdown:(n,t)=>{var e;const i=`- [${(e=n.attrs)!=null&&e.checked?"x":" "}] `;return qM(n,t,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:t,getPos:e,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),c=document.createElement("input"),f=document.createElement("div"),d=g=>{var b,y;c.ariaLabel=((y=(b=this.options.a11y)==null?void 0:b.checkboxLabel)==null?void 0:y.call(b,g,c.checked))||`Task item checkbox for ${g.textContent||"empty task item"}`};d(n),s.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",g=>g.preventDefault()),c.addEventListener("change",g=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:b}=g.target;r.isEditable&&typeof e=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const M=e();if(typeof M!="number")return!1;const C=y.doc.nodeAt(M);return y.setNodeMarkup(M,void 0,{...C?.attrs,checked:b}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,b)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([g,b])=>{i.setAttribute(g,b)}),i.dataset.checked=n.attrs.checked,c.checked=n.attrs.checked,s.append(c,l),i.append(s,f),Object.entries(t).forEach(([g,b])=>{i.setAttribute(g,b)});let p=new Set(Object.keys(t));return{dom:i,contentDOM:f,update:g=>{if(g.type!==this.type)return!1;i.dataset.checked=g.attrs.checked,c.checked=g.attrs.checked,d(g);const b=r.extensionManager.attributes,y=kp(g,b),M=new Set(Object.keys(y)),C=this.options.HTMLAttributes;return p.forEach(D=>{M.has(D)||(D in C?i.setAttribute(D,C[D]):i.removeAttribute(D))}),Object.entries(y).forEach(([D,L])=>{L==null?D in C?i.setAttribute(D,C[D]):i.removeAttribute(D):i.setAttribute(D,L)}),p=M,!0}}}},addInputRules(){return[nh({find:ej,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),rj=Za.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",mo(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,t)=>t.createNode("taskList",{},t.parseChildren(n.items||[])),renderMarkdown:(n,t)=>n.content?t.renderChildren(n.content,`
227
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var t;const e=(t=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return e!==void 0?e:-1},tokenize(n,t,e){const r=s=>{const l=g3(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,f)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:e.inlineTokens(c.mainContent),nestedTokens:f}),customNestedParser:r},e);return l?[{type:"taskList",raw:l.raw,items:l.items}]:e.blockTokens(s)},i=g3(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,l)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:e.inlineTokens(s.mainContent),nestedTokens:l}),customNestedParser:r},e);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ci.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(dC.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(hC.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(xC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(wC.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(nj.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(rj.configure(this.options.taskList)),n}});var j3="&nbsp;",ij=" ",oj=Za.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",mo(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,t)=>{const e=n.tokens||[];if(e.length===1&&e[0].type==="image")return t.parseChildren([e[0]]);const r=t.parseInline(e);return r.length===1&&r[0].type==="text"&&(r[0].text===j3||r[0].text===ij)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(n,t)=>{if(!n)return"";const e=Array.isArray(n.content)?n.content:[];return e.length===0?j3:t.renderChildren(e)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sj=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aj=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lj=xf.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",mo(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,t)=>t.applyMark("strike",t.parseInline(n.tokens||[])),renderMarkdown:(n,t)=>`~~${t.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[eh({find:sj,type:this.type})]},addPasteRules(){return[id({find:aj,type:this.type})]}}),cj=Za.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),uj=xf.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",mo(this.options.HTMLAttributes,n),0]},parseMarkdown(n,t){return t.applyMark(this.name||"underline",t.parseInline(n.tokens||[]))},renderMarkdown(n,t){return`++${t.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,t,e){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:e.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function fj(n={}){return new Oi({view(t){return new dj(t,n)}})}class dj{constructor(t,e){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=e.width)!==null&&r!==void 0?r:1,this.color=e.color===!1?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=l=>{this[i](l)};return t.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e))}update(t,e){this.cursorPos!=null&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),e=!t.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),l=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(e){let g=t.nodeBefore,b=t.nodeAfter;if(g||b){let y=this.editorView.nodeDOM(this.cursorPos-(g?g.nodeSize:0));if(y){let M=y.getBoundingClientRect(),C=g?M.bottom:M.top;g&&b&&(C=(C+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let D=this.width/2*c;r={left:M.left,right:M.right,top:C-D,bottom:C+D}}}}if(!r){let g=this.editorView.coordsAtPos(this.cursorPos),b=this.width/2*l;r={left:g.left-b,right:g.left+b,top:g.top,bottom:g.bottom}}let f=this.editorView.dom.offsetParent;this.element||(this.element=f.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",e),this.element.classList.toggle("prosemirror-dropcursor-inline",!e);let d,p;if(!f||f==document.body&&getComputedStyle(f).position=="static")d=-pageXOffset,p=-pageYOffset;else{let g=f.getBoundingClientRect(),b=g.width/f.offsetWidth,y=g.height/f.offsetHeight;d=g.left-f.scrollLeft*b,p=g.top-f.scrollTop*y}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,e,t):i;if(e&&!s){let l=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=hA(this.editorView.state.doc,l,this.editorView.dragging.slice);c!=null&&(l=c)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class Qi extends Qn{constructor(t){super(t,t)}map(t,e){let r=t.resolve(e.map(this.head));return Qi.valid(r)?new Qi(r):Qn.near(r)}content(){return Ke.empty}eq(t){return t instanceof Qi&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Qi(t.resolve(e.pos))}getBookmark(){return new Q5(this.anchor)}static valid(t){let e=t.parent;if(e.inlineContent||!hj(t)||!pj(t))return!1;let r=e.type.spec.allowGapCursor;if(r!=null)return r;let i=e.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,e,r=!1){t:for(;;){if(!r&&Qi.valid(t))return t;let i=t.pos,s=null;for(let l=t.depth;;l--){let c=t.node(l);if(e>0?t.indexAfter(l)<c.childCount:t.index(l)>0){s=c.child(e>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;i+=e;let f=t.doc.resolve(i);if(Qi.valid(f))return f}for(;;){let l=e>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Cn.isSelectable(s)){t=t.doc.resolve(i+s.nodeSize*e),r=!1;continue t}break}s=l,i+=e;let c=t.doc.resolve(i);if(Qi.valid(c))return c}return null}}}Qi.prototype.visible=!1;Qi.findFrom=Qi.findGapCursorFrom;Qn.jsonID("gapcursor",Qi);class Q5{constructor(t){this.pos=t}map(t){return new Q5(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return Qi.valid(e)?new Qi(e):Qn.near(e)}}function SC(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function hj(n){for(let t=n.depth;t>=0;t--){let e=n.index(t),r=n.node(t);if(e==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(e-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||SC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function pj(n){for(let t=n.depth;t>=0;t--){let e=n.indexAfter(t),r=n.node(t);if(e==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(e);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||SC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function mj(){return new Oi({props:{decorations:xj,createSelectionBetween(n,t,e){return t.pos==e.pos&&Qi.valid(e)?new Qi(e):null},handleClick:yj,handleKeyDown:gj,handleDOMEvents:{beforeinput:bj}}})}const gj=yM({ArrowLeft:Ym("horiz",-1),ArrowRight:Ym("horiz",1),ArrowUp:Ym("vert",-1),ArrowDown:Ym("vert",1)});function Ym(n,t){const e=n=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,i,s){let l=r.selection,c=t>0?l.$to:l.$from,f=l.empty;if(l instanceof Rn){if(!s.endOfTextblock(e)||c.depth==0)return!1;f=!1,c=r.doc.resolve(t>0?c.after():c.before())}let d=Qi.findGapCursorFrom(c,t,f);return d?(i&&i(r.tr.setSelection(new Qi(d))),!0):!1}}function yj(n,t,e){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(t);if(!Qi.valid(r))return!1;let i=n.posAtCoords({left:e.clientX,top:e.clientY});return i&&i.inside>-1&&Cn.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Qi(r))),!0)}function bj(n,t){if(t.inputType!="insertCompositionText"||!(n.state.selection instanceof Qi))return!1;let{$from:e}=n.state.selection,r=e.parent.contentMatchAt(e.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=Ce.empty;for(let l=r.length-1;l>=0;l--)i=Ce.from(r[l].createAndFill(null,i));let s=n.state.tr.replace(e.pos,e.pos,new Ke(i,0,0));return s.setSelection(Rn.near(s.doc.resolve(e.pos+1))),n.dispatch(s),!1}function xj(n){if(!(n.selection instanceof Qi))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Jr.create(n.doc,[sa.widget(n.selection.head,t,{key:"gapcursor"})])}var i0=200,Wo=function(){};Wo.prototype.append=function(t){return t.length?(t=Wo.from(t),!this.length&&t||t.length<i0&&this.leafAppend(t)||this.length<i0&&t.leafPrepend(this)||this.appendInner(t)):this};Wo.prototype.prepend=function(t){return t.length?Wo.from(t).append(this):this};Wo.prototype.appendInner=function(t){return new vj(this,t)};Wo.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Wo.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Wo.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Wo.prototype.forEach=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length),e<=r?this.forEachInner(t,e,r,0):this.forEachInvertedInner(t,e,r,0)};Wo.prototype.map=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,l){return i.push(t(s,l))},e,r),i};Wo.from=function(t){return t instanceof Wo?t:t&&t.length?new kC(t):Wo.empty};var kC=(function(n){function t(r){n.call(this),this.values=r}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new t(this.values.slice(i,s))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,s,l,c){for(var f=s;f<l;f++)if(i(this.values[f],c+f)===!1)return!1},t.prototype.forEachInvertedInner=function(i,s,l,c){for(var f=s-1;f>=l;f--)if(i(this.values[f],c+f)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=i0)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=i0)return new t(i.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t})(Wo);Wo.empty=new kC([]);var vj=(function(n){function t(e,r){n.call(this),this.left=e,this.right=r,this.length=e.length+r.length,this.depth=Math.max(e.depth,r.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,i,s,l){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),l)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,l+c)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,s,l){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,l+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),s,l)===!1)return!1},t.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t})(Wo);const wj=500;class ec{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;e&&(i=this.remapping(r,this.items.length),s=i.maps.length);let l=t.tr,c,f,d=[],p=[];return this.items.forEach((g,b)=>{if(!g.step){i||(i=this.remapping(r,b+1),s=i.maps.length),s--,p.push(g);return}if(i){p.push(new Rc(g.map));let y=g.step.map(i.slice(s)),M;y&&l.maybeStep(y).doc&&(M=l.mapping.maps[l.mapping.maps.length-1],d.push(new Rc(M,void 0,void 0,d.length+p.length))),s--,M&&i.appendMap(M,s)}else l.maybeStep(g.step);if(g.selection)return c=i?g.selection.map(i.slice(s)):g.selection,f=new ec(this.items.slice(0,r).append(p.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:l,selection:c}}addTransform(t,e,r,i){let s=[],l=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<t.steps.length;p++){let g=t.steps[p].invert(t.docs[p]),b=new Rc(t.mapping.maps[p],g,e),y;(y=f&&f.merge(b))&&(b=y,p?s.pop():c=c.slice(0,c.length-1)),s.push(b),e&&(l++,e=void 0),i||(f=b)}let d=l-r.depth;return d>kj&&(c=Sj(c,d),l-=d),new ec(c.append(s),l)}remapping(t,e){let r=new bp;return this.items.forEach((i,s)=>{let l=i.mirrorOffset!=null&&s-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},t,e),r}addMaps(t){return this.eventCount==0?this:new ec(this.items.append(t.map(e=>new Rc(e))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-e),s=t.mapping,l=t.steps.length,c=this.eventCount;this.items.forEach(b=>{b.selection&&c--},i);let f=e;this.items.forEach(b=>{let y=s.getMirror(--f);if(y==null)return;l=Math.min(l,y);let M=s.maps[y];if(b.step){let C=t.steps[y].invert(t.docs[y]),D=b.selection&&b.selection.map(s.slice(f+1,y));D&&c++,r.push(new Rc(M,C,D))}else r.push(new Rc(M))},i);let d=[];for(let b=e;b<l;b++)d.push(new Rc(s.maps[b]));let p=this.items.slice(0,i).append(d).append(r),g=new ec(p,c);return g.emptyItemCount()>wj&&(g=g.compress(this.items.length-r.length)),g}emptyItemCount(){let t=0;return this.items.forEach(e=>{e.step||t++}),t}compress(t=this.items.length){let e=this.remapping(0,t),r=e.maps.length,i=[],s=0;return this.items.forEach((l,c)=>{if(c>=t)i.push(l),l.selection&&s++;else if(l.step){let f=l.step.map(e.slice(r)),d=f&&f.getMap();if(r--,d&&e.appendMap(d,r),f){let p=l.selection&&l.selection.map(e.slice(r));p&&s++;let g=new Rc(d.invert(),f,p),b,y=i.length-1;(b=i.length&&i[y].merge(g))?i[y]=b:i.push(g)}}else l.map&&r--},this.items.length,0),new ec(Wo.from(i.reverse()),s)}}ec.empty=new ec(Wo.empty,0);function Sj(n,t){let e;return n.forEach((r,i)=>{if(r.selection&&t--==0)return e=i,!1}),n.slice(e)}class Rc{constructor(t,e,r,i){this.map=t,this.step=e,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Rc(e.getMap().invert(),e,this.selection)}}}class rf{constructor(t,e,r,i,s){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const kj=20;function Aj(n,t,e,r){let i=e.getMeta(Xf),s;if(i)return i.historyState;e.getMeta(Ej)&&(n=new rf(n.done,n.undone,null,0,-1));let l=e.getMeta("appendedTransaction");if(e.steps.length==0)return n;if(l&&l.getMeta(Xf))return l.getMeta(Xf).redo?new rf(n.done.addTransform(e,void 0,r,cg(t)),n.undone,B3(e.mapping.maps),n.prevTime,n.prevComposition):new rf(n.done,n.undone.addTransform(e,void 0,r,cg(t)),null,n.prevTime,n.prevComposition);if(e.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=e.getMeta("composition"),f=n.prevTime==0||!l&&n.prevComposition!=c&&(n.prevTime<(e.time||0)-r.newGroupDelay||!Mj(e,n.prevRanges)),d=l?Fy(n.prevRanges,e.mapping):B3(e.mapping.maps);return new rf(n.done.addTransform(e,f?t.selection.getBookmark():void 0,r,cg(t)),ec.empty,d,e.time,c??n.prevComposition)}else return(s=e.getMeta("rebased"))?new rf(n.done.rebased(e,s),n.undone.rebased(e,s),Fy(n.prevRanges,e.mapping),n.prevTime,n.prevComposition):new rf(n.done.addMaps(e.mapping.maps),n.undone.addMaps(e.mapping.maps),Fy(n.prevRanges,e.mapping),n.prevTime,n.prevComposition)}function Mj(n,t){if(!t)return!1;if(!n.docChanged)return!0;let e=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<t.length;s+=2)r<=t[s+1]&&i>=t[s]&&(e=!0)}),e}function B3(n){let t=[];for(let e=n.length-1;e>=0&&t.length==0;e--)n[e].forEach((r,i,s,l)=>t.push(s,l));return t}function Fy(n,t){if(!n)return null;let e=[];for(let r=0;r<n.length;r+=2){let i=t.map(n[r],1),s=t.map(n[r+1],-1);i<=s&&e.push(i,s)}return e}function Cj(n,t,e){let r=cg(t),i=Xf.get(t).spec.config,s=(e?n.undone:n.done).popEvent(t,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(e?n.done:n.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),f=new rf(e?c:s.remaining,e?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(Xf,{redo:e,historyState:f})}let Uy=!1,z3=null;function cg(n){let t=n.plugins;if(z3!=t){Uy=!1,z3=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Uy=!0;break}}return Uy}const Xf=new Eo("history"),Ej=new Eo("closeHistory");function Tj(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Oi({key:Xf,state:{init(){return new rf(ec.empty,ec.empty,null,0,-1)},apply(t,e,r){return Aj(e,r,t,n)}},config:n,props:{handleDOMEvents:{beforeinput(t,e){let r=e.inputType,i=r=="historyUndo"?MC:r=="historyRedo"?CC:null;return!i||!t.editable?!1:(e.preventDefault(),i(t.state,t.dispatch))}}}})}function AC(n,t){return(e,r)=>{let i=Xf.getState(e);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=Cj(i,e,n);s&&r(t?s.scrollIntoView():s)}return!0}}const MC=AC(!1,!0),CC=AC(!0,!0);ci.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const t=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=n=>{const t=n?.node||this.editor.state.doc,e=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(e)}},addProseMirrorPlugins(){let n=!1;return[new Oi({key:new Eo("characterCount"),appendTransaction:(t,e,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const l=s-i,c=0,f=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,f);return n=!0,d}n=!0},filterTransaction:(t,e)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:e.doc}),s=this.storage.characters({node:t.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!t.getMeta("paste"))return!1;const c=t.selection.$head.pos,f=s-r,d=c-f,p=c;return t.deleteRange(d,p),!(this.storage.characters({node:t.doc})>r)}})]}});var Nj=ci.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[fj(this.options)]}});ci.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oi({key:new Eo("focus"),props:{decorations:({doc:n,selection:t})=>{const{isEditable:e,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!e||!r)return Jr.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((f,d)=>{if(f.isText)return;if(!(i>=d&&i<=d+f.nodeSize-1))return!1;l+=1});let c=0;return n.descendants((f,d)=>{if(f.isText||!(i>=d&&i<=d+f.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&l-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";s.push(sa.node(d,d+f.nodeSize,{class:this.options.className}))}),Jr.create(n,s)}}})]}});var _j=ci.create({name:"gapCursor",addProseMirrorPlugins(){return[mj()]},extendNodeSchema(n){var t;const e={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(t=Pr(yn(n,"allowGapCursor",e)))!=null?t:null}}}),F3="placeholder";function Dj(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}ci.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:F3,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${Dj(this.options.dataAttribute)}`:`data-${F3}`;return[new Oi({key:new Eo("placeholder"),props:{decorations:({doc:t,selection:e})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!r)return null;const l=this.editor.isEmpty;return t.descendants((c,f)=>{const d=i>=f&&i<=f+c.nodeSize,p=!c.isLeaf&&v0(c);if((d||!this.options.showOnlyCurrent)&&p){const g=[this.options.emptyNodeClass];l&&g.push(this.options.emptyEditorClass);const b=sa.node(f,f+c.nodeSize,{class:g.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:f,hasAnchor:d}):this.options.placeholder});s.push(b)}return this.options.includeChildren}),Jr.create(t,s)}}})]}});ci.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:t}=this;return[new Oi({key:new Eo("selection"),props:{decorations(e){return e.selection.empty||n.isFocused||!n.isEditable||PM(e.selection)||n.view.dragging?null:Jr.create(e.doc,[sa.inline(e.selection.from,e.selection.to,{class:t.className})])}}})]}});function U3({types:n,node:t}){return t&&Array.isArray(n)&&n.includes(t.type)||t?.type===n}var Lj=ci.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const t=new Eo(this.name),e=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(e).includes(i.name));return[new Oi({key:t,appendTransaction:(i,s,l)=>{const{doc:c,tr:f,schema:d}=l,p=t.getState(l),g=c.content.size,b=d.nodes[e];if(p)return f.insert(g,b.create())},state:{init:(i,s)=>{const l=s.tr.doc.lastChild;return!U3({node:l,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const l=i.doc.lastChild;return!U3({node:l,types:r})}}})]}}),Rj=ci.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:t})=>MC(n,t),redo:()=>({state:n,dispatch:t})=>CC(n,t)}},addProseMirrorPlugins(){return[Tj(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Oj=ci.create({name:"starterKit",addExtensions(){var n,t,e,r;const i=[];return this.options.bold!==!1&&i.push(oI.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(tI.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(dC.configure(this.options.bulletList)),this.options.code!==!1&&i.push(lI.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(fI.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(dI.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Nj.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(_j.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(hI.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(pI.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Rj.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(mI.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(vI.configure(this.options.italic)),this.options.listItem!==!1&&i.push(hC.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(xC.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push($I.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&i.push(wC.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(oj.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(lj.configure(this.options.strike)),this.options.text!==!1&&i.push(cj.configure(this.options.text)),this.options.underline!==!1&&i.push(uj.configure((e=this.options)==null?void 0:e.underline)),this.options.trailingNode!==!1&&i.push(Lj.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Pj=Oj,Ij=20,EC=(n,t=0)=>{const e=[];return!n.children.length||t>Ij||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?e.push(r):r.children.length&&e.push(...EC(r,t+1))}),e},jj=n=>{if(!n.children.length)return;const t=EC(n);t&&t.forEach(e=>{var r,i;const s=e.getAttribute("style"),l=(i=(r=e.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");e.setAttribute("style",`${l};${s}`)})},TC=xf.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&jj(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",mo(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:t})=>t.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:t}=n;return n.doc.nodesBetween(t.from,t.to,(e,r)=>{if(e.isTextblock)return!0;e.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||n.removeMark(r,r+e.nodeSize,this.type)}),!0}}}}),Bj=ci.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var t;const e=n.getAttribute("style");if(e){const r=e.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),c=s.slice(1).join(":").trim();if(l==="background-color")return c.replace(/['"]+/g,"")}}}return(t=n.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:t})=>t().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),zj=ci.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var t;const e=n.getAttribute("style");if(e){const r=e.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),c=s.slice(1).join(":").trim();if(l==="color")return c.replace(/['"]+/g,"")}}}return(t=n.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:t})=>t().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Fj=ci.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:t})=>t().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Uj=ci.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:t})=>t().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Hj=ci.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:t})=>t().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ci.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(Bj.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(zj.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(Fj.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(Uj.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(Hj.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(TC.configure(this.options.textStyle)),n}});const oe={pasteInCallout:{id:"pasteInCallout",label:"Вставити з буфера",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"V"}]},newImage:{id:"newImage",label:"Нове зображення",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"N"}]},replaceBackground:{id:"replaceBackground",label:"Замінити фон",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"B"}]},toolPoint:{id:"toolPoint",label:"Точка",keys:[{kind:"key",value:"1"}]},toolNumbering:{id:"toolNumbering",label:"Нумерація",keys:[{kind:"key",value:"0"}]},toolRegion:{id:"toolRegion",label:"Район",keys:[{kind:"key",value:"2"}]},toolRoute:{id:"toolRoute",label:"Маршрут",keys:[{kind:"key",value:"3"}]},toolRectangle:{id:"toolRectangle",label:"Прямокутник",keys:[{kind:"key",value:"4"}]},toolEllipse:{id:"toolEllipse",label:"Еліпс",keys:[{kind:"key",value:"5"}]},toolArrow:{id:"toolArrow",label:"Стрілка",keys:[{kind:"key",value:"6"}]},toolText:{id:"toolText",label:"Текст",keys:[{kind:"key",value:"7"}]},toolPointText:{id:"toolPointText",label:"Точка з текстом",keys:[{kind:"key",value:"P"}]},toolImageObject:{id:"toolImageObject",label:"Додати зображення",keys:[{kind:"key",value:"I"}]},toolRedact:{id:"toolRedact",label:"Замалювати ділянку фону",keys:[{kind:"key",value:"R"}]},toolDateTime:{id:"toolDateTime",label:"Дата/час",keys:[{kind:"key",value:"8"}]},toolStandaloneCallout:{id:"toolStandaloneCallout",label:"Блок виноски",keys:[{kind:"key",value:"9"}]},toolCompass:{id:"toolCompass",label:"Компас",keys:[{kind:"key",value:"K"}]},toolCrop:{id:"toolCrop",label:"Кадрування (Crop)",keys:[{kind:"key",value:"C"}]},zoomIn:{id:"zoomIn",label:"Наблизити",keys:[{kind:"plusMinus",value:"+"}]},zoomOut:{id:"zoomOut",label:"Віддалити",keys:[{kind:"plusMinus",value:"-"}]},fitToWindow:{id:"fitToWindow",label:"Припасувати розмір",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"O"}]},undo:{id:"undo",label:"Відмінити",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"Z"}]},redo:{id:"redo",label:"Повернути",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"Z"}]},downloadJpg:{id:"downloadJpg",label:"Завантажити JPG",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"D"}]},openExportMenu:{id:"openExportMenu",label:"Інші опції збереження",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"D"}]},exportMenuChooseByNumber:{id:"exportMenuChooseByNumber",label:"Вибір пункту меню цифрою",keys:[{kind:"digits",value:"1…9"}]},calloutBold:{id:"calloutBold",label:"Жирний текст",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"B"}]},calloutItalic:{id:"calloutItalic",label:"Курсив",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"I"}]},calloutUnderline:{id:"calloutUnderline",label:"Підкреслення",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"U"}]},calloutStrike:{id:"calloutStrike",label:"Закреслення",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"S"}]},calloutFontSizeDown:{id:"calloutFontSizeDown",label:"Менший шрифт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"-"}]},calloutFontSizeUp:{id:"calloutFontSizeUp",label:"Більший шрифт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"="}]},calloutAddText:{id:"calloutAddText",label:"Додати текст",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"T"}]},calloutAddImage:{id:"calloutAddImage",label:"Додати / змінити фото",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"I"}]},calloutRemoveText:{id:"calloutRemoveText",label:"Прибрати текст",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"X"}]},calloutRemoveImage:{id:"calloutRemoveImage",label:"Прибрати фото",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"E"}]},calloutToggleDescPos:{id:"calloutToggleDescPos",label:"Текст вгору / вниз",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"P"}]},calloutToggleTheme:{id:"calloutToggleTheme",label:"Світлий / темний фон",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"L"}]},calloutDelete:{id:"calloutDelete",label:"Видалити виноску",keys:[{kind:"key",value:"Delete"}]},calloutBringForward:{id:"calloutBringForward",label:"На рівень вище",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"]"}]},calloutSendBackward:{id:"calloutSendBackward",label:"На рівень нижче",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"["}]},calloutBringToFront:{id:"calloutBringToFront",label:"На передній план",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"]"}]},calloutSendToBack:{id:"calloutSendToBack",label:"На задній план",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"["}]},objectCopy:{id:"objectCopy",label:"Копіювати обʼєкт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"C"}]},objectDuplicate:{id:"objectDuplicate",label:"Дублювати обʼєкт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"J"}]},objectPaste:{id:"objectPaste",label:"Вставити обʼєкт",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"V"}]}};function rh(){return/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function mn(n,t){const e=t?.isMac??rh();return n.keys.map(i=>i.kind==="cmdOrCtrl"?e?"⌘":"Ctrl":i.kind==="shift"?e?"⇧":"Shift":i.kind==="plusMinus"||i.kind==="digits"?i.value:i.value.toUpperCase()).join(e?"":"+")}function Ai(n,t){const e=t?.isMac??rh();return n.keys.map(r=>r.kind==="cmdOrCtrl"?e?"⌘":"Ctrl":r.kind==="shift"?e?"⇧":"Shift":r.kind==="plusMinus"||r.kind==="digits"?r.value:r.value.toUpperCase())}const Xa={minWidth:16,height:16,paddingV:0,paddingH:4,borderRadius:4,fontSize:11,translateY:-.5},H3={display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:Xa.minWidth,height:Xa.height,padding:`0 ${Xa.paddingH}px`,borderRadius:Xa.borderRadius,border:"1px solid rgba(255,255,255,0.2)",background:"rgba(255,255,255,0.06)",color:"rgba(255,255,255,0.6)",fontSize:Xa.fontSize,fontWeight:900,lineHeight:1,letterSpacing:"0.02em",transform:`translateY(${Xa.translateY}px)`,userSelect:"none",boxShadow:"0 1px 0 0 rgba(255,255,255,0.2)"};function tc({children:n,title:t,scale:e=1}){const r=e,i=r===1?H3:{...H3,minWidth:Xa.minWidth*r,height:Xa.height*r,padding:`${Xa.paddingV*r}px ${Xa.paddingH*r}px`,borderRadius:Xa.borderRadius*r,fontSize:Xa.fontSize*r,transform:`translateY(${Xa.translateY*r}px)`};return T.jsx("span",{style:i,title:t,children:n})}const o0="tyts-callout-insert-plain-text";function qj(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Si="bi",On=Zr*f5,ki=Math.round(12*On),Yj=8,Ku=18*On,NC=5*On,$j=Math.max(NC,18*On),Vj=1.5*On,Wj="#1a1a2e",Xj=.45,Gj="rgba(0,0,0,0.001)",q3="blur(12px)",Kj=2*On,Jj=2*On,Zj="88",Y3="33",Qj=10*On,tB="1.5em",eB="#d0d0d0",nB="#111111",rB="rgba(10,10,16,0.88)",iB="rgba(245,245,250,0.98)",$3=4*On,oB=4*On,sB=`${2*On}px ${6*On}px`,aB=10*On,lB=4*On,cB="rgba(0,0,0,0.6)",uB="#ddd",A0="rgba(255,255,255,0.08)",tb="1px solid rgba(255,255,255,0.18)",_C="#ccc",fB="rgba(230,57,70,0.1)",dB="1px solid rgba(230,57,70,0.8)",r5="#ff6b6b",M0=4*On,C0=14*On,hB=`${3*On}px ${8*On}px`,V3=8*On,pB=14*On,mB="#888",gB=8*On,yB=12*On,bB="rgba(255,255,255,0.5)",xB=2,vB=1*On,W3={background:A0,border:tb,color:_C,cursor:"pointer",borderRadius:M0,fontSize:C0,padding:hB,fontFamily:"inherit",display:"inline-flex",alignItems:"center",gap:6*On},X3=10*On,G3=8*On,wB=8*On,SB=4*On,kB=12*On,AB="rgba(20,20,32,0.95)",MB="1px solid rgba(60,60,80,0.9)",Hy=6*On,Ql=16*On,K3=6*On,$m=4*On,qy="2px solid #fff",CB="1px solid rgba(255,255,255,0.2)",J3="rgba(255,255,255,0.05)",Z3="1px solid rgba(255,255,255,0.35)",Q3="1.8",EB="2.2 1.8",tk="#fff",TB=10*On,NB=3*On,_B=10*On,DB=32*On,ek=16*On,s0="#aaa",LB={width:ek,height:ek,padding:0,margin:0,background:"transparent",border:"none",color:s0,cursor:"pointer",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},E0=28*On,RB=26*On,DC=`${2*On}px ${6*On}px`,OB=4*On,LC={minWidth:RB,height:E0,cursor:"pointer",borderRadius:M0,fontSize:C0,padding:DC,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:OB,lineHeight:1,boxSizing:"border-box"},Vm={...LC,background:A0,border:tb,color:s0},Wm={...LC,background:fB,border:dB,color:r5},RC=E0,PB=4*On,_d={minWidth:RC,height:E0,background:A0,border:tb,color:_C,cursor:"pointer",borderRadius:M0,fontSize:C0,padding:DC,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,boxSizing:"border-box"},IB="1px solid rgba(255,255,255,0.4)",nk=18*On,jB=3*On,BB=10*On,zB="1px solid rgba(255,255,255,0.25)",FB="#f5f5fa",UB="#111",HB="#111",qB="#fff",a0=32*On,YB=`${3*On}px`,$B=6,OC="rgba(20, 20, 32, 0.95)",VB="1px solid rgba(255,255,255,0.28)",WB="#cfcfcf",XB="background 0.15s, border 0.15s, color 0.15s",rk="1px solid rgba(230,57,70,0.7)",GB="rgba(230,57,70,0.95)",KB="1px solid #ff6b6b",JB="#fff",Yy={position:"absolute",top:"50%",width:a0,height:a0,transform:"translateY(-50%)",background:OC,border:VB,color:WB,cursor:"pointer",borderRadius:"50%",fontSize:C0,padding:YB,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:XB};function $y(n){return n*(a0+$B)}const ZB=[{id:"nw",cx:0,cy:0,cursor:"nwse-resize"},{id:"n",cx:.5,cy:0,cursor:"ns-resize"},{id:"ne",cx:1,cy:0,cursor:"nesw-resize"},{id:"e",cx:1,cy:.5,cursor:"ew-resize"},{id:"se",cx:1,cy:1,cursor:"nwse-resize"},{id:"s",cx:.5,cy:1,cursor:"ns-resize"},{id:"sw",cx:0,cy:1,cursor:"nesw-resize"},{id:"w",cx:0,cy:.5,cursor:"ew-resize"}],QB=Cu.memo(function({pin:t,position:e,imageSize:r,active:i,isSelected:s,justCreated:l,fontFamily:c,strokeWidthScale:f=1,controlsLayer:d,onUpdateDescription:p,onUpdateImage:g,onClearImage:b,onDragStart:y,onResizeStart:M,onActivate:C,onUpdateColor:D,onUpdateStrokeStyle:L,onUpdateFillStyle:H,onUpdateStrokeWidthScale:Y,onContextMenu:W,onToggleDescPos:St,onToggleTheme:_t,onHide:Ct,onAddLinked:bt,onDelete:ot,onUpdateTextStyle:jt,onUpdateTextFontSize:Z}){const ct=Qt=>Qt,V=U.useRef(null),xt=U.useRef(null),Lt=U.useRef(null),[dt,st]=U.useState(()=>t.description.trim().length>0),lt=t.description.trim().length>0,zt=!!t.image,At=g5(t.anchor),K=L4(t.anchor),P=(t.strokeStyle??Qh)==="dashed",X=(t.fillStyle??pg)==="none",tt=x_(t.anchor),gt=t.strokeWidthScale!==void 0,vt=(f-Pc)/(Qf-Pc)*100,kt=(t.textFontSize??Fs)*p4,qt=t.anchor.type==="standalone"?"Блок виноски":`Виноска ${t.label}`,Rt=t.theme==="light"&&lt,Zt=t.textColor??(Rt?nB:eB),Ae=t.textBackgroundColor===null?"transparent":t.textBackgroundColor??(Rt?iB:rB),le=XP({extensions:[Pj,TC],content:t.description||"",autofocus:!1,editorProps:{attributes:{style:["width: 100%",`min-height: ${tB}`,"background: transparent","border: none","outline: none",`color: ${Zt}`,`font-size: ${kt}px`,`line-height: ${tp}`,`font-family: ${c}`,"direction: ltr","unicode-bidi: plaintext","text-align: left","white-space: pre-wrap","word-break: break-word"].join("; ")}},onUpdate({editor:Qt}){let ve=Qt.getHTML();(ve==="<p></p>"||ve===`<p></p>
228
- `)&&(ve=""),p(t.id,ve),!dt&&ve.trim().length>0&&st(!0)}}),Ie=U.useCallback(Qt=>Math.max(Qj,Qt),[]),Ue=U.useCallback(Qt=>{if(!lt||!le)return;const ve=le.state.selection;if(!ve.empty&&ve.from!==ve.to){const We=le.getAttributes("textStyle"),He=We?.fontSize?Number.parseFloat(We.fontSize):Number.NaN,Pe=Number.isFinite(He)?He:kt,Vn=Ie(Pe+Qt*On);le.chain().focus().setMark("textStyle",{fontSize:`${Vn}px`}).run();return}Z&&Z(t.id,Qt)},[lt,le,kt,Ie,Z,t.id]),ft=U.useCallback(()=>{C(t.id),st(!0),requestAnimationFrame(()=>{le?.commands.focus("end")})},[C,t.id,le]);U.useEffect(()=>{if(le){if(!i&&!s){le.commands.blur();return}s&&!i&&le.isFocused&&le.commands.blur()}},[i,s,le]),U.useEffect(()=>{if(!i||!le)return;const Qt=ve=>{const me=ve;if(me.detail?.pinId!==t.id)return;const We=me.detail.text??"";if(!We.trim())return;st(!0);const He=()=>{if(!le||le.isDestroyed)return;le.isFocused||le.commands.focus("end");const Pe=qj(We);le.chain().focus().insertContent(Pe).run()};requestAnimationFrame(()=>requestAnimationFrame(He))};return document.addEventListener(o0,Qt),()=>document.removeEventListener(o0,Qt)},[i,le,t.id]),U.useEffect(()=>{if(!l||!le)return;C(t.id);const Qt=setTimeout(()=>{document.activeElement?.blur?.(),le.commands.focus("end")},0);return()=>clearTimeout(Qt)},[l,t.id,C,le]);const Re=(i||s)&&!!le;U.useEffect(()=>{if(!Re||!le)return;const Qt=ve=>{const me=ve.target;me&&(me.tagName==="TEXTAREA"||me.tagName==="INPUT"&&me!==Lt.current||me.getAttribute?.("contenteditable")==="true")||ve.ctrlKey||ve.metaKey||ve.altKey||ve.key.length===1&&(le.isFocused||(ve.preventDefault(),ve.stopPropagation(),C(t.id),le.chain().focus().insertContent(ve.key).run(),st(!0)))};return window.addEventListener("keydown",Qt,!0),()=>window.removeEventListener("keydown",Qt,!0)},[Re,t.id,C,le]);const rn=rh();U.useEffect(()=>{if(!i||!D||!St||!ot)return;const Qt=rn?me=>me.metaKey:me=>me.ctrlKey,ve=me=>{const We=me.key,He=Qt(me),Pe=me.shiftKey;if(He&&We==="b"){me.preventDefault(),me.stopPropagation(),lt&&le&&le.chain().focus().toggleBold().run();return}if(He&&We==="i"){me.preventDefault(),me.stopPropagation(),lt&&le&&le.chain().focus().toggleItalic().run();return}if(He&&We==="u"){me.preventDefault(),me.stopPropagation(),lt&&le&&le.chain().focus().toggleUnderline?.().run?.();return}if(He&&Pe&&(We==="S"||We==="s")){me.preventDefault(),me.stopPropagation(),lt&&le&&le.chain().focus().toggleStrike?.().run?.();return}if(He&&(We==="-"||We==="Minus")){me.preventDefault(),me.stopPropagation(),Ue(-2);return}if(He&&(We==="="||We==="+")){me.preventDefault(),me.stopPropagation(),Ue(2);return}if(He&&Pe&&(We==="T"||We==="t")){me.preventDefault(),me.stopPropagation(),C(t.id),st(!0),requestAnimationFrame(()=>le?.commands.focus("end"));return}if(He&&Pe&&(We==="I"||We==="i")){me.preventDefault(),me.stopPropagation(),xt.current?.click();return}if(He&&Pe&&(We==="X"||We==="x")){me.preventDefault(),me.stopPropagation(),p(t.id,""),st(!1);return}if(He&&Pe&&(We==="E"||We==="e")){me.preventDefault(),me.stopPropagation(),zt&&b&&b(t.id);return}if(He&&Pe&&(We==="P"||We==="p")){me.preventDefault(),me.stopPropagation(),zt&&(lt||dt)&&St(t.id);return}if(He&&Pe&&(We==="L"||We==="l")){me.preventDefault(),me.stopPropagation(),lt&&_t&&_t(t.id);return}We==="Delete"&&(me.preventDefault(),me.stopPropagation(),ot(t.id))};return window.addEventListener("keydown",ve,!0),()=>window.removeEventListener("keydown",ve,!0)},[i,t.id,lt,zt,dt,rn,C,p,St,_t,ot,b,Z,D,le,Ue]);const{x:on,y:be,width:_e,height:Te}=e,{w:Le,h:Ye}=r,hn=$y(1),Pn=$y(2),wn=$y(3),Nn=on+_e+Pn+a0>Le,Sn=U.useCallback(Qt=>["TEXTAREA","BUTTON","INPUT","LABEL"].includes(Qt.tagName)||Qt.getAttribute("contenteditable")==="true"||!!Qt.closest('[contenteditable="true"]')||!!Qt.closest(".ProseMirror"),[]),Be=U.useCallback(Qt=>{y(t.id,ct(Qt))},[y,t.id]),[tn,je]=U.useState(1),ur=U.useRef(null),bn=U.useCallback(()=>{const Qt=ur.current;if(!Qt)return;const ve=Math.ceil(Qt.getBoundingClientRect().height),me=Math.ceil(Qt.scrollHeight),We=Math.max(1,ve,me);je(He=>He!==We?We:He)},[]);U.useLayoutEffect(()=>{if(!i)return;const Qt=ur.current;if(!Qt)return;bn();const ve=requestAnimationFrame(()=>{bn(),requestAnimationFrame(bn)}),me=new ResizeObserver(()=>bn());return me.observe(Qt),()=>{cancelAnimationFrame(ve),me.disconnect()}},[i,zt,lt,dt,t.theme,t.descPos,bn]);const cn=U.useCallback(()=>{},[]);U.useEffect(()=>{(dt||lt)&&cn()},[dt,lt,cn,Te]);const pn=Qt=>{const ve=Qt.target.files?.[0];if(!ve)return;const me=new FileReader;me.onload=We=>g(t.id,We.target?.result),me.readAsDataURL(ve),Qt.target.value=""},$n=t.image?T.jsx("div",{style:{width:"100%",flex:lt||dt?"1 1 auto":"1 1 100%",minHeight:y4,background:`url(${t.image}) center/cover no-repeat`,position:"relative",borderTop:t.descPos==="above"&&(lt||dt)?`1px solid ${t.color}${Y3}`:"none",borderBottom:t.descPos==="below"&&(lt||dt)?`1px solid ${t.color}${Y3}`:"none",boxSizing:"border-box"},children:T.jsxs("label",{style:{position:"absolute",bottom:$3,right:$3,cursor:"pointer",background:cB,borderRadius:oB,padding:sB,fontSize:aB,color:uB,display:"inline-flex",alignItems:"center",gap:lB},children:[T.jsx("i",{className:`${Si} bi-arrow-repeat`,style:{fontSize:ki},"aria-hidden":!0}),"замінити (",Hd(),")",T.jsx("input",{type:"file",accept:"image/*",style:{display:"none"},onChange:pn})]})}):null,en=lt||dt||!zt?T.jsx("div",{style:{flex:zt?"0 0 auto":"1 1 auto",padding:`${m2}px ${g2}px ${x4}px`,overflow:"hidden",minHeight:"1.5em",height:zt?"auto":"100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:dt||lt?T.jsx("div",{style:{position:"relative",width:"100%",height:"100%",flex:"1 1 auto",display:"flex",flexDirection:"column"},children:le&&T.jsx(GM,{editor:le,onContextMenu:Qt=>Qt.preventDefault(),onPointerDown:()=>{C(t.id)},onMouseDown:()=>{C(t.id)},onDoubleClick:Qt=>{Qt.stopPropagation(),ft()},style:{width:"100%",minHeight:"1.5em",flex:"1 1 auto",height:"100%",overflowY:"auto",boxSizing:"border-box",userSelect:"text",WebkitUserSelect:"text",WebkitTouchCallout:"default"}})}):zt?null:T.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:V3,color:mB,fontSize:pB},children:[T.jsxs("div",{style:{display:"flex",gap:V3},children:[!zt&&T.jsxs("button",{type:"button",onPointerDown:Qt=>Qt.stopPropagation(),onMouseDown:Qt=>Qt.stopPropagation(),onClick:Qt=>{Qt.stopPropagation(),C(t.id),xt.current?.click()},style:W3,children:[T.jsx("i",{className:`${Si} bi-plus-lg-lg`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-image`,style:{fontSize:ki},"aria-hidden":!0}),"Фото"]}),T.jsxs("button",{type:"button",onPointerDown:Qt=>Qt.stopPropagation(),onMouseDown:Qt=>Qt.stopPropagation(),onClick:Qt=>{Qt.stopPropagation(),ft()},style:W3,children:[T.jsx("i",{className:`${Si} bi-plus-lg`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-type`,style:{fontSize:ki},"aria-hidden":!0}),"Текст"]})]}),T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:gB,fontSize:yB,color:bB,marginTop:xB},children:["Або вставте з буфера"," ",Ai(oe.pasteInCallout,{isMac:rh()}).map(Qt=>T.jsx(tc,{title:Hd(),scale:vB,children:Qt},Qt))]})]})}):null;return T.jsxs("g",{onContextMenu:W?Qt=>W(t.id,Qt):void 0,children:[T.jsx("foreignObject",{x:on,y:be,width:_e,height:Te,style:{overflow:"visible"},onPointerDown:Qt=>{Qt.stopPropagation(),C(t.id);const ve=Qt.target;if(Sn(ve)){V.current={pointerId:Qt.pointerId,pointerType:Qt.pointerType,startX:Qt.clientX,startY:Qt.clientY};return}Be(Qt)},onPointerMove:Qt=>{const ve=V.current;if(!ve||ve.pointerId!==Qt.pointerId)return;const me=window.getSelection();if(ve.pointerType==="mouse"&&me&&!me.isCollapsed&&me.toString().trim().length>0){V.current=null;return}const We=Qt.clientX-ve.startX,He=Qt.clientY-ve.startY;Math.hypot(We,He)<Yj||(V.current=null,Be(Qt))},onPointerUp:Qt=>{V.current?.pointerId===Qt.pointerId&&(V.current=null)},onPointerCancel:Qt=>{V.current?.pointerId===Qt.pointerId&&(V.current=null)},onMouseDown:Qt=>{Qt.stopPropagation(),C(t.id);const ve=Qt.target;Sn(ve)||y(t.id,Qt)},children:T.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{width:"100%",height:"100%",border:`${b4*w4(f)}px solid ${t.color}`,borderRadius:h2,background:Ae,backdropFilter:q3,WebkitBackdropFilter:q3,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:c,cursor:"grab",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",outline:i?`${Kj}px solid ${t.color}${Zj}`:"none",outlineOffset:Jj},onDragOver:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),Qt.dataTransfer.dropEffect="copy"},onDrop:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),C(t.id);const ve=Qt.dataTransfer.files?.[0];if(ve?.type.startsWith("image/")){const me=new FileReader;me.onload=We=>{const He=We.target?.result;He&&g(t.id,He)},me.readAsDataURL(ve)}},children:[T.jsx("input",{ref:Lt,type:"text",readOnly:!0,tabIndex:0,"aria-label":qt,style:{position:"absolute",left:0,top:0,width:1,height:1,opacity:0,pointerEvents:"none",padding:0,margin:0,border:"none",outline:"none"}}),T.jsx("input",{ref:xt,type:"file",accept:"image/*",style:{display:"none"},onChange:pn}),T.jsxs("div",{style:{display:"flex",flexDirection:t.descPos==="above"?"column":"column-reverse",height:"100%"},children:[en,$n]}),T.jsx("div",{"data-drag-hit-zone":"top",style:{position:"absolute",top:0,left:0,right:0,height:Ku,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(C(t.id),Be(Qt))}}),T.jsx("div",{"data-drag-hit-zone":"bottom",style:{position:"absolute",bottom:0,left:0,right:0,height:Ku,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(C(t.id),Be(Qt))}}),T.jsx("div",{"data-drag-hit-zone":"left",style:{position:"absolute",top:Ku,bottom:Ku,left:0,width:Ku,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(C(t.id),Be(Qt))}}),T.jsx("div",{"data-drag-hit-zone":"right",style:{position:"absolute",top:Ku,bottom:Ku,right:0,width:Ku,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(C(t.id),Be(Qt))}})]})}),i&&D&&St&&ot&&(()=>{const Qt=be-tn-X3,ve=be+Te+X3,me=be+Te/2,We=Ye/2,Pe=!(me<We),Xo=Math.max(0,Math.min(Pe?Qt:ve,Ye-tn)),ui=(At&&L?1:0)+(K&&H?1:0),Hi=Cl.length+ui,Je=Hi*Ql+(Hi-1)*K3+G3*2,Ss=Math.max(0,Math.min(on+(_e-Je)/2,Le-Je)),to=T.jsx("foreignObject",{x:Ss,y:Xo,width:Je,height:tn,style:{overflow:"visible",outline:"none"},onPointerDown:Xt=>Xt.stopPropagation(),onMouseDown:Xt=>Xt.stopPropagation(),children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{display:"flex",flexDirection:"column",justifyContent:Pe?"flex-end":"flex-start",width:"100%",height:"100%"},children:T.jsxs("div",{ref:ur,style:{display:"flex",flexDirection:"column",gap:wB,width:"100%",padding:G3,boxSizing:"border-box",background:AB,borderRadius:SB,border:MB,fontFamily:c,fontSize:kB,position:"relative"},children:[T.jsxs("div",{style:{display:"flex",gap:K3,justifyContent:"center"},children:[Cl.map(Xt=>T.jsx("button",{type:"button",onPointerDown:Ei=>Ei.stopPropagation(),onClick:Ei=>{Ei.stopPropagation(),D(t.id,Xt)},title:Xt,style:{width:Ql,height:Ql,borderRadius:"50%",background:Xt,border:t.color===Xt?qy:CB,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},Xt)),At&&L&&T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),L(t.id,P?"solid":"dashed")},onMouseDown:Xt=>Xt.preventDefault(),"aria-label":"Перемикач стилю обводки",title:P?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:Ql,height:Ql,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:J3,border:P?qy:Z3,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("svg",{width:Ql-$m,height:Ql-$m,viewBox:"0 0 16 16","aria-hidden":!0,children:T.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:tk,strokeWidth:Q3,strokeDasharray:EB})})}),K&&H&&T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),H(t.id,X?"filled":"none")},onMouseDown:Xt=>Xt.preventDefault(),"aria-label":"Перемикач фону фігури",title:X?"Додати фон фігури":"Прибрати фон фігури",style:{width:Ql,height:Ql,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:J3,border:X?qy:Z3,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("svg",{width:Ql-$m,height:Ql-$m,viewBox:"0 0 16 16","aria-hidden":!0,children:T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:tk,strokeWidth:Q3})})})]}),tt&&Y&&T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Hy},children:[T.jsx("i",{className:`${Si} bi-border-width`,style:{fontSize:ki,color:s0,flexShrink:0},"aria-hidden":!0}),T.jsx("input",{type:"range",min:Pc,max:Qf,step:d5,value:f,"aria-label":"Товщина ліній виноски",title:"Товщина контуру, лінії та маркера",onPointerDown:Xt=>Xt.stopPropagation(),onMouseDown:Xt=>Xt.stopPropagation(),onChange:Xt=>Y(t.id,Number(Xt.target.value)),className:"tyts-range",style:{flex:1,minWidth:0,"--tyts-range-accent":t.color,"--tyts-range-bg":A0,"--tyts-range-track":`${NB}px`,"--tyts-range-thumb":`${TB}px`,"--tyts-range-fill":`${vt}%`}}),T.jsxs("span",{style:{color:s0,fontSize:_B,fontVariantNumeric:"tabular-nums",minWidth:DB,textAlign:"right",flexShrink:0},children:["×",p5(f)]}),gt&&T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onMouseDown:Xt=>Xt.preventDefault(),onClick:Xt=>{Xt.stopPropagation(),Y(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:LB,children:T.jsx("i",{className:`${Si} bi-arrow-counterclockwise`,style:{fontSize:ki},"aria-hidden":!0})})]}),(zt&&!lt||!zt&&lt||zt&&(lt||dt)||lt&&jt&&Z&&le||lt&&_t)&&T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Hy,flexShrink:0,flexWrap:"wrap",overflowX:"visible",rowGap:Hy},children:[zt&&!lt&&!dt&&T.jsxs(T.Fragment,{children:[T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),C(t.id),st(!0)},title:`Додати текст (${mn(oe.calloutAddText,{isMac:rn})})`,style:Vm,children:[T.jsx("i",{className:`${Si} bi-type`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-plus-lg`,style:{fontSize:ki},"aria-hidden":!0})]}),b&&T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),b(t.id)},title:`Прибрати фото (${mn(oe.calloutRemoveImage,{isMac:rn})})`,style:Wm,children:[T.jsx("i",{className:`${Si} bi-image`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-x-lg`,style:{fontSize:ki},"aria-hidden":!0})]})]}),!zt&&lt&&T.jsxs(T.Fragment,{children:[T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),xt.current?.click()},onMouseDown:Xt=>Xt.preventDefault(),title:`Додати фото (${Hd()} або ${mn(oe.calloutAddImage,{isMac:rn})})`,style:Vm,children:[T.jsx("i",{className:`${Si} bi-image`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-plus-lg`,style:{fontSize:ki},"aria-hidden":!0})]}),T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),p(t.id,""),st(!1)},onMouseDown:Xt=>Xt.preventDefault(),title:`Прибрати текст (${mn(oe.calloutRemoveText,{isMac:rn})})`,style:Wm,children:[T.jsx("i",{className:`${Si} bi-type`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-x-lg`,style:{fontSize:ki},"aria-hidden":!0})]})]}),zt&&(lt||dt)&&T.jsxs(T.Fragment,{children:[T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),xt.current?.click()},onMouseDown:Xt=>Xt.preventDefault(),title:`Змінити фото (${Hd()} або ${mn(oe.calloutAddImage,{isMac:rn})})`,style:Vm,children:[T.jsx("i",{className:`${Si} bi-image`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-arrow-repeat`,style:{fontSize:ki},"aria-hidden":!0})]}),T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),St(t.id)},onMouseDown:Xt=>Xt.preventDefault(),title:`${t.descPos==="above"?"Текст вниз":"Текст вгору"} (${mn(oe.calloutToggleDescPos,{isMac:rn})})`,style:Vm,children:T.jsx("i",{className:`${Si} ${t.descPos==="above"?"bi-arrow-bar-down":"bi-arrow-bar-up"}`,style:{fontSize:ki},"aria-hidden":!0})}),T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),p(t.id,""),st(!1)},onMouseDown:Xt=>Xt.preventDefault(),title:`Прибрати текст (${mn(oe.calloutRemoveText,{isMac:rn})})`,style:Wm,children:[T.jsx("i",{className:`${Si} bi-type`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-x-lg`,style:{fontSize:ki},"aria-hidden":!0})]}),b&&T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),b(t.id)},title:`Прибрати фото (${mn(oe.calloutRemoveImage,{isMac:rn})})`,style:Wm,children:[T.jsx("i",{className:`${Si} bi-image`,style:{fontSize:ki},"aria-hidden":!0}),T.jsx("i",{className:`${Si} bi-x-lg`,style:{fontSize:ki},"aria-hidden":!0})]})]}),lt&&jt&&Z&&le&&T.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:PB,flexWrap:"wrap"},children:[T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),le.chain().focus().toggleBold().run()},onMouseDown:Xt=>Xt.preventDefault(),title:`Жирний текст (${mn(oe.calloutBold,{isMac:rn})})`,style:{..._d,fontWeight:700},children:"B"}),T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),le.chain().focus().toggleItalic().run()},onMouseDown:Xt=>Xt.preventDefault(),title:`Курсив (${mn(oe.calloutItalic,{isMac:rn})})`,style:{..._d,fontStyle:"italic"},children:"I"}),T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),le.chain().focus().toggleUnderline?.().run?.()},onMouseDown:Xt=>Xt.preventDefault(),title:`Підкреслення (${mn(oe.calloutUnderline,{isMac:rn})})`,style:{..._d,textDecoration:"underline"},children:"U"}),T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),le.chain().focus().toggleStrike?.().run?.()},onMouseDown:Xt=>Xt.preventDefault(),title:`Закреслення (${mn(oe.calloutStrike,{isMac:rn})})`,style:{..._d,textDecoration:"line-through"},children:"S"}),T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),Ue(-2)},onMouseDown:Xt=>Xt.preventDefault(),title:`Менший шрифт (${mn(oe.calloutFontSizeDown,{isMac:rn})})`,style:_d,children:"A–"}),T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),Ue(2)},onMouseDown:Xt=>Xt.preventDefault(),title:`Більший шрифт (${mn(oe.calloutFontSizeUp,{isMac:rn})})`,style:_d,children:"A+"})]}),lt&&_t&&T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),_t(t.id)},onMouseDown:Xt=>Xt.preventDefault(),title:`${Rt?"Світлий фон, темний текст":"Темний фон, світлий текст"} (${mn(oe.calloutToggleTheme,{isMac:rn})})`,style:{width:RC,height:E0,borderRadius:M0,background:"transparent",border:IB,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:"pointer",padding:0,boxSizing:"border-box"},children:T.jsx("span",{style:{width:nk,height:nk,borderRadius:jB,background:Rt?FB:UB,color:Rt?HB:qB,border:zB,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:BB,fontWeight:700,lineHeight:1},children:"Aa"})})]}),Ct&&T.jsx("button",{type:"button",onPointerDown:Xt=>{Xt.stopPropagation()},onClick:Xt=>{Xt.stopPropagation(),Ct(t.id)},title:"Приховати виноску",style:{...Yy,right:Nn?"auto":-Pn,left:Nn?-Pn:"auto"},children:T.jsx("i",{className:`${Si} bi-eye-slash`,style:{fontSize:ki},"aria-hidden":!0})}),bt&&T.jsx("button",{type:"button",onPointerDown:Xt=>{Xt.stopPropagation()},onClick:Xt=>{Xt.stopPropagation(),bt(t.id)},title:"Додати ще одну виноску до цієї фігури",style:{...Yy,right:Nn?"auto":-wn,left:Nn?-wn:"auto"},children:T.jsx("i",{className:`${Si} bi-plus-lg`,style:{fontSize:ki},"aria-hidden":!0})}),T.jsx("button",{type:"button",onPointerDown:Xt=>{Xt.stopPropagation()},onClick:Xt=>{Xt.stopPropagation(),ot(t.id)},title:`Видалити виноску (${mn(oe.calloutDelete,{isMac:rn})})`,style:{...Yy,right:Nn?"auto":-hn,left:Nn?-hn:"auto",border:rk,color:r5},onMouseEnter:Xt=>{Xt.currentTarget.style.background=GB,Xt.currentTarget.style.border=KB,Xt.currentTarget.style.color=JB},onMouseLeave:Xt=>{Xt.currentTarget.style.background=OC,Xt.currentTarget.style.border=rk,Xt.currentTarget.style.color=r5},children:T.jsx("i",{className:`${Si} bi-trash`,style:{fontSize:ki},"aria-hidden":!0})})]})})});return d?I4.createPortal(to,d):to})(),ZB.map(Qt=>T.jsxs("g",{children:[T.jsx("circle",{cx:on+Qt.cx*_e,cy:be+Qt.cy*Te,r:$j,fill:Gj,stroke:"none","data-resize-handle-hit":Qt.id,style:{cursor:Qt.cursor},onPointerDown:ve=>{ve.stopPropagation(),C(t.id),M(t.id,Qt.id,ct(ve))},onMouseDown:ve=>{ve.stopPropagation(),C(t.id),M(t.id,Qt.id,ve)}}),T.jsx("circle",{cx:on+Qt.cx*_e,cy:be+Qt.cy*Te,r:NC,fill:i?t.color:Wj,stroke:t.color,strokeWidth:Vj,opacity:i?1:Xj,pointerEvents:"none"})]},Qt.id))]})},(n,t)=>n.pin===t.pin&&n.position===t.position&&n.active===t.active&&n.isSelected===t.isSelected&&n.imageSize===t.imageSize&&n.justCreated===t.justCreated),tz=U.memo(function({anchor:t,card:e,color:r,widthScale:i=1,points:s}){if(t.type==="standalone")return null;const l=Q_(S2(t,e,s));return T.jsx("g",{children:T.jsx("path",{d:l,fill:"none",stroke:r,strokeWidth:g4*i,strokeLinecap:"round",strokeLinejoin:"round"})})});function ez({isMac:n,backgroundImage:t,pinsLength:e,showExportMenu:r,sourceImageSize:i,imageSize:s,activePin:l,calloutControlPinId:c,undo:f,redo:d,handleExport:p,handleExportPdf:g,stepZoom:b,handleFitToWindow:y,deletePin:M,movePinZ:C,copyPin:D,duplicatePin:L,pastePinFromClipboard:H,setMode:Y,setPolygonDraft:W,setPolylineDraft:St,setShapeDraftType:_t,setPlacementTool:Ct,setShowExportMenu:bt,beginCrop:ot,insertCurrentDateTimeText:jt,toggleCompassMenu:Z,toggleImageObjectMenu:ct,newBgFileRef:V,replaceBgFileRef:xt,exportMenuOpenedViaHotkeyRef:Lt}){U.useEffect(()=>{const dt=At=>At?At.isContentEditable?!0:["INPUT","TEXTAREA","BUTTON"].includes(At.tagName):!1,st=At=>At.code==="NumpadAdd"||At.key==="+"||At.key==="="||At.code==="Equal"&&At.shiftKey,lt=At=>At.code==="NumpadSubtract"||At.code==="Minus"||At.key==="-"||At.key==="_",zt=At=>{const K=At.target;if(dt(K))return;const P=n?At.metaKey:At.ctrlKey;if(r&&!P&&!At.altKey&&!At.shiftKey){const X=/^[1-9]$/.test(At.key)?Number(At.key):null;if(X!=null){At.preventDefault();const tt=[];i&&tt.push(()=>{const{w:vt}=s;if(!vt)return;const kt=i.w/vt/2;p("png",kt)}),tt.push(()=>p("png",1)),tt.push(()=>p("png",2)),tt.push(()=>p("jpeg",2)),tt.push(()=>g()),tt.push(()=>{t&&window.print()});const gt=tt[X-1];gt&&(bt(!1),Lt.current=!1,gt());return}}if(P&&At.shiftKey&&At.code==="KeyV"){At.preventDefault(),H();return}if(P&&!At.shiftKey&&(At.code==="KeyC"||At.code==="KeyJ")){const X=c??l;if(X){At.preventDefault(),At.code==="KeyC"?D(X):L(X);return}}if(P&&(At.code==="BracketRight"||At.code==="BracketLeft")){const X=c??l;if(X){At.preventDefault();const tt=At.code==="BracketRight",gt=At.shiftKey?tt?"front":"back":tt?"up":"down";C(X,gt);return}}if(P&&(At.code==="KeyZ"||At.key.toLowerCase()==="z")){At.preventDefault(),At.shiftKey?d():f();return}if(!n&&At.ctrlKey&&At.key.toLowerCase()==="y"){At.preventDefault(),d();return}if(P&&!At.shiftKey&&(At.code==="KeyD"||At.key.toLowerCase()==="d")){At.preventDefault(),t&&p("jpeg");return}if(P&&At.shiftKey&&At.code==="KeyD"){if(At.preventDefault(),!t)return;Lt.current=!0,bt(!0);return}if((At.key==="Delete"||At.key==="Backspace")&&(c||l)){At.preventDefault(),M(c??l);return}if(P&&!At.altKey&&!At.shiftKey){if(At.code==="KeyN"){At.preventDefault(),V.current?.click();return}if(At.code==="KeyB"){At.preventDefault(),(xt.current??V.current)?.click();return}if(At.code==="KeyO"){At.preventDefault(),t&&y();return}}if(t){if(!P&&!At.altKey&&!At.shiftKey){if(At.code==="Digit1"||At.code==="Numpad1"){At.preventDefault(),Y("place"),W(null),St(null),_t(null),Ct("point");return}if(At.code==="Digit0"||At.code==="Numpad0"||At.key==="0"){At.preventDefault(),Y("place"),W(null),St(null),_t(null),Ct("numbering");return}if(At.code==="Digit2"||At.code==="Numpad2"){At.preventDefault(),Y("place"),W([]),St(null),_t(null);return}if(At.code==="Digit3"||At.code==="Numpad3"){At.preventDefault(),Y("place"),W(null),St([]),_t(null);return}if(At.code==="Digit4"||At.code==="Numpad4"){At.preventDefault(),Y("place"),W(null),St(null),_t("rectangle");return}if(At.code==="Digit5"||At.code==="Numpad5"){At.preventDefault(),Y("place"),W(null),St(null),_t("ellipse"),Ct("point");return}if(At.code==="Digit6"||At.code==="Numpad6"){At.preventDefault(),Y("place"),W(null),St(null),_t(null),Ct("text");return}if(At.code==="Digit7"||At.code==="Numpad7"){At.preventDefault(),Y("place"),W(null),St(null),_t(null),Ct("arrow");return}if(At.code==="Digit8"||At.code==="Numpad8"){At.preventDefault(),jt();return}if(At.code==="Digit9"||At.code==="Numpad9"){At.preventDefault(),Y("place"),W(null),St(null),_t(null),Ct("standalone");return}if(At.code==="KeyK"){At.preventDefault(),Z();return}if(At.code==="KeyP"){At.preventDefault(),Y("place"),W(null),St(null),_t(null),Ct("pointText");return}if(At.code==="KeyR"){At.preventDefault(),Y("place"),W(null),St(null),_t("redact");return}if(At.code==="KeyI"){At.preventDefault(),ct();return}if(At.code==="KeyC"){At.preventDefault(),ot();return}}if(!P&&!At.altKey){if(st(At)){At.preventDefault(),b("in");return}if(lt(At)){At.preventDefault(),b("out");return}}}};return window.addEventListener("keydown",zt,!0),()=>window.removeEventListener("keydown",zt,!0)},[t,e,f,d,l,c,r,i,s,p,g,b,y,n,M,C,D,L,H,Y,W,St,_t,Ct,bt,ot,jt,Z,ct,V,xt,Lt])}function nz(){return{past:[],future:[]}}function eb(n){return n.map(t=>({x:t.x,y:t.y}))}function rz(n){n.past=[],n.future=[]}function iz(n,t,e=100){n.past.push(eb(t)),n.past.length>e&&n.past.shift(),n.future=[]}function oz(n,t){if(n.past.length===0)return null;const e=n.past.pop();return n.future.push(eb(t)),e}function sz(n,t){if(n.future.length===0)return null;const e=n.future.pop();return n.past.push(eb(t)),e}const az=100;function lz(){const n=U.useRef(nz()),[t,e]=U.useState(!1),[r,i]=U.useState(!1),s=U.useCallback(()=>{e(n.current.past.length>0),i(n.current.future.length>0)},[]),l=U.useCallback(()=>{rz(n.current),e(!1),i(!1)},[]),c=U.useCallback(p=>{iz(n.current,p,az),s()},[s]),f=U.useCallback(p=>{const g=oz(n.current,p);return s(),g},[s]),d=U.useCallback(p=>{const g=sz(n.current,p);return s(),g},[s]);return{canUndo:t,canRedo:r,reset:l,record:c,undo:f,redo:d}}const nb="tyts-collage-autosave",cz=2e3,uz=.82;function cr(n){return typeof n=="number"&&Number.isFinite(n)}function PC(n){if(!n||typeof n!="object")return!1;const t=n;return cr(t.w)&&cr(t.h)&&t.w>0&&t.h>0}function fz(n){return n===null?!0:PC(n)}function dz(n){if(!n||typeof n!="object")return!1;const t=n;return cr(t.x)&&cr(t.y)&&cr(t.width)&&cr(t.height)&&t.width>0&&t.height>0}function Ju(n){if(!n||typeof n!="object")return!1;const t=n;return cr(t.x)&&cr(t.y)}function hz(n){if(!n||typeof n!="object")return!1;const t=n;if(typeof t.type!="string")return!1;switch(t.type){case"point":case"standalone":return Ju(t);case"linked":{const e=t.pinId;return typeof e=="string"&&e.length>0}case"numbering":return Ju(t.start)&&Ju(t.end);case"polygon":case"polyline":{const e=t.points;return Array.isArray(e)&&e.every(Ju)}case"arrow":{const e=t;return Ju(e.start)&&Ju(e.end)&&Ju(e.control)}case"rectangle":{const e=t;return cr(e.x)&&cr(e.y)&&cr(e.width)&&cr(e.height)}case"ellipse":{const e=t;return cr(e.cx)&&cr(e.cy)&&cr(e.rx)&&cr(e.ry)}case"compass":{const e=t;return cr(e.cx)&&cr(e.cy)&&cr(e.radius)&&e.radius>0}case"redact":{const e=t;return cr(e.x)&&cr(e.y)&&cr(e.width)&&cr(e.height)&&cr(e.strength)&&(e.mode==="blur"||e.mode==="pixelate"||e.mode==="fill")}case"image":{const e=t;return cr(e.x)&&cr(e.y)&&cr(e.width)&&cr(e.height)&&cr(e.aspect)&&typeof e.src=="string"&&e.src.length>0}case"text":{const e=t;return e.point!==void 0&&!Ju(e.point)?!1:cr(e.x)&&cr(e.y)&&cr(e.width)&&cr(e.height)}default:return!1}}function pz(n){if(!n||typeof n!="object")return!1;const t=n;return typeof t.id!="string"||!t.id||typeof t.color!="string"||!t.color||!cr(t.label)||t.label<1||typeof t.description!="string"||t.descPos!=="above"&&t.descPos!=="below"||t.image!==null&&typeof t.image!="string"||t.imageAspect!==null&&t.imageAspect!==void 0&&!cr(t.imageAspect)?!1:hz(t.anchor)}function IC(n){return jC(n)?n:null}function jC(n){if(!n||typeof n!="object")return!1;const t=n;return t.version!==1&&t.version!==2||!cr(t.savedAt)||t.sourceUrl!==void 0&&typeof t.sourceUrl!="string"||t.sourceTitle!==void 0&&typeof t.sourceTitle!="string"||t.capturedAt!==void 0&&!cr(t.capturedAt)||typeof t.backgroundImage!="string"||!t.backgroundImage.startsWith("data:")||!PC(t.imageSize)||!fz(t.sourceImageSize??null)||!Array.isArray(t.pins)||!t.pins.every(pz)||!t.cardPositions||typeof t.cardPositions!="object"?!1:Object.values(t.cardPositions).every(dz)}function mz(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>e(new Error("Image load failed")),r.src=n})}function gz(n){return new Promise(t=>{const e=new FileReader;e.onload=()=>{const r=e.result;t(typeof r=="string"?r:null)},e.onerror=()=>t(null),e.readAsDataURL(n)})}async function yz(n){if(n.startsWith("data:"))return n;if(n.startsWith("blob:"))try{const e=await(await fetch(n)).blob();return gz(e)}catch{return null}return n}async function bz(n,t=cz,e=uz){try{const r=await mz(n),i=Math.max(r.naturalWidth,r.naturalHeight),s=i>t?t/i:1,l=Math.max(1,Math.round(r.naturalWidth*s)),c=Math.max(1,Math.round(r.naturalHeight*s)),f=document.createElement("canvas");f.width=l,f.height=c;const d=f.getContext("2d");return d?(d.drawImage(r,0,0,l,c),f.toDataURL("image/jpeg",e)):null}catch{return null}}function ik(n){try{return localStorage.setItem(nb,JSON.stringify(n)),!0}catch(t){if(t instanceof DOMException&&t.name==="QuotaExceededError")return!1;throw t}}function Vy(){try{const n=localStorage.getItem(nb);if(!n)return null;const t=JSON.parse(n);return jC(t)?t:null}catch{return null}}function xz(){localStorage.removeItem(nb)}async function vz(n){const t=await yz(n.backgroundImage);if(!t||!t.startsWith("data:"))return{ok:!1,error:"invalid_background"};const e={version:2,savedAt:Date.now(),backgroundImage:t,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,sourceUrl:n.sourceUrl,sourceTitle:n.sourceTitle,capturedAt:n.capturedAt};if(ik(e))return{ok:!0,compressed:!1};const r=await bz(t);if(!r)return{ok:!1,error:"quota"};const i={...e,backgroundImage:r};return ik(i)?{ok:!0,compressed:!0}:{ok:!1,error:"quota"}}const wz=800,Sz=2e3;function ok(n){return n.backgroundImage?JSON.stringify({backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,sourceUrl:n.sourceUrl??null,sourceTitle:n.sourceTitle??null,capturedAt:n.capturedAt??null}):null}function kz({state:n,onRestore:t,enabled:e=!0}){const[r,i]=U.useState("idle"),[s,l]=U.useState(null),[c,f]=U.useState(null),[d,p]=U.useState(()=>Vy()),[g,b]=U.useState(!1),[y,M]=U.useState(!1),C=U.useRef(t),D=U.useRef(n),L=U.useRef(null),H=U.useRef(!1),Y=U.useRef(!1),W=U.useRef(null),St=U.useRef(null),_t=U.useRef(async()=>!1);U.useEffect(()=>{C.current=t,D.current=n});const Ct=U.useCallback(async(xt=!1)=>{if(!e)return!1;const Lt=D.current;if(!Lt.backgroundImage)return!1;const dt=ok(Lt);if(!dt)return!1;if(!xt&&dt===L.current)return!0;if(H.current)return Y.current=!0,!1;H.current=!0,i("saving"),f(null);const st=await vz({backgroundImage:Lt.backgroundImage,imageSize:Lt.imageSize,sourceImageSize:Lt.sourceImageSize,pins:Lt.pins,cardPositions:Lt.cardPositions,sourceUrl:Lt.sourceUrl,sourceTitle:Lt.sourceTitle,capturedAt:Lt.capturedAt});if(H.current=!1,!st.ok){const zt=st.error==="quota"?"Чернетка занадто велика для localStorage":"Не вдалося зберегти чернетку";return i("error"),f(zt),!1}L.current=dt;const lt=Date.now();return l(lt),i("saved"),p(Vy()),M(!0),St.current&&clearTimeout(St.current),St.current=setTimeout(()=>M(!1),Sz),Y.current&&(Y.current=!1,queueMicrotask(()=>{_t.current()})),!0},[e]);U.useEffect(()=>{_t.current=Ct},[Ct]);const bt=U.useCallback(()=>{e&&D.current.backgroundImage&&(W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=null,_t.current()},wz))},[e]),ot=U.useCallback(()=>{e&&(xz(),p(null),b(!0),L.current=null,i("idle"),l(null),f(null),M(!1))},[e]),jt=U.useCallback(()=>{const xt=Vy();return xt?(C.current(xt),L.current=ok({backgroundImage:xt.backgroundImage,imageSize:xt.imageSize,sourceImageSize:xt.sourceImageSize,pins:xt.pins,cardPositions:xt.cardPositions,sourceUrl:xt.sourceUrl,sourceTitle:xt.sourceTitle,capturedAt:xt.capturedAt}),p(xt),l(xt.savedAt),i("saved"),f(null),b(!0),!0):(p(null),!1)},[]),Z=U.useCallback(()=>{b(!0)},[]);U.useEffect(()=>{e&&n.backgroundImage&&bt()},[e,n.backgroundImage,n.imageSize,n.sourceImageSize,n.pins,n.cardPositions,n.sourceUrl,n.sourceTitle,n.capturedAt,bt]),U.useEffect(()=>{if(!e)return;const xt=()=>{W.current&&(clearTimeout(W.current),W.current=null),_t.current()},Lt=()=>xt(),dt=()=>{document.visibilityState==="hidden"&&xt()};return window.addEventListener("beforeunload",Lt),document.addEventListener("visibilitychange",dt),()=>{window.removeEventListener("beforeunload",Lt),document.removeEventListener("visibilitychange",dt),W.current&&clearTimeout(W.current),St.current&&clearTimeout(St.current)}},[e]);const ct=e&&d!==null,V=e&&ct&&!n.backgroundImage;return{status:r,lastSavedAt:s,errorMessage:c,hasStoredDraft:ct,canRestore:V,showRestorePrompt:V&&!g,storedDraftSavedAt:d?.savedAt??null,saveFlash:y,saveNow:Ct,restoreDraft:jt,clearDraft:ot,dismissRestorePrompt:Z}}const rb=1;function Az(n){if(!n||typeof n!="object")return!1;const t=n;if(t.version!==rb)return!1;const e={version:2,savedAt:Date.now(),backgroundImage:t.backgroundImage,imageSize:t.imageSize,sourceImageSize:t.sourceImageSize??null,pins:t.pins,cardPositions:t.cardPositions,sourceUrl:t.meta?.sourceUrl,sourceTitle:t.meta?.sourceTitle,capturedAt:t.meta?.capturedAt};return IC(e)!==null}function sk(n){if(Az(n))return n;const t=IC(n);return t?Mz(t):null}function Mz(n){return{version:rb,backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,meta:n.sourceUrl!==void 0||n.sourceTitle!==void 0||n.capturedAt!==void 0?{sourceUrl:n.sourceUrl,sourceTitle:n.sourceTitle,capturedAt:n.capturedAt}:void 0}}function Cz(n){return{version:2,savedAt:Date.now(),backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,sourceUrl:n.meta?.sourceUrl,sourceTitle:n.meta?.sourceTitle,capturedAt:n.meta?.capturedAt}}function Ez(n){return!n.backgroundImage||!n.imageSize.w?null:{version:rb,backgroundImage:n.backgroundImage,imageSize:n.imageSize,sourceImageSize:n.sourceImageSize,pins:n.pins,cardPositions:n.cardPositions,settings:n.settings,meta:n.meta??void 0}}function Tz(n){return`${n.length}:${n.slice(0,64)}:${n.slice(-64)}`}function Nz(n){return JSON.stringify({...n,backgroundImage:Tz(n.backgroundImage)})}async function _z(n){if(typeof n=="string")return n;const t=await Dz(n);if(!t)throw new Error("Failed to read image");return t}async function Dz(n){return new Promise(t=>{const e=new FileReader;e.onload=()=>{const r=e.result;t(typeof r=="string"?r:null)},e.onerror=()=>t(null),e.readAsDataURL(n)})}const Wy=1;function Lz(n){if(!n||typeof n!="object")return!1;const t=n;return typeof t.type=="string"&&t.type.startsWith("tyts:")}const Rz=250;function Oz(){if(typeof window>"u")return null;try{if(window.parent===window)return null}catch{return null}return{parentWindow:window.parent,post:(n,t)=>window.parent.postMessage(n,t)}}function Pz(n){return(n??[]).map(t=>t.trim()).filter(Boolean)}function kl(n,t){return{code:n,message:t}}function ak(n,t){return n instanceof Error?n.message:t}function Iz(n){const t=n.transport===void 0?Oz():n.transport,e=Pz(n.config?.allowedOrigins),r=e.length===0||e.includes("*"),i=n.config?.token||void 0,s=n.changeDebounceMs??Rz;let l=null,c=!1,f=null,d=null;const p=(H,Y)=>{c||t?.post(H,Y)},g=(H,Y,W)=>{n.onError?.(Y),p({type:"tyts:error",requestId:H,error:Y},W)},b=H=>r||e.includes(H),y=()=>{if(f=null,!d||l===null)return;const H=d;d=null,p({type:"tyts:change",document:H.document,dirty:H.dirty},l)},M=()=>{l===null||c||(f&&clearTimeout(f),f=setTimeout(y,s))},C=(H,Y)=>{if(!b(Y)){g(H.requestId,kl("origin_denied",`Origin not allowed: ${Y}`),Y);return}if(H.protocol!==Wy){g(H.requestId,kl("protocol_mismatch","Unsupported embed protocol version"),Y);return}if(i&&H.token!==i){g(H.requestId,kl("invalid_token","Invalid embed token"),Y);return}l=Y,(async()=>{try{if(H.document){const W=sk(H.document);if(!W){g(H.requestId,kl("invalid_document","Invalid initial document"),Y);return}await n.editor.loadDocument(W)}p({type:"tyts:initialized",requestId:H.requestId,protocol:Wy},Y),n.onReady?.(),d&&M()}catch(W){g(H.requestId,kl("init_failed",ak(W,"Init failed")),Y)}})()},D=async(H,Y)=>{switch(H.type){case"tyts:loadDocument":{const W=sk(H.document);if(!W){g(H.requestId,kl("invalid_document","Invalid document"),Y);return}await n.editor.loadDocument(W),H.requestId&&p({type:"tyts:done",requestId:H.requestId},Y);return}case"tyts:loadImage":await n.editor.loadImage(H.dataUrl),H.requestId&&p({type:"tyts:done",requestId:H.requestId},Y);return;case"tyts:getDocument":p({type:"tyts:document",requestId:H.requestId,document:n.editor.getDocument()},Y);return;case"tyts:export":{if(H.format==="pdf"){const St=await n.editor.exportPdf();if(!St){g(H.requestId,kl("export_failed","PDF export failed"),Y);return}const _t=await Bz(St);p({type:"tyts:exportResult",requestId:H.requestId,format:"pdf",mime:"application/pdf",dataUrl:_t},Y);return}const W=await n.editor.exportImage(H.format,H.scale??1);if(!W){g(H.requestId,kl("export_failed","Image export failed"),Y);return}p({type:"tyts:exportResult",requestId:H.requestId,format:H.format,mime:W.mime,dataUrl:W.dataUrl},Y);return}case"tyts:markSaved":n.editor.markSaved(),H.requestId&&p({type:"tyts:done",requestId:H.requestId},Y);return;case"tyts:reset":n.editor.reset(),H.requestId&&p({type:"tyts:done",requestId:H.requestId},Y);return;case"tyts:init":return;default:{const W=H;g(W.requestId,kl("unknown_message",`Unknown message: ${W.type}`),Y)}}};return{handleMessage:H=>{if(c||!t||H.source!==t.parentWindow||!Lz(H.data))return;const Y=H.data,W="requestId"in Y?Y.requestId:void 0;if(Y.type==="tyts:init"){C(Y,H.origin);return}if(l===null){g(W,kl("not_initialized","Editor is not initialized"),H.origin);return}if(H.origin!==l){g(W,kl("origin_denied",`Origin not allowed: ${H.origin}`),H.origin);return}D(Y,l).catch(St=>{g(W,kl("handler_error",ak(St,"Handler error")),H.origin)})},notifyChange(H,Y){d={document:H,dirty:Y},M()},announceReady(){const H={type:"tyts:ready",protocol:Wy};if(r){p(H,"*");return}for(const Y of e)p(H,Y)},stop(){c=!0,f&&clearTimeout(f),f=null,d=null}}}function jz(n){const t=Iz(n),e=r=>{t.handleMessage({data:r.data,origin:r.origin,source:r.source})};return window.addEventListener("message",e),t.announceReady(),{...t,stop(){window.removeEventListener("message",e),t.stop()}}}async function Bz(n){return new Promise((t,e)=>{const r=new FileReader;r.onload=()=>{const i=r.result;typeof i=="string"?t(i):e(new Error("Failed to encode blob"))},r.onerror=()=>e(new Error("Failed to encode blob")),r.readAsDataURL(n)})}const zz={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_TYTS_EMBED:"1",VITE_UAF_SANS:"0"};function Fz(){return!0}function Uz(n=zz){const t=n.VITE_TYTS_EMBED_ALLOWED_ORIGINS,e=typeof t=="string"?t.split(",").map(s=>s.trim()).filter(Boolean):[],r=n.VITE_TYTS_EMBED_TOKEN,i=typeof r=="string"&&r.trim()?r.trim():void 0;return{allowedOrigins:e.length>0?e:void 0,token:i}}function Gf(){return typeof window>"u"||window.location.protocol!=="chrome-extension:"?!1:!!globalThis.chrome?.runtime?.id}function Hz(n){if(typeof n!="object"||n===null)return!1;const t=n;return!(typeof t.dataUrl!="string"||!t.dataUrl.startsWith("data:image/")||t.sourceUrl!==void 0&&typeof t.sourceUrl!="string"||t.sourceTitle!==void 0&&typeof t.sourceTitle!="string"||t.capturedAt!==void 0&&!(typeof t.capturedAt=="number"&&Number.isFinite(t.capturedAt)))}function BC(n){const t=new URL(window.location.href);t.searchParams.delete(n),window.history.replaceState(null,"",t.toString())}function qz(){return Gf()?new URLSearchParams(window.location.search).has("capture"):!1}function Yz(){if(!Gf())return!1;const n=new URLSearchParams(window.location.search).get("restore")==="1";return n&&BC("restore"),n}async function $z(){if(!Gf())return null;const n=new URLSearchParams(window.location.search).get("capture");if(!n)return null;BC("capture");const t=`capture:${n}`,e=[chrome.storage.session,chrome.storage.local].filter(Boolean);for(const r of e)try{const i=(await r.get(t))[t];if(i===void 0)continue;return r.remove(t),Hz(i)?i:null}catch{}return null}const lk="tyts-ext-settings",Yh={downloadSubfolder:"Tyts",saveAs:!1};function Vz(n){return n.trim().replace(/[/\\]/g,"").replace(/\.\./g,"").replace(/[<>:"|?*]/g,"").slice(0,60)}async function Wz(){if(!Gf())return{...Yh};try{const n=(await chrome.storage.sync.get(lk))[lk];if(!n||typeof n!="object")return{...Yh};const t=n;return{downloadSubfolder:typeof t.downloadSubfolder=="string"?Vz(t.downloadSubfolder):Yh.downloadSubfolder,saveAs:typeof t.saveAs=="boolean"?t.saveAs:Yh.saveAs}}catch{return{...Yh}}}const qn="bi",rr=14,Xz=2800,Gz=.5,Kz=250,Jz=16*Zr,Zz={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},Qz=1500,t9=150,e9=/\.(png|jpe?g|svg|webp|gif|avif|bmp)$/i;function Xy(n){if(!n)return null;const t=Array.from(n.files??[]),e=Array.from(n.items??[]).filter(i=>i.kind==="file").map(i=>i.getAsFile()).filter(i=>!!i);return[...t,...e].find(i=>i.type.startsWith("image/")||e9.test(i.name))??null}const ck=96,uk=44,de=Zr,fn=Zr*f5,Xm=n=>`${Ud[0]*n} ${Ud[1]*n}`;async function fk(n,t){try{const e=await Wz(),r=e.downloadSubfolder?`${e.downloadSubfolder}/${t}`:t;return await chrome.downloads.download({url:n,filename:r,saveAs:e.saveAs}),!0}catch{return!1}}function dk(n,t){const e=t.x-n.x,r=t.y-n.y;return Math.abs(e)>=Math.abs(r)?{x:t.x,y:n.y}:{x:n.x,y:t.y}}const bu=Cl[0];function n9(n){return n.filter(t=>t.anchor.type==="numbering").length+1}function Zu(n){return n.filter(t=>t.anchor.type!=="numbering"&&t.anchor.type!=="linked").length+1}function hk(n){let t=0,e=0;const r=new Map;return n.map(s=>s.anchor.type==="linked"?s:s.anchor.type==="numbering"?(t+=1,r.set(s.id,t),{...s,label:t}):(e+=1,r.set(s.id,e),{...s,label:e})).map(s=>s.anchor.type==="linked"?{...s,label:r.get(s.anchor.pinId)??s.label}:s)}function r9(n,t){const e=t.x-n.x,r=t.y-n.y;if(e===0&&r===0)return t;const i=Math.max(Math.abs(e),Math.abs(r)),s=e===0?r>=0?1:-1:Math.sign(e),l=r===0?e>=0?1:-1:Math.sign(r);return{x:n.x+s*i,y:n.y+l*i}}function pk(n,t){return{x:t.x-n.x,y:t.y-n.y}}const zC=5.25*de,Gm=18*fn,Gy=6*fn,mk={fontSize:12*fn,color:"#aaa",flexShrink:0},Lf={minWidth:28*fn,height:28*fn,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.18)",color:"#ccc",cursor:"pointer",borderRadius:4*fn,fontSize:16*fn,padding:`${3*fn}px ${8*fn}px`,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},Al=4*de,i9=22*de,o9=18*de,s9=12*de,Ky=5*de;function Dd(n,t,e,r=1,i=[]){const s=i9*r,l=zC*1.6*r,c=(n.minX+n.maxX)/2,f=(n.minY+n.maxY)/2,d=[{cx:c,cy:n.minY-s},{cx:c,cy:n.maxY+s},{cx:n.maxX+s,cy:f},{cx:n.minX-s,cy:f}],p=g=>{if(g.cx<l||g.cx>t-l||g.cy<l||g.cy>e-l)return!1;for(const b of i)if(g.cx>=b.x-l&&g.cx<=b.x+b.w+l&&g.cy>=b.y-l&&g.cy<=b.y+b.h+l)return!1;return!0};for(const g of d)if(p(g))return g;return{cx:Math.max(l,Math.min(c,t-l)),cy:Math.max(l,Math.min(n.minY+s,e-l))}}function Jy(n,t,e=1){const r={nw:[-1,-1],n:[0,-1],ne:[1,-1],e:[1,0],se:[1,1],s:[0,1],sw:[-1,1],w:[-1,0]},i=1/Math.SQRT2,s=l=>l==="n"||l==="s"||l==="e"||l==="w"?1:i;return n.map(l=>{let c=1/0;for(const g of t){const b=Math.hypot(l.cx-g.x,l.cy-g.y);b<c&&(c=b)}if(c>=o9*e)return l;const[f,d]=r[l.handle],p=s9*e*s(l.handle);return{...l,cx:l.cx+f*p,cy:l.cy+d*p}})}function Ld({color:n,scale:t=1}){const e=zC*t,r=`M 0 ${-e} L ${e} 0 L 0 ${e} L ${-e} 0 Z`;return T.jsx("path",{d:r,fill:n,stroke:"#fff",strokeWidth:1.5*de*t})}function gk(n){const t=n.indexOf(",");if(t<0)return null;const e=n.slice(0,t),r=n.slice(t+1),s=e.match(/data:([^;]+)(;base64)?/)?.[1]??"image/png",l=/;base64/i.test(e);try{if(l){const c=atob(r),f=new Uint8Array(c.length);for(let d=0;d<c.length;d+=1)f[d]=c.charCodeAt(d);return new Blob([f],{type:s})}return new Blob([decodeURIComponent(r)],{type:s})}catch{return null}}const a9=new Set(["jpg","jpeg","png","webp","gif","bmp","svg","avif","heic","heif"]),l9=15e3;function i5(n){if(!n)return!1;if(n.type.startsWith("image/"))return!0;if(n.type)return!1;const t=n.name.lastIndexOf(".");if(t<0||t===n.name.length-1)return!1;const e=n.name.slice(t+1).toLowerCase();return a9.has(e)}function c9(n,t,e=l9){const r=Math.max(n,t);return r<=e?null:`Зображення завелике (${r} px по довгій стороні). Зменште до ${e} px або менше.`}async function u9(n){const t=URL.createObjectURL(n),e=new Image;try{return await new Promise((r,i)=>{e.onload=()=>r(),e.onerror=()=>i(new Error("Image decode failed")),e.src=t}),{width:e.naturalWidth,height:e.naturalHeight}}catch{return null}finally{URL.revokeObjectURL(t)}}const _a=24,yk=[{id:"free",label:"Вільний формат"},{id:"16:9",label:"16:9"},{id:"16:10",label:"16:10"},{id:"4:3",label:"4:3"},{id:"1:1",label:"Квадрат 1:1"},{id:"21:9",label:"21:9"},{id:"3:2",label:"3:2"},{id:"a4-portrait",label:"A4 (вертикальний)"},{id:"a4-landscape",label:"A4 (горизонтальний)"}];function Zy(n){switch(n){case"free":return null;case"16:9":return 16/9;case"16:10":return 16/10;case"4:3":return 4/3;case"1:1":return 1;case"21:9":return 21/9;case"3:2":return 3/2;case"a4-portrait":return 1/Math.SQRT2;case"a4-landscape":return Math.SQRT2}}function bk(n,t,e){if(!e)return{x:0,y:0,width:n,height:t};let r=n,i=r/e;return i>t&&(i=t,r=i*e),{x:(n-r)/2,y:(t-i)/2,width:r,height:i}}const f9=U.forwardRef(function(t,e){const{mode:r="standalone",initialDocument:i,embedConfig:s,features:l,onReady:c,onChange:f,onError:d}=t,p=r==="embed"||Fz(),g=U.useMemo(()=>({autosave:l?.autosave??!p}),[p,l]),b=rh(),y=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),M=typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent),[C,D]=U.useState(null),[L,H]=U.useState(null),[Y,W]=U.useState(!1),[St,_t]=U.useState("free"),[Ct,bt]=U.useState(!1),[ot,jt]=U.useState(null),[Z,ct]=U.useState(!1),[V,xt]=U.useState({w:0,h:0}),[Lt,dt]=U.useState(null),[st,lt]=U.useState([]),[zt,At]=U.useState({}),[K,P]=U.useState("select"),[X,tt]=U.useState(null),[gt,vt]=U.useState(null),[kt,qt]=U.useState(null),[Rt,Zt]=U.useState(null),{canUndo:Ae,canRedo:le,reset:Ie,record:Ue,undo:ft,redo:Re}=lz(),rn=U.useRef(Ue);rn.current=Ue;const on=kt!==null?"polygon":Rt!==null?"polyline":"none",be=U.useRef(on);U.useEffect(()=>{be.current!==on&&(Ie(),be.current=on)},[on,Ie]);const[_e,Te]=U.useState(null),[Le,Ye]=U.useState("point"),[hn,Pn]=U.useState(null),[wn,Nn]=U.useState(null),Sn=U.useRef(null),[Be,tn]=U.useState(null),[je,ur]=U.useState(null),bn=U.useRef(null),cn=U.useRef(null);U.useEffect(()=>{cn.current=ot},[ot]);const pn=U.useRef(null),[$n,en]=U.useState(!1),Qt=U.useRef(!1),[ve,me]=U.useState(!1),[We,He]=U.useState(!1),[Pe,Vn]=U.useState(()=>new Date),[Xo,ui]=U.useState(()=>Pf(new Date)),[Hi,Go]=U.useState(p2),[Je,Ss]=U.useState(!1),[to,Xt]=U.useState(null);U.useEffect(()=>{(Le!=="numbering"||K!=="place")&&hn&&(Pn(null),Nn(null),Sn.current=null)},[Le,K,hn]);const{settings:Ei,fontFamily:Xn,setFontId:fi,setStrokeWidthScale:Ti}=A_(),Ko=U.useRef(Xn);Ko.current=Xn;const gi=Ei.strokeWidthScale,Ar=U.useRef(gi);Ar.current=gi;const ir=U.useCallback(w=>Hw(w,gi),[gi]),[Gn,Jo]=U.useState(!1),[ks,Oa]=U.useState(!1),[Zo,To]=U.useState(!1);U.useEffect(()=>{if(!Zo)return;const w=k=>{k.key==="Escape"&&To(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Zo]);const[Ll,ca]=U.useState(!1),[As,Qa]=U.useState(!1),[Qo,di]=U.useState(!1),tl=typeof window<"u"&&!!navigator.clipboard&&"ClipboardItem"in window,[Pi,qr]=U.useState(null),[Ms,Rl]=U.useState(null),[ac,Bc]=U.useState({w:420*fn,h:96*fn}),zc=U.useRef(null),eo=U.useRef(null),yi=U.useRef(null),Ni=U.useRef(!1),Fn=U.useRef([]),Po=U.useRef([]),fr=U.useRef(st),go=U.useRef(zt),qi=U.useRef(C),Yr=U.useRef(null),dr=U.useRef(V),Ir=U.useRef(Lt);U.useEffect(()=>{fr.current=st,go.current=zt},[st,zt]),U.useEffect(()=>{qi.current=C},[C]),U.useEffect(()=>{dr.current=V},[V]),U.useEffect(()=>{Ir.current=Lt},[Lt]);const hi=20;function Ys(w){const k=m4,_=d2,{w:N,h:j}=dr.current;let G,nt;if(w.type==="linked")G=0,nt=0;else if(w.type==="point")G=w.x,nt=w.y;else if(w.type==="polygon"||w.type==="polyline"){const ut=w.points;G=Math.max(...ut.map(it=>it.x)),nt=Math.max(...ut.map(it=>it.y))}else w.type==="rectangle"?(G=w.x+w.width,nt=w.y+w.height):w.type==="ellipse"?(G=w.cx+w.rx,nt=w.cy+w.ry):w.type==="compass"?(G=w.cx+w.radius,nt=w.cy+w.radius):w.type==="arrow"?(G=Math.max(w.start.x,w.end.x,w.control.x),nt=Math.max(w.start.y,w.end.y,w.control.y)):w.type==="numbering"?(G=Math.max(w.start.x,w.end.x),nt=Math.max(w.start.y,w.end.y)):w.type==="text"||w.type==="image"?(G=w.x+w.width,nt=w.y+w.height):(G=w.x,nt=w.y);let z=G+hi,J=nt+hi;return z=Math.max(0,Math.min(z,Math.max(0,N-k))),J=Math.max(0,Math.min(J,Math.max(0,j-_))),{x:z,y:J,width:k,height:_}}const te=U.useCallback(()=>{const w={pins:structuredClone(fr.current),cardPositions:structuredClone(go.current),backgroundImage:qi.current,imageSize:structuredClone(dr.current),sourceImageSize:structuredClone(Ir.current)};Fn.current=[...Fn.current.slice(-99),w],Po.current=[],Pa(Fn.current.length),Io(0)},[]),[el,Pa]=U.useState(0),[$s,Io]=U.useState(0),Ol=kt!==null||Rt!==null,Pl=Ol?Ae:el>0,lc=Ol?le:$s>0,cc=U.useCallback(()=>{if(Fn.current.length===0)return;Po.current=[{pins:structuredClone(fr.current),cardPositions:structuredClone(go.current),backgroundImage:qi.current,imageSize:structuredClone(dr.current),sourceImageSize:structuredClone(Ir.current)},...Po.current];const w=Fn.current.pop();lt(w.pins),At(w.cardPositions),D(w.backgroundImage),xt(w.imageSize),dt(w.sourceImageSize),Pa(Fn.current.length),Io(Po.current.length)},[]),Tu=U.useCallback(()=>{if(Po.current.length===0)return;Fn.current=[...Fn.current,{pins:structuredClone(fr.current),cardPositions:structuredClone(go.current),backgroundImage:qi.current,imageSize:structuredClone(dr.current),sourceImageSize:structuredClone(Ir.current)}];const w=Po.current.shift();lt(w.pins),At(w.cardPositions),D(w.backgroundImage),xt(w.imageSize),dt(w.sourceImageSize),Pa(Fn.current.length),Io(Po.current.length)},[]),uc=U.useCallback(()=>{if(kt!==null){const w=ft(kt);w!==null&&qt(w);return}if(Rt!==null){const w=ft(Rt);w!==null&&Zt(w);return}cc()},[kt,Rt,cc,ft]),jo=U.useCallback(()=>{if(kt!==null){const w=Re(kt);w!==null&&qt(w);return}if(Rt!==null){const w=Re(Rt);w!==null&&Zt(w);return}Tu()},[kt,Rt,Tu,Re]),Bo=U.useRef(null),ts=U.useRef(null),fc=U.useRef(null),es=U.useRef(()=>{}),vn=U.useRef(null),dc=U.useRef(null),xr=U.useRef(null),hc=U.useRef(null),ua=U.useRef(!1),zo=U.useRef(null),Fo=U.useRef(null),Yi=U.useRef(null),No=U.useRef(null),nl=U.useRef(null),Cs=U.useRef(null),Ia=U.useRef(null),no=U.useRef(null),ja=U.useRef(null),fa=U.useRef(null),Ii=U.useRef(null),_o=U.useRef(null),Uo=U.useRef(null),Es=U.useRef(null),da=U.useRef(null),ha=U.useRef(null),Vs=U.useRef(null),Ts=U.useRef(null),Ns=U.useRef(null),rl=U.useRef(null),ns=U.useRef(null),_s=U.useRef(null),Il=U.useRef(null),Ba=U.useRef(null),jl=U.useRef(null),pa=U.useRef(null),Bl=U.useRef(null),A=U.useRef(null),B=U.useRef(null),ht=U.useRef(null);U.useEffect(()=>{ht.current=kt},[kt]);const Tt=U.useRef(null),Bt=U.useRef(null),ne=U.useRef(null),xe=U.useRef(null),Ge=U.useRef(null),un=U.useRef(null),In=U.useRef(null),Bn=U.useRef(null),or=U.useRef(null),$i=U.useRef(null);U.useEffect(()=>{$i.current=Rt},[Rt]),U.useEffect(()=>{pn.current=Be},[Be]),U.useEffect(()=>{Sn.current=hn&&wn?{start:hn,end:wn}:null},[hn,wn]);const ue=U.useRef(!1),Sr=20,$r=10,sn=20,[an,Do]=U.useState(!1),[Ws,Fc]=U.useState(!1),[gr,yo]=U.useState(1),[il,Xs]=U.useState(!1),[zl,za]=U.useState(null);U.useEffect(()=>{if(!C){za(null);return}let w=!1;const k=new Image;return k.onload=()=>{w||za(k)},k.onerror=()=>{w||za(null)},k.src=C,()=>{w=!0}},[C]),U.useLayoutEffect(()=>{const w=zc.current;if(!w)return;const k=()=>{const j=Math.max(1,Math.ceil(w.getBoundingClientRect().width),Math.ceil(w.scrollWidth)),G=Math.max(1,Math.ceil(w.getBoundingClientRect().height),Math.ceil(w.scrollHeight));Bc(nt=>nt.w!==j||nt.h!==G?{w:j,h:G}:nt)};k();const _=requestAnimationFrame(k),N=new ResizeObserver(k);return N.observe(w),()=>{cancelAnimationFrame(_),N.disconnect()}},[X,gt,Ms]);const Vi=U.useRef(null),Gs=U.useRef(null),rs=U.useRef(null),pc=U.useRef(null),Ks=U.useRef(null),bo=U.useRef(null),mc=U.useRef(null),ol=U.useRef(null),[Js,pi]=U.useState(!1),[sl,ma]=U.useState(!1),al=U.useRef(null),xo=U.useRef({isPanning:!1,startX:0,startY:0,startScrollLeft:0,startScrollTop:0}),ji=U.useRef(new Map),_i=U.useRef(null),Qr=U.useRef(!0),Fa=U.useRef(null),ga=U.useRef(1),ya=U.useCallback(w=>{const k=[.25,.5,.75,1,1.25,1.5,1.75,2,2.5,3,3.5,4,5,6,8,10,12,16,20];Fa.current="viewport-center",yo(_=>{const N=Math.min(k[k.length-1],Math.max(k[0],_));let j=0;for(let z=1;z<k.length;z+=1)Math.abs(k[z]-N)<Math.abs(k[j]-N)&&(j=z);const G=w==="in"?Math.min(k.length-1,j+1):Math.max(0,j-1),nt=k[G];return Qr.current=!1,nt})},[]),Me=U.useCallback((w,k)=>{if(!hc.current)return{x:0,y:0};const _=w,N=k,j=hc.current.getBoundingClientRect(),G=gr||1,nt=(_-j.left)/G,z=(N-j.top)/G;return{x:nt,y:z}},[gr]),Wi=U.useCallback((w,k,_)=>{const N=new Image;N.onload=()=>{const j=f2,G=Math.min(j/N.naturalWidth,j/N.naturalHeight,Number.POSITIVE_INFINITY),nt=Math.round(N.naturalWidth*G),z=Math.round(N.naturalHeight*G);xt({w:nt,h:z}),dt({w:N.naturalWidth,h:N.naturalHeight}),D(w),tt(null),vt(null),qt(null),Zt(null),Te(null),ur(null),W(!1),jt(null),k&&(lt([]),At({})),ua.current=!0,Qr.current=!0,_?.(!0)},N.onerror=()=>{_?.(!1)},N.src=w},[]);U.useEffect(()=>()=>{Yr.current&&(URL.revokeObjectURL(Yr.current),Yr.current=null)},[]),U.useEffect(()=>{if(!C||!xr.current||!V.w||!V.h)return;const w=xr.current,k=V.w*gr,_=V.h*gr,{clientWidth:N,clientHeight:j}=w;if(Fa.current==="viewport-center"){const G=ga.current,nt=w.scrollLeft+N/2,z=w.scrollTop+j/2,J=nt/G,ut=z/G;w.scrollLeft=Math.max(0,Math.min(k-N,J*gr-N/2)),w.scrollTop=Math.max(0,Math.min(_-j,ut*gr-j/2)),Fa.current=null}else Qr.current&&(w.scrollLeft=Math.max(0,(k-N)/2),w.scrollTop=Math.max(0,(_-j)/2));ga.current=gr},[C,V.w,V.h,gr]),U.useEffect(()=>{if(!ua.current||!C||!V.w||!V.h)return;const w=xr.current,k=V.w,_=V.h,N=()=>{const nt=xr.current;if(!nt?.clientWidth||!nt?.clientHeight)return!1;const z=Math.min(nt.clientWidth/k,nt.clientHeight/_);if(!z||!Number.isFinite(z))return!1;const J=Math.max(Mm,Math.min(Cm,+z.toFixed(Em)));return ua.current=!1,yo(J),!0};if(N())return;let j=0,G=null;return j=requestAnimationFrame(()=>{j=0,!N()&&w&&(G=new ResizeObserver(()=>{N()&&G?.disconnect()}),G.observe(w))}),()=>{j&&cancelAnimationFrame(j),G?.disconnect()}},[C,V.w,V.h]);const bi=U.useCallback(()=>{if(!C||!xr.current||!V.w||!V.h)return;const w=xr.current,{clientWidth:k,clientHeight:_}=w;if(!k||!_)return;const N=Math.min(k/V.w,_/V.h);if(!N||!Number.isFinite(N))return;const j=Math.max(Mm,Math.min(Cm,+N.toFixed(Em)));Qr.current=!0,yo(j)},[C,V.w,V.h]);U.useEffect(()=>{const w=xr.current;if(!w)return;const k=_=>{if(!qi.current||!(_.ctrlKey||_.metaKey))return;_.preventDefault();const N=w.getBoundingClientRect(),j=_.clientX,G=_.clientY,nt=j-N.left,z=G-N.top,J=_.deltaY>0?1/Ow:Ow;yo(ut=>{const it=Math.min(Cm,Math.max(Mm,+(ut*J).toFixed(Em))),rt=w.scrollLeft+nt,I=w.scrollTop+z,Mt=rt/ut,It=I/ut,wt=dr.current.w*it,Et=dr.current.h*it;return w.scrollLeft=Math.max(0,Math.min(wt-w.clientWidth,Mt*it-nt)),w.scrollTop=Math.max(0,Math.min(Et-w.clientHeight,It*it-z)),Qr.current=!1,it})};return w.addEventListener("wheel",k,{passive:!1}),()=>w.removeEventListener("wheel",k)},[]);const Uc=U.useCallback(async w=>{if(!i5(w))return;const k=await u9(w);if(!k){H("Не вдалося відкрити зображення. Спробуйте інший файл.");return}const _=c9(k.width,k.height);if(_){H(_);return}H(null),Xt(null);const N=URL.createObjectURL(w);Wi(N,!0,j=>{if(!j){H("Не вдалося завантажити зображення. Спробуйте файл меншого розміру."),URL.revokeObjectURL(N);return}Yr.current&&Yr.current!==N&&URL.revokeObjectURL(Yr.current),Yr.current=N})},[Wi]),mi=U.useCallback(w=>{if(!i5(w)||!qi.current)return;te(),Xt(null);const k=URL.createObjectURL(w);Wi(k,!1,_=>{if(!_){URL.revokeObjectURL(k);return}Yr.current&&Yr.current!==k&&URL.revokeObjectURL(Yr.current),Yr.current=k})},[Wi,te]),ro=w=>{const k=w.target.files?.[0];k&&(Uc(k),w.target.value="")},ll=w=>{const k=w.target.files?.[0];k&&(mi(k),w.target.value="")},Fl=U.useCallback(()=>{if(!qi.current)return;const{w,h:k}=dr.current;if(!w||!k)return;const _=Zy(St);jt(bk(w,k,_)),W(!0),bt(!1),P("select")},[St]),gc=U.useCallback(()=>{W(!1),bt(!1),jt(null),Yi.current=null,No.current=null},[]),Ul=U.useCallback(w=>{_t(w);const{w:k,h:_}=dr.current;!k||!_||jt(bk(k,_,Zy(w)))},[]),ba=U.useCallback(w=>{if(!cn.current)return;w.preventDefault(),w.stopPropagation();const k=Me(w.clientX,w.clientY);Yi.current={startRect:cn.current,startSvgX:k.x,startSvgY:k.y}},[Me]),cl=U.useCallback((w,k)=>{if(!cn.current)return;k.preventDefault(),k.stopPropagation();const _=Me(k.clientX,k.clientY);No.current={corner:w,startRect:cn.current,startSvgX:_.x,startSvgY:_.y,aspect:Zy(St)}},[St,Me]),is=U.useCallback(async()=>{if(!cn.current||!qi.current||!Ir.current||!dr.current.w||!dr.current.h)return;const w=qi.current,k=cn.current,_=Ir.current,N=dr.current,j=_.w/N.w,G=_.h/N.h,nt=Math.max(0,Math.round(k.x*j)),z=Math.max(0,Math.round(k.y*G)),J=Math.max(1,Math.round(k.width*j)),ut=Math.max(1,Math.round(k.height*G)),it=new Image;ct(!0);try{await new Promise((yt,Ft)=>{it.onload=()=>yt(),it.onerror=()=>Ft(new Error("Crop image load failed")),it.src=w});const rt=document.createElement("canvas");rt.width=J,rt.height=ut;const I=rt.getContext("2d");if(!I)return;I.drawImage(it,nt,z,J,ut,0,0,J,ut);const Mt=rt.toDataURL("image/png"),It=H_(J,ut),{pins:wt,cardPositions:Et}=Y_(fr.current,go.current,k,It);te(),lt(wt),At(Et),tt(null),vt(null),qr(null),Wi(Mt,!1),W(!1),bt(!1),jt(null)}finally{ct(!1),Yi.current=null,No.current=null}},[Wi,te]);U.useEffect(()=>{const w=k=>{if(C)return;const _=k.clipboardData?.items;if(_){for(const N of _)if(N.type.startsWith("image/")){k.preventDefault();const j=N.getAsFile();if(!j)return;const G=new FileReader;G.onload=nt=>{const z=nt.target?.result;z&&(Xt(null),Wi(z,!0))},G.readAsDataURL(j);return}}};return document.addEventListener("paste",w),()=>document.removeEventListener("paste",w)},[C,Wi]),U.useEffect(()=>{const w=_=>{_.dataTransfer?.types?.includes("Files")&&(_.preventDefault(),_.dataTransfer.dropEffect="copy")},k=_=>{if(!_.dataTransfer?.files?.length)return;_.preventDefault();const N=_.dataTransfer.files[0];if(N){if(!qi.current){Uc(N);return}es.current(N)}};return window.addEventListener("dragover",w),window.addEventListener("drop",k),()=>{window.removeEventListener("dragover",w),window.removeEventListener("drop",k)}},[Uc]),U.useEffect(()=>{const w=()=>{if(!Gs.current)return;const N=Gs.current,j=N.scrollWidth>N.clientWidth,G=typeof window<"u"&&window.innerWidth<(y?1280:Xz),nt=j||G,z=typeof window<"u"&&window.innerWidth<(y?1040:1320),J=N.clientWidth<(y?980:1240);Do(nt),Fc(z||j&&J)};w(),window.addEventListener("resize",w);const k=Gs.current;let _=null;return k&&typeof ResizeObserver<"u"&&(_=new ResizeObserver(()=>w()),_.observe(k)),()=>{window.removeEventListener("resize",w),_&&_.disconnect()}},[y]),U.useEffect(()=>{V.w&&At(w=>{const k=new Set(st.filter(j=>j.anchor.type==="text").map(j=>j.id)),_=Object.fromEntries(Object.entries(w).filter(([j])=>!k.has(j))),N=st.filter(j=>j.anchor.type!=="text").map(j=>j.id);return N.length===0||Object.keys(_).length>0?Object.keys(_).length===Object.keys(w).length?w:_:U_(N,V.w,V.h)})},[st.length,V]);const Ds=U.useCallback(w=>{if(Y||K!=="place"||!C)return;const k=w.target;if(k!==Bo.current&&k.getAttribute?.("data-background")!=="true")return;w.preventDefault();const{x:_,y:N}=Me(w.clientX,w.clientY),{w:j,h:G}=dr.current,nt=Math.max(0,Math.min(_,j)),z=Math.max(0,Math.min(N,G));if(Le==="arrow"&&!_e&&kt===null&&Rt===null){const J={start:{x:nt,y:z},end:{x:nt,y:z},control:{x:nt,y:z}};pn.current=J,tn(J);return}if(Le==="numbering"&&!_e&&kt===null&&Rt===null){const J={start:{x:nt,y:z},end:{x:nt,y:z}};Sn.current=J,Pn(J.start),Nn(J.end);return}_e&&(bn.current={shape:_e,x1:nt,y1:z,x2:nt,y2:z},ur({x1:nt,y1:z,x2:nt,y2:z}))},[K,_e,C,Me,Le,kt,Rt,Y]),io=U.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!kt||kt.length<2)return;const k=wl(),_=bu,N={type:"polygon",points:[...kt],rotation:0},j=Ys(N);te(),lt(G=>[...G,{id:k,anchor:N,color:_,strokeStyle:Qh,fillStyle:pg,label:Zu(G),image:null,imageAspect:null,description:"",descPos:"below"}]),At(G=>({...G,[k]:j})),qt(null),tt(k),vt(k),P("select"),yi.current=k,Ni.current=!0},[kt,te]),Zs=U.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!Rt||Rt.length<2)return;const k=wl(),_=bu,N={type:"polyline",points:[...Rt],rotation:0},j=Ys(N);te(),lt(G=>[...G,{id:k,anchor:N,color:_,strokeStyle:Qh,label:Zu(G),image:null,imageAspect:null,description:"",descPos:"below"}]),At(G=>({...G,[k]:j})),Zt(null),tt(k),vt(k),P("select"),yi.current=k,Ni.current=!0},[Rt,te]),oo=U.useCallback(w=>{if(Y)return;const k=w.target;if(K!=="place"&&(k===Bo.current||k.getAttribute?.("data-background")==="true")){tt(null),vt(null);return}if(K!=="place"||!C)return;if(ue.current){ue.current=!1;return}const{x:_,y:N}=Me(w.clientX,w.clientY),{w:j,h:G}=dr.current;if(_<0||N<0||_>j||N>G)return;let nt=_,z=N;if(kt!==null){if(w.shiftKey&&kt.length>0){const yt=dk(kt[kt.length-1],{x:_,y:N});nt=Math.max(0,Math.min(yt.x,j)),z=Math.max(0,Math.min(yt.y,G))}if(kt.length>=2){const yt=kt[0];if(Math.hypot(nt-yt.x,z-yt.y)<18*de){w.preventDefault(),w.stopPropagation(),io(w);return}}Ue(kt),qt(yt=>[...yt??[],{x:nt,y:z}]);return}if(Rt!==null){if(w.shiftKey&&Rt.length>0){const yt=dk(Rt[Rt.length-1],{x:_,y:N});nt=Math.max(0,Math.min(yt.x,j)),z=Math.max(0,Math.min(yt.y,G))}Ue(Rt),Zt(yt=>[...yt??[],{x:nt,y:z}]);return}if(Le==="arrow"||Le==="numbering")return;w.preventDefault(),w.stopPropagation();const J=wl(),ut=bu,it=Le==="pointText",rt=Le==="text"||it,I=Le==="standalone",Mt={width:ck,height:uk},It=it?E4({x:_,y:N},p_,Mt):{x:_,y:N},wt=rt?{type:"text",x:It.x,y:It.y,...Mt,...it?{point:{x:_,y:N}}:{}}:I?{type:"standalone",x:_,y:N}:{type:"point",x:_,y:N},Et=rt?null:Ys(wt);te(),lt(yt=>[...yt,{id:J,anchor:wt,color:ut,label:Zu(yt),image:null,imageAspect:null,description:rt?cy:"",descPos:"below",textColor:it?m_:void 0,textBackgroundColor:it?g_:rt?null:void 0}]),Et&&At(yt=>({...yt,[J]:Et})),tt(J),vt(J),P("select"),yi.current=J,Ni.current=!0,rt&&qr(J)},[K,C,Me,kt,Rt,te,io,Le,Y,Ue]),so=U.useCallback(w=>{if(!C||($t.current=Me(w.clientX,w.clientY),K!=="place"||Le!=="numbering"||!hn))return;const{x:k,y:_}=Me(w.clientX,w.clientY),{w:N,h:j}=dr.current;Nn({x:Math.max(0,Math.min(k,N)),y:Math.max(0,Math.min(_,j))})},[C,K,Le,hn,Me]);U.useEffect(()=>{const w=k=>{k.key==="Enter"&&(kt&&kt.length>=2?io():Rt&&Rt.length>=2&&Zs()),k.key==="Escape"&&K==="place"&&(k.preventDefault(),hn&&(Pn(null),Nn(null),Sn.current=null),kt&&kt.length>0&&qt(null),Rt&&Rt.length>0&&Zt(null),_e&&(Te(null),ur(null),bn.current=null),pn.current&&(tn(null),pn.current=null),P("select"))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[K,hn,kt,Rt,io,Zs,_e]);const yr=U.useCallback((w,k)=>{if(K==="place")return;k.preventDefault();const _=zt[w];if(!_)return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,zo.current={pinId:w,startCardX:_.x,startCardY:_.y,startSvgX:N.x,startSvgY:N.y}},[zt,Me,K,te]),Mr=U.useCallback((w,k,_)=>{_.preventDefault();const N=zt[w];if(!N)return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,Fo.current={pinId:w,handle:k,startCardX:N.x,startCardY:N.y,startCardW:N.width,startCardH:N.height,startSvgX:j.x,startSvgY:j.y}},[zt,Me,te]);U.useEffect(()=>{const w=N=>Me(N.clientX,N.clientY),k=N=>{const{w:j,h:G}=dr.current;if(Yi.current){const{startRect:nt,startSvgX:z,startSvgY:J}=Yi.current,ut=w(N),it=ut.x-z,rt=ut.y-J;jt({x:Math.max(0,Math.min(nt.x+it,j-nt.width)),y:Math.max(0,Math.min(nt.y+rt,G-nt.height)),width:nt.width,height:nt.height});return}if(No.current){const{corner:nt,startRect:z,startSvgX:J,startSvgY:ut,aspect:it}=No.current,rt=w(N),I=rt.x-J,Mt=rt.y-ut;let It={...z};if(it==null)if(nt==="nw"){const wt=z.x+z.width,Et=z.y+z.height,yt=Math.max(0,Math.min(z.x+I,wt-_a)),Ft=Math.max(0,Math.min(z.y+Mt,Et-_a));It={x:yt,y:Ft,width:wt-yt,height:Et-Ft}}else if(nt==="ne"){const wt=z.y+z.height,Et=Math.max(_a,Math.min(z.width+I,j-z.x)),yt=Math.max(0,Math.min(z.y+Mt,wt-_a));It={x:z.x,y:yt,width:Et,height:wt-yt}}else if(nt==="se"){const wt=Math.max(_a,Math.min(z.width+I,j-z.x)),Et=Math.max(_a,Math.min(z.height+Mt,G-z.y));It={x:z.x,y:z.y,width:wt,height:Et}}else{const wt=z.x+z.width,Et=Math.max(0,Math.min(z.x+I,wt-_a)),yt=Math.max(_a,Math.min(z.height+Mt,G-z.y));It={x:Et,y:z.y,width:wt-Et,height:yt}}else{const wt=nt==="nw"?{x:z.x+z.width,y:z.y+z.height}:nt==="ne"?{x:z.x,y:z.y+z.height}:nt==="se"?{x:z.x,y:z.y}:{x:z.x+z.width,y:z.y},Et=nt==="nw"||nt==="sw"?Math.max(0,Math.min(z.x+I,wt.x-_a)):Math.max(wt.x+_a,Math.min(z.x+z.width+I,j)),yt=nt==="nw"||nt==="ne"?Math.max(0,Math.min(z.y+Mt,wt.y-_a)):Math.max(wt.y+_a,Math.min(z.y+z.height+Mt,G)),Ft=Math.abs(Et-wt.x),Vt=Math.abs(yt-wt.y),pe=nt==="nw"||nt==="sw"?wt.x:j-wt.x,se=nt==="nw"||nt==="ne"?wt.y:G-wt.y;let Ee=Ft,Qe=Vt;Ee/Math.max(1,Qe)>it?Qe=Ee/it:Ee=Qe*it;const En=Math.max(_a,Math.min(pe,se*it));Ee=Math.max(_a,Math.min(Ee,En)),Qe=Ee/it,It={x:nt==="nw"||nt==="sw"?wt.x-Ee:wt.x,y:nt==="nw"||nt==="ne"?wt.y-Qe:wt.y,width:Ee,height:Qe}}jt(It);return}if(B.current){const{pointIndex:nt,startX:z,startY:J,startSvgX:ut,startSvgY:it}=B.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0);const It=Math.max(0,Math.min(z+I,j)),wt=Math.max(0,Math.min(J+Mt,G));qt(Et=>{if(!Et||nt<0||nt>=Et.length)return Et;const yt=[...Et];return yt[nt]={x:It,y:wt},yt});return}if(Ge.current){const{pointIndex:nt,startX:z,startY:J,startSvgX:ut,startSvgY:it}=Ge.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0);const It=Math.max(0,Math.min(z+I,j)),wt=Math.max(0,Math.min(J+Mt,G));Zt(Et=>{if(!Et||nt<0||nt>=Et.length)return Et;const yt=[...Et];return yt[nt]={x:It,y:wt},yt});return}if(bn.current){const nt=w(N);let z=Math.max(0,Math.min(nt.x,j)),J=Math.max(0,Math.min(nt.y,G));if(N.shiftKey){const ut=r9({x:bn.current.x1,y:bn.current.y1},{x:z,y:J});z=Math.max(0,Math.min(ut.x,j)),J=Math.max(0,Math.min(ut.y,G))}bn.current.x2=z,bn.current.y2=J,ur({x1:bn.current.x1,y1:bn.current.y1,x2:z,y2:J});return}if(pn.current){const nt=w(N),z=Math.max(0,Math.min(nt.x,j)),J=Math.max(0,Math.min(nt.y,G)),ut=pn.current.start;(Math.abs(z-ut.x)>2||Math.abs(J-ut.y)>2)&&(ue.current=!0);const it={start:ut,end:{x:z,y:J},control:{x:(ut.x+z)/2,y:(ut.y+J)/2}};pn.current=it,tn(it);return}if(Sn.current){const nt=w(N),z=Math.max(0,Math.min(nt.x,j)),J=Math.max(0,Math.min(nt.y,G)),ut=Sn.current.start;(Math.abs(z-ut.x)>2||Math.abs(J-ut.y)>2)&&(ue.current=!0);const it={start:ut,end:{x:z,y:J}};Sn.current=it,Pn(ut),Nn(it.end);return}if(Ii.current){const{pinId:nt,startCenterX:z,startCenterY:J,startDist:ut,startFontSize:it}=Ii.current,rt=w(N),I=Math.hypot(rt.x-z,rt.y-J);Math.abs(I-ut)>1.5&&(ue.current=!0);const Mt=Math.max(.25,I/Math.max(1,ut)),It=Math.max(10,Math.round(it*Mt));lt(wt=>wt.map(Et=>{if(Et.id!==nt||Et.anchor.type!=="text")return Et;const yt=xi(Et.description||"",{fontSize:It,bold:Et.textBold??!1,italic:Et.textItalic??!1}),Ft=yt.width,Vt=yt.height,pe=Math.max(0,Math.min(z-Ft/2,j-Ft)),se=Math.max(0,Math.min(J-Vt/2,G-Vt));return{...Et,textFontSize:It,anchor:{...Et.anchor,x:pe,y:se,width:Ft,height:Vt}}}));return}if(Es.current){const{pinId:nt,startX:z,startY:J,startSvgX:ut,startSvgY:it}=Es.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),lt(It=>It.map(wt=>wt.id!==nt||wt.anchor.type!=="redact"?wt:{...wt,anchor:{...wt.anchor,x:Math.max(0,Math.min(z+I,j-wt.anchor.width)),y:Math.max(0,Math.min(J+Mt,G-wt.anchor.height))}}));return}if(da.current){const{pinId:nt,handle:z,startX:J,startY:ut,startW:it,startH:rt,startSvgX:I,startSvgY:Mt}=da.current,It=w(N),wt=It.x-I,Et=It.y-Mt;(Math.abs(wt)>2||Math.abs(Et)>2)&&(ue.current=!0);const yt=J+it,Ft=ut+rt,Vt=z==="nw"||z==="sw",pe=z==="nw"||z==="ne",se=Vt?Math.min(J+wt,yt-Nm):J,Ee=pe?Math.min(ut+Et,Ft-Nm):ut,Qe=Vt?yt-se:Math.max(Nm,it+wt),En=pe?Ft-Ee:Math.max(Nm,rt+Et);lt(fe=>fe.map(Xe=>Xe.id!==nt||Xe.anchor.type!=="redact"?Xe:{...Xe,anchor:{...Xe.anchor,x:se,y:Ee,width:Qe,height:En}}));return}if(ha.current){const{pinId:nt,startX:z,startY:J,startSvgX:ut,startSvgY:it}=ha.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),lt(It=>It.map(wt=>wt.id!==nt||wt.anchor.type!=="image"?wt:{...wt,anchor:{...wt.anchor,x:Math.max(0,Math.min(z+I,j-wt.anchor.width)),y:Math.max(0,Math.min(J+Mt,G-wt.anchor.height))}}));return}if(Vs.current){const{pinId:nt,handle:z,startX:J,startY:ut,startW:it,startH:rt,startSvgX:I,startSvgY:Mt}=Vs.current,It=w(N),wt=It.x-I,Et=It.y-Mt;(Math.abs(wt)>2||Math.abs(Et)>2)&&(ue.current=!0);const Ft=Math.max(_m,it+(z==="ne"||z==="se"?1:-1)*wt);lt(Vt=>Vt.map(pe=>{if(pe.id!==nt||pe.anchor.type!=="image")return pe;const se=pe.anchor.aspect||1,Ee=Ft,Qe=Math.max(_m,Ee/se),En=z==="nw"||z==="sw"?J+it-Ee:J,fe=z==="nw"||z==="ne"?ut+rt-Qe:ut;return{...pe,anchor:{...pe.anchor,x:En,y:fe,width:Ee,height:Qe}}}));return}if(ja.current){const{pinId:nt,startPoint:z,startBox:J,startSvgX:ut,startSvgY:it}=ja.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0);const It=Math.max(0,Math.min(z.x+I,j)),wt=Math.max(0,Math.min(z.y+Mt,G));lt(Et=>Et.map(yt=>yt.id!==nt||yt.anchor.type!=="text"||!yt.anchor.point?yt:{...yt,anchor:{...yt.anchor,point:{x:It,y:wt},x:J.x+(It-z.x),y:J.y+(wt-z.y)}}));return}if(fa.current){const{pinId:nt,startX:z,startY:J,startSvgX:ut,startSvgY:it}=fa.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),lt(It=>It.map(wt=>{if(wt.id!==nt||wt.anchor.type!=="text")return wt;const Et={width:wt.anchor.width,height:wt.anchor.height};if(wt.anchor.point){const Vt={x:z+I+Et.width/2,y:J+Mt+Et.height/2},pe=W_(wt.anchor.point,Vt,Et);return{...wt,anchor:{...wt.anchor,x:pe.x,y:pe.y}}}const yt=Math.max(0,Math.min(z+I,j-Et.width)),Ft=Math.max(0,Math.min(J+Mt,G-Et.height));return{...wt,anchor:{...wt.anchor,x:yt,y:Ft}}}));return}if(nl.current){const{pinId:nt,startPinX:z,startPinY:J,startSvgX:ut,startSvgY:it}=nl.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),lt(It=>It.map(wt=>wt.id!==nt||wt.anchor.type!=="point"?wt:{...wt,anchor:{type:"point",x:Math.max(0,Math.min(z+I,j)),y:Math.max(0,Math.min(J+Mt,G))}}));return}if(Cs.current){const{pinId:nt,startStart:z,startEnd:J,startSvgX:ut,startSvgY:it}=Cs.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),lt(It=>It.map(wt=>wt.id!==nt||wt.anchor.type!=="numbering"?wt:{...wt,anchor:{type:"numbering",start:{x:Math.max(0,Math.min(z.x+I,j)),y:Math.max(0,Math.min(z.y+Mt,G))},end:{x:Math.max(0,Math.min(J.x+I,j)),y:Math.max(0,Math.min(J.y+Mt,G))}}}));return}if(Ia.current){const{pinId:nt,endpoint:z,startStart:J,startEnd:ut,startSvgX:it,startSvgY:rt}=Ia.current,I=w(N),Mt=I.x-it,It=I.y-rt;(Math.abs(Mt)>2||Math.abs(It)>2)&&(ue.current=!0);const wt=z==="start"?{x:Math.max(0,Math.min(J.x+Mt,j)),y:Math.max(0,Math.min(J.y+It,G))}:J,Et=z==="end"?{x:Math.max(0,Math.min(ut.x+Mt,j)),y:Math.max(0,Math.min(ut.y+It,G))}:ut;lt(yt=>yt.map(Ft=>Ft.id!==nt||Ft.anchor.type!=="numbering"?Ft:{...Ft,anchor:{type:"numbering",start:wt,end:Et}}));return}if(_o.current){const{pinId:nt,pointIndex:z,startPoints:J,startSvgX:ut,startSvgY:it}=_o.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),lt(It=>It.map(wt=>{if(wt.id!==nt||wt.anchor.type!=="polygon")return wt;const Et=[...wt.anchor.points];return Et[z]={x:Math.max(0,Math.min(J[z].x+I,j)),y:Math.max(0,Math.min(J[z].y+Mt,G))},{...wt,anchor:{type:"polygon",points:Et,rotation:wt.anchor.rotation??0}}}));return}if(Uo.current){const{pinId:nt,startPoints:z,startSvgX:J,startSvgY:ut}=Uo.current,it=w(N),rt=it.x-J,I=it.y-ut;(Math.abs(rt)>2||Math.abs(I)>2)&&(ue.current=!0),lt(Mt=>Mt.map(It=>{if(It.id!==nt||It.anchor.type!=="polygon")return It;const wt=z.map(Et=>({x:Math.max(0,Math.min(Et.x+rt,j)),y:Math.max(0,Math.min(Et.y+I,G))}));return{...It,anchor:{type:"polygon",points:wt,rotation:It.anchor.rotation??0}}}));return}if(Tt.current){const{pinId:nt,pointIndex:z,startPoints:J,startSvgX:ut,startSvgY:it}=Tt.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),lt(It=>It.map(wt=>{if(wt.id!==nt||wt.anchor.type!=="polyline")return wt;const Et=[...wt.anchor.points];return Et[z]={x:Math.max(0,Math.min(J[z].x+I,j)),y:Math.max(0,Math.min(J[z].y+Mt,G))},{...wt,anchor:{type:"polyline",points:Et,rotation:wt.anchor.rotation??0}}}));return}if(Bt.current){const{pinId:nt,startPoints:z,startSvgX:J,startSvgY:ut}=Bt.current,it=w(N),rt=it.x-J,I=it.y-ut;(Math.abs(rt)>2||Math.abs(I)>2)&&(ue.current=!0),lt(Mt=>Mt.map(It=>{if(It.id!==nt||It.anchor.type!=="polyline")return It;const wt=z.map(Et=>({x:Math.max(0,Math.min(Et.x+rt,j)),y:Math.max(0,Math.min(Et.y+I,G))}));return{...It,anchor:{type:"polyline",points:wt,rotation:It.anchor.rotation??0}}}));return}if(xe.current){const{pinId:nt,handle:z,startPoints:J,startMinX:ut,startMinY:it,startMaxX:rt,startMaxY:I,startSvgX:Mt,startSvgY:It}=xe.current,wt=w(N);(Math.abs(wt.x-Mt)>2||Math.abs(wt.y-It)>2)&&(ue.current=!0);const Et=Math.max(sn,rt-ut),yt=Math.max(sn,I-it);let Ft=ut,Vt=it,pe=rt,se=I;switch(z){case"se":pe=Math.max(ut+sn,wt.x),se=Math.max(it+sn,wt.y);break;case"sw":Ft=Math.min(rt-sn,wt.x),se=Math.max(it+sn,wt.y);break;case"nw":Ft=Math.min(rt-sn,wt.x),Vt=Math.min(I-sn,wt.y);break;case"ne":pe=Math.max(ut+sn,wt.x),Vt=Math.min(I-sn,wt.y);break;case"n":Vt=Math.min(I-sn,wt.y);break;case"s":se=Math.max(it+sn,wt.y);break;case"e":pe=Math.max(ut+sn,wt.x);break;case"w":Ft=Math.min(rt-sn,wt.x);break}const Ee=pe-Ft,Qe=se-Vt,En=J.map(fe=>({x:Ft+(fe.x-ut)/Et*Ee,y:Vt+(fe.y-it)/yt*Qe}));lt(fe=>fe.map(Xe=>Xe.id!==nt||Xe.anchor.type!=="polyline"?Xe:{...Xe,anchor:{type:"polyline",points:En,rotation:Xe.anchor.rotation??0}}));return}if(A.current){const{pinId:nt,handle:z,startPoints:J,startMinX:ut,startMinY:it,startMaxX:rt,startMaxY:I,startSvgX:Mt,startSvgY:It}=A.current,wt=w(N);(Math.abs(wt.x-Mt)>2||Math.abs(wt.y-It)>2)&&(ue.current=!0);const Et=Math.max(sn,rt-ut),yt=Math.max(sn,I-it);let Ft=ut,Vt=it,pe=rt,se=I;switch(z){case"se":pe=Math.max(ut+sn,wt.x),se=Math.max(it+sn,wt.y);break;case"sw":Ft=Math.min(rt-sn,wt.x),se=Math.max(it+sn,wt.y);break;case"nw":Ft=Math.min(rt-sn,wt.x),Vt=Math.min(I-sn,wt.y);break;case"ne":pe=Math.max(ut+sn,wt.x),Vt=Math.min(I-sn,wt.y);break;case"n":Vt=Math.min(I-sn,wt.y);break;case"s":se=Math.max(it+sn,wt.y);break;case"e":pe=Math.max(ut+sn,wt.x);break;case"w":Ft=Math.min(rt-sn,wt.x);break}const Ee=pe-Ft,Qe=se-Vt,En=J.map(fe=>({x:Ft+(fe.x-ut)/Et*Ee,y:Vt+(fe.y-it)/yt*Qe}));lt(fe=>fe.map(Xe=>Xe.id!==nt||Xe.anchor.type!=="polygon"?Xe:{...Xe,anchor:{type:"polygon",points:En,rotation:Xe.anchor.rotation??0}}));return}if(Ts.current){const{pinId:nt,startX:z,startY:J,startW:ut,startH:it,startSvgX:rt,startSvgY:I}=Ts.current,Mt=w(N),It=Mt.x-rt,wt=Mt.y-I;(Math.abs(It)>2||Math.abs(wt)>2)&&(ue.current=!0);const Et=Math.max(0,Math.min(z+It,j-ut)),yt=Math.max(0,Math.min(J+wt,G-it));lt(Ft=>Ft.map(Vt=>Vt.id!==nt||Vt.anchor.type!=="rectangle"?Vt:{...Vt,anchor:{type:"rectangle",x:Et,y:yt,width:ut,height:it,rotation:Vt.anchor.rotation??0}}));return}if(Ns.current){const{pinId:nt,startCx:z,startCy:J,startRx:ut,startRy:it,startSvgX:rt,startSvgY:I}=Ns.current,Mt=w(N),It=Mt.x-rt,wt=Mt.y-I;(Math.abs(It)>2||Math.abs(wt)>2)&&(ue.current=!0);const Et=Math.max(ut,Math.min(z+It,j-ut)),yt=Math.max(it,Math.min(J+wt,G-it));lt(Ft=>Ft.map(Vt=>Vt.id!==nt||Vt.anchor.type!=="ellipse"?Vt:{...Vt,anchor:{type:"ellipse",cx:Et,cy:yt,rx:ut,ry:it,rotation:Vt.anchor.rotation??0}}));return}if(Ba.current){const{pinId:nt,startCx:z,startCy:J,startRadius:ut,startSvgX:it,startSvgY:rt}=Ba.current,I=w(N),Mt=I.x-it,It=I.y-rt;(Math.abs(Mt)>2||Math.abs(It)>2)&&(ue.current=!0);const wt=Math.max(ut,Math.min(z+Mt,j-ut)),Et=Math.max(ut,Math.min(J+It,G-ut));lt(yt=>yt.map(Ft=>Ft.id!==nt||Ft.anchor.type!=="compass"?Ft:{...Ft,anchor:{type:"compass",cx:wt,cy:Et,radius:ut,rotation:Ft.anchor.rotation??0}}));return}if(un.current){const{pinId:nt,startStart:z,startEnd:J,startControl:ut,startSvgX:it,startSvgY:rt}=un.current,I=w(N),Mt=I.x-it,It=I.y-rt;(Math.abs(Mt)>2||Math.abs(It)>2)&&(ue.current=!0),lt(wt=>wt.map(Et=>Et.id!==nt||Et.anchor.type!=="arrow"?Et:{...Et,anchor:{type:"arrow",start:{x:Math.max(0,Math.min(z.x+Mt,j)),y:Math.max(0,Math.min(z.y+It,G))},end:{x:Math.max(0,Math.min(J.x+Mt,j)),y:Math.max(0,Math.min(J.y+It,G))},control:{x:Math.max(0,Math.min(ut.x+Mt,j)),y:Math.max(0,Math.min(ut.y+It,G))}}}));return}if(In.current){const{pinId:nt,handle:z,startStart:J,startEnd:ut,startControl:it,startSvgX:rt,startSvgY:I}=In.current,Mt=w(N),It=Mt.x-rt,wt=Mt.y-I;(Math.abs(It)>2||Math.abs(wt)>2)&&(ue.current=!0),lt(Et=>Et.map(yt=>{if(yt.id!==nt||yt.anchor.type!=="arrow")return yt;const Ft={...J},Vt={...ut},pe={...it};return z==="start"?(Ft.x=Math.max(0,Math.min(Ft.x+It,j)),Ft.y=Math.max(0,Math.min(Ft.y+wt,G))):z==="end"?(Vt.x=Math.max(0,Math.min(Vt.x+It,j)),Vt.y=Math.max(0,Math.min(Vt.y+wt,G))):(pe.x=Math.max(0,Math.min(pe.x+It,j)),pe.y=Math.max(0,Math.min(pe.y+wt,G))),{...yt,anchor:{type:"arrow",start:Ft,end:Vt,control:pe}}}));return}if(or.current){const{pinId:nt,handle:z,startStart:J,startEnd:ut,startControl:it,startMinX:rt,startMinY:I,startMaxX:Mt,startMaxY:It,startSvgX:wt,startSvgY:Et}=or.current,yt=w(N);(Math.abs(yt.x-wt)>2||Math.abs(yt.y-Et)>2)&&(ue.current=!0);const Ft=Math.max(sn,Mt-rt),Vt=Math.max(sn,It-I);let pe=rt,se=I,Ee=Mt,Qe=It;switch(z){case"se":Ee=Math.max(rt+sn,yt.x),Qe=Math.max(I+sn,yt.y);break;case"sw":pe=Math.min(Mt-sn,yt.x),Qe=Math.max(I+sn,yt.y);break;case"nw":pe=Math.min(Mt-sn,yt.x),se=Math.min(It-sn,yt.y);break;case"ne":Ee=Math.max(rt+sn,yt.x),se=Math.min(It-sn,yt.y);break;case"n":se=Math.min(It-sn,yt.y);break;case"s":Qe=Math.max(I+sn,yt.y);break;case"e":Ee=Math.max(rt+sn,yt.x);break;case"w":pe=Math.min(Mt-sn,yt.x);break}const En=Ee-pe,fe=Qe-se,Xe=we=>({x:pe+(we.x-rt)/Ft*En,y:se+(we.y-I)/Vt*fe});lt(we=>we.map(Tn=>Tn.id!==nt||Tn.anchor.type!=="arrow"?Tn:{...Tn,anchor:{type:"arrow",start:Xe(J),end:Xe(ut),control:Xe(it)}}));return}if(Bn.current){const{pinId:nt,startStart:z,startEnd:J,startControl:ut,centerX:it,centerY:rt,startAngle:I,startSvgX:Mt,startSvgY:It}=Bn.current,wt=w(N);(Math.abs(wt.x-Mt)>2||Math.abs(wt.y-It)>2)&&(ue.current=!0);const yt=Math.atan2(wt.y-rt,wt.x-it)-I,Ft=Math.cos(yt),Vt=Math.sin(yt),pe=se=>({x:it+(se.x-it)*Ft-(se.y-rt)*Vt,y:rt+(se.x-it)*Vt+(se.y-rt)*Ft});lt(se=>se.map(Ee=>Ee.id!==nt||Ee.anchor.type!=="arrow"?Ee:{...Ee,anchor:{type:"arrow",start:pe(z),end:pe(J),control:pe(ut)}}));return}if(_s.current){const{pinId:nt,startRotation:z,centerX:J,centerY:ut,startSvgX:it,startSvgY:rt}=_s.current,I=w(N);(Math.abs(I.x-it)>2||Math.abs(I.y-rt)>2)&&(ue.current=!0);const Mt=yt=>yt*180/Math.PI,It=Mt(Math.atan2(rt-ut,it-J)),wt=Mt(Math.atan2(I.y-ut,I.x-J));let Et=z+(wt-It);for(;Et<0;)Et+=360;for(;Et>=360;)Et-=360;lt(yt=>yt.map(Ft=>Ft.id!==nt||Ft.anchor.type!=="rectangle"?Ft:{...Ft,anchor:{...Ft.anchor,rotation:Et}}));return}if(Il.current){const{pinId:nt,startRotation:z,centerX:J,centerY:ut,startSvgX:it,startSvgY:rt}=Il.current,I=w(N);(Math.abs(I.x-it)>2||Math.abs(I.y-rt)>2)&&(ue.current=!0);const Mt=yt=>yt*180/Math.PI,It=Mt(Math.atan2(rt-ut,it-J)),wt=Mt(Math.atan2(I.y-ut,I.x-J));let Et=z+(wt-It);for(;Et<0;)Et+=360;for(;Et>=360;)Et-=360;lt(yt=>yt.map(Ft=>Ft.id!==nt||Ft.anchor.type!=="ellipse"?Ft:{...Ft,anchor:{...Ft.anchor,rotation:Et}}));return}if(pa.current){const{pinId:nt,startRotation:z,centerX:J,centerY:ut,startSvgX:it,startSvgY:rt}=pa.current,I=w(N);(Math.abs(I.x-it)>2||Math.abs(I.y-rt)>2)&&(ue.current=!0);const Mt=yt=>yt*180/Math.PI,It=Mt(Math.atan2(rt-ut,it-J)),wt=Mt(Math.atan2(I.y-ut,I.x-J));let Et=z+(wt-It);for(;Et<0;)Et+=360;for(;Et>=360;)Et-=360;lt(yt=>yt.map(Ft=>Ft.id!==nt||Ft.anchor.type!=="compass"?Ft:{...Ft,anchor:{...Ft.anchor,rotation:Et}}));return}if(Bl.current){const{pinId:nt,startPoints:z,centerX:J,centerY:ut,startAngle:it,startRotation:rt,startSvgX:I,startSvgY:Mt}=Bl.current,It=w(N);(Math.abs(It.x-I)>2||Math.abs(It.y-Mt)>2)&&(ue.current=!0);const Et=Math.atan2(It.y-ut,It.x-J)-it,yt=Math.cos(Et),Ft=Math.sin(Et),Vt=z.map(Ee=>({x:J+(Ee.x-J)*yt-(Ee.y-ut)*Ft,y:ut+(Ee.x-J)*Ft+(Ee.y-ut)*yt}));let se=rt+(Ee=>Ee*180/Math.PI)(Et);for(;se<0;)se+=360;for(;se>=360;)se-=360;lt(Ee=>Ee.map(Qe=>Qe.id!==nt||Qe.anchor.type!=="polygon"?Qe:{...Qe,anchor:{type:"polygon",points:Vt,rotation:se}}));return}if(ne.current){const{pinId:nt,startPoints:z,centerX:J,centerY:ut,startAngle:it,startRotation:rt,startSvgX:I,startSvgY:Mt}=ne.current,It=w(N);(Math.abs(It.x-I)>2||Math.abs(It.y-Mt)>2)&&(ue.current=!0);const Et=Math.atan2(It.y-ut,It.x-J)-it,yt=Math.cos(Et),Ft=Math.sin(Et),Vt=z.map(Ee=>({x:J+(Ee.x-J)*yt-(Ee.y-ut)*Ft,y:ut+(Ee.x-J)*Ft+(Ee.y-ut)*yt}));let se=rt+(Ee=>Ee*180/Math.PI)(Et);for(;se<0;)se+=360;for(;se>=360;)se-=360;lt(Ee=>Ee.map(Qe=>Qe.id!==nt||Qe.anchor.type!=="polyline"?Qe:{...Qe,anchor:{type:"polyline",points:Vt,rotation:se}}));return}if(rl.current){const{pinId:nt,handle:z,startX:J,startY:ut,startW:it,startH:rt,startRotation:I,startSvgX:Mt,startSvgY:It}=rl.current,wt=w(N);(Math.abs(wt.x-Mt)>2||Math.abs(wt.y-It)>2)&&(ue.current=!0);const Et=I*Math.PI/180,yt=Math.cos(Et),Ft=Math.sin(Et),Vt=J+it/2,pe=ut+rt/2,se=(sr,br)=>({x:Vt+sr*yt-br*Ft,y:pe+sr*Ft+br*yt}),Ee={nw:se(-it/2,-rt/2),ne:se(it/2,-rt/2),se:se(it/2,rt/2),sw:se(-it/2,rt/2)},Qe={n:se(0,-rt/2),s:se(0,rt/2),e:se(it/2,0),w:se(-it/2,0)},En={nw:Ee.se,ne:Ee.sw,se:Ee.nw,sw:Ee.ne},fe={n:Qe.s,s:Qe.n,e:Qe.w,w:Qe.e},Xe=En[z]??fe[z],we=(wt.x+Xe.x)/2,Tn=(wt.y+Xe.y)/2,Yt=Xe.x-we,De=Xe.y-Tn,ze={x:Yt*yt+De*Ft,y:-Yt*Ft+De*yt},Fe=z==="n"||z==="e"||z==="s"||z==="w",ke=Fe?z==="e"||z==="w"?Math.max(Sr,2*Math.abs(ze.x)):it:Math.max(Sr,2*Math.abs(ze.x)),_n=Fe?z==="n"||z==="s"?Math.max(Sr,2*Math.abs(ze.y)):rt:Math.max(Sr,2*Math.abs(ze.y)),qe=we-ke/2,nr=Tn-_n/2;lt(sr=>sr.map(br=>br.id!==nt||br.anchor.type!=="rectangle"?br:{...br,anchor:{type:"rectangle",x:qe,y:nr,width:ke,height:_n,rotation:I}}));return}if(ns.current){const{pinId:nt,handle:z,startCx:J,startCy:ut,startRx:it,startRy:rt,startSvgX:I,startSvgY:Mt}=ns.current,It=w(N);(Math.abs(It.x-I)>2||Math.abs(It.y-Mt)>2)&&(ue.current=!0);const{startRotation:wt}=ns.current,Et=wt*Math.PI/180,yt=Math.cos(Et),Ft=Math.sin(Et),Vt=(fe,Xe)=>({x:J+fe*yt-Xe*Ft,y:ut+fe*Ft+Xe*yt}),pe=z==="nw"||z==="ne"||z==="se"||z==="sw";let se=J,Ee=ut,Qe=it,En=rt;if(pe){const fe={nw:Vt(-it,-rt),ne:Vt(it,-rt),se:Vt(it,rt),sw:Vt(-it,rt)},we={nw:fe.se,ne:fe.sw,se:fe.nw,sw:fe.ne}[z];se=(It.x+we.x)/2,Ee=(It.y+we.y)/2;const Tn=we.x-se,Yt=we.y-Ee;Qe=Math.max($r,Math.abs(Tn*yt+Yt*Ft)),En=Math.max($r,Math.abs(-Tn*Ft+Yt*yt))}else{if(z==="n"){const fe=ut+rt;En=Math.max($r,(fe-It.y)/2),Ee=fe-En}else if(z==="s"){const fe=ut-rt;En=Math.max($r,(It.y-fe)/2),Ee=fe+En}else if(z==="e"){const fe=J-it;Qe=Math.max($r,(It.x-fe)/2),se=fe+Qe}else if(z==="w"){const fe=J+it;Qe=Math.max($r,(fe-It.x)/2),se=fe-Qe}se=Math.max(Qe,Math.min(se,j-Qe)),Ee=Math.max(En,Math.min(Ee,G-En))}lt(fe=>fe.map(Xe=>Xe.id!==nt||Xe.anchor.type!=="ellipse"?Xe:{...Xe,anchor:{type:"ellipse",cx:se,cy:Ee,rx:Qe,ry:En,rotation:Xe.anchor.rotation??0}}));return}if(jl.current){const{pinId:nt,startCx:z,startCy:J,startSvgX:ut,startSvgY:it}=jl.current,rt=w(N);(Math.abs(rt.x-ut)>2||Math.abs(rt.y-it)>2)&&(ue.current=!0);const I=Math.hypot(rt.x-z,rt.y-J),Mt=Math.min(z,J,j-z,G-J),It=Math.max(a8,Math.min(I,Mt));lt(wt=>wt.map(Et=>Et.id!==nt||Et.anchor.type!=="compass"?Et:{...Et,anchor:{type:"compass",cx:z,cy:J,radius:It,rotation:Et.anchor.rotation??0}}));return}if(no.current){const{pinId:nt,pointIndex:z,startPoints:J,startSvgX:ut,startSvgY:it}=no.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0);const It=J.map((wt,Et)=>Et===z?{x:Math.max(0,Math.min(wt.x+I,j)),y:Math.max(0,Math.min(wt.y+Mt,G))}:wt);lt(wt=>wt.map(Et=>Et.id===nt?{...Et,leaderPoints:It}:Et));return}if(zo.current){const{pinId:nt,startCardX:z,startCardY:J,startSvgX:ut,startSvgY:it}=zo.current,rt=w(N),I=rt.x-ut,Mt=rt.y-it;(Math.abs(I)>2||Math.abs(Mt)>2)&&(ue.current=!0),At(It=>{const wt=It[nt];return wt?{...It,[nt]:{...wt,x:Math.max(0,Math.min(z+I,j-wt.width)),y:Math.max(0,Math.min(J+Mt,G-wt.height))}}:It});return}if(Fo.current){const{pinId:nt,handle:z,startCardX:J,startCardY:ut,startCardW:it,startCardH:rt,startSvgX:I,startSvgY:Mt}=Fo.current,It=w(N),wt=It.x-I,Et=It.y-Mt;(Math.abs(wt)>2||Math.abs(Et)>2)&&(ue.current=!0);let yt=J,Ft=ut,Vt=it,pe=rt;z.includes("e")&&(Vt=Math.max(Pw,it+wt)),z.includes("s")&&(pe=Math.max(Iw,rt+Et)),z.includes("w")&&(Vt=Math.max(Pw,it-wt),yt=J+it-Vt),z.includes("n")&&(pe=Math.max(Iw,rt-Et),Ft=ut+rt-pe),yt=Math.max(0,Math.min(yt,j-Vt)),Ft=Math.max(0,Math.min(Ft,G-pe)),At(se=>({...se,[nt]:{x:yt,y:Ft,width:Vt,height:pe}}))}},_=()=>{if(Yi.current=null,No.current=null,bn.current){const N=bn.current,j=20,G=Math.min(N.x1,N.x2),nt=Math.max(N.x1,N.x2),z=Math.min(N.y1,N.y2),J=Math.max(N.y1,N.y2),ut=Math.max(j,nt-G),it=Math.max(j,J-z),rt=wl(),I=bu;te();const Mt=N.shape==="rectangle"?{type:"rectangle",x:G,y:z,width:ut,height:it}:N.shape==="redact"?{type:"redact",x:G,y:z,width:ut,height:it,mode:f_,strength:d_}:{type:"ellipse",cx:(G+nt)/2,cy:(z+J)/2,rx:ut/2,ry:it/2},It=N.shape==="redact"?null:Ys(Mt);lt(wt=>[...wt,{id:rt,anchor:Mt,color:I,strokeStyle:Qh,fillStyle:pg,label:Zu(wt),image:null,imageAspect:null,description:"",descPos:"below"}]),It&&At(wt=>({...wt,[rt]:It})),tt(rt),vt(rt),P("select"),ur(null),Te(null),bn.current=null,yi.current=rt,Ni.current=!0}if(pn.current){const N=pn.current;if(Math.hypot(N.end.x-N.start.x,N.end.y-N.start.y)>=6){const G=wl(),nt=bu,z={type:"arrow",start:N.start,end:N.end,control:N.control},J=Ys(z);te(),lt(ut=>[...ut,{id:G,anchor:z,color:nt,label:Zu(ut),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),At(ut=>({...ut,[G]:J})),tt(G),vt(null),P("select"),yi.current=G,Ni.current=!0}tn(null),pn.current=null}if(Sn.current){const N=Sn.current;if(Math.hypot(N.end.x-N.start.x,N.end.y-N.start.y)>=6){const G=wl(),nt=bu;te(),lt(z=>[...z,{id:G,anchor:{type:"numbering",start:N.start,end:N.end},color:nt,label:n9(z),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),tt(G),vt(null),P("select"),yi.current=G,Ni.current=!0}Pn(null),Nn(null),Sn.current=null}zo.current=null,Fo.current=null,nl.current=null,Cs.current=null,Ia.current=null,fa.current=null,Ii.current=null,_o.current=null,B.current&&ue.current&&rn.current(B.current.startPoints),B.current=null,Uo.current=null,Tt.current=null,Ge.current&&ue.current&&rn.current(Ge.current.startPoints),Ge.current=null,Bt.current=null,ne.current=null,xe.current=null,Ts.current=null,Ns.current=null,Ba.current=null,rl.current=null,ns.current=null,jl.current=null,_s.current=null,Il.current=null,pa.current=null,Bl.current=null,A.current=null,un.current=null,In.current=null,Bn.current=null,or.current=null,Sn.current=null,no.current=null,ja.current=null,ha.current=null,Vs.current=null,Es.current=null,da.current=null};return window.addEventListener("pointermove",k,{passive:!1}),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),window.addEventListener("mousemove",k),window.addEventListener("mouseup",_),()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",_)}},[Me]);const ti=U.useCallback((w,k)=>{if(K==="place")return;const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="point")return;k.preventDefault(),te();const N=Me(k.clientX,k.clientY);ue.current=!1,nl.current={pinId:w,startPinX:_.anchor.x,startPinY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[K,st,Me,te]),Dr=U.useCallback((w,k)=>{if(K==="place")return;const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="numbering")return;k.preventDefault(),k.stopPropagation(),te();const N=Me(k.clientX,k.clientY);ue.current=!1,Cs.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startSvgX:N.x,startSvgY:N.y}},[K,st,Me,te]),ss=U.useCallback((w,k,_)=>{if(K==="place")return;const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="numbering")return;_.preventDefault(),_.stopPropagation(),te();const j=Me(_.clientX,_.clientY);ue.current=!1,Ia.current={pinId:w,endpoint:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startSvgX:j.x,startSvgY:j.y}},[K,st,Me,te]),Hl=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=ht.current;if(!_||w<0||w>=_.length)return;const N=_[w],{x:j,y:G}=Me(k.clientX,k.clientY);ue.current=!1,B.current={pointIndex:w,startX:N.x,startY:N.y,startSvgX:j,startSvgY:G,startPoints:_.map(nt=>({x:nt.x,y:nt.y}))}},[Me]),ul=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=$i.current;if(!_||w<0||w>=_.length)return;const N=_[w],{x:j,y:G}=Me(k.clientX,k.clientY);ue.current=!1,Ge.current={pointIndex:w,startX:N.x,startY:N.y,startSvgX:j,startSvgY:G,startPoints:_.map(nt=>({x:nt.x,y:nt.y}))}},[Me]),Hc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=fr.current.find(G=>G.id===w);if(!N)return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,no.current={pinId:w,pointIndex:k,startPoints:(N.leaderPoints??[]).map(G=>({x:G.x,y:G.y})),startSvgX:j.x,startSvgY:j.y}},[Me,te]),wf=U.useCallback((w,k,_,N)=>{N.preventDefault(),N.stopPropagation();const j=fr.current.find(J=>J.id===w);if(!j)return;te();const G=Me(N.clientX,N.clientY);ue.current=!1;const nt=(j.leaderPoints??[]).map(J=>({x:J.x,y:J.y})),z=[...nt.slice(0,k),{x:_.x,y:_.y},...nt.slice(k)];lt(J=>J.map(ut=>ut.id===w?{...ut,leaderPoints:z}:ut)),no.current={pinId:w,pointIndex:k,startPoints:z,startSvgX:G.x,startSvgY:G.y}},[Me,te]),cd=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation(),te(),lt(N=>N.map(j=>{if(j.id!==w||!j.leaderPoints)return j;const G=j.leaderPoints.filter((nt,z)=>z!==k);if(G.length===0){const nt={...j};return delete nt.leaderPoints,nt}return{...j,leaderPoints:G}}))},[te]),Nu=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="polygon")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,_o.current={pinId:w,pointIndex:k,startPoints:N.anchor.points.map(G=>({x:G.x,y:G.y})),startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),Sf=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation(),te(),lt(N=>N.map(j=>{if(j.id!==w||j.anchor.type!=="polygon")return j;const G=j.anchor.points;if(G.length<=3)return j;const nt=G.filter((z,J)=>J!==k);return{...j,anchor:{type:"polygon",points:nt,rotation:j.anchor.rotation??0}}}))},[te]),fl=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(rt=>rt.id===w);if(!N||N.anchor.type!=="polygon")return;const j=N.anchor.points,G=j.length,nt=j[k],z=j[(k+1)%G],J={x:(nt.x+z.x)/2,y:(nt.y+z.y)/2},ut=[...j.slice(0,k+1),J,...j.slice(k+1)];te(),lt(rt=>rt.map(I=>I.id!==w||I.anchor.type!=="polygon"?I:{...I,anchor:{type:"polygon",points:ut,rotation:I.anchor.rotation??0}}));const it=Me(_.clientX,_.clientY);ue.current=!1,_o.current={pinId:w,pointIndex:k+1,startPoints:ut.map(rt=>({x:rt.x,y:rt.y})),startSvgX:it.x,startSvgY:it.y}},[st,Me,te]),as=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="polygon")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,Uo.current={pinId:w,startPoints:_.anchor.points.map(j=>({x:j.x,y:j.y})),startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),yc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="rectangle")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,Ts.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startW:_.anchor.width,startH:_.anchor.height,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),Ho=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="ellipse")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,Ns.current={pinId:w,startCx:_.anchor.cx,startCy:_.anchor.cy,startRx:_.anchor.rx,startRy:_.anchor.ry,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),dl=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="rectangle")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,rl.current={pinId:w,handle:k,startX:N.anchor.x,startY:N.anchor.y,startW:N.anchor.width,startH:N.anchor.height,startRotation:N.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),qc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="ellipse")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,ns.current={pinId:w,handle:k,startCx:N.anchor.cx,startCy:N.anchor.cy,startRx:N.anchor.rx,startRy:N.anchor.ry,startRotation:N.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),bc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(it=>it.id===w);if(!N||N.anchor.type!=="polygon")return;const j=N.anchor.points;if(j.length<2)return;te();const G=Me(_.clientX,_.clientY),nt=Math.min(...j.map(it=>it.x)),z=Math.min(...j.map(it=>it.y)),J=Math.max(...j.map(it=>it.x)),ut=Math.max(...j.map(it=>it.y));ue.current=!1,A.current={pinId:w,handle:k,startPoints:j.map(it=>({x:it.x,y:it.y})),startMinX:nt,startMinY:z,startMaxX:J,startMaxY:ut,startSvgX:G.x,startSvgY:G.y}},[st,Me,te]),xc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(nt=>nt.id===w);if(!_||_.anchor.type!=="rectangle")return;te();const N=Me(k.clientX,k.clientY),j=_.anchor.x+_.anchor.width/2,G=_.anchor.y+_.anchor.height/2;ue.current=!1,_s.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:j,centerY:G,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),Yc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="ellipse")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,Il.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:_.anchor.cx,centerY:_.anchor.cy,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),xa=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="compass")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,Ba.current={pinId:w,startCx:_.anchor.cx,startCy:_.anchor.cy,startRadius:_.anchor.radius,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),vc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="compass")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,jl.current={pinId:w,handle:k,startCx:N.anchor.cx,startCy:N.anchor.cy,startRadius:N.anchor.radius,startRotation:N.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),ao=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="compass")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,pa.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:_.anchor.cx,centerY:_.anchor.cy,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),Xi=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(J=>J.id===w);if(!_||_.anchor.type!=="polygon")return;const N=_.anchor.points;if(N.length<2)return;te();const j=Me(k.clientX,k.clientY),G=N.reduce((J,ut)=>J+ut.x,0)/N.length,nt=N.reduce((J,ut)=>J+ut.y,0)/N.length,z=Math.atan2(j.y-nt,j.x-G);ue.current=!1,Bl.current={pinId:w,startPoints:N.map(J=>({x:J.x,y:J.y})),centerX:G,centerY:nt,startAngle:z,startRotation:_.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),$c=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="polyline")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,Tt.current={pinId:w,pointIndex:k,startPoints:N.anchor.points.map(G=>({x:G.x,y:G.y})),startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),vo=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation(),te(),lt(N=>N.map(j=>{if(j.id!==w||j.anchor.type!=="polyline")return j;const G=j.anchor.points;if(G.length<=2)return j;const nt=G.filter((z,J)=>J!==k);return{...j,anchor:{type:"polyline",points:nt,rotation:j.anchor.rotation??0}}}))},[te]),Vc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(it=>it.id===w);if(!N||N.anchor.type!=="polyline")return;const j=N.anchor.points;if(k>=j.length-1)return;const G=j[k],nt=j[k+1],z={x:(G.x+nt.x)/2,y:(G.y+nt.y)/2},J=[...j.slice(0,k+1),z,...j.slice(k+1)];te(),lt(it=>it.map(rt=>rt.id!==w||rt.anchor.type!=="polyline"?rt:{...rt,anchor:{type:"polyline",points:J,rotation:rt.anchor.rotation??0}}));const ut=Me(_.clientX,_.clientY);ue.current=!1,Tt.current={pinId:w,pointIndex:k+1,startPoints:J.map(it=>({x:it.x,y:it.y})),startSvgX:ut.x,startSvgY:ut.y}},[st,Me,te]),ls=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="polyline")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,Bt.current={pinId:w,startPoints:_.anchor.points.map(j=>({x:j.x,y:j.y})),startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),wc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="arrow")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,un.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startControl:{..._.anchor.control},startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),Qs=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="arrow")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,In.current={pinId:w,handle:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),Ua=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(it=>it.id===w);if(!N||N.anchor.type!=="arrow")return;te();const j=[N.anchor.start,N.anchor.end,N.anchor.control],G=Math.min(...j.map(it=>it.x)),nt=Math.min(...j.map(it=>it.y)),z=Math.max(...j.map(it=>it.x)),J=Math.max(...j.map(it=>it.y)),ut=Me(_.clientX,_.clientY);ue.current=!1,or.current={pinId:w,handle:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},startMinX:G,startMinY:nt,startMaxX:z,startMaxY:J,startSvgX:ut.x,startSvgY:ut.y}},[st,Me,te]),Sc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(J=>J.id===w);if(!_||_.anchor.type!=="arrow")return;te();const N=Me(k.clientX,k.clientY),j=[_.anchor.start,_.anchor.end,_.anchor.control],G=j.reduce((J,ut)=>J+ut.x,0)/j.length,nt=j.reduce((J,ut)=>J+ut.y,0)/j.length,z=Math.atan2(N.y-nt,N.x-G);ue.current=!1,Bn.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startControl:{..._.anchor.control},centerX:G,centerY:nt,startAngle:z,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),Wc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(it=>it.id===w);if(!N||N.anchor.type!=="polyline")return;te();const j=N.anchor.points,G=Math.min(...j.map(it=>it.x)),nt=Math.min(...j.map(it=>it.y)),z=Math.max(...j.map(it=>it.x)),J=Math.max(...j.map(it=>it.y)),ut=Me(_.clientX,_.clientY);ue.current=!1,xe.current={pinId:w,handle:k,startPoints:j.map(it=>({x:it.x,y:it.y})),startMinX:G,startMinY:nt,startMaxX:z,startMaxY:J,startSvgX:ut.x,startSvgY:ut.y}},[st,Me,te]),ql=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(J=>J.id===w);if(!_||_.anchor.type!=="polyline")return;const N=_.anchor.points;if(N.length<2)return;te();const j=Me(k.clientX,k.clientY),G=N.reduce((J,ut)=>J+ut.x,0)/N.length,nt=N.reduce((J,ut)=>J+ut.y,0)/N.length,z=Math.atan2(j.y-nt,j.x-G);ue.current=!1,ne.current={pinId:w,startPoints:N.map(J=>({x:J.x,y:J.y})),centerX:G,centerY:nt,startAngle:z,startRotation:_.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[st,Me,te]),Yl=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="text")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,fa.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[st,Me,te]),wo=U.useCallback(async w=>{const k=await new Promise(rt=>{const I=new FileReader;I.onload=Mt=>rt(Mt.target?.result??null),I.onerror=()=>rt(null),I.readAsDataURL(w)});if(!k)return;const _=await new Promise(rt=>{const I=new Image;I.onload=()=>rt({w:I.naturalWidth||ly,h:I.naturalHeight||ly}),I.onerror=()=>rt(null),I.src=k});if(!_)return;const N=_.w/_.h,j=ly/Math.max(_.w,_.h),G=Math.max(_m,_.w*j),nt=Math.max(_m,_.h*j),{w:z,h:J}=dr.current,ut={type:"image",x:Math.max(0,(z-G)/2),y:Math.max(0,(J-nt)/2),width:G,height:nt,src:k,aspect:N},it=wl();te(),lt(rt=>[...rt,{id:it,anchor:ut,color:bu,label:Zu(rt),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),At(rt=>({...rt,[it]:Ys(ut)})),tt(it),vt(it),P("select")},[te]);es.current=wo;const $l=U.useRef(0),Ls=U.useCallback(w=>{const k=Date.now();k-$l.current<800||($l.current=k,wo(w),pi(!1))},[wo]);U.useEffect(()=>{if(!Js)return;al.current?.focus();const w=_=>{const N=Xy(_.clipboardData);N&&(_.preventDefault(),_.stopPropagation(),Ls(N))},k=_=>{if(_.key==="Escape"){pi(!1);return}!(b?_.metaKey:_.ctrlKey)||_.shiftKey||_.altKey||_.code!=="KeyV"||(async()=>{try{const j=await Promise.race([navigator.clipboard?.read?.(),new Promise(G=>setTimeout(()=>G(void 0),Qz))]);for(const G of j??[]){const nt=G.types.find(J=>J.startsWith("image/"));if(!nt)continue;const z=await G.getType(nt);Ls(new File([z],"clipboard",{type:nt}));return}}catch{}})()};return window.addEventListener("paste",w,!0),window.addEventListener("keydown",k,!0),()=>{window.removeEventListener("paste",w,!0),window.removeEventListener("keydown",k,!0)}},[Js,b,Ls]);const Xc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=fr.current.find(j=>j.id===w);if(!_||_.anchor.type!=="redact")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,Es.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[Me,te]),kc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=fr.current.find(G=>G.id===w);if(!N||N.anchor.type!=="redact")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,da.current={pinId:w,handle:k,startX:N.anchor.x,startY:N.anchor.y,startW:N.anchor.width,startH:N.anchor.height,startSvgX:j.x,startSvgY:j.y}},[Me,te]),cs=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id===w&&N.anchor.type==="redact"?{...N,anchor:{...N.anchor,...k}}:N))},[te]),us=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=fr.current.find(j=>j.id===w);if(!_||_.anchor.type!=="image")return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,ha.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[Me,te]),Ha=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=fr.current.find(G=>G.id===w);if(!N||N.anchor.type!=="image")return;te();const j=Me(_.clientX,_.clientY);ue.current=!1,Vs.current={pinId:w,handle:k,startX:N.anchor.x,startY:N.anchor.y,startW:N.anchor.width,startH:N.anchor.height,startSvgX:j.x,startSvgY:j.y}},[Me,te]),fs=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=fr.current.find(j=>j.id===w);if(!_||_.anchor.type!=="text"||!_.anchor.point)return;te();const N=Me(k.clientX,k.clientY);ue.current=!1,tt(w),ja.current={pinId:w,startPoint:{..._.anchor.point},startBox:{x:_.anchor.x,y:_.anchor.y},startSvgX:N.x,startSvgY:N.y}},[Me,te]),ds=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(z=>z.id===w);if(!N||N.anchor.type!=="text")return;te();const j=Me(_.clientX,_.clientY),G=N.anchor.x+N.anchor.width/2,nt=N.anchor.y+N.anchor.height/2;Ii.current={pinId:w,handle:k,startCenterX:G,startCenterY:nt,startDist:Math.max(1,Math.hypot(j.x-G,j.y-nt)),startFontSize:N.textFontSize??Fs},ue.current=!1},[st,te,Me]),xi=U.useCallback((w,k)=>{const _=k?.fontSize??Fs,N=k?.bold?"700":"400",j=k?.italic?"italic ":"",nt=document.createElement("canvas").getContext("2d");return nt?(nt.font=`${j}${N} ${_}px ${Ko.current}`,$_(w,z=>nt.measureText(z).width,k)):{width:ck,height:uk}},[]),Gc=U.useCallback((w,k)=>{const _=fr.current.find(nt=>nt.id===w);if(!_||_.anchor.type!=="text")return;const N=xi(k,{fontSize:_.textFontSize??Fs,bold:_.textBold??!1,italic:_.textItalic??!1}),j=N.width,G=N.height;lt(nt=>nt.map(z=>{if(z.id!==w||z.anchor.type!=="text")return z;const J=Math.max(0,dr.current.w-j),ut=Math.max(0,dr.current.h-G);return{...z,anchor:{...z.anchor,width:j,height:G,x:Math.max(0,Math.min(z.anchor.x,J)),y:Math.max(0,Math.min(z.anchor.y,ut))}}}))},[xi]),ta=U.useCallback(w=>{const k=w.trim()?w:cy;if(typeof document>"u")return k;const _=document.createElement("div");return _.innerHTML=k,_.querySelectorAll("p").forEach(N=>{N.style.margin="0",N.style.padding="0"}),_.innerHTML},[]),Vl=U.useCallback((w=new Date,k=p2)=>{if(!C)return;const{w:_,h:N}=dr.current;if(!_||!N)return;const j=Pd(w,k),G=ta(`<p>${j}</p>`),nt=xi(G,{fontSize:Fs,bold:!1,italic:!1}),z=12*de,J=Math.max(0,Math.min(z,_-nt.width)),ut=Math.max(0,Math.min(N-nt.height-z,N-nt.height)),it=wl(),rt=bu;te(),lt(I=>[...I,{id:it,anchor:{type:"text",x:J,y:ut,width:nt.width,height:nt.height},color:rt,label:Zu(I),image:null,imageAspect:null,description:G,descPos:"below",textColor:"#FFFFFF",textBackgroundColor:"#000000"}]),tt(it),vt(it),qr(it),P("select"),yi.current=it,Ni.current=!0,me(!1)},[C,xi,ta,te]),ud=U.useCallback(w=>{if(!C)return;const{w:k,h:_}=dr.current;if(!k||!_)return;const N=R4,{cx:j,cy:G}=c8(w,k,_,N),nt=wl(),z=bu;te(),lt(J=>[...J,{id:nt,anchor:{type:"compass",cx:j,cy:G,radius:N,rotation:0},color:z,label:Zu(J),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),tt(nt),vt(nt),P("select"),yi.current=nt,Ni.current=!0,He(!1)},[C,te]),lo=U.useCallback(()=>{pi(w=>!w)},[]),Lr=U.useCallback(()=>{C&&(me(!1),He(w=>!w))},[C]),tr=U.useCallback(()=>{C&&(He(!1),me(w=>{if(w)return!1;if(Je)ui(Pf(Pe));else{const k=new Date;Vn(k),ui(Pf(k))}return!0}))},[C,Pe,Je]),Lo=U.useCallback(()=>{const w=new Date;Vn(w),ui(Pf(w))},[]),ei=U.useCallback(()=>{Vl(Je?Pe:new Date,Hi)},[Pe,Hi,Je,Vl]),ea=U.useCallback(()=>{Vl(Pe,Hi)},[Pe,Hi,Vl]),na=U.useCallback((w,k)=>{const _=document.querySelector(`div[data-text-pin-id="${w}"]`);if(!_)return!1;const N=window.getSelection();if(!N||N.rangeCount===0)return!1;const j=N.getRangeAt(0);if(j.collapsed||!_.contains(j.commonAncestorContainer))return!1;te(),_.focus(),document.execCommand(k,!1);const G=ta(_.innerHTML);return _.innerHTML=G,lt(nt=>nt.map(z=>z.id===w?{...z,description:G}:z)),Gc(w,G),!0},[te,Gc,ta]),hl=U.useCallback((w,k)=>{const _=fr.current.find(N=>N.id===w);!_||_.description===k||(te(),lt(N=>N.map(j=>j.id===w?{...j,description:k}:j)))},[te]),ra=U.useCallback(w=>{const k=eo.current;if(!k)return;const _=ta(k.innerHTML);hl(w,_),Gc(w,_)},[Gc,ta,hl]);U.useEffect(()=>{if(!Ms)return;const w=k=>{k.target?.closest('[data-text-bg-picker="true"]')||Rl(null)};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[Ms]),U.useEffect(()=>{if(!Pi){eo.current=null;return}const w=fr.current.find(N=>N.id===Pi);if(!w||w.anchor.type!=="text")return;const k=ta(w.description),_=!w.description.trim()||w.description===cy;requestAnimationFrame(()=>{const N=eo.current;if(!N)return;N.innerHTML!==k&&(N.innerHTML=k),N.focus();const j=document.createRange();j.selectNodeContents(N),_||j.collapse(!1);const G=window.getSelection();G?.removeAllRanges(),G?.addRange(j)})},[Pi,ta]),U.useEffect(()=>{if(!Pi)return;const w=k=>{const _=k.target,N=eo.current;!N||_&&N.contains(_)||(ra(Pi),qr(null))};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[Pi,ra]);const Bi=U.useCallback((w,k)=>{const _=new Image;_.onload=()=>{const N=_.naturalWidth/_.naturalHeight;te(),lt(j=>j.map(G=>G.id===w?{...G,image:k,imageAspect:N}:G))},_.src=k},[te]);U.useEffect(()=>{const w=k=>{const _=gt??X;if(!_){if(!qi.current)return;const it=Xy(k.clipboardData);if(!it)return;k.preventDefault(),Ls(it);return}const N=fr.current.find(it=>it.id===_)??null,j=k.target,G=j?.tagName,nt=G==="TEXTAREA"||G==="INPUT"&&!j.readOnly&&!j.disabled,z=!!j&&(j.isContentEditable||j.closest(".ProseMirror")!==null||nt),J=k.clipboardData?.items;if(J){for(const it of J)if(it.type.startsWith("image/")){k.preventDefault(),k.stopPropagation();const rt=it.getAsFile();if(!rt)return;const I=new FileReader;I.onload=Mt=>{const It=Mt.target?.result;It&&Bi(_,It)},I.readAsDataURL(rt);return}}let ut=k.clipboardData?.getData("text/plain")??"";if(!ut&&k.clipboardData?.items?.length){for(const rt of k.clipboardData.items)if(rt.kind==="string"&&rt.type==="text/plain"){k.preventDefault();const I=_,Mt=gt;rt.getAsString(It=>{const wt=It??"";if(wt.trim()){if(Mt&&I===Mt&&N?.anchor.type!=="text"){document.dispatchEvent(new CustomEvent(o0,{detail:{pinId:Mt,text:wt},bubbles:!0}));return}hl(I,wt)}});return}const it=k.clipboardData.getData("text/html");if(it)try{ut=new DOMParser().parseFromString(it,"text/html").body?.textContent??""}catch{ut=""}}if(ut.trim().length>0){if(gt&&_===gt&&N?.anchor.type!=="text"){k.preventDefault(),k.stopPropagation(),document.dispatchEvent(new CustomEvent(o0,{detail:{pinId:gt,text:ut},bubbles:!0}));return}if(z)return;k.preventDefault(),hl(_,ut)}};return document.addEventListener("paste",w,!0),()=>document.removeEventListener("paste",w,!0)},[gt,X,Bi,hl,Ls]);const va=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id===w?{...N,color:k}:N))},[te]),kf=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id!==w||!g5(N.anchor)?N:{...N,strokeStyle:k}))},[te]),Ac=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id!==w||!L4(N.anchor)?N:{...N,fillStyle:k}))},[te]),Kc=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>{if(N.id!==w)return N;if(k===null){const j={...N};return delete j.strokeWidthScale,j}return{...N,strokeWidthScale:td(k)}}))},[te]),qa=U.useCallback((w,k)=>{te(),lt(_=>n8(_,w,k))},[te]),wa=U.useCallback(w=>{te(),lt(k=>k.map(_=>_.id===w?{..._,descPos:_.descPos==="above"?"below":"above"}:_))},[te]),hs=U.useCallback(w=>{te();const k=ZN(w,fr.current);lt(_=>hk(_.filter(N=>!k.has(N.id)))),At(_=>{const N={..._};for(const j of k)delete N[j];return N}),tt(null),vt(null),qr(_=>_===w?null:_)},[te]),Rs=U.useCallback(w=>{const k=fr.current.find(Mt=>Mt.id===w),_=k?u2(k,fr.current):null;if(!_||!Rw(_))return;const N=_.id;te();const j=wl(),nt=[N,...u5(N,fr.current)].map(Mt=>go.current[Mt]).filter(Mt=>!!Mt),z=nt.length>0?nt.reduce((Mt,It)=>It.y+It.height>Mt.y+Mt.height?It:Mt):Ys(_.anchor),{w:J,h:ut}=dr.current,it=z.width,rt=d2,I={x:Math.max(0,Math.min(z.x+hi,Math.max(0,J-it))),y:Math.max(0,Math.min(z.y+z.height+hi,Math.max(0,ut-rt))),width:it,height:rt};lt(Mt=>[...Mt,{id:j,anchor:{type:"linked",pinId:N},color:_.color,label:_.label,image:null,imageAspect:null,description:"",descPos:_.descPos,theme:_.theme,textFontSize:_.textFontSize}]),At(Mt=>({...Mt,[j]:I})),yi.current=j,tt(j),vt(j)},[te]),Wl=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id===w?{...N,calloutHidden:k}:N)),k?(tt(w),vt(null)):(tt(w),vt(w))},[te]),Gi=U.useCallback(async(w="png",k=1,_)=>{if(!qi.current||!dr.current.w)return;const N=Yt=>new Promise((De,ze)=>{const Fe=new Image;Fe.onload=()=>De(Fe),Fe.onerror=ze,Fe.src=Yt});let j=null;try{j=await N(qi.current)}catch{j=null}const G=fr.current,nt=go.current,{w:z,h:J}=dr.current;if(!z)return;const it=2*(k||1),rt=document.createElement("canvas");rt.width=z*it,rt.height=J*it;const I=rt.getContext("2d");I.scale(it,it);const Mt=(Yt,De,ze,Fe,ke)=>{I.beginPath(),I.moveTo(Yt+ke,De),I.lineTo(Yt+ze-ke,De),I.arcTo(Yt+ze,De,Yt+ze,De+ke,ke),I.lineTo(Yt+ze,De+Fe-ke),I.arcTo(Yt+ze,De+Fe,Yt+ze-ke,De+Fe,ke),I.lineTo(Yt+ke,De+Fe),I.arcTo(Yt,De+Fe,Yt,De+Fe-ke,ke),I.lineTo(Yt,De+ke),I.arcTo(Yt,De,Yt+ke,De,ke),I.closePath()},It=await Promise.allSettled(G.map(Yt=>Yt.image?N(Yt.image):Promise.resolve(null))),wt=await Promise.all(G.filter(Yt=>Yt.anchor.type==="image").map(async Yt=>{const De=Yt.anchor.type==="image"?Yt.anchor.src:"";try{return[Yt.id,await N(De)]}catch{return[Yt.id,null]}})),Et=new Map(wt),yt=new Map(It.map((Yt,De)=>[G[De].id,Yt.status==="fulfilled"?Yt.value:null]));j&&I.drawImage(j,0,0,z,J);const Ft=Yt=>Hw(Yt,Ar.current),Vt=gg(G);I.lineCap="round";const pe=Yt=>{if(Yt.calloutHidden||Yt.anchor.type==="text"||Yt.anchor.type==="standalone"||Yt.anchor.type==="redact")return;const De=nt[Yt.id];if(!De)return;const ze=ay(Yt,G);if(!ze)return;const Fe=S2(ze,De,Yt.leaderPoints);I.beginPath(),Fe.forEach((ke,_n)=>_n===0?I.moveTo(ke.x,ke.y):I.lineTo(ke.x,ke.y)),I.strokeStyle=Yt.color,I.lineJoin="round",I.lineWidth=g4*Ft(Yt),I.stroke()},se=Yt=>{const De=Ft(Yt);if(Yt.anchor.type==="redact"){if(_?.skipRedaction)return;P4(I,rt,{rect:Yt.anchor,mode:Yt.anchor.mode,strength:Yt.anchor.strength,imageSize:{w:z,h:J},sourceSize:{w:rt.width,h:rt.height}});return}if(Yt.anchor.type==="image"){const ze=Et.get(Yt.id);if(ze){const{x:Fe,y:ke,width:_n,height:qe}=Yt.anchor;I.drawImage(ze,Fe,ke,_n,qe)}return}if(Yt.anchor.type==="point"){const{x:ze,y:Fe}=Yt.anchor,ke=$h*De;I.beginPath(),I.arc(ze+jw*De,Fe+Bw*De,ke+zw*De,0,Math.PI*2),I.fillStyle=Fw,I.fill(),I.beginPath(),I.arc(ze,Fe,ke,0,Math.PI*2),I.fillStyle=Yt.color,I.fill(),I.strokeStyle="white",I.lineWidth=ng*De,I.stroke()}else if(Yt.anchor.type==="numbering"){const{start:ze,end:Fe}=Yt.anchor;I.beginPath(),I.moveTo(ze.x,ze.y),I.lineTo(Fe.x,Fe.y),I.strokeStyle=Yt.color,I.lineWidth=Nf*De,I.stroke();const ke=String(Yt.label),_n=14*de,qe=0*_n,nr=.4*_n,sr=.35*_n;I.font=`700 ${_n}px ${Ko.current}`;const oi=Math.max(_n*.62,I.measureText(ke).width)+nr*2,Wr=_n+qe+sr,hr=Fe.x-oi/2,Cr=Fe.y-Wr/2,vi=4*de;I.beginPath(),I.moveTo(hr+vi,Cr),I.lineTo(hr+oi-vi,Cr),I.quadraticCurveTo(hr+oi,Cr,hr+oi,Cr+vi),I.lineTo(hr+oi,Cr+Wr-vi),I.quadraticCurveTo(hr+oi,Cr+Wr,hr+oi-vi,Cr+Wr),I.lineTo(hr+vi,Cr+Wr),I.quadraticCurveTo(hr,Cr+Wr,hr,Cr+Wr-vi),I.lineTo(hr,Cr+vi),I.quadraticCurveTo(hr,Cr,hr+vi,Cr),I.closePath(),I.fillStyle="rgba(10,10,16,0.95)",I.fill(),I.strokeStyle=Yt.color,I.lineWidth=1.5*de,I.stroke(),I.textAlign="center",I.textBaseline="middle",I.fillStyle="#ffffff",I.fillText(ke,Fe.x,Fe.y),I.textAlign="left",I.textBaseline="alphabetic"}else if(Yt.anchor.type==="polygon"){const Fe=Yt.anchor.points;if(Fe.length>=2){I.beginPath(),I.moveTo(Fe[0].x,Fe[0].y);for(let _n=1;_n<Fe.length;_n++)I.lineTo(Fe[_n].x,Fe[_n].y);I.closePath();const ke=rg(Yt.color,Yt.fillStyle);ke&&(I.fillStyle=ke,I.fill()),I.setLineDash(Xu(Yt)?Ud.map(_n=>_n*De):[]),I.strokeStyle=Yt.color,I.lineWidth=Nf*De,I.stroke(),I.setLineDash([])}}else if(Yt.anchor.type==="polyline"){const Fe=Yt.anchor.points;if(Fe.length>=2){I.beginPath(),I.moveTo(Fe[0].x,Fe[0].y);for(let ke=1;ke<Fe.length;ke++)I.lineTo(Fe[ke].x,Fe[ke].y);I.setLineDash(Xu(Yt)?Ud.map(ke=>ke*De):[]),I.strokeStyle=Yt.color,I.lineWidth=Nf*De,I.stroke(),I.setLineDash([])}}else if(Yt.anchor.type==="rectangle"){const{x:ze,y:Fe,width:ke,height:_n,rotation:qe=0}=Yt.anchor,nr=ze+ke/2,sr=Fe+_n/2,br=qe*Math.PI/180;I.save(),I.translate(nr,sr),I.rotate(br),I.translate(-ke/2,-_n/2),I.beginPath(),I.rect(0,0,ke,_n);const oi=rg(Yt.color,Yt.fillStyle);oi&&(I.fillStyle=oi,I.fill()),I.setLineDash(Xu(Yt)?Ud.map(Wr=>Wr*De):[]),I.strokeStyle=Yt.color,I.lineWidth=Nf*De,I.stroke(),I.setLineDash([]),I.restore()}else if(Yt.anchor.type==="ellipse"){const{cx:ze,cy:Fe,rx:ke,ry:_n,rotation:qe=0}=Yt.anchor,nr=qe*Math.PI/180;I.save(),I.translate(ze,Fe),I.rotate(nr),I.beginPath(),I.ellipse(0,0,ke,_n,0,0,Math.PI*2);const sr=rg(Yt.color,Yt.fillStyle);sr&&(I.fillStyle=sr,I.fill()),I.setLineDash(Xu(Yt)?Ud.map(br=>br*De):[]),I.strokeStyle=Yt.color,I.lineWidth=Nf*De,I.stroke(),I.setLineDash([]),I.restore()}else if(Yt.anchor.type==="compass")f8(I,{cx:Yt.anchor.cx,cy:Yt.anchor.cy,radius:Yt.anchor.radius,rotation:Yt.anchor.rotation??0,color:Yt.color,strokeWidth:ig*De});else if(Yt.anchor.type==="arrow"){const{start:ze,end:Fe,control:ke}=Yt.anchor;I.beginPath(),I.moveTo(ze.x,ze.y),I.quadraticCurveTo(ke.x,ke.y,Fe.x,Fe.y),I.strokeStyle=Yt.color,I.lineWidth=Nf*De,I.stroke();const _n=pk(ke,Fe),qe=Math.atan2(_n.y,_n.x),nr=8*de,sr=Math.PI/7,br=Fe.x-Math.cos(qe-sr)*nr,oi=Fe.y-Math.sin(qe-sr)*nr,Wr=Fe.x-Math.cos(qe+sr)*nr,hr=Fe.y-Math.sin(qe+sr)*nr;I.beginPath(),I.moveTo(Fe.x,Fe.y),I.lineTo(br,oi),I.lineTo(Wr,hr),I.closePath(),I.fillStyle=Yt.color,I.fill(),I.stroke()}},Ee=Yt=>{if(Yt.anchor.type!=="text")return;if(Yt.anchor.point){const Cr=Ft(Yt),{x:vi,y:So}=Yt.anchor.point;I.beginPath(),I.arc(vi+jw*Cr,So+Bw*Cr,$h*Cr+zw*Cr,0,Math.PI*2),I.fillStyle=Fw,I.fill(),I.beginPath(),I.arc(vi,So,$h*Cr,0,Math.PI*2),I.fillStyle=Yt.color,I.fill(),I.strokeStyle="white",I.lineWidth=ng*Cr,I.stroke()}const{x:De,y:ze,width:Fe}=Yt.anchor,ke=Yt.textBackgroundColor,_n=Yt.textColor??"#ffffff",qe=Yt.textFontSize??Fs,nr=Yt.textBold?700:400,sr=Yt.textItalic?"italic ":"",br=M4(Yt.description||""),oi=C4(br.length,qe);ke!=null&&ke!=="transparent"&&(I.fillStyle=ke,Mt(De,ze,Fe,oi,Uw),I.fill()),I.font=`${sr}${nr} ${qe}px ${Ko.current}`,I.fillStyle=_n,I.textBaseline="top";const Wr=De+mg+y2;let hr=ze+mg+y_;for(const Cr of br){I.fillText(Cr,Wr,hr);const vi=hr+qe*.9,So=I.measureText(Cr).width;Yt.textUnderline&&(I.strokeStyle=_n,I.lineWidth=1,I.beginPath(),I.moveTo(Wr,vi+1),I.lineTo(Wr+So,vi+1),I.stroke()),Yt.textStrike&&(I.strokeStyle=_n,I.lineWidth=1,I.beginPath(),I.moveTo(Wr,hr+qe*.55),I.lineTo(Wr+So,hr+qe*.55),I.stroke()),hr+=qe*tp}},Qe=Yt=>{if(Yt.calloutHidden||Yt.anchor.type==="text"||Yt.anchor.type==="redact")return;const De=nt[Yt.id];if(!De)return;const{x:ze,y:Fe,width:ke,height:_n}=De,qe=b4*w4(Ft(Yt)),nr=qe,sr=ze+nr,br=Fe+nr,oi=Math.max(0,ke-2*nr),Wr=Math.max(0,_n-2*nr);let hr=0,Cr=0,vi=[];const So=[],Qc=(Yt.textFontSize??Fs)*p4;if(Cr=Math.round(Qc*tp),Yt.description){I.save();const Xr=oi-g2*2,qo=document.createElement("div");let Br=Yt.description;Br=Br.replace(/<br\s*\/?>/gi,`
229
- `),Br=Br.replace(/<p[^>]*>/gi,""),Br=Br.replace(/<\/p>/gi,`
230
- `),Br=Br.replace(/<div[^>]*>/gi,""),Br=Br.replace(/<\/div>/gi,`
231
- `),qo.innerHTML=Br;const Ro=[],Os=(vr,ps,yl,Mf,lh,ch)=>{if(vr.nodeType===Node.TEXT_NODE)vr.textContent&&Ro.push({text:vr.textContent,b:ps,i:yl,u:Mf,s:lh,fs:ch});else if(vr.nodeType===Node.ELEMENT_NODE){const bl=vr,oa=bl.style||{},Op=ps||bl.tagName==="B"||bl.tagName==="STRONG"||oa.fontWeight==="bold"||parseInt(oa.fontWeight||"0")>=600,Pp=yl||bl.tagName==="I"||bl.tagName==="EM"||oa.fontStyle==="italic",uh=Mf||bl.tagName==="U"||!!oa.textDecoration&&typeof oa.textDecoration=="string"&&oa.textDecoration.includes("underline"),Ip=lh||bl.tagName==="S"||bl.tagName==="STRIKE"||!!oa.textDecoration&&typeof oa.textDecoration=="string"&&oa.textDecoration.includes("line-through"),fh=oa.fontSize?Number.parseFloat(oa.fontSize):Number.NaN,T0=Number.isFinite(fh)?fh:ch;for(const dh of bl.childNodes)Os(dh,Op,Pp,uh,Ip,T0)}};for(const vr of qo.childNodes)Os(vr,!1,!1,!1,!1,Qc);const co=[];for(const vr of Ro){const ps=vr.text.split(/([ \n])/);for(const yl of ps)yl&&co.push({text:yl,b:vr.b,i:vr.i,u:vr.u,s:vr.s,fs:vr.fs})}let Or=[],zr=0;const Aa=(vr,ps,yl)=>`${ps?"italic ":""}${vr?"600":"400"} ${yl}px ${Ko.current}`;for(const vr of co){if(vr.text===`
232
- `){So.push({tokens:Or,width:zr}),Or=[],zr=0;continue}I.font=Aa(vr.b,vr.i,vr.fs);const ps=I.measureText(vr.text).width;if(vr.text===" ")Or.push(vr),zr+=ps;else if(zr+ps>Xr&&Or.length>0){for(;Or.length>0&&Or[Or.length-1].text===" ";)Or.pop();So.push({tokens:Or,width:zr}),Or=[vr],zr=ps}else Or.push(vr),zr+=ps}Or.length>0&&So.push({tokens:Or,width:zr}),So.length>0&&So[0].tokens.length===0&&So.length>1,vi=So.map(vr=>{const ps=vr.tokens.reduce((yl,Mf)=>Math.max(yl,Mf.fs),Qc);return Math.round(ps*tp)}),hr=vi.reduce((vr,ps)=>vr+ps,0)+m2+x4,I.restore()}const ia=!!Yt.description,Af=Yt.image?y4:0;let Du=ia?hr:Yt.image?0:Wr,Gl=Yt.image?Wr-Du:0;Yt.image&&Gl<Af&&(Gl=Af,Du=Math.max(0,Wr-Gl));const tu=Yt.descPos==="above"?br+Du:br,Lu=Yt.descPos==="above"?br:br+Gl;I.save(),Mt(ze,Fe,ke,_n,h2),I.clip();const gl=Yt.theme==="light"&&ia,eu=Yt.textColor??(gl?"#111111":"#d0d0d0"),nu=Yt.textBackgroundColor===null?"rgba(0,0,0,0)":Yt.textBackgroundColor??(gl?"rgba(245,245,250,0.98)":"rgba(10,10,16,0.88)");if(I.fillStyle=nu,I.fillRect(ze,Fe,ke,_n),Yt.image){const Xr=yt.get(Yt.id)??null;if(Xr){const qo=Xr.width/Xr.height,Br=oi/Gl;let Ro=0,Os=0,co=Xr.width,Or=Xr.height;qo>Br?(co=Or*Br,Ro=(Xr.width-co)/2):(Or=co/Br,Os=(Xr.height-Or)/2),I.drawImage(Xr,Ro,Os,co,Or,sr,tu,oi,Gl)}I.strokeStyle=Yt.color+"44",I.lineWidth=1*de,I.beginPath(),Yt.descPos==="above"?ia&&(I.moveTo(sr,tu),I.lineTo(sr+oi,tu)):ia&&(I.moveTo(sr,Lu),I.lineTo(sr+oi,Lu)),I.stroke()}if(Yt.description){let Xr=Lu+m2;const qo=sr+g2;I.textAlign="left",I.textBaseline="top";const Br=(Ro,Os,co)=>`${Os?"italic ":""}${Ro?"600":"400"} ${co}px ${Ko.current}`;for(let Ro=0;Ro<So.length;Ro+=1){const Os=So[Ro],co=vi[Ro]??Cr;let Or=qo;for(const zr of Os.tokens){I.font=Br(zr.b,zr.i,zr.fs),I.fillStyle=eu,I.fillText(zr.text,Or,Xr);const Aa=I.measureText(zr.text).width;if(zr.u||zr.s){if(I.strokeStyle=eu,I.lineWidth=1*de,I.beginPath(),zr.u){const ru=Xr+zr.fs*1.1;I.moveTo(Or,ru),I.lineTo(Or+Aa,ru)}if(zr.s){const ru=Xr+zr.fs*.6;I.moveTo(Or,ru),I.lineTo(Or+Aa,ru)}I.stroke()}Or+=Aa}Xr+=co}}I.restore(),Mt(ze,Fe,ke,_n,h2),I.strokeStyle=Yt.color,I.lineWidth=qe,I.stroke()};for(const Yt of Vt)pe(Yt),Yt.anchor.type==="text"?Ee(Yt):se(Yt),Qe(Yt);const En=w==="jpeg"?"image/jpeg":"image/png",fe=rt.toDataURL(En,w==="jpeg"?.92:void 0);if(_?.returnDataUrl)return fe;const Xe=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),we=w==="jpeg"?`img_${Xe}.jpg`:`img_${Xe}.png`;if(Gf()&&await fk(fe,we))return;const Tn=document.createElement("a");if(Tn.href=fe,Tn.download=we,M){window.open(fe,"_blank","noopener,noreferrer");return}Tn.click()},[M]);fc.current=Gi;const Sa=U.useCallback(async()=>{if(!C||!V.w)return null;const w=await Gi("png",1,{returnDataUrl:!0});if(!w||typeof w!="string")return null;const{w:k,h:_}=V,N=new xn({orientation:k>_?"landscape":"portrait",unit:"mm",format:"a4"}),j=N.internal.pageSize.getWidth(),G=N.internal.pageSize.getHeight(),nt=25.4/96,z=k*nt,J=_*nt,ut=Math.min(j/z,G/J),it=z*ut,rt=J*ut,I=(j-it)/2,Mt=(G-rt)/2;return N.addImage(w,"PNG",I,Mt,it,rt),N.output("blob")},[C,V,Gi]),Jc=U.useCallback(async()=>{const w=await Sa();if(!w)return;const _=`collage_${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.pdf`,N=URL.createObjectURL(w);if(setTimeout(()=>URL.revokeObjectURL(N),6e4),Gf()&&await fk(N,_))return;const j=document.createElement("a");j.href=N,j.download=_,j.click()},[Sa]),pl=U.useCallback(async()=>{if(!(!C||!V.w||Qo)){di(!0);try{const k=window.ClipboardItem;if(!tl||!k)return;const _=await Gi("png",1,{returnDataUrl:!0});if(!_||typeof _!="string")return;const N=gk(_);if(!N)return;const j=new k({[N.type]:N});await navigator.clipboard.write([j]),Qa(!0),setTimeout(()=>Qa(!1),1500)}catch{}finally{di(!1)}}},[C,V.w,Qo,Gi,tl]),Di=U.useCallback(w=>{const k=new Date(w);Vn(k),ui(Pf(k)),Ss(!0)},[]),Mc=U.useCallback(w=>{Xt(w.sourceUrl!==void 0||w.sourceTitle!==void 0||w.capturedAt!==void 0?{sourceUrl:w.sourceUrl,sourceTitle:w.sourceTitle,capturedAt:w.capturedAt}:null),w.capturedAt!==void 0&&Di(w.capturedAt),D(w.backgroundImage),xt(w.imageSize),dt(w.sourceImageSize),lt(w.pins),At(w.cardPositions),tt(null),vt(null),qr(null),qt(null),Zt(null),Te(null),ur(null),tn(null),W(!1),jt(null),ua.current=!0,Qr.current=!0,Fn.current=[],Po.current=[],Pa(0),Io(0)},[Di]),_u=U.useCallback(()=>Ez({backgroundImage:C,imageSize:V,sourceImageSize:Lt,pins:st,cardPositions:zt,settings:{fontId:Ei.fontId,strokeWidthScale:gi},meta:to}),[C,V,Lt,st,zt,Ei.fontId,gi,to]),ah=U.useCallback(()=>{D(null),xt({w:0,h:0}),dt(null),lt([]),At({}),Xt(null),tt(null),vt(null),qr(null),qt(null),Zt(null),Te(null),ur(null),tn(null),W(!1),jt(null),Fn.current=[],Po.current=[],Pa(0),Io(0),Cc.current=null,Vr.current=null},[]),Cc=U.useRef(null),fd=U.useRef(0),Vr=U.useRef(null),ka=U.useRef(null),ml=U.useCallback(()=>{Cc.current=null,fd.current=performance.now()+t9},[]),Xl=U.useRef(f);Xl.current=f;const Zc=U.useRef(c);Zc.current=c;const m=U.useRef(d);m.current=d;const v=U.useCallback(w=>{w&&((w.fontId==="road-ui"||w.fontId==="uaf-sans"&&S4)&&fi(w.fontId),typeof w.strokeWidthScale=="number"&&Ti(w.strokeWidthScale))},[fi,Ti]),E=U.useCallback(async w=>{Mc(Cz(w)),v(w.settings),ml()},[Mc,v,ml]),R=U.useCallback(async w=>{const k=await _z(w);await new Promise((_,N)=>{Wi(k,!0,j=>{j?_():N(new Error("Failed to load image"))})}),ml()},[Wi,ml]),F=U.useCallback(()=>{const w=Vr.current;w&&(Cc.current=w.fingerprint,Xl.current?.(w.document,{dirty:!1}),ka.current?.notifyChange(w.document,!1))},[]),q=U.useRef({loadDocument:async()=>{},loadImage:async()=>{},getDocument:()=>null,exportImage:async()=>null,exportPdf:async()=>null,markSaved:()=>{},reset:()=>{}});q.current.loadDocument=E,q.current.loadImage=R,q.current.getDocument=_u,q.current.exportImage=async(w,k=1)=>{const _=await Gi(w,k,{returnDataUrl:!0});if(!_||typeof _!="string")return null;const N=w==="jpeg"?"image/jpeg":"image/png",j=gk(_);return j?{mime:N,dataUrl:_,blob:j}:null},q.current.exportPdf=Sa,q.current.markSaved=F,q.current.reset=ah,U.useImperativeHandle(e,()=>q.current,[]);const $=U.useRef(!1);U.useEffect(()=>{$.current||!i||($.current=!0,E(i))},[i,E]),U.useEffect(()=>{const w=_u();if(!w){Vr.current=null;return}const k=Nz(w);(Cc.current===null||performance.now()<fd.current)&&(Cc.current=k),Vr.current={document:w,fingerprint:k};const _=k!==Cc.current;Xl.current?.(w,{dirty:_}),ka.current?.notifyChange(w,_)},[_u]),U.useEffect(()=>{const w=jz({editor:q.current,config:{...Uz(),...s},onReady:()=>Zc.current?.(),onError:k=>m.current?.(k)});return ka.current=w,()=>{w.stop(),ka.current===w&&(ka.current=null)}},[p,s]);const Q=kz({state:{backgroundImage:C,imageSize:V,sourceImageSize:Lt,pins:st,cardPositions:zt,sourceUrl:to?.sourceUrl,sourceTitle:to?.sourceTitle,capturedAt:to?.capturedAt},onRestore:Mc,enabled:g.autosave}),{restoreDraft:at,dismissRestorePrompt:mt}=Q,Dt=U.useRef(!1);U.useEffect(()=>{if(!Dt.current&&(Dt.current=!0,!!Gf())){if(Yz()){at();return}qz()&&(mt(),$z().then(w=>{if(!w){H("Не вдалося отримати знімок від розширення.");return}Wi(w.dataUrl,!0,k=>{if(!k){H("Не вдалося завантажити знімок.");return}Xt({sourceUrl:w.sourceUrl,sourceTitle:w.sourceTitle,capturedAt:w.capturedAt}),w.capturedAt!==void 0&&Di(w.capturedAt)})}))}},[at,mt,Wi,Di]);const Wt=Q.errorMessage??(Q.status==="saving"?"Збереження чернетки…":Q.status==="saved"&&Q.lastSavedAt?`Чернетка збережена: ${Pd(new Date(Q.lastSavedAt))}`:Q.canRestore&&Q.storedDraftSavedAt?`Знайдено чернетку від ${Pd(new Date(Q.storedDraftSavedAt))}`:null),pt=Q.status==="error"?"#E63946":"#555",[Ot,Ht]=U.useState(null),ie=U.useRef(null),$t=U.useRef(null),[re,ce]=U.useState(!1),Se=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation(),w&&tt(w),Ht({pinId:w,x:k.clientX,y:k.clientY,at:Me(k.clientX,k.clientY)})},[Me]),ge=U.useCallback(w=>{const k=fr.current.find(_=>_.id===w);k&&(ie.current=tS(k,go.current[w]),ce(!0))},[]),Ze=U.useCallback(w=>{te(),lt(k=>hk([...k,w.pin])),w.card&&At(k=>({...k,[w.pin.id]:w.card})),tt(w.pin.id),vt(w.pin.id),yi.current=null},[te]),$e=U.useCallback(w=>{const k=fr.current.find(N=>N.id===w);if(!k)return;const _=Jz;Ze(D4(tS(k,go.current[w]),_,_,wl()))},[Ze]),Dn=U.useCallback(w=>{const k=ie.current;k&&Ze(s8(k,w,wl()))},[Ze]),nn=U.useCallback(()=>{const{w,h:k}=dr.current;Dn($t.current??{x:w/2,y:k/2})},[Dn]);ez({isMac:b,backgroundImage:C,pinsLength:st.length,showExportMenu:$n,sourceImageSize:Lt,imageSize:V,activePin:X,calloutControlPinId:gt,undo:uc,redo:jo,handleExport:Gi,handleExportPdf:Jc,stepZoom:ya,handleFitToWindow:bi,deletePin:hs,movePinZ:qa,copyPin:ge,duplicatePin:$e,pastePinFromClipboard:nn,setMode:P,setPolygonDraft:qt,setPolylineDraft:Zt,setShapeDraftType:Te,setPlacementTool:Ye,setShowExportMenu:en,beginCrop:Fl,insertCurrentDateTimeText:ei,toggleCompassMenu:Lr,toggleImageObjectMenu:lo,newBgFileRef:ts,replaceBgFileRef:dc,exportMenuOpenedViaHotkeyRef:Qt}),U.useEffect(()=>{if(!yi.current)return;const w=setTimeout(()=>{yi.current=null},500);return()=>clearTimeout(w)},[gt]);const Jn=U.useMemo(()=>gg(st),[st]),[jr,zn]=U.useState(null),Ve=st.some(w=>w.anchor.type==="redact"),Oe=U.useMemo(()=>JSON.stringify(st.filter(w=>w.anchor.type!=="redact").map(w=>[w.id,w.anchor,w.color,w.description,w.calloutHidden,w.z])),[st]);U.useEffect(()=>{if(!Ve||!C||!V.w){zn(null);return}let w=!1;const k=setTimeout(async()=>{const _=await fc.current?.("png",Gz,{returnDataUrl:!0,skipRedaction:!0});if(w||typeof _!="string")return;const N=new Image;N.onload=()=>{w||zn(N)},N.src=_},Kz);return()=>{w=!0,clearTimeout(k)}},[Ve,C,V.w,V.h,Oe,zt]);const[ni,Mn]=U.useState(null);U.useEffect(()=>{if(!Ot)return;const w=()=>Ht(null),k=_=>{_.key==="Escape"&&w()};return window.addEventListener("pointerdown",w),window.addEventListener("wheel",w,{passive:!0}),window.addEventListener("resize",w),window.addEventListener("keydown",k),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("wheel",w),window.removeEventListener("resize",w),window.removeEventListener("keydown",k)}},[Ot]);const jn=U.useMemo(()=>{const w={};for(const k of st)if(k.anchor.type==="polygon"||k.anchor.type==="polyline"){const _=k.anchor.points;if(!_.length)continue;let N=_[0].x,j=_[0].y,G=_[0].x,nt=_[0].y;for(let z=1;z<_.length;z++)_[z].x<N&&(N=_[z].x),_[z].y<j&&(j=_[z].y),_[z].x>G&&(G=_[z].x),_[z].y>nt&&(nt=_[z].y);w[k.id]={minX:N,minY:j,maxX:G,maxY:nt}}return w},[st]),kr=U.useCallback(w=>{const k=12*de,_=k,N=k,j=Math.max(_,V.w-k),G=Math.max(N,V.h-k),nt=(ut,it,rt)=>Math.max(it,Math.min(ut,rt));let z=k,J=k;if(w.anchor.type==="point")z=w.anchor.x+k,J=w.anchor.y+k;else if(w.anchor.type==="image")z=w.anchor.x+w.anchor.width+k,J=w.anchor.y+k;else if(w.anchor.type==="polygon"||w.anchor.type==="polyline"){const ut=jn[w.id];ut&&(z=ut.maxX+k,J=ut.maxY+k)}else if(w.anchor.type==="rectangle"){const{x:ut,y:it,width:rt,height:I,rotation:Mt=0}=w.anchor,It=ut+rt/2,wt=it+I/2,Et=Mt*Math.PI/180,yt=Math.cos(Et),Ft=Math.sin(Et),Vt=[{lx:-rt/2,ly:-I/2},{lx:rt/2,ly:-I/2},{lx:rt/2,ly:I/2},{lx:-rt/2,ly:I/2}].map(Ee=>({x:It+Ee.lx*yt-Ee.ly*Ft,y:wt+Ee.lx*Ft+Ee.ly*yt})),pe=Math.max(...Vt.map(Ee=>Ee.x)),se=Math.max(...Vt.map(Ee=>Ee.y));z=pe+k,J=se+k}else if(w.anchor.type==="ellipse"){const{cx:ut,cy:it,rx:rt,ry:I,rotation:Mt=0}=w.anchor,It=Mt*Math.PI/180,wt=Math.cos(It),Et=Math.sin(It),yt=Math.sqrt((rt*wt)**2+(I*Et)**2),Ft=Math.sqrt((rt*Et)**2+(I*wt)**2);z=ut+yt+k,J=it+Ft+k}else if(w.anchor.type==="compass")z=w.anchor.cx+w.anchor.radius+k,J=w.anchor.cy+w.anchor.radius+k;else if(w.anchor.type==="arrow"){const ut=[w.anchor.start,w.anchor.end,w.anchor.control],it=Math.max(...ut.map(I=>I.x)),rt=Math.max(...ut.map(I=>I.y));z=it+k,J=rt+k}return{x:nt(z,_,j),y:nt(J,N,G)}},[V.h,V.w,jn]),zi=w=>{const k=u2(w,st);return k!==null&&Rw(k)},Fi=Ws,Rr=Ws,ri=rs.current?.getBoundingClientRect()??null,Ui=pc.current?.getBoundingClientRect()??null,ii=Ks.current?.getBoundingClientRect()??null,Un=bo.current?.getBoundingClientRect()??null,kn=!!C&&V.w>0,Nr=mc.current?.getBoundingClientRect()??null,er=ol.current?.getBoundingClientRect()??null;return T.jsxs("div",{ref:Vi,style:{display:"flex",flexDirection:"column",height:"100dvh",minHeight:"100vh",background:"#08080d",color:"#ddd",fontFamily:Xn},onClick:()=>{if(Ni.current){Ni.current=!1;return}tt(null),vt(null),en(!1),To(!1),bt(!1),me(!1),He(!1),pi(!1)},onDragOver:w=>{w.dataTransfer?.types?.includes("Files")&&(w.preventDefault(),w.dataTransfer.dropEffect="copy",Xs(!0))},onDragLeave:w=>{const k=w.relatedTarget;k&&Vi.current?.contains(k)||Xs(!1)},onDrop:()=>{Xs(!1)},children:[T.jsxs("div",{ref:Gs,style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",background:"rgba(16,16,24,0.97)",borderBottom:"1px solid rgba(255,255,255,0.06)",flexShrink:0,position:"relative",zIndex:200,fontSize:14,overflow:"visible",scrollbarWidth:"thin"},onClick:w=>w.stopPropagation(),children:[T.jsx("div",{className:"tyts-no-scrollbar",style:{flex:1,minWidth:0,overflowX:"auto",overflowY:"hidden",display:"flex",alignItems:"center"},children:T.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,minWidth:"100%",width:"max-content"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[T.jsx("img",{src:"./favicon/favicon.svg",alt:"",width:24,height:24,style:{flexShrink:0},"aria-hidden":!0}),!Ws&&T.jsx("span",{style:{fontWeight:700,letterSpacing:"0.03em"},children:"Тиць"}),C?T.jsxs(T.Fragment,{children:[T.jsx(wr,{title:"Створити новий колаж (виноски будуть видалені)",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Q.clearDraft(),D(null),xt({w:0,h:0}),dt(null),lt([]),At({}),tt(null),vt(null),qr(null),qt(null),Zt(null),Te(null),tn(null),Ye("point"),tn(null),ur(null),W(!1),bt(!1),jt(null),en(!1),Xs(!1),Fn.current=[],Po.current=[],Pa(0),Io(0),P("select"),Ye("point"),yo(1)},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-file-earmark-plus`,style:{fontSize:rr},"aria-hidden":!0}),!an&&"Нове"]})}),T.jsx(wr,{title:"Замінити фон, зберегти виноски",onClick:()=>dc.current?.click(),children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-arrow-repeat`,style:{fontSize:rr},"aria-hidden":!0}),!an&&"Замінити"]})}),T.jsxs("div",{ref:rs,style:{position:"relative"},children:[T.jsx(wr,{title:`Обрізати фон (${mn(oe.toolCrop,{isMac:b})})`,tooltip:`Обрізати фон (${mn(oe.toolCrop,{isMac:b})})`,onClick:Fl,disabled:!C,active:Y,hotkeyParts:Ai(oe.toolCrop,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-crop`,style:{fontSize:rr,display:"block",lineHeight:1,transform:"translate(-1px, -1px)"},"aria-hidden":!0}),!an&&"Crop"]})}),Y&&T.jsxs("div",{style:{position:"fixed",top:ri?ri.bottom+6:0,left:ri?ri.left:0,display:"inline-flex",alignItems:"center",gap:6,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:6,zIndex:30},children:[T.jsx(wr,{title:"Обрати формат обрізки",onClick:()=>bt(w=>!w),children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:128,whiteSpace:"nowrap"},children:T.jsx("span",{children:`${yk.find(w=>w.id===St)?.label??"Вільний формат"}`})})}),Ct&&T.jsx("div",{onClick:w=>w.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,minWidth:170,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:4,zIndex:30},children:yk.map(w=>{const k=w.id===St;return T.jsxs("button",{type:"button",onClick:()=>{Ul(w.id),bt(!1)},style:{width:"100%",textAlign:"left",border:"none",background:k?"rgba(78,205,196,0.16)":"transparent",color:k?"#bdf8f3":"#ddd",borderRadius:6,padding:"6px 8px",cursor:"pointer",fontFamily:Xn,fontSize:13,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[T.jsx("span",{children:w.label}),k&&T.jsx("span",{style:{opacity:.9},children:"✓"})]},w.id)})}),T.jsx(wr,{title:"Скасувати crop",onClick:gc,children:T.jsx("i",{className:`${qn} bi-x-lg`,style:{fontSize:rr-1},"aria-hidden":!0})}),T.jsx(wr,{primary:!0,title:"Застосувати crop",onClick:()=>{is()},disabled:Z,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-check-lg`,style:{fontSize:rr},"aria-hidden":!0}),!an&&(Z?"Обробка…":"Застосувати")]})})]})]}),T.jsx("input",{ref:ts,type:"file",accept:"image/*",style:{display:"none"},onChange:ro}),T.jsx("input",{ref:dc,type:"file",accept:"image/*",style:{display:"none"},onChange:ll})]}):T.jsxs(T.Fragment,{children:[T.jsx(wr,{title:"Завантажити фонове зображення",onClick:()=>ts.current?.click(),children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-image`,style:{fontSize:rr},"aria-hidden":!0}),!an&&"Нове зображення"]})}),T.jsx("input",{ref:ts,type:"file",accept:"image/*",style:{display:"none"},onChange:ro})]})]}),T.jsx("div",{style:{display:"flex",justifyContent:"center",flexShrink:0,margin:"0 auto"},children:T.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(wr,{disabled:!C,active:K==="place"&&kt===null&&Rt===null&&_e===null&&Le==="point",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),Ye("point")},title:`${K==="place"&&kt===null&&!_e?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${mn(oe.toolPoint,{isMac:b})})`,tooltip:`${K==="place"&&kt===null&&!_e?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${mn(oe.toolPoint,{isMac:b})})`,hotkeyParts:Ai(oe.toolPoint,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-pin-map`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Точка"]})}),T.jsxs("div",{ref:pc,style:{position:"relative"},children:[T.jsx(wr,{disabled:!C,active:K==="place"&&kt!==null,onClick:()=>{P("place"),qt([]),Zt(null),Te(null),tn(null),Ye("point")},title:`${K==="place"&&kt!==null?"Клік — додати вершину; тягніть вершину — перемістити; «Готово» — закрити":"Додати район (полігон)"} (${mn(oe.toolRegion,{isMac:b})})`,tooltip:`${K==="place"&&kt!==null?"Клік — додати вершину; тягніть вершину — перемістити; подвійний клік, клік на першу точку або «Готово» — закрити район":"Додати район (полігон). Кліки задають вершини."} (${mn(oe.toolRegion,{isMac:b})})`,hotkeyParts:Ai(oe.toolRegion,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-hexagon`,style:{fontSize:rr},"aria-hidden":!0}),!an&&"Район"]})}),kt!==null&&T.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:Ui?Ui.bottom+6:0,left:Ui?Ui.left:0,display:"inline-flex",alignItems:"center",gap:6,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:6,zIndex:30},children:[T.jsx(wr,{title:"Скасувати район",onClick:()=>qt(null),children:T.jsx("i",{className:`${qn} bi-x-lg`,style:{fontSize:rr-1},"aria-hidden":!0})}),T.jsx(vk,{canUndo:Ae,canRedo:le,onUndo:uc,onRedo:jo,isMac:b}),T.jsx(wr,{accent:!0,title:"Завершити район із поточних вершин",tooltip:"Завершити район із поточних вершин",onClick:io,disabled:kt.length<2,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-check-lg`,style:{fontSize:rr},"aria-hidden":!0}),!Fi&&`Готово (${kt.length})`]})})]})]}),T.jsxs("div",{ref:Ks,style:{position:"relative"},children:[T.jsx(wr,{disabled:!C,active:K==="place"&&Rt!==null,onClick:()=>{P("place"),qt(null),Zt([]),Te(null),tn(null),Ye("point")},title:`${K==="place"&&Rt!==null?"Клік — додати точку маршруту; «Готово» — завершити":"Додати маршрут (полілінія)"} (${mn(oe.toolRoute,{isMac:b})})`,tooltip:`${K==="place"&&Rt!==null?"Клік — додати точку; тягніть вершину — перемістити; подвійний клік або «Готово» — завершити маршрут (без замикання)":"Додати маршрут (полілінія). Кліки задають точки; лінія не замикається."} (${mn(oe.toolRoute,{isMac:b})})`,hotkeyParts:Ai(oe.toolRoute,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("svg",{width:rr,height:rr,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:T.jsx("path",{d:"M1.00007 15L6 8L10 8L15 1.00002",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})}),!an&&"Маршрут"]})}),Rt!==null&&T.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:ii?ii.bottom+6:0,left:ii?ii.left:0,display:"inline-flex",alignItems:"center",gap:6,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:6,zIndex:30},children:[T.jsx(wr,{title:"Скасувати маршрут",onClick:()=>Zt(null),children:T.jsx("i",{className:`${qn} bi-x-lg`,style:{fontSize:rr-1},"aria-hidden":!0})}),T.jsx(vk,{canUndo:Ae,canRedo:le,onUndo:uc,onRedo:jo,isMac:b}),T.jsx(wr,{accent:!0,title:"Завершити маршрут",tooltip:"Завершити маршрут із поточних точок",onClick:Zs,disabled:Rt.length<2,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-check-lg`,style:{fontSize:rr},"aria-hidden":!0}),!Fi&&`Готово (${Rt.length})`]})})]})]}),T.jsx(wr,{disabled:!C,active:K==="place"&&_e==="rectangle",onClick:()=>{P("place"),qt(null),Zt(null),Te("rectangle"),tn(null),Ye("point")},title:`${_e==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область"} (${mn(oe.toolRectangle,{isMac:b})})`,tooltip:`${_e==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область. Потягніть на фото для малювання."} (${mn(oe.toolRectangle,{isMac:b})})`,hotkeyParts:Ai(oe.toolRectangle,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-square`,style:{fontSize:rr-2},"aria-hidden":!0}),!an&&"Прямокутник"]})}),T.jsx(wr,{disabled:!C,active:K==="place"&&_e==="ellipse",onClick:()=>{P("place"),qt(null),Zt(null),Te("ellipse"),tn(null),Ye("point")},title:`${_e==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область"} (${mn(oe.toolEllipse,{isMac:b})})`,tooltip:`${_e==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область. Потягніть на фото для малювання."} (${mn(oe.toolEllipse,{isMac:b})})`,hotkeyParts:Ai(oe.toolEllipse,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-circle`,style:{fontSize:rr-2},"aria-hidden":!0}),!an&&"Еліпс"]})}),T.jsx(wr,{disabled:!C,active:K==="place"&&kt===null&&Rt===null&&_e===null&&Le==="arrow",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),tn(null),Ye("arrow")},title:`${Le==="arrow"&&K==="place"?"Потягніть на фото, щоб намалювати стрілку":"Додати стрілку"} (${mn(oe.toolArrow,{isMac:b})})`,tooltip:`${Le==="arrow"&&K==="place"?"Потягніть на фото, щоб намалювати стрілку; центральний важіль згинає лінію":"Додати стрілку (drag для створення, центральний важіль для вигину)."} (${mn(oe.toolArrow,{isMac:b})})`,hotkeyParts:Ai(oe.toolArrow,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-arrow-right`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Стрілка"]})}),T.jsx(wr,{disabled:!C,active:K==="place"&&kt===null&&Rt===null&&_e===null&&Le==="text",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),tn(null),Ye("text")},title:`${Le==="text"&&K==="place"?"Клікніть на фото, щоб додати текст":"Додати текст"} (${mn(oe.toolText,{isMac:b})})`,tooltip:`${Le==="text"&&K==="place"?"Клікніть на фото, щоб додати текстову виноску":"Додати текстову виноску"} (${mn(oe.toolText,{isMac:b})})`,hotkeyParts:Ai(oe.toolText,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-type`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Текст"]})}),T.jsx(wr,{disabled:!C,active:K==="place"&&kt===null&&Rt===null&&_e===null&&Le==="pointText",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),tn(null),Ye("pointText")},title:`${Le==="pointText"&&K==="place"?"Клікніть на фото, щоб поставити точку з текстом":"Точка з текстом"} (${mn(oe.toolPointText,{isMac:b})})`,tooltip:`${Le==="pointText"&&K==="place"?"Клікніть на фото, щоб поставити точку з підписом":"Точка з підписом, без виноски"} (${mn(oe.toolPointText,{isMac:b})})`,hotkeyParts:Ai(oe.toolPointText,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsxs("svg",{width:rr,height:rr,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,style:{display:"block",flexShrink:0},children:[T.jsx("circle",{cx:"3.4",cy:"12.6",r:"1.5",fill:"currentColor"}),T.jsx("rect",{x:"6.6",y:"1.1",width:"8.8",height:"7.4",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),T.jsx("text",{x:"11",y:"4.8",textAnchor:"middle",dominantBaseline:"central",fontSize:"5.6",fontWeight:"700",fill:"currentColor",children:"А"})]}),!an&&"Точка з текстом"]})}),T.jsx(wr,{disabled:!C,active:K==="place"&&_e==="redact",onClick:()=>{P("place"),qt(null),Zt(null),tn(null),Te("redact")},title:`Замалювати ділянку фону (${mn(oe.toolRedact,{isMac:b})})`,tooltip:`Виділіть ділянку — її можна розмити, пікселізувати або залити середнім кольором (${mn(oe.toolRedact,{isMac:b})})`,hotkeyParts:Ai(oe.toolRedact,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-droplet-half`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Замалювати"]})}),T.jsxs("div",{ref:ol,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[T.jsx(wr,{disabled:!C,active:Js,onClick:()=>pi(w=>!w),title:`Додати зображення (${mn(oe.toolImageObject,{isMac:b})})`,tooltip:`Покласти зображення поверх фото — можна совати й масштабувати (${mn(oe.toolImageObject,{isMac:b})})`,hotkeyParts:Ai(oe.toolImageObject,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-image`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Картинка"]})}),Js&&T.jsxs("div",{style:{position:"fixed",top:er?er.bottom+6:0,left:er?er.left+er.width/2:0,transform:"translateX(-50%)",zIndex:3200,padding:8,background:"rgba(16,16,28,0.98)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 10px 28px rgba(0,0,0,0.45)"},onClick:w=>w.stopPropagation(),children:[T.jsx("input",{ref:al,type:"text","aria-label":"Вставте зображення з буфера",onChange:()=>{},value:"",onPaste:w=>{const k=Xy(w.clipboardData);k&&(w.preventDefault(),Ls(k))},style:{position:"absolute",width:1,height:1,opacity:0,border:"none",outline:"none",padding:0,margin:0}}),T.jsxs("button",{type:"button",onClick:()=>vn.current?.click(),onDragOver:w=>{w.preventDefault(),ma(!0)},onDragLeave:()=>ma(!1),onDrop:w=>{w.preventDefault(),w.stopPropagation(),ma(!1);const k=Array.from(w.dataTransfer.files).find(_=>_.type.startsWith("image/"));k&&(wo(k),pi(!1))},style:{width:260,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,padding:14,borderRadius:8,border:`2px dashed ${sl?Qu:"rgba(255,255,255,0.28)"}`,background:sl?"rgba(230,57,70,0.10)":"rgba(255,255,255,0.04)",color:"#ccc",cursor:"pointer",fontFamily:"inherit",fontSize:13,textAlign:"center",transition:"background 0.15s, border-color 0.15s"},children:[T.jsx("i",{className:`${qn} bi-file-earmark-image`,style:{fontSize:22},"aria-hidden":!0}),T.jsx("span",{children:"Перетягніть зображення сюди"}),T.jsx("span",{style:{color:"rgba(255,255,255,0.55)",fontSize:11,letterSpacing:.2},children:s_.join(" · ")}),T.jsxs("span",{style:{color:"rgba(255,255,255,0.45)",fontSize:11,lineHeight:1.5},children:["або клікніть, щоб вибрати файл",T.jsx("br",{}),"чи вставте з буфера (",Hd(),")"]})]})]})]}),T.jsx(wr,{disabled:!C,active:K==="place"&&kt===null&&Rt===null&&_e===null&&Le==="standalone",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),tn(null),Ye("standalone")},title:`${Le==="standalone"&&K==="place"?"Клікніть на фото, щоб додати блок виноски":"Додати блок виноски"} (${mn(oe.toolStandaloneCallout,{isMac:b})})`,tooltip:`${Le==="standalone"&&K==="place"?"Клікніть на фото, щоб додати блок виноски без лінії та фігури":"Додати блок виноски без лінії та фігури"} (${mn(oe.toolStandaloneCallout,{isMac:b})})`,hotkeyParts:Ai(oe.toolStandaloneCallout,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-chat-square-text`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Блок"]})}),T.jsxs("div",{ref:bo,style:{position:"relative"},children:[T.jsx(h9,{disabled:!C,menuOpen:ve,onMainClick:ei,onMenuClick:tr,mainTitle:Je?`Вставити зафіксовані дату та час (${mn(oe.toolDateTime,{isMac:b})})`:`Вставити поточні дату та час (${mn(oe.toolDateTime,{isMac:b})})`,mainTooltip:Je?`Вставляє зафіксовані дату й час: ${Pd(Pe,Hi)}`:"Додає редагований текст із поточними датою й часом у лівому нижньому куті",menuTitle:"Відкрити календар і вибір часу",menuTooltip:"Відкрити календар (3 місяці) та вибрати дату й час",hotkeyParts:Ai(oe.toolDateTime,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[T.jsx("i",{className:`${qn} bi-clock`,style:{fontSize:rr-1},"aria-hidden":!0}),Je&&T.jsx("i",{className:`${qn} bi-lock-fill`,style:{fontSize:rr-3,opacity:.85},"aria-hidden":!0}),!an&&"Дата/час"]})}),ve&&T.jsx("div",{style:{position:"fixed",top:Un?Un.bottom+6:0,left:Un?Un.left+Un.width/2:0,transform:"translateX(-50%)",zIndex:3200},onClick:w=>w.stopPropagation(),children:T.jsx(P_,{value:Pe,viewMonth:Xo,format:Hi,locked:Je,onChange:Vn,onViewMonthChange:ui,onFormatChange:Go,onLockedChange:Ss,onInsert:ea,onNow:Lo,onClose:()=>me(!1)})})]}),T.jsx(wr,{disabled:!C,active:K==="place"&&kt===null&&Rt===null&&_e===null&&Le==="numbering",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),tn(null),Ye("numbering")},title:`${Le==="numbering"&&K==="place"?hn?"Клікніть кінцеву точку лінії нумерації":"Клікніть початкову точку лінії нумерації":"Нумерація (2 точки: початок -> кінець)"} (${mn(oe.toolNumbering,{isMac:b})})`,tooltip:`${Le==="numbering"&&K==="place"?hn?"Другий клік поставить кінець і номер на кінці":"Перший клік задає старт лінії":"Поставте старт і фініш лінії, номер буде на кінці"} (${mn(oe.toolNumbering,{isMac:b})})`,hotkeyParts:Ai(oe.toolNumbering,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-123`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Нумерація"]})}),T.jsxs("div",{ref:mc,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[T.jsx(wr,{disabled:!C,active:We,onClick:Lr,title:`Додати компас (${mn(oe.toolCompass,{isMac:b})})`,tooltip:`Оберіть кут, щоб додати компас на зображення (${mn(oe.toolCompass,{isMac:b})})`,hotkeyParts:Ai(oe.toolCompass,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-compass`,style:{fontSize:rr-1},"aria-hidden":!0}),!an&&"Компас"]})}),We&&T.jsx("div",{style:{position:"fixed",top:Nr?Nr.bottom+6:0,left:Nr?Nr.left+Nr.width/2:0,transform:"translateX(-50%)",zIndex:3200,display:"grid",gridTemplateColumns:"1fr 1fr",gap:6,padding:8,background:"rgba(16,16,28,0.98)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 10px 28px rgba(0,0,0,0.45)"},onClick:w=>w.stopPropagation(),children:[["nw","ne"],["sw","se"]].flatMap(w=>w.map(k=>T.jsx("button",{type:"button",title:k==="nw"?"Верхній лівий":k==="ne"?"Верхній правий":k==="sw"?"Нижній лівий":"Нижній правий",onClick:()=>ud(k),style:{width:56,height:56,padding:0,borderRadius:8,border:"none",background:"rgba(255,255,255,0.06)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:T.jsx(d9,{corner:k})},k)))})]}),T.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),T.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[T.jsx(wr,{disabled:!C,title:`Зменшити масштаб (${mn(oe.zoomOut,{isMac:b})})`,onClick:()=>ya("out"),hotkeyParts:Ai(oe.zoomOut,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${qn} bi-zoom-out`,style:{fontSize:rr-2},"aria-hidden":!0})})}),!Fi&&T.jsxs("span",{style:{minWidth:52,textAlign:"center",color:"#888",fontVariantNumeric:"tabular-nums"},children:[Math.round(gr*100),"%"]}),T.jsx(wr,{disabled:!C,title:`Збільшити масштаб (${mn(oe.zoomIn,{isMac:b})})`,onClick:()=>ya("in"),hotkeyParts:Ai(oe.zoomIn,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${qn} bi-zoom-in`,style:{fontSize:rr-2},"aria-hidden":!0})})}),T.jsx(wr,{disabled:!C,title:`Припасувати розмір зображення під розмір вікна (${mn(oe.fitToWindow,{isMac:b})})`,tooltip:`Припасувати розмір зображення під розмір вікна (${mn(oe.fitToWindow,{isMac:b})})`,onClick:bi,hotkeyParts:Ai(oe.fitToWindow,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${qn} bi-aspect-ratio`,style:{fontSize:rr-2},"aria-hidden":!0})})})]}),T.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),T.jsx(wr,{title:`Відмінити останню дію (${mn(oe.undo,{isMac:b})})`,tooltip:`Відмінити останню дію (${mn(oe.undo,{isMac:b})})`,onClick:uc,disabled:!C||!Pl,hotkeyParts:Ai(oe.undo,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:T.jsx("i",{className:`${qn} bi-arrow-counterclockwise`,style:{fontSize:rr},"aria-hidden":!0})})}),T.jsx(wr,{title:`Повернути скасовану дію (${mn(oe.redo,{isMac:b})})`,tooltip:`Повернути скасовану дію (${mn(oe.redo,{isMac:b})})`,onClick:jo,disabled:!C||!lc,hotkeyParts:Ai(oe.redo,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:T.jsx("i",{className:`${qn} bi-arrow-clockwise`,style:{fontSize:rr},"aria-hidden":!0})})})]})})]})}),T.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",zIndex:1},children:[T.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[T.jsx(wr,{title:C?`Швидке збереження у форматі JPEG (${mn(oe.downloadJpg,{isMac:b})})`:"Спочатку завантажте фонове зображення",onClick:()=>Gi("jpeg"),disabled:!kn,hotkeyParts:Ai(oe.downloadJpg,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} bi-download`,style:{fontSize:rr},"aria-hidden":!0}),!Rr&&"JPG"]})}),T.jsx(wr,{title:tl?"Скопіювати зображення в буфер обміну":"Ваш браузер не підтримує копіювання зображення в буфер",onClick:pl,disabled:!kn||Qo||!tl,success:As,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${qn} ${Qo?"bi-arrow-repeat tyts-spin":As?"bi-check-lg":"bi-clipboard-plus"}`,style:{fontSize:rr-2},"aria-hidden":!0}),!an&&"Копіювати"]})}),T.jsx(wr,{title:`Більше опцій збереження (${mn(oe.openExportMenu,{isMac:b})})`,onClick:()=>{en(w=>!w)},disabled:!kn,hotkeyParts:Ai(oe.openExportMenu,{isMac:b}),showHotkeyBadge:Gn&&!an,children:T.jsx("i",{className:`${qn} bi-caret-down-fill`,style:{fontSize:rr-4},"aria-hidden":!0})})]}),$n&&T.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:6,background:"rgba(10,10,16,0.97)",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",boxShadow:"0 8px 24px rgba(0,0,0,0.6)",padding:"6px 0",width:"max-content",display:"flex",flexDirection:"column",zIndex:3e3},onClick:w=>w.stopPropagation(),children:[Lt&&T.jsx("button",{type:"button",disabled:!kn,onClick:()=>{if(!Lt)return;en(!1);const{w}=V;if(!w)return;const k=Lt.w/w/2;Gi("png",k)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:kn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Xn,fontSize:13,cursor:kn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(tc,{children:"1"}),T.jsxs("span",{children:["PNG оригінал"," ",T.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:[Lt.w,"×",Lt.h," px"]})]})]})}),T.jsx("button",{type:"button",disabled:!kn,onClick:()=>{en(!1),Gi("png",1)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:kn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Xn,fontSize:13,cursor:kn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(tc,{children:Lt?"2":"1"}),T.jsxs("span",{children:["PNG"," ",T.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",V.w,"×",V.h," px"]})]})]})}),T.jsx("button",{type:"button",disabled:!kn,onClick:()=>{en(!1),Gi("png",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:kn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Xn,fontSize:13,cursor:kn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(tc,{children:Lt?"3":"2"}),T.jsxs("span",{children:["PNG ×2"," ",T.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",V.w*2,"×",V.h*2," px"]})]})]})}),T.jsx("button",{type:"button",disabled:!kn,onClick:()=>{en(!1),Gi("jpeg",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:kn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Xn,fontSize:13,cursor:kn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(tc,{children:Lt?"4":"3"}),T.jsxs("span",{children:["JPG ×2"," ",T.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",V.w*2,"×",V.h*2," px"]})]})]})}),T.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),T.jsx("button",{type:"button",disabled:!kn,onClick:()=>{en(!1),Jc()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:kn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Xn,fontSize:13,cursor:kn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(tc,{children:Lt?"5":"4"}),T.jsx("span",{children:"PDF"})]})}),T.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),T.jsx("button",{type:"button",disabled:!kn,onClick:()=>{en(!1),st.length>0&&window.print()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:kn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Xn,fontSize:13,cursor:kn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(tc,{children:Lt?"6":"5"}),T.jsx("span",{children:"Друк… (діалог друку)"})]})})]})]})]}),T.jsx("div",{ref:xr,style:{flex:1,minHeight:0,overflow:C?"auto":"hidden",position:"relative",touchAction:"none"},onClick:w=>w.stopPropagation(),onPointerDown:w=>{if(!C||!xr.current)return;const k=w.target,_=y&&w.pointerType!=="mouse";if(_&&(ji.current.set(w.pointerId,{x:w.clientX,y:w.clientY}),ji.current.size>=2)){const z=Array.from(ji.current.values()),J=z[0],ut=z[1],it=Math.hypot(ut.x-J.x,ut.y-J.y);if(it>0){const rt=xr.current.getBoundingClientRect(),I=(J.x+ut.x)/2,Mt=(J.y+ut.y)/2,It=I-rt.left,wt=Mt-rt.top,Et=gr||1,yt=(xr.current.scrollLeft+It)/Et,Ft=(xr.current.scrollTop+wt)/Et;_i.current={active:!0,startDistance:it,startZoom:Et,anchorImageX:yt,anchorImageY:Ft},xo.current.isPanning=!1,xr.current.style.cursor="default",w.preventDefault();return}}const N=w.button===1,j=w.button===0&&(k.getAttribute("data-background")==="true"||!!k.closest('[data-background="true"]'));(_||N||j&&!(K==="place"&&_e))&&(w.preventDefault(),Qr.current=!1,xo.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:xr.current.scrollLeft,startScrollTop:xr.current.scrollTop},xr.current.style.cursor="grabbing")},onPointerMove:w=>{const k=xr.current;if(!k)return;y&&w.pointerType!=="mouse"&&ji.current.has(w.pointerId)&&ji.current.set(w.pointerId,{x:w.clientX,y:w.clientY});const N=_i.current;if(N?.active&&ji.current.size>=2){const z=Array.from(ji.current.values()),J=z[0],ut=z[1],it=Math.hypot(ut.x-J.x,ut.y-J.y);if(it>0&&N.startDistance>0){const rt=k.getBoundingClientRect(),I=(J.x+ut.x)/2-rt.left,Mt=(J.y+ut.y)/2-rt.top,It=it/N.startDistance,wt=Math.min(Cm,Math.max(Mm,+(N.startZoom*It).toFixed(Em))),Et=dr.current.w*wt,yt=dr.current.h*wt;k.scrollLeft=Math.max(0,Math.min(Et-k.clientWidth,N.anchorImageX*wt-I)),k.scrollTop=Math.max(0,Math.min(yt-k.clientHeight,N.anchorImageY*wt-Mt)),Qr.current=!1,yo(wt)}w.preventDefault();return}const j=xo.current;if(!j.isPanning)return;w.preventDefault();const G=w.clientX-j.startX,nt=w.clientY-j.startY;k.scrollLeft=j.startScrollLeft-G,k.scrollTop=j.startScrollTop-nt},onPointerUp:w=>{const k=xr.current;k&&(ji.current.has(w.pointerId)&&ji.current.delete(w.pointerId),ji.current.size<2&&(_i.current=null),xo.current.isPanning=!1,k.style.cursor="default")},onPointerCancel:w=>{const k=xr.current;k&&(ji.current.has(w.pointerId)&&ji.current.delete(w.pointerId),ji.current.size<2&&(_i.current=null),xo.current.isPanning=!1,k.style.cursor="default")},onMouseDown:w=>{if(!C||!xr.current)return;const k=w.target,_=w.button===1,N=w.button===0&&(k.getAttribute("data-background")==="true"||!!k.closest('[data-background="true"]'));!_&&(!N||K==="place"&&_e)||(w.preventDefault(),Qr.current=!1,xo.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:xr.current.scrollLeft,startScrollTop:xr.current.scrollTop},xr.current.style.cursor="grabbing")},onMouseMove:w=>{const k=xo.current,_=xr.current;if(!k.isPanning||!_)return;w.preventDefault();const N=w.clientX-k.startX,j=w.clientY-k.startY;_.scrollLeft=k.startScrollLeft-N,_.scrollTop=k.startScrollTop-j},onMouseUp:()=>{const w=xr.current;w&&(xo.current.isPanning=!1,w.style.cursor="default")},onMouseLeave:()=>{const w=xr.current;w&&(xo.current.isPanning=!1,w.style.cursor="default")},children:C?T.jsx(T.Fragment,{children:T.jsx("div",{style:{minWidth:"100%",minHeight:"100%",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:T.jsx("div",{style:{width:V.w*gr,height:V.h*gr,position:"relative"},children:T.jsx("div",{ref:hc,style:{transform:`scale(${gr})`,transformOrigin:"top left",width:V.w,height:V.h},children:T.jsxs("svg",{ref:Bo,width:V.w,height:V.h,viewBox:`0 0 ${V.w} ${V.h}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",cursor:Y?"default":K==="place"?"crosshair":"default",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},onContextMenu:w=>{Y||Se(null,w)},onPointerDown:w=>Ds(w),onMouseDown:Ds,onPointerMove:w=>so(w),onMouseMove:so,onClick:oo,onDoubleClick:()=>{kt&&kt.length>=2&&io(),Rt&&Rt.length>=2&&Zs()},children:[T.jsx("image",{href:C,x:0,y:0,width:V.w,height:V.h,preserveAspectRatio:"xMidYMid meet","data-background":"true",style:{userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"}}),T.jsx("defs",{children:T.jsxs("radialGradient",{id:"vignette",cx:"50%",cy:"50%",r:"70%",children:[T.jsx("stop",{offset:"60%",stopColor:"transparent"}),T.jsx("stop",{offset:"100%",stopColor:"rgba(0,0,0,0.18)"})]})}),T.jsx("rect",{x:0,y:0,width:V.w,height:V.h,fill:"url(#vignette)",pointerEvents:"none","data-background":"true"}),Y&&ot&&T.jsxs("g",{children:[T.jsx("rect",{x:0,y:0,width:V.w,height:ot.y,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:0,y:ot.y+ot.height,width:V.w,height:Math.max(0,V.h-ot.y-ot.height),fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:0,y:ot.y,width:ot.x,height:ot.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:ot.x+ot.width,y:ot.y,width:Math.max(0,V.w-ot.x-ot.width),height:ot.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:ot.x,y:ot.y,width:ot.width,height:ot.height,fill:"rgba(78,205,196,0.12)",stroke:"#4ECDC4",strokeWidth:2*de,style:{cursor:"move"},onPointerDown:w=>ba(w),onMouseDown:ba}),[{key:"nw",x:ot.x,y:ot.y,cursor:"nwse-resize"},{key:"ne",x:ot.x+ot.width,y:ot.y,cursor:"nesw-resize"},{key:"se",x:ot.x+ot.width,y:ot.y+ot.height,cursor:"nwse-resize"},{key:"sw",x:ot.x,y:ot.y+ot.height,cursor:"nesw-resize"}].map(w=>T.jsx("rect",{x:w.x-6*de,y:w.y-6*de,width:12*de,height:12*de,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.2*de,style:{cursor:w.cursor},onPointerDown:k=>cl(w.key,k),onMouseDown:k=>cl(w.key,k)},w.key))]}),kt&&kt.length>0&&T.jsxs("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"none",children:[kt.length>=2&&T.jsx("polyline",{points:kt.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*de} ${4*de}`,pointerEvents:"none"}),kt.map((w,k)=>T.jsx("circle",{cx:w.x,cy:w.y,r:8*de,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"move"},onPointerDown:_=>Hl(k,_),onMouseDown:_=>Hl(k,_)},k))]}),Rt&&Rt.length>0&&T.jsxs("g",{stroke:"#9B59B6",strokeWidth:2*de,fill:"none",children:[Rt.length>=2&&T.jsx("polyline",{points:Rt.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*de} ${4*de}`,pointerEvents:"none"}),Rt.map((w,k)=>T.jsx("circle",{cx:w.x,cy:w.y,r:8*de,fill:"#9B59B6",stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"move"},onPointerDown:_=>ul(k,_),onMouseDown:_=>ul(k,_)},k))]}),je&&_e&&T.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"#4ECDC444",strokeDasharray:`${6*de} ${4*de}`,pointerEvents:"none",children:_e==="rectangle"||_e==="redact"?T.jsx("rect",{x:Math.min(je.x1,je.x2),y:Math.min(je.y1,je.y2),width:Math.abs(je.x2-je.x1),height:Math.abs(je.y2-je.y1)}):T.jsx("ellipse",{cx:(je.x1+je.x2)/2,cy:(je.y1+je.y2)/2,rx:Math.abs(je.x2-je.x1)/2,ry:Math.abs(je.y2-je.y1)/2})}),Be&&T.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"none",pointerEvents:"none",children:T.jsx("path",{d:`M ${Be.start.x} ${Be.start.y} Q ${Be.control.x} ${Be.control.y} ${Be.end.x} ${Be.end.y}`,strokeDasharray:`${6*de} ${4*de}`})}),hn&&wn&&K==="place"&&Le==="numbering"&&T.jsx("g",{stroke:"#4ECDC4",fill:"none",pointerEvents:"none",children:T.jsx("line",{x1:hn.x,y1:hn.y,x2:wn.x,y2:wn.y,strokeWidth:2*de,strokeDasharray:`${6*de} ${4*de}`})}),Jn.map(w=>T.jsxs("g",{onContextMenu:k=>Se(w.id,k),children:[[w].map(k=>{if(k.anchor.type==="text"||k.anchor.type==="standalone"||k.anchor.type==="redact"||k.calloutHidden)return null;const _=zt[k.id];if(!_)return null;const N=ay(k,st);return N?T.jsx(tz,{anchor:N,card:_,color:k.color,widthScale:ir(k),points:k.leaderPoints},k.id+"-line"):null}),st.filter(k=>k.id===w.id&&k.anchor.type==="point").map(k=>{const{x:_,y:N}=k.anchor;return T.jsx(d8,{x:_,y:N,color:k.color,label:k.label,widthScale:ir(k),active:X===k.id,onPointerDown:j=>ti(k.id,j),onMouseDown:j=>ti(k.id,j),onClick:j=>{if(j.stopPropagation(),ue.current){ue.current=!1;return}tt(G=>G===k.id?null:k.id),vt(null)}},k.id+"-pin")}),st.filter(k=>k.id===w.id&&k.anchor.type==="numbering").map(k=>{const{start:_,end:N}=k.anchor,j=X===k.id,G=ir(k),nt=String(k.label),z=14*de,J=.075*z,ut=.4*z,it=.35*z,I=Math.max(z*.62,nt.length*.62*z)+ut*2,Mt=z+J+it,It=N.x-I/2,wt=N.y-Mt/2,Et=14*de,yt=4*de,Ft=7*de,Vt=6*de,pe=Ft*2+Et*Cl.length+yt*Math.max(0,Cl.length-1),se=Vt*2+Et,Ee=10*de,Qe=N.x-pe/2,En=Math.max(0,Math.min(Qe,V.w-pe)),fe=wt-Ee-se,Xe=Math.max(0,Math.min(fe,V.h-se)),we=24*de,Tn=6*de,Yt=En+pe+Tn,De=En-we-Tn,ze=Yt+we<=V.w?Yt:De>=0?De:Math.max(0,Math.min(Yt,V.w-we)),Fe=Math.max(0,Math.min(Xe+se/2-we/2,V.h-we));return T.jsxs("g",{style:{cursor:"pointer"},children:[T.jsx("line",{x1:_.x,y1:_.y,x2:N.x,y2:N.y,stroke:k.color,strokeWidth:(j?3*de:Nf)*G,style:{cursor:"grab"},onPointerDown:ke=>Dr(k.id,ke),onMouseDown:ke=>Dr(k.id,ke),onClick:ke=>{if(ke.stopPropagation(),ue.current){ue.current=!1;return}tt(_n=>_n===k.id?null:k.id),vt(null)}}),T.jsx("rect",{x:It,y:wt,width:I,height:Mt,rx:4*de,ry:4*de,fill:"rgba(10,10,16,0.95)",stroke:k.color,strokeWidth:1.5*de,pointerEvents:"none"}),T.jsx("text",{x:N.x,y:N.y,textAnchor:"middle",dominantBaseline:"middle",fill:"#ffffff",style:{fontSize:`${z}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:nt}),j&&T.jsxs(T.Fragment,{children:[T.jsx("circle",{cx:_.x,cy:_.y,r:6*de,fill:k.color,stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"grab"},onPointerDown:ke=>ss(k.id,"start",ke),onMouseDown:ke=>ss(k.id,"start",ke)}),T.jsx("circle",{cx:N.x,cy:N.y,r:6*de,fill:k.color,stroke:"#fff",strokeWidth:1.5*de,style:{cursor:"grab"},onPointerDown:ke=>ss(k.id,"end",ke),onMouseDown:ke=>ss(k.id,"end",ke)})]}),j&&T.jsx("foreignObject",{x:En,y:Xe,width:pe,height:se,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:ke=>ke.stopPropagation(),onMouseDown:ke=>ke.stopPropagation(),onClick:ke=>ke.stopPropagation(),style:{width:pe,height:se,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Vt}px ${Ft}px`,borderRadius:8*de,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:T.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${yt}px`},children:Cl.map(ke=>T.jsx("button",{type:"button",title:`Колір ${ke}`,onClick:()=>va(k.id,ke),style:{width:Et,height:Et,borderRadius:"50%",border:k.color===ke?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:ke,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${k.id}-num-color-${ke}`))})})}),j&&T.jsx("foreignObject",{x:ze,y:Fe,width:we,height:we,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:ke=>ke.stopPropagation(),onMouseDown:ke=>ke.stopPropagation(),onClick:ke=>ke.stopPropagation(),children:T.jsx("button",{type:"button",title:"Видалити",onClick:()=>hs(k.id),style:{width:we,height:we,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},children:T.jsx("i",{className:`${qn} bi-trash`,style:{fontSize:12*de},"aria-hidden":!0})})})})]},k.id+"-numbering")}),st.filter(k=>k.id===w.id&&k.anchor.type==="polygon"&&k.anchor.points.length>=2).map(k=>{const _=k.anchor.points,N=1/Math.max(gr,1e-4),j=1.5*de*N,G=gt===k.id,nt=ir(k),{minX:z,minY:J,maxX:ut,maxY:it}=jn[k.id],rt=ut-z,I=it-J,Mt=Dd({minX:z,minY:J,maxX:ut,maxY:it},V.w,V.h,N),It=[{cx:z,cy:J,handle:"nw"},{cx:z+rt/2,cy:J,handle:"n"},{cx:ut,cy:J,handle:"ne"},{cx:ut,cy:J+I/2,handle:"e"},{cx:ut,cy:it,handle:"se"},{cx:z+rt/2,cy:it,handle:"s"},{cx:z,cy:it,handle:"sw"},{cx:z,cy:J+I/2,handle:"w"}],wt=Jy(It,_,N),Et=yt=>yt==="n"||yt==="s"?"ns-resize":yt==="e"||yt==="w"?"ew-resize":yt==="nw"||yt==="se"?"nwse-resize":"nesw-resize";return T.jsxs("g",{style:{cursor:"default"},children:[T.jsx("polygon",{points:_.map(yt=>`${yt.x},${yt.y}`).join(" "),fill:dy(k.color,k.fillStyle),stroke:k.color,strokeWidth:(G?3:2.5)*de*nt,strokeDasharray:Xu(k)?Xm(nt):void 0,style:G?{cursor:"grab"}:void 0,onPointerDown:yt=>{G&&(yt.stopPropagation(),as(k.id,yt))},onMouseDown:yt=>{G&&(yt.stopPropagation(),as(k.id,yt))},onClick:yt=>{if(yt.stopPropagation(),ue.current){ue.current=!1;return}tt(Ft=>Ft===k.id?null:k.id),vt(k.id)}}),G&&_.map((yt,Ft)=>T.jsx("circle",{cx:yt.x,cy:yt.y,r:8*de*N,fill:k.color,stroke:"white",strokeWidth:2*de*N,style:{cursor:"grab"},onPointerDown:Vt=>Nu(k.id,Ft,Vt),onMouseDown:Vt=>Nu(k.id,Ft,Vt),onDoubleClick:Vt=>Sf(k.id,Ft,Vt)},`v-${Ft}`)),G&&_.map((yt,Ft)=>{const Vt=_.length,pe=_[Ft],se=_[(Ft+1)%Vt],Ee=(pe.x+se.x)/2,Qe=(pe.y+se.y)/2;return T.jsx("circle",{cx:Ee,cy:Qe,r:6*de*N,fill:"white",stroke:k.color,strokeWidth:j,style:{cursor:"pointer"},onPointerDown:En=>fl(k.id,Ft,En),onMouseDown:En=>fl(k.id,Ft,En)},`m-${Ft}`)}),G&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:z,y:J,width:rt,height:I,fill:"none",stroke:k.color,strokeWidth:j,strokeDasharray:`${6*de*N} ${4*de*N}`,opacity:.8,style:{pointerEvents:"none"}}),wt.map(({cx:yt,cy:Ft,handle:Vt})=>T.jsx("rect",{x:yt-Al*N,y:Ft-Al*N,width:Al*2*N,height:Al*2*N,fill:"white",stroke:k.color,strokeWidth:j,style:{cursor:Et(Vt)},onPointerDown:pe=>bc(k.id,Vt,pe),onMouseDown:pe=>bc(k.id,Vt,pe)},`bbox-${Vt}`))]}),G&&T.jsx("g",{transform:`translate(${Mt.cx}, ${Mt.cy})`,style:{cursor:"move"},onPointerDown:yt=>Xi(k.id,yt),onMouseDown:yt=>Xi(k.id,yt),children:T.jsx(Ld,{color:k.color,scale:N})})]},k.id+"-poly")}),st.filter(k=>k.id===w.id&&k.anchor.type==="polyline"&&k.anchor.points.length>=2).map(k=>{const _=k.anchor.points,N=1/Math.max(gr,1e-4),j=1.5*de*N,G=gt===k.id,nt=ir(k),{minX:z,minY:J,maxX:ut,maxY:it}=jn[k.id],rt=ut-z,I=it-J,Mt=Dd({minX:z,minY:J,maxX:ut,maxY:it},V.w,V.h,N),It=[{cx:z,cy:J,handle:"nw"},{cx:z+rt/2,cy:J,handle:"n"},{cx:ut,cy:J,handle:"ne"},{cx:ut,cy:J+I/2,handle:"e"},{cx:ut,cy:it,handle:"se"},{cx:z+rt/2,cy:it,handle:"s"},{cx:z,cy:it,handle:"sw"},{cx:z,cy:J+I/2,handle:"w"}],wt=Jy(It,_,N),Et=yt=>yt==="n"||yt==="s"?"ns-resize":yt==="e"||yt==="w"?"ew-resize":yt==="nw"||yt==="se"?"nwse-resize":"nesw-resize";return T.jsxs("g",{style:{cursor:"default"},children:[T.jsx("polyline",{points:_.map(yt=>`${yt.x},${yt.y}`).join(" "),fill:"none",stroke:k.color,strokeWidth:(G?3:2.5)*de*nt,strokeDasharray:Xu(k)?Xm(nt):void 0,style:G?{cursor:"grab"}:void 0,onPointerDown:yt=>{G&&(yt.stopPropagation(),ls(k.id,yt))},onMouseDown:yt=>{G&&(yt.stopPropagation(),ls(k.id,yt))},onClick:yt=>{if(yt.stopPropagation(),ue.current){ue.current=!1;return}tt(Ft=>Ft===k.id?null:k.id),vt(k.id)}}),G&&_.map((yt,Ft)=>T.jsx("circle",{cx:yt.x,cy:yt.y,r:8*de*N,fill:k.color,stroke:"white",strokeWidth:2*de*N,style:{cursor:"grab"},onPointerDown:Vt=>$c(k.id,Ft,Vt),onMouseDown:Vt=>$c(k.id,Ft,Vt),onDoubleClick:Vt=>vo(k.id,Ft,Vt)},`v-${Ft}`)),G&&_.slice(0,-1).map((yt,Ft)=>{const Vt=_[Ft],pe=_[Ft+1],se=(Vt.x+pe.x)/2,Ee=(Vt.y+pe.y)/2;return T.jsx("circle",{cx:se,cy:Ee,r:6*de*N,fill:"white",stroke:k.color,strokeWidth:j,style:{cursor:"pointer"},onPointerDown:Qe=>Vc(k.id,Ft,Qe),onMouseDown:Qe=>Vc(k.id,Ft,Qe)},`m-${Ft}`)}),G&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:z,y:J,width:rt,height:I,fill:"none",stroke:k.color,strokeWidth:j,strokeDasharray:`${6*de*N} ${4*de*N}`,opacity:.8,style:{pointerEvents:"none"}}),wt.map(({cx:yt,cy:Ft,handle:Vt})=>T.jsx("rect",{x:yt-Al*N,y:Ft-Al*N,width:Al*2*N,height:Al*2*N,fill:"white",stroke:k.color,strokeWidth:j,style:{cursor:Et(Vt)},onPointerDown:pe=>Wc(k.id,Vt,pe),onMouseDown:pe=>Wc(k.id,Vt,pe)},`bbox-${Vt}`))]}),G&&T.jsx("g",{transform:`translate(${Mt.cx}, ${Mt.cy})`,style:{cursor:"move"},onPointerDown:yt=>ql(k.id,yt),onMouseDown:yt=>ql(k.id,yt),children:T.jsx(Ld,{color:k.color,scale:N})})]},k.id+"-polyline")}),st.filter(k=>k.id===w.id&&k.anchor.type==="arrow").map(k=>{const{start:_,end:N,control:j}=k.anchor,G=1/Math.max(gr,1e-4),nt=gt===k.id,z=ir(k),J=[_,N,j],ut=Math.min(...J.map(we=>we.x)),it=Math.min(...J.map(we=>we.y)),rt=Math.max(...J.map(we=>we.x)),I=Math.max(...J.map(we=>we.y)),Mt=rt-ut,It=I-it,wt=Dd({minX:ut,minY:it,maxX:rt,maxY:I},V.w,V.h,G),Et=[{cx:ut,cy:it,handle:"nw"},{cx:ut+Mt/2,cy:it,handle:"n"},{cx:rt,cy:it,handle:"ne"},{cx:rt,cy:it+It/2,handle:"e"},{cx:rt,cy:I,handle:"se"},{cx:ut+Mt/2,cy:I,handle:"s"},{cx:ut,cy:I,handle:"sw"},{cx:ut,cy:it+It/2,handle:"w"}],yt=Jy(Et,J,G),Ft=we=>we==="n"||we==="s"?"ns-resize":we==="e"||we==="w"?"ew-resize":we==="nw"||we==="se"?"nwse-resize":"nesw-resize",Vt=pk(j,N),pe=Math.atan2(Vt.y,Vt.x),se=12*de*G,Ee=Math.PI/7,Qe=N.x-Math.cos(pe-Ee)*se,En=N.y-Math.sin(pe-Ee)*se,fe=N.x-Math.cos(pe+Ee)*se,Xe=N.y-Math.sin(pe+Ee)*se;return T.jsxs("g",{style:{cursor:"default"},children:[T.jsx("path",{d:`M ${_.x} ${_.y} Q ${j.x} ${j.y} ${N.x} ${N.y}`,fill:"none",stroke:k.color,strokeWidth:(nt?3:2.5)*de*z,strokeDasharray:nt?`${5*de} ${3*de}`:void 0,style:nt?{cursor:"grab"}:void 0,onPointerDown:we=>{nt&&wc(k.id,we)},onMouseDown:we=>{nt&&wc(k.id,we)},onClick:we=>{if(we.stopPropagation(),ue.current){ue.current=!1;return}tt(Tn=>Tn===k.id?null:k.id),vt(k.id)}}),T.jsx("path",{d:`M ${N.x} ${N.y} L ${Qe} ${En} L ${fe} ${Xe} Z`,fill:k.color,stroke:k.color,strokeWidth:(nt?3:2.5)*de*z,pointerEvents:"none"}),nt&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:ut,y:it,width:Mt,height:It,fill:"none",stroke:k.color,strokeWidth:1.5*de*G,strokeDasharray:`${6*de*G} ${4*de*G}`,opacity:.8,style:{pointerEvents:"none"}}),yt.map(({cx:we,cy:Tn,handle:Yt})=>T.jsx("rect",{x:we-Al*G,y:Tn-Al*G,width:Al*2*G,height:Al*2*G,fill:"white",stroke:k.color,strokeWidth:1.5*de*G,style:{cursor:Ft(Yt)},onPointerDown:De=>Ua(k.id,Yt,De),onMouseDown:De=>Ua(k.id,Yt,De)},`arrow-bbox-${Yt}`)),T.jsx("g",{transform:`translate(${wt.cx}, ${wt.cy})`,style:{cursor:"move"},onPointerDown:we=>Sc(k.id,we),onMouseDown:we=>Sc(k.id,we),children:T.jsx(Ld,{color:k.color,scale:G})}),T.jsx("circle",{cx:_.x,cy:_.y,r:7*de*G,fill:k.color,stroke:"#fff",strokeWidth:1.5*de*G,style:{cursor:"grab"},onPointerDown:we=>Qs(k.id,"start",we),onMouseDown:we=>Qs(k.id,"start",we)}),T.jsx("circle",{cx:N.x,cy:N.y,r:7*de*G,fill:k.color,stroke:"#fff",strokeWidth:1.5*de*G,style:{cursor:"grab"},onPointerDown:we=>Qs(k.id,"end",we),onMouseDown:we=>Qs(k.id,"end",we)}),T.jsx("circle",{cx:j.x,cy:j.y,r:6*de*G,fill:"#fff",stroke:k.color,strokeWidth:1.5*de*G,style:{cursor:"grab"},onPointerDown:we=>Qs(k.id,"control",we),onMouseDown:we=>Qs(k.id,"control",we)})]})]},k.id+"-arrow")}),st.filter(k=>k.id===w.id&&k.anchor.type==="rectangle").map(k=>{const{x:_,y:N,width:j,height:G,rotation:nt=0}=k.anchor,z=1/Math.max(gr,1e-4),J=gt===k.id,ut=ir(k),it=_+j/2,rt=N+G/2,I=nt*Math.PI/180,Mt=Math.cos(I),It=Math.sin(I),wt=(Vt,pe)=>({cx:it+Vt*Mt-pe*It,cy:rt+Vt*It+pe*Mt}),Et=[{...wt(-j/2,-G/2),handle:"nw"},{...wt(0,-G/2),handle:"n"},{...wt(j/2,-G/2),handle:"ne"},{...wt(j/2,0),handle:"e"},{...wt(j/2,G/2),handle:"se"},{...wt(0,G/2),handle:"s"},{...wt(-j/2,G/2),handle:"sw"},{...wt(-j/2,0),handle:"w"}],yt=Dd({minX:Math.min(...Et.map(Vt=>Vt.cx)),minY:Math.min(...Et.map(Vt=>Vt.cy)),maxX:Math.max(...Et.map(Vt=>Vt.cx)),maxY:Math.max(...Et.map(Vt=>Vt.cy))},V.w,V.h,z),Ft=Vt=>Vt==="n"||Vt==="s"?"ns-resize":Vt==="e"||Vt==="w"?"ew-resize":Vt==="nw"||Vt==="se"?"nwse-resize":"nesw-resize";return T.jsxs("g",{style:{cursor:"default"},children:[T.jsx("g",{transform:`rotate(${nt} ${it} ${rt})`,children:T.jsx("rect",{x:_,y:N,width:j,height:G,fill:dy(k.color,k.fillStyle),stroke:k.color,strokeWidth:(J?3:2.5)*de*ut,strokeDasharray:Xu(k)?Xm(ut):void 0,style:J?{cursor:"grab"}:void 0,onPointerDown:Vt=>{J&&(Vt.stopPropagation(),yc(k.id,Vt))},onMouseDown:Vt=>{J&&(Vt.stopPropagation(),yc(k.id,Vt))},onClick:Vt=>{if(Vt.stopPropagation(),ue.current){ue.current=!1;return}tt(pe=>pe===k.id?null:k.id),vt(k.id)}})}),J&&Et.map(({cx:Vt,cy:pe,handle:se})=>T.jsx("circle",{cx:Vt,cy:pe,r:Ky*z,fill:k.color,stroke:"white",strokeWidth:1.5*de*z,style:{cursor:Ft(se)},onPointerDown:Ee=>dl(k.id,se,Ee),onMouseDown:Ee=>dl(k.id,se,Ee)},se)),J&&T.jsx("g",{transform:`translate(${yt.cx}, ${yt.cy})`,style:{cursor:"move"},onPointerDown:Vt=>xc(k.id,Vt),onMouseDown:Vt=>xc(k.id,Vt),children:T.jsx(Ld,{color:k.color,scale:z})})]},k.id+"-rect")}),st.filter(k=>k.id===w.id&&k.anchor.type==="ellipse").map(k=>{const{cx:_,cy:N,rx:j,ry:G,rotation:nt=0}=k.anchor,z=1/Math.max(gr,1e-4),J=gt===k.id,ut=ir(k),it=nt*Math.PI/180,rt=Math.cos(it),I=Math.sin(it),Mt=(yt,Ft)=>({cx:_+yt*rt-Ft*I,cy:N+yt*I+Ft*rt}),It=[{...Mt(-j,-G),handle:"nw"},{...Mt(0,-G),handle:"n"},{...Mt(j,-G),handle:"ne"},{...Mt(j,0),handle:"e"},{...Mt(j,G),handle:"se"},{...Mt(0,G),handle:"s"},{...Mt(-j,G),handle:"sw"},{...Mt(-j,0),handle:"w"}],wt=Dd({minX:Math.min(...It.map(yt=>yt.cx)),minY:Math.min(...It.map(yt=>yt.cy)),maxX:Math.max(...It.map(yt=>yt.cx)),maxY:Math.max(...It.map(yt=>yt.cy))},V.w,V.h,z),Et=yt=>yt==="n"||yt==="s"?"ns-resize":yt==="e"||yt==="w"?"ew-resize":yt==="nw"||yt==="se"?"nwse-resize":"nesw-resize";return T.jsxs("g",{style:{cursor:"default"},children:[T.jsx("g",{transform:`rotate(${nt} ${_} ${N})`,children:T.jsx("ellipse",{cx:_,cy:N,rx:j,ry:G,fill:dy(k.color,k.fillStyle),stroke:k.color,strokeWidth:(J?3:2.5)*de*ut,strokeDasharray:Xu(k)?Xm(ut):void 0,style:J?{cursor:"grab"}:void 0,onPointerDown:yt=>{J&&(yt.stopPropagation(),Ho(k.id,yt))},onMouseDown:yt=>{J&&(yt.stopPropagation(),Ho(k.id,yt))},onClick:yt=>{if(yt.stopPropagation(),ue.current){ue.current=!1;return}tt(Ft=>Ft===k.id?null:k.id),vt(k.id)}})}),J&&It.map(({cx:yt,cy:Ft,handle:Vt})=>T.jsx("circle",{cx:yt,cy:Ft,r:Ky*z,fill:k.color,stroke:"white",strokeWidth:1.5*de*z,style:{cursor:Et(Vt)},onPointerDown:pe=>qc(k.id,Vt,pe),onMouseDown:pe=>qc(k.id,Vt,pe)},Vt)),J&&T.jsx("g",{transform:`translate(${wt.cx}, ${wt.cy})`,style:{cursor:"move"},onPointerDown:yt=>Yc(k.id,yt),onMouseDown:yt=>Yc(k.id,yt),children:T.jsx(Ld,{color:k.color,scale:z})})]},k.id+"-ellipse")}),st.filter(k=>k.id===w.id&&k.anchor.type==="text").map(k=>{const _=X===k.id||gt===k.id,N=Pi===k.id,j=k.textColor??"#ffffff",G=k.textBackgroundColor,nt=`${k.textUnderline?" underline":""}${k.textStrike?" line-through":""}`.trim(),z=k.textBold?700:400,J=k.textItalic?"italic":"normal",ut=k.textFontSize??Fs,{x:it,y:rt,width:I,height:Mt}=k.anchor,It=1/Math.max(gr,1e-4),wt=ir(k);return T.jsxs("g",{children:[k.anchor.point&&T.jsx("circle",{cx:k.anchor.point.x,cy:k.anchor.point.y,r:$h*wt,fill:k.color,stroke:"white",strokeWidth:ng*wt,style:{cursor:"grab"},onPointerDown:Et=>fs(k.id,Et),onMouseDown:Et=>fs(k.id,Et)}),T.jsx("foreignObject",{x:it,y:rt,width:I,height:Mt,onPointerDown:Et=>{if(tt(k.id),vt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),qr(k.id);return}Yl(k.id,Et)},onMouseDown:Et=>{if(tt(k.id),vt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),qr(k.id);return}Yl(k.id,Et)},children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",ref:N?Et=>{eo.current=Et}:void 0,"data-text-pin-id":k.id,contentEditable:N,suppressContentEditableWarning:!0,onContextMenu:Et=>Et.preventDefault(),onPointerDown:Et=>{if(tt(k.id),vt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),qr(k.id);return}if(!N){Yl(k.id,Et);return}Et.stopPropagation()},onMouseDown:Et=>{if(tt(k.id),vt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),qr(k.id);return}if(!N){Yl(k.id,Et);return}Et.stopPropagation()},onDoubleClick:Et=>{Et.preventDefault(),Et.stopPropagation(),tt(k.id),vt(k.id),qr(k.id)},onBlur:()=>{N&&(ra(k.id),qr(Et=>Et===k.id?null:Et))},onInput:Et=>{if(!N)return;const yt=Et.currentTarget,Ft=yt.innerHTML,Vt=xi(Ft,{fontSize:k.textFontSize??Fs,bold:k.textBold??!1,italic:k.textItalic??!1}),pe=yt.closest("foreignObject");pe&&(pe.setAttribute("width",String(Vt.width)),pe.setAttribute("height",String(Vt.height)))},style:{width:"100%",height:"auto",overflow:"hidden",whiteSpace:"pre",wordBreak:"normal",overflowWrap:"normal",color:j,background:G??"transparent",border:_?`1px dashed ${k.color}`:"1px dashed transparent",borderRadius:Uw,padding:`0 ${y2}px`,boxSizing:"border-box",fontFamily:Xn,fontSize:ut,lineHeight:1.4,fontWeight:z,fontStyle:J,textDecoration:nt||"none",outline:"none",cursor:N?"text":"move",userSelect:"text"},...N?{}:{dangerouslySetInnerHTML:{__html:ta(k.description)}}})}),_&&!N&&(()=>{const Et=5*It;return[{cx:it,cy:rt,key:"nw",cursor:"nwse-resize"},{cx:it+I,cy:rt,key:"ne",cursor:"nesw-resize"},{cx:it+I,cy:rt+Mt,key:"se",cursor:"nwse-resize"},{cx:it,cy:rt+Mt,key:"sw",cursor:"nesw-resize"}].map(Ft=>T.jsx("circle",{cx:Ft.cx,cy:Ft.cy,r:Et,fill:k.color,stroke:"#ffffff",strokeWidth:1.2*It,style:{cursor:Ft.cursor},onPointerDown:Vt=>ds(k.id,Ft.key,Vt),onMouseDown:Vt=>ds(k.id,Ft.key,Vt)},`${k.id}-text-resize-${Ft.key}`))})()]},`${k.id}-text`)}),st.filter(k=>k.id===w.id&&k.anchor.type==="redact").map(k=>{const{x:_,y:N,width:j,height:G,mode:nt,strength:z}=k.anchor,J=X===k.id||gt===k.id,ut=1/Math.max(gr,1e-4),it=5*de*ut,rt=[{id:"nw",cx:_,cy:N,cursor:"nwse-resize"},{id:"ne",cx:_+j,cy:N,cursor:"nesw-resize"},{id:"se",cx:_+j,cy:N+G,cursor:"nwse-resize"},{id:"sw",cx:_,cy:N+G,cursor:"nesw-resize"}];return T.jsxs("g",{children:[T.jsx(x8,{x:_,y:N,width:j,height:G,mode:nt,strength:z,source:jr??zl,imageSize:V}),T.jsx("rect",{x:_,y:N,width:j,height:G,fill:"rgba(0,0,0,0.001)",style:{cursor:"grab"},onPointerDown:I=>Xc(k.id,I),onMouseDown:I=>Xc(k.id,I),onClick:I=>{if(I.stopPropagation(),ue.current){ue.current=!1;return}tt(k.id),vt(k.id)}}),J&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:_,y:N,width:j,height:G,fill:"none",stroke:Qu,strokeWidth:1.5*de*ut,strokeDasharray:`${5*de*ut} ${3*de*ut}`,pointerEvents:"none"}),rt.map(I=>T.jsx("circle",{cx:I.cx,cy:I.cy,r:it,fill:Qu,stroke:"#fff",strokeWidth:1.2*de*ut,style:{cursor:I.cursor},onPointerDown:Mt=>kc(k.id,I.id,Mt),onMouseDown:Mt=>kc(k.id,I.id,Mt)},`${k.id}-redact-${I.id}`))]})]},`${k.id}-redact`)}),st.filter(k=>k.id===w.id&&k.anchor.type==="image").map(k=>{const{x:_,y:N,width:j,height:G,src:nt}=k.anchor,z=X===k.id||gt===k.id,J=1/Math.max(gr,1e-4),ut=5*de*J,it=[{id:"nw",cx:_,cy:N,cursor:"nwse-resize"},{id:"ne",cx:_+j,cy:N,cursor:"nesw-resize"},{id:"se",cx:_+j,cy:N+G,cursor:"nwse-resize"},{id:"sw",cx:_,cy:N+G,cursor:"nesw-resize"}];return T.jsxs("g",{children:[T.jsx("image",{href:nt,x:_,y:N,width:j,height:G,preserveAspectRatio:"xMidYMid meet",style:{cursor:"grab"},onPointerDown:rt=>us(k.id,rt),onMouseDown:rt=>us(k.id,rt),onClick:rt=>{if(rt.stopPropagation(),ue.current){ue.current=!1;return}tt(k.id),vt(k.id)}}),z&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:_,y:N,width:j,height:G,fill:"none",stroke:Qu,strokeWidth:1.5*de*J,strokeDasharray:`${5*de*J} ${3*de*J}`,pointerEvents:"none"}),it.map(rt=>T.jsx("circle",{cx:rt.cx,cy:rt.cy,r:ut,fill:Qu,stroke:"#fff",strokeWidth:1.2*de*J,style:{cursor:rt.cursor},onPointerDown:I=>Ha(k.id,rt.id,I),onMouseDown:I=>Ha(k.id,rt.id,I)},`${k.id}-img-${rt.id}`))]})]},`${k.id}-image`)}),st.filter(k=>k.id===w.id&&k.anchor.type==="compass").map(k=>{const{cx:_,cy:N,radius:j,rotation:G=0}=k.anchor,nt=1/Math.max(gr,1e-4),z=gt===k.id,J=ir(k),ut=G*Math.PI/180,it=Math.cos(ut),rt=Math.sin(ut),I=(qe,nr)=>({cx:_+qe*it-nr*rt,cy:N+qe*rt+nr*it}),Mt=[{...I(0,-j),handle:"n"},{...I(j,0),handle:"e"},{...I(0,j),handle:"s"},{...I(-j,0),handle:"w"}],It=y5(j),wt=qe=>qe==="n"||qe==="s"?"ns-resize":"ew-resize",Et=14*de,yt=4*de,Ft=7*de,Vt=6*de,pe=Ft*2+Et*Cl.length+yt*Math.max(0,Cl.length-1),se=Vt*2+Et,Ee=10*de,Qe=_-pe/2,En=Math.max(0,Math.min(Qe,V.w-pe)),Xe=N<V.h/2?N+j+Ee:N-j-Ee-se,we=Math.max(0,Math.min(Xe,V.h-se)),Tn=24*de,Yt=6*de,De=En+pe+Yt,ze=En-Tn-Yt,Fe=De+Tn<=V.w?De:ze>=0?ze:Math.max(0,Math.min(De,V.w-Tn)),ke=Math.max(0,Math.min(we+se/2-Tn/2,V.h-Tn)),_n=Dd({minX:_-j,minY:N-j,maxX:_+j,maxY:N+j},V.w,V.h,nt,[{x:En,y:we,w:pe,h:se},{x:Fe,y:ke,w:Tn,h:Tn}]);return T.jsxs("g",{style:{cursor:"default"},children:[T.jsxs("g",{transform:`rotate(${G} ${_} ${N})`,children:[T.jsx("circle",{cx:_,cy:N,r:j,fill:"transparent",stroke:"none",style:z?{cursor:"grab"}:void 0,onPointerDown:qe=>{z&&(qe.stopPropagation(),xa(k.id,qe))},onMouseDown:qe=>{z&&(qe.stopPropagation(),xa(k.id,qe))},onClick:qe=>{if(qe.stopPropagation(),ue.current){ue.current=!1;return}tt(nr=>nr===k.id?null:k.id),vt(k.id)}}),T.jsx("path",{d:u8(_,N,j),fill:"none",stroke:k.color,strokeWidth:(z?ig*1.35:ig)*J,strokeLinecap:"round",pointerEvents:"none"}),T.jsx("polygon",{points:It.arrowPoints.map(qe=>`${_+qe.x},${N+qe.y}`).join(" "),fill:k.color,pointerEvents:"none"}),T.jsx("text",{x:_,y:N+It.letterY,textAnchor:"middle",dominantBaseline:"middle",fill:k.color,style:{fontSize:`${It.fontSize}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:"N"})]}),z&&Mt.map(({cx:qe,cy:nr,handle:sr})=>T.jsx("circle",{cx:qe,cy:nr,r:Ky*nt,fill:k.color,stroke:"white",strokeWidth:1.5*de*nt,style:{cursor:wt(sr)},onPointerDown:br=>vc(k.id,sr,br),onMouseDown:br=>vc(k.id,sr,br)},sr)),z&&T.jsx("g",{transform:`translate(${_n.cx}, ${_n.cy})`,style:{cursor:"move"},onPointerDown:qe=>ao(k.id,qe),onMouseDown:qe=>ao(k.id,qe),children:T.jsx(Ld,{color:k.color,scale:nt})}),z&&T.jsx("foreignObject",{x:En,y:we,width:pe,height:se,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:qe=>qe.stopPropagation(),onMouseDown:qe=>qe.stopPropagation(),onClick:qe=>qe.stopPropagation(),style:{width:pe,height:se,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Vt}px ${Ft}px`,borderRadius:8*de,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:T.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${yt}px`},children:Cl.map(qe=>T.jsx("button",{type:"button",title:`Колір ${qe}`,onClick:()=>va(k.id,qe),style:{width:Et,height:Et,borderRadius:"50%",border:k.color===qe?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:qe,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${k.id}-compass-color-${qe}`))})})}),z&&T.jsx("foreignObject",{x:Fe,y:ke,width:Tn,height:Tn,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:qe=>qe.stopPropagation(),onMouseDown:qe=>qe.stopPropagation(),onClick:qe=>qe.stopPropagation(),children:T.jsx("button",{type:"button",title:"Видалити",onClick:()=>hs(k.id),style:{width:Tn,height:Tn,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},children:T.jsx("i",{className:`${qn} bi-trash`,style:{fontSize:12*de},"aria-hidden":!0})})})})]},k.id+"-compass")}),[w].map(k=>{if(k.anchor.type==="text"||k.anchor.type==="redact"||k.calloutHidden)return null;const _=zt[k.id];return _?T.jsx(QB,{pin:k,fontFamily:Xn,justCreated:yi.current===k.id,position:_,imageSize:V,active:gt===k.id,isSelected:gt===k.id||X===k.id,onUpdateDescription:hl,onUpdateImage:Bi,onClearImage:N=>{te(),lt(j=>j.map(G=>G.id===N?{...G,image:null,imageAspect:null}:G))},onDragStart:yr,onResizeStart:Mr,onActivate:N=>{tt(N),vt(N)},onUpdateColor:va,onUpdateStrokeStyle:kf,onUpdateFillStyle:Ac,strokeWidthScale:ir(k),onUpdateStrokeWidthScale:Kc,onContextMenu:Se,controlsLayer:ni,onToggleDescPos:wa,onToggleTheme:N=>{te(),lt(j=>j.map(G=>G.id===N?{...G,theme:G.theme==="light"?"dark":"light"}:G))},onHide:N=>Wl(N,!0),onAddLinked:zi(k)?Rs:void 0,onDelete:hs,onUpdateTextStyle:(N,j)=>{te(),lt(G=>G.map(nt=>nt.id===N?{...nt,textBold:j.bold??nt.textBold??!1,textItalic:j.italic??nt.textItalic??!1,textUnderline:j.underline??nt.textUnderline??!1,textStrike:j.strike??nt.textStrike??!1}:nt))},onUpdateTextFontSize:(N,j)=>{te(),lt(G=>G.map(nt=>{if(nt.id!==N)return nt;let J=(nt.textFontSize??Fs)+j;return J=Math.max(10,J),{...nt,textFontSize:J}}))}},k.id+"-card"):null})]},w.id+"-z")),st.filter(w=>w.anchor.type==="text"&&(X===w.id||gt===w.id)).map(w=>{const k=ac.w,_=ac.h,N=4*fn,j=Math.max(0,Math.min(w.anchor.x,V.w-k)),G=w.anchor.y+w.anchor.height/2,nt=V.h/2,J=G<nt?w.anchor.y+w.anchor.height+N:w.anchor.y-_-N,ut=Math.max(0,Math.min(J,V.h-_)),it=Ms===w.id,rt=ut,I=_,Mt=32*fn,It=6*fn,wt=j+k+It,Et=j-Mt-It,yt=wt+Mt<=V.w?wt:Et>=0?Et:Math.max(0,Math.min(wt,V.w-Mt)),Ft=168*fn,Vt=132*fn,pe=Math.max(0,Math.min(j+k-Ft,V.w-Ft)),se=Math.max(0,ut-Vt-6*fn),Ee=fe=>{te(),lt(Xe=>Xe.map(we=>we.id===w.id?{...we,textColor:fe}:we))},Qe=fe=>{te(),lt(Xe=>Xe.map(we=>we.id===w.id?{...we,textBackgroundColor:fe}:we)),Rl(null)},En=fe=>{te(),lt(Xe=>Xe.map(we=>{if(we.id!==w.id||we.anchor.type!=="text")return we;const Tn={...we,...fe},Yt=we.anchor,De=xi(Tn.description||"",{fontSize:Tn.textFontSize??Fs,bold:Tn.textBold??!1,italic:Tn.textItalic??!1}),ze=Math.max(0,V.w-De.width),Fe=Math.max(0,V.h-De.height);return{...Tn,anchor:{...Yt,width:De.width,height:De.height,x:Math.max(0,Math.min(Yt.x,ze)),y:Math.max(0,Math.min(Yt.y,Fe))}}}))};return T.jsxs("g",{children:[T.jsx("foreignObject",{x:j,y:rt,width:k,height:I,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:fe=>fe.stopPropagation(),onMouseDown:fe=>fe.stopPropagation(),style:{width:"100%",height:_,boxSizing:"border-box",display:"flex",alignItems:"flex-start"},children:T.jsxs("div",{ref:zc,style:{width:"max-content",minWidth:300*fn,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*fn,padding:`${8*fn}px ${10*fn}px`,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7*fn},children:[w.anchor.point&&(()=>{const fe=ir(w),Xe=(fe-Pc)/(Qf-Pc)*100;return T.jsxs(T.Fragment,{children:[T.jsxs("div",{style:{display:"flex",gap:Gy,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[T.jsx("i",{className:`${qn} bi-record-circle`,style:mk,"aria-hidden":!0}),Cl.map(we=>T.jsx("button",{type:"button",title:`Колір точки ${we}`,onClick:()=>va(w.id,we),style:{width:Gm,height:Gm,borderRadius:"50%",background:we,border:w.color===we?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},`${w.id}-pointc-${we}`))]}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Gy},children:[T.jsx("input",{type:"range",className:"tyts-range",min:Pc,max:Qf,step:d5,value:fe,"aria-label":"Розмір точки",title:"Розмір точки",onChange:we=>Kc(w.id,Number(we.target.value)),style:{flex:1,minWidth:0,"--tyts-range-accent":w.color,"--tyts-range-fill":`${Xe}%`}}),T.jsxs("span",{style:{color:"#aaa",fontSize:11*fn,minWidth:30*fn,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:["×",p5(fe)]})]})]})})(),T.jsxs("div",{style:{display:"flex",gap:Gy,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[T.jsx("i",{className:`${qn} bi-type`,style:mk,"aria-hidden":!0}),Cl.map(fe=>T.jsx("button",{type:"button",onClick:()=>Ee(fe),style:{width:Gm,height:Gm,borderRadius:"50%",border:w.textColor===fe?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",background:fe,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${w.id}-tc-${fe}`))]}),T.jsxs("div",{style:{display:"flex",gap:4*fn,alignItems:"center",justifyContent:"space-between",position:"relative",flexWrap:"nowrap"},children:[T.jsx("button",{type:"button",style:{...Lf,fontWeight:700},onClick:()=>{na(w.id,"bold")||En({textBold:!(w.textBold??!1)})},children:"B"}),T.jsx("button",{type:"button",style:{...Lf,fontStyle:"italic"},onClick:()=>{na(w.id,"italic")||En({textItalic:!(w.textItalic??!1)})},children:"I"}),T.jsx("button",{type:"button",style:{...Lf,textDecoration:"underline"},onClick:()=>{na(w.id,"underline")||En({textUnderline:!(w.textUnderline??!1)})},children:"U"}),T.jsx("button",{type:"button",style:{...Lf,textDecoration:"line-through"},onClick:()=>{na(w.id,"strikeThrough")||En({textStrike:!(w.textStrike??!1)})},children:"S"}),T.jsx("button",{type:"button",style:Lf,onClick:()=>{te(),lt(fe=>fe.map(Xe=>{if(Xe.id!==w.id||Xe.anchor.type!=="text")return Xe;const we={...Xe,textFontSize:Math.max(10,(Xe.textFontSize??Fs)-2)},Tn=Xe.anchor,Yt=xi(we.description||"",{fontSize:we.textFontSize??Fs,bold:we.textBold??!1,italic:we.textItalic??!1}),De=Math.max(0,V.w-Yt.width),ze=Math.max(0,V.h-Yt.height);return{...we,anchor:{...Tn,width:Yt.width,height:Yt.height,x:Math.max(0,Math.min(Tn.x,De)),y:Math.max(0,Math.min(Tn.y,ze))}}}))},children:"A-"}),T.jsx("button",{type:"button",style:Lf,onClick:()=>{te(),lt(fe=>fe.map(Xe=>{if(Xe.id!==w.id||Xe.anchor.type!=="text")return Xe;const we={...Xe,textFontSize:(Xe.textFontSize??Fs)+2},Tn=Xe.anchor,Yt=xi(we.description||"",{fontSize:we.textFontSize??Fs,bold:we.textBold??!1,italic:we.textItalic??!1}),De=Math.max(0,V.w-Yt.width),ze=Math.max(0,V.h-Yt.height);return{...we,anchor:{...Tn,width:Yt.width,height:Yt.height,x:Math.max(0,Math.min(Tn.x,De)),y:Math.max(0,Math.min(Tn.y,ze))}}}))},children:"A+"}),T.jsx("div",{"data-text-bg-picker":"true",style:{position:"relative"},children:T.jsxs("button",{type:"button",onClick:()=>Rl(fe=>fe===w.id?null:w.id),style:{...Lf,minWidth:42*fn,justifyContent:"space-between",gap:6*fn,padding:`0 ${7*fn}px`,color:"#e8e8e8"},title:"Колір фону тексту",children:[T.jsx("span",{style:{width:18*fn,height:18*fn,borderRadius:3*fn,border:"1px solid rgba(255,255,255,0.35)",background:w.textBackgroundColor??"transparent",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",color:w.textBackgroundColor?"#111":"#f0f0f0",fontSize:10*fn,fontWeight:700},children:"A"}),T.jsx("i",{className:`${qn} bi-chevron-down`,style:{fontSize:11*fn},"aria-hidden":!0})]})})]})]})})},`${w.id}-text-tools`),it&&T.jsx("foreignObject",{x:pe,y:se,width:Ft,height:Vt,style:{overflow:"visible"},children:T.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml","data-text-bg-picker":"true",onPointerDown:fe=>fe.stopPropagation(),onMouseDown:fe=>fe.stopPropagation(),style:{width:"100%",background:"rgba(18, 20, 30, 0.98)",border:"1px solid rgba(255,255,255,0.18)",borderRadius:8*fn,padding:8*fn,boxSizing:"border-box",display:"grid",gridTemplateColumns:`repeat(4, ${30*fn}px)`,gap:6*fn},children:[T.jsx("button",{type:"button",onClick:()=>Qe(null),style:{gridColumn:"1 / -1",height:24*fn,borderRadius:5*fn,border:"1px solid rgba(255,255,255,0.22)",background:"rgba(255,255,255,0.06)",color:"#ddd",cursor:"pointer",fontSize:12*fn},children:"Без фону"}),Cl.map(fe=>T.jsx("button",{type:"button",onClick:()=>Qe(fe),style:{width:30*fn,height:24*fn,borderRadius:5*fn,border:w.textBackgroundColor===fe?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:fe,cursor:"pointer",boxSizing:"border-box"},title:fe},`${w.id}-bg-${fe}`))]})},`${w.id}-text-bg-picker`),T.jsx("foreignObject",{x:yt,y:Math.max(0,Math.min(ut+_/2-Mt/2,V.h-Mt)),width:Mt,height:Mt,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:fe=>fe.stopPropagation(),onMouseDown:fe=>fe.stopPropagation(),children:T.jsx("button",{type:"button",title:"Видалити",onClick:()=>hs(w.id),style:{width:Mt,height:Mt,background:"rgba(20, 20, 32, 0.95)",border:"1px solid rgba(230,57,70,0.7)",color:"#ff6b6b",cursor:"pointer",borderRadius:"50%",fontSize:16*fn,padding:`${3*fn}px`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${qn} bi-trash`,style:{fontSize:rr},"aria-hidden":!0})})})},`${w.id}-text-tools-delete`)]},`${w.id}-text-tools-wrap`)}),st.map(w=>{if(w.anchor.type==="text"||w.anchor.type==="standalone"||w.anchor.type==="redact"||w.calloutHidden||gt!==w.id&&X!==w.id)return null;const k=zt[w.id];if(!k)return null;const _=ay(w,st);if(!_)return null;const N=Array.isArray(w.leaderPoints)?w.leaderPoints:[],j=S2(_,k,N),G=1/Math.max(gr,1e-4),nt=5*de*G,z=3.5*de*G;return T.jsxs("g",{children:[t8(j).map((J,ut)=>T.jsx("circle",{cx:J.x,cy:J.y,r:z,fill:"rgba(255,255,255,0.8)",stroke:w.color,strokeWidth:1.2*de*G,style:{cursor:"crosshair"},onPointerDown:it=>wf(w.id,ut,J,it),onMouseDown:it=>wf(w.id,ut,J,it),children:T.jsx("title",{children:"Потягніть, щоб зламати лінію"})},`${w.id}-leader-mid-${ut}`)),N.map((J,ut)=>T.jsx("circle",{cx:J.x,cy:J.y,r:nt,fill:w.color,stroke:"#fff",strokeWidth:1.5*de*G,style:{cursor:"grab"},onPointerDown:it=>Hc(w.id,ut,it),onMouseDown:it=>Hc(w.id,ut,it),onDoubleClick:it=>cd(w.id,ut,it),children:T.jsx("title",{children:"Подвійний клік — прибрати злам"})},`${w.id}-leader-pt-${ut}`))]},w.id+"-leader-handles")}),st.filter(w=>w.anchor.type==="redact"&&(X===w.id||gt===w.id)).map(w=>{const{x:k,y:_,width:N,height:j,mode:G,strength:nt}=w.anchor,z=250*fn,J=8*fn,ut=24*fn,it=7*fn,rt=12*fn,I=J*2+ut+(G==="fill"?0:it+rt),Mt=8*fn,It=Math.max(0,Math.min(k+N/2-z/2,V.w-z)),wt=_<V.h/2,Et=Math.max(0,Math.min(wt?_+j+Mt:_-Mt-I,V.h-I)),yt=32*fn,Ft=6*fn,Vt=It+z+Ft,pe=It-yt-Ft,se=Vt+yt<=V.w?Vt:pe>=0?pe:Math.max(0,Math.min(Vt,V.w-yt)),Ee=Math.max(0,Math.min(Et+I/2-yt/2,V.h-yt)),Qe=[{id:"blur",label:"Розмити",icon:"bi-droplet-half"},{id:"pixelate",label:"Пікселі",icon:"bi-grid-3x3"},{id:"fill",label:"Заливка",icon:"bi-square-fill"}],En=nt*100;return T.jsxs("g",{children:[T.jsx("foreignObject",{x:It,y:Et,width:z,height:I,children:T.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:fe=>fe.stopPropagation(),onMouseDown:fe=>fe.stopPropagation(),onClick:fe=>fe.stopPropagation(),style:{width:z,height:I,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",gap:it,padding:`${J}px ${10*fn}px`,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*fn,fontFamily:Xn},children:[T.jsx("div",{style:{display:"flex",gap:6*fn},children:Qe.map(fe=>T.jsxs("button",{type:"button",title:fe.label,onClick:()=>cs(w.id,{mode:fe.id}),style:{flex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4*fn,height:24*fn,borderRadius:6*fn,cursor:"pointer",fontFamily:"inherit",fontSize:11*fn,background:G===fe.id?"rgba(255,255,255,0.14)":"rgba(255,255,255,0.06)",border:`1px solid ${G===fe.id?Qu:"rgba(255,255,255,0.18)"}`,color:G===fe.id?"#fff":"#bbb"},children:[T.jsx("i",{className:`${qn} ${fe.icon}`,style:{fontSize:11*fn},"aria-hidden":!0}),fe.label]},fe.id))}),G!=="fill"&&T.jsx("input",{type:"range",className:"tyts-range",min:0,max:1,step:h_,value:nt,"aria-label":"Сила ефекту",title:"Сила ефекту",onChange:fe=>cs(w.id,{strength:Number(fe.target.value)}),style:{width:"100%",height:rt,minWidth:0,"--tyts-range-accent":Qu,"--tyts-range-thumb":`${rt}px`,"--tyts-range-track":`${4*fn}px`,"--tyts-range-fill":`${En}%`}})]})}),T.jsx("foreignObject",{x:se,y:Ee,width:yt,height:yt,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:fe=>fe.stopPropagation(),onMouseDown:fe=>fe.stopPropagation(),onClick:fe=>fe.stopPropagation(),children:T.jsx("button",{type:"button",title:"Видалити ділянку","aria-label":"Видалити ділянку",onClick:()=>hs(w.id),style:{width:yt,height:yt,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:`${3*fn}px`},children:T.jsx("i",{className:`${qn} bi-trash`,style:{fontSize:Math.round(12*fn)},"aria-hidden":!0})})})})]},`${w.id}-redact-panel`)}),T.jsx("g",{ref:Mn}),st.filter(w=>w.calloutHidden&&w.anchor.type!=="numbering"&&w.anchor.type!=="compass"&&w.anchor.type!=="redact").filter(w=>w.anchor.type==="standalone"||w.anchor.type==="linked"||X===w.id||gt===w.id).map(w=>{const k=kr(w);return T.jsxs("g",{transform:`translate(${k.x}, ${k.y})`,style:{cursor:"pointer"},onMouseDown:_=>_.stopPropagation(),onClick:_=>{_.stopPropagation(),Wl(w.id,!1)},children:[T.jsx("circle",{cx:0,cy:0,r:11*de,fill:"rgba(20,20,32,0.95)",stroke:w.color,strokeWidth:2*de}),T.jsx("text",{x:0,y:1*de,textAnchor:"middle",dominantBaseline:"middle",fill:w.color,style:{fontSize:`${14*de}px`,fontWeight:700,userSelect:"none"},children:"+"})]},`${w.id}-restore-callout`)})]})})})})}):T.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16},children:[T.jsx(p9,{onFile:ro,highlight:il,warning:L}),Q.showRestorePrompt&&Q.storedDraftSavedAt&&T.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center",gap:10,maxWidth:440,padding:"10px 14px",borderRadius:8,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.04)",color:"#888",fontSize:13,lineHeight:1.5},children:[T.jsxs("span",{children:["Знайдено збережену чернетку від"," ",Pd(new Date(Q.storedDraftSavedAt))]}),T.jsx("button",{type:"button",onClick:()=>Q.restoreDraft(),style:{border:"1px solid rgba(255,255,255,0.12)",borderRadius:5,background:"rgba(255,255,255,0.08)",color:"#ccc",fontWeight:600,fontSize:13,padding:"5px 12px",cursor:"pointer"},children:"Відновити"}),T.jsx("button",{type:"button",onClick:()=>Q.clearDraft(),style:{border:"1px solid rgba(255,255,255,0.08)",borderRadius:5,background:"transparent",color:"#777",fontWeight:600,fontSize:13,padding:"5px 12px",cursor:"pointer"},children:"Відкинути"})]})]})}),T.jsxs("div",{style:{padding:"3px 16px",background:"#0a0a14",borderTop:"1px solid #1a1a28",fontSize:10,color:"#444",display:"flex",gap:16,flexShrink:0,alignItems:"center",overflow:"hidden",minWidth:0,position:"relative"},children:[T.jsxs("div",{style:{...Zz,flex:1},children:[T.jsxs("span",{title:`полотно: ${V.w} × ${V.h}px`,children:["полотно: ",V.w," × ",V.h,"px"]}),Lt&&T.jsxs("span",{title:`оригінал: ${Lt.w} × ${Lt.h}px`,style:{marginLeft:16},children:["оригінал: ",Lt.w," × ",Lt.h,"px"]}),X&&(()=>{const w=zt[X];if(!w)return null;const k=`картка: ${Math.round(w.width)} × ${Math.round(w.height)}px`;return T.jsx("span",{title:k,style:{marginLeft:16},children:k})})(),Wt&&T.jsxs("span",{title:Wt,style:{color:pt,display:"inline-flex",alignItems:"center",gap:5,marginLeft:16,verticalAlign:"bottom"},children:[T.jsx("i",{className:`${qn} ${Q.status==="error"?"bi-exclamation-triangle":Q.status==="saving"?"bi-cloud-arrow-up tyts-spin":"bi-cloud-check"}`,style:{fontSize:11,flexShrink:0},"aria-hidden":!0}),T.jsx("span",{children:Wt})]})]}),T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0},children:[!p,T.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),To(!0),Oa(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Налаштування",children:"Налаштування"}),T.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),Oa(k=>!k),To(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Показати список гарячих клавіш",children:"Гарячі клавіші"}),!p,T.jsxs("span",{children:["v",QN]})]}),ks&&T.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"absolute",right:12,bottom:"100%",marginBottom:8,width:600,fontSize:12,maxWidth:"calc(100vw - 24px)",background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 10px 28px rgba(0,0,0,0.65)",padding:12,color:"#ddd",zIndex:2e3},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[T.jsx("div",{style:{fontWeight:800,color:"#fff"},children:"Гарячі клавіші"}),T.jsx("button",{type:"button",onClick:()=>Oa(!1),style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:16,lineHeight:1},title:"Закрити",children:"×"})]}),T.jsxs("div",{style:{display:"flex",gap:16,fontSize:12},children:[T.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[oe.newImage,oe.replaceBackground,oe.toolPoint,oe.toolRegion,oe.toolRoute,oe.toolRectangle,oe.toolEllipse,oe.toolArrow,oe.toolText,oe.toolPointText,oe.toolImageObject,oe.toolRedact,oe.toolDateTime,oe.toolStandaloneCallout,oe.toolNumbering,oe.toolCompass,oe.toolCrop,oe.zoomIn,oe.zoomOut,oe.fitToWindow,oe.undo,oe.redo,oe.downloadJpg,oe.openExportMenu,oe.exportMenuChooseByNumber].map(w=>T.jsx(xk,{shortcut:w,isMac:b},w.id))}),T.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[oe.calloutBold,oe.calloutItalic,oe.calloutUnderline,oe.calloutStrike,oe.calloutFontSizeDown,oe.calloutFontSizeUp,oe.calloutAddText,oe.calloutAddImage,oe.calloutRemoveText,oe.calloutRemoveImage,oe.calloutToggleDescPos,oe.calloutToggleTheme,oe.calloutDelete,oe.calloutBringForward,oe.calloutSendBackward,oe.calloutBringToFront,oe.calloutSendToBack,oe.objectCopy,oe.objectDuplicate,oe.objectPaste].map(w=>T.jsx(xk,{shortcut:w,isMac:b},w.id))})]}),T.jsx("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid rgba(255,255,255,0.08)"},children:T.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12,color:"rgba(255,255,255,0.8)"},children:[T.jsx("input",{type:"checkbox",checked:Gn,onChange:w=>Jo(w.target.checked)}),"Показувати бейджі хоткеїв на кнопках"]})})]})]}),Ot&&(()=>{const w=Ot.pinId,k=[{move:"front",label:"На передній план",shortcut:"calloutBringToFront"},{move:"up",label:"На рівень вище",shortcut:"calloutBringForward"},{move:"down",label:"На рівень нижче",shortcut:"calloutSendBackward"},{move:"back",label:"На задній план",shortcut:"calloutSendToBack"}],_=[...w?[{key:"copy",label:"Копіювати",shortcut:"objectCopy",enabled:!0,run:()=>ge(w)},{key:"duplicate",label:"Дублювати",shortcut:"objectDuplicate",enabled:!0,run:()=>$e(w)}]:[],{key:"paste",label:"Вставити сюди",shortcut:"objectPaste",enabled:re,run:()=>Dn(Ot.at)}],N=_.length+(w?k.length:0),j=230,G=8+N*30+(w?9:0),nt=Math.max(8,Math.min(Ot.x,window.innerWidth-j-8)),z=Math.max(8,Math.min(Ot.y,window.innerHeight-G-8));return T.jsxs("div",{role:"menu",onPointerDown:J=>J.stopPropagation(),onContextMenu:J=>J.preventDefault(),style:{position:"fixed",left:nt,top:z,zIndex:6e3,width:j,padding:4,borderRadius:8,background:"rgba(20,20,32,0.98)",border:"1px solid rgba(255,255,255,0.14)",boxShadow:"0 12px 32px rgba(0,0,0,0.6)",fontFamily:Xn,fontSize:13},children:[_.map(({key:J,label:ut,shortcut:it,enabled:rt,run:I})=>T.jsxs("button",{type:"button",role:"menuitem",disabled:!rt,onClick:()=>{I(),Ht(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:rt?"#ddd":"rgba(255,255,255,0.28)",cursor:rt?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:Mt=>{rt&&(Mt.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:Mt=>{Mt.currentTarget.style.background="transparent"},children:[T.jsx("span",{children:ut}),T.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:mn(oe[it],{isMac:b})})]},J)),w&&T.jsx("div",{style:{height:1,margin:"4px 6px",background:"rgba(255,255,255,0.12)"}}),w&&k.map(({move:J,label:ut,shortcut:it})=>{const rt=r8(st,w,J);return T.jsxs("button",{type:"button",role:"menuitem",disabled:!rt,onClick:()=>{qa(w,J),Ht(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:rt?"#ddd":"rgba(255,255,255,0.28)",cursor:rt?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:I=>{rt&&(I.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:I=>{I.currentTarget.style.background="transparent"},children:[T.jsx("span",{children:ut}),T.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:mn(oe[it],{isMac:b})})]},J)})]})})(),T.jsx("input",{ref:vn,type:"file",accept:o_,style:{display:"none"},onChange:w=>{const k=w.target.files?.[0];w.target.value="",k&&(wo(k),pi(!1))}}),T.jsx(C_,{open:Zo,fontId:Ei.fontId,fontFamily:Xn,strokeWidthScale:gi,onClose:()=>To(!1),onFontIdChange:fi,onStrokeWidthScaleChange:Ti})]})});function d9({corner:n}){const i=n==="nw"||n==="sw"?12:32,s=n==="nw"||n==="ne"?12:32;return T.jsx("svg",{width:44,height:44,viewBox:"0 0 44 44","aria-hidden":!0,children:T.jsx("circle",{cx:i,cy:s,r:7,fill:"none",stroke:"#F2D727",strokeWidth:1.6})})}function xk({shortcut:n,isMac:t}){const[e,r]=U.useState(!1);return T.jsxs("div",{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,padding:"4px 6px",borderRadius:6,background:e?"rgba(255,255,255,0.08)":"transparent",transition:"background 0.15s"},children:[T.jsx("span",{style:{color:"rgba(255,255,255,0.85)"},children:n.label}),T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:Ai(n,{isMac:t}).map(i=>T.jsx(tc,{children:i},i))})]})}function vk({canUndo:n,canRedo:t,onUndo:e,onRedo:r,isMac:i}){return T.jsxs(T.Fragment,{children:[T.jsx(wr,{title:`Відмінити (${mn(oe.undo,{isMac:i})})`,tooltip:`Відмінити останню точку або переміщення (${mn(oe.undo,{isMac:i})})`,onClick:e,disabled:!n,children:T.jsx("i",{className:`${qn} bi-arrow-counterclockwise`,style:{fontSize:rr},"aria-hidden":!0})}),T.jsx(wr,{title:`Повернути (${mn(oe.redo,{isMac:i})})`,tooltip:`Повернути скасовану дію (${mn(oe.redo,{isMac:i})})`,onClick:r,disabled:!t,children:T.jsx("i",{className:`${qn} bi-arrow-clockwise`,style:{fontSize:rr},"aria-hidden":!0})})]})}function wr({children:n,onClick:t,active:e,accent:r,primary:i,title:s,tooltip:l,disabled:c,hotkeyParts:f,showHotkeyBadge:d,success:p}){const[g,b]=U.useState(!1),[y,M]=U.useState(!1),C=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),D=typeof window<"u"&&window.innerWidth<(C?1040:1320),L=l!=null&&l!=="",H=y&&!c,Y=i?H?"rgb(30, 90, 180)":"rgb(0, 102, 204)":null,W=r?H?"rgb(210, 50, 60)":"rgb(230, 57, 70)":null,St=!!p&&!c;return T.jsxs("span",{style:{position:"relative",display:"inline-block"},onMouseEnter:()=>{b(!0),M(!0)},onMouseLeave:()=>{b(!1),M(!1)},children:[T.jsx("button",{onClick:t,disabled:c,title:L?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:C?40:30,boxSizing:"border-box",background:Y??W??(e?"linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))":H?"rgba(255,255,255,0.12)":"rgba(255,255,255,0.06)"),border:St?"1px solid #2ecc71":`1px solid ${Y??W??(e?"transparent":"rgba(255,255,255,0.08)")}`,borderRadius:5,color:c?"rgba(255,255,255,0.55)":St?"#2ecc71":i||r||e?"#fff":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:C?D?"7px 10px":"8px 14px":D?"4px 8px":"5px 12px",transition:"all 0.15s",cursor:c?"not-allowed":"pointer",opacity:c?.6:1},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:D?6:8},children:[n,d&&f&&f.length>0&&T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:f.map(_t=>T.jsx(tc,{title:`Гаряча клавіша: ${_t}`,children:_t},_t))})]})}),L&&g&&T.jsx("span",{role:"tooltip",style:{position:"absolute",left:"50%",bottom:"100%",transform:"translateX(-50%)",marginBottom:6,padding:"6px 10px",background:"rgba(0,0,0,0.9)",color:"#fff",borderRadius:6,fontSize:12,width:"max-content",maxWidth:320,whiteSpace:"normal",textAlign:"center",zIndex:1e3,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:l})]})}function h9({children:n,onMainClick:t,onMenuClick:e,menuOpen:r,disabled:i,mainTitle:s,mainTooltip:l,menuTitle:c,menuTooltip:f,hotkeyParts:d,showHotkeyBadge:p}){const[g,b]=U.useState(!1),[y,M]=U.useState(!1),[C,D]=U.useState(!1),[L,H]=U.useState(!1),Y=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),W=typeof window<"u"&&window.innerWidth<(Y?1040:1320),St=Y?40:30,_t=Y?W?7:8:W?4:5,Ct=Y?W?10:14:W?8:12,bt="rgba(255,255,255,0.06)",ot="rgba(255,255,255,0.12)",jt="linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))",Z=r?"transparent":"rgba(255,255,255,0.08)",ct={position:"absolute",left:"50%",bottom:"100%",transform:"translateX(-50%)",marginBottom:6,padding:"6px 10px",background:"rgba(0,0,0,0.9)",color:"#fff",borderRadius:6,fontSize:12,width:"max-content",maxWidth:320,whiteSpace:"normal",textAlign:"center",zIndex:1e3,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"};return T.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"stretch",opacity:i?.6:1,border:`1px solid ${Z}`,borderRadius:5,overflow:"hidden",background:bt},children:[T.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{b(!0),D(!0)},onMouseLeave:()=>{b(!1),D(!1)},children:[T.jsx("button",{type:"button",onClick:t,disabled:i,title:l?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:St,boxSizing:"border-box",background:g&&!i?ot:"transparent",border:"none",borderRadius:0,color:i?"rgba(255,255,255,0.55)":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:`${_t}px ${Ct}px`,transition:"background 0.15s",cursor:i?"not-allowed":"pointer"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:W?6:8},children:[n,p&&d&&d.length>0&&T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:d.map(V=>T.jsx(tc,{title:`Гаряча клавіша: ${V}`,children:V},V))})]})}),l&&C&&T.jsx("span",{role:"tooltip",style:ct,children:l})]}),T.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{M(!0),H(!0)},onMouseLeave:()=>{M(!1),H(!1)},children:[T.jsx("button",{type:"button",onClick:e,disabled:i,"aria-expanded":!!r,"aria-haspopup":"dialog",title:f?void 0:c,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:St,minWidth:Y?32:26,boxSizing:"border-box",background:r?jt:y&&!i?ot:"transparent",border:"none",borderLeft:`1px solid ${r?"rgba(255,255,255,0.18)":"rgba(255,255,255,0.12)"}`,borderRadius:0,color:i?"rgba(255,255,255,0.55)":r?"#fff":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:`${_t}px ${W?6:8}px`,transition:"background 0.15s, color 0.15s",cursor:i?"not-allowed":"pointer"},children:T.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:rr-2},"aria-hidden":!0})}),f&&L&&T.jsx("span",{role:"tooltip",style:ct,children:f})]})]})}function p9({onFile:n,highlight:t=!1,warning:e=null}){const r=U.useRef(null),[i,s]=U.useState(!1),l=i||t,c=f=>{f.preventDefault(),f.stopPropagation(),s(!1);const d=f.dataTransfer.files[0];if(!i5(d))return;const p=new DataTransfer;p.items.add(d),r.current&&(Object.defineProperty(r.current,"files",{value:p.files,configurable:!0}),r.current.dispatchEvent(new Event("change",{bubbles:!0})))};return T.jsxs("div",{onDragOver:f=>{f.preventDefault(),s(!0)},onDragLeave:()=>s(!1),onDrop:c,onClick:()=>r.current?.click(),style:{border:`2px dashed ${l?"#4ecdc4":"rgba(255,255,255,0.08)"}`,borderRadius:14,padding:"60px 80px",textAlign:"center",cursor:"pointer",transition:"all 0.2s",background:l?"rgba(78,205,196,0.05)":"transparent",maxWidth:440},children:[T.jsx("div",{style:{marginBottom:14,opacity:.5,display:"flex",justifyContent:"center",color:"#555"},children:T.jsx("i",{className:`${qn} bi-image`,style:{fontSize:48},"aria-hidden":!0})}),T.jsx("p",{style:{fontSize:16,color:"#777",lineHeight:1.7,fontWeight:700,margin:0},children:"Завантажте фонове зображення"}),T.jsxs("p",{style:{fontSize:14,color:"#555",margin:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:["або вставте з буфера",Ai(oe.pasteInCallout,{isMac:rh()}).map(f=>T.jsx(tc,{title:Hd(),children:f},f))]}),T.jsx("div",{style:{display:"inline-block",marginTop:18,borderRadius:7,background:"linear-gradient(135deg, #E63946, #c62b38)",color:"#fff",fontSize:14,fontWeight:700,padding:"7px 24px 9px"},children:"Обрати файл"}),e&&T.jsx("p",{style:{marginTop:14,marginBottom:0,color:"#E63946",fontSize:13,lineHeight:1.5},children:e}),T.jsx("input",{ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:n})]})}Q6.createRoot(document.getElementById("root")).render(T.jsx(U.StrictMode,{children:T.jsx(f9,{mode:"embed"})}));export{Hr as _,m9 as c,wk as g};