@3rtools/tyts-mcp 0.1.0

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.
Files changed (85) hide show
  1. package/README.md +103 -0
  2. package/dist/chrome.d.ts +3 -0
  3. package/dist/chrome.js +36 -0
  4. package/dist/chrome.js.map +1 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +23 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/document.d.ts +76 -0
  9. package/dist/document.js +101 -0
  10. package/dist/document.js.map +1 -0
  11. package/dist/image.d.ts +16 -0
  12. package/dist/image.js +70 -0
  13. package/dist/image.js.map +1 -0
  14. package/dist/schemas.d.ts +490 -0
  15. package/dist/schemas.js +49 -0
  16. package/dist/schemas.js.map +1 -0
  17. package/dist/server.d.ts +20 -0
  18. package/dist/server.js +197 -0
  19. package/dist/server.js.map +1 -0
  20. package/dist/session.d.ts +57 -0
  21. package/dist/session.js +186 -0
  22. package/dist/session.js.map +1 -0
  23. package/editor/appicon/Icon 1024.png +0 -0
  24. package/editor/appicon/Icon 128.png +0 -0
  25. package/editor/appicon/Icon 16.png +0 -0
  26. package/editor/appicon/Icon 256.png +0 -0
  27. package/editor/appicon/Icon 32.png +0 -0
  28. package/editor/appicon/Icon 512.png +0 -0
  29. package/editor/appicon/Icon 64.png +0 -0
  30. package/editor/assets/bootstrap-icons-BeopsB42.woff +0 -0
  31. package/editor/assets/bootstrap-icons-mSm7cUeB.woff2 +0 -0
  32. package/editor/assets/html2canvas.esm-DXEQVQnt.js +5 -0
  33. package/editor/assets/index-Bnr_82GS.js +236 -0
  34. package/editor/assets/index-DkXpHR6W.css +1 -0
  35. package/editor/assets/index.es-COZX40-D.js +5 -0
  36. package/editor/assets/purify.es-C0_7NiBM.js +2 -0
  37. package/editor/favicon/192.png +0 -0
  38. package/editor/favicon/512.png +0 -0
  39. package/editor/favicon/apple-touch-icon.png +0 -0
  40. package/editor/favicon/favicon.ico +0 -0
  41. package/editor/favicon/favicon.svg +12 -0
  42. package/editor/favicon/png/favicon-16x16.png +0 -0
  43. package/editor/favicon/png/favicon-32x32.png +0 -0
  44. package/editor/favicon/png/favicon-64x64.png +0 -0
  45. package/editor/fonts/road-ui/RoadUI-Bold.woff +0 -0
  46. package/editor/fonts/road-ui/RoadUI-Bold.woff2 +0 -0
  47. package/editor/fonts/road-ui/RoadUI-BoldOblique.woff +0 -0
  48. package/editor/fonts/road-ui/RoadUI-BoldOblique.woff2 +0 -0
  49. package/editor/fonts/road-ui/RoadUI-ExtraBold.woff +0 -0
  50. package/editor/fonts/road-ui/RoadUI-ExtraBold.woff2 +0 -0
  51. package/editor/fonts/road-ui/RoadUI-ExtraBoldOblique.woff +0 -0
  52. package/editor/fonts/road-ui/RoadUI-ExtraBoldOblique.woff2 +0 -0
  53. package/editor/fonts/road-ui/RoadUI-ExtraLight.woff +0 -0
  54. package/editor/fonts/road-ui/RoadUI-ExtraLight.woff2 +0 -0
  55. package/editor/fonts/road-ui/RoadUI-ExtraLightOblique.woff +0 -0
  56. package/editor/fonts/road-ui/RoadUI-ExtraLightOblique.woff2 +0 -0
  57. package/editor/fonts/road-ui/RoadUI-Light.woff +0 -0
  58. package/editor/fonts/road-ui/RoadUI-Light.woff2 +0 -0
  59. package/editor/fonts/road-ui/RoadUI-LightOblique.woff +0 -0
  60. package/editor/fonts/road-ui/RoadUI-LightOblique.woff2 +0 -0
  61. package/editor/fonts/road-ui/RoadUI-Medium.woff +0 -0
  62. package/editor/fonts/road-ui/RoadUI-Medium.woff2 +0 -0
  63. package/editor/fonts/road-ui/RoadUI-MediumOblique.woff +0 -0
  64. package/editor/fonts/road-ui/RoadUI-MediumOblique.woff2 +0 -0
  65. package/editor/fonts/road-ui/RoadUI-Oblique.woff +0 -0
  66. package/editor/fonts/road-ui/RoadUI-Oblique.woff2 +0 -0
  67. package/editor/fonts/road-ui/RoadUI-Regular.woff +0 -0
  68. package/editor/fonts/road-ui/RoadUI-Regular.woff2 +0 -0
  69. package/editor/fonts/road-ui/RoadUI-SemiBold.woff +0 -0
  70. package/editor/fonts/road-ui/RoadUI-SemiBold.woff2 +0 -0
  71. package/editor/fonts/road-ui/RoadUI-SemiBoldOblique.woff +0 -0
  72. package/editor/fonts/road-ui/RoadUI-SemiBoldOblique.woff2 +0 -0
  73. package/editor/fonts/road-ui/RoadUI-Thin.woff +0 -0
  74. package/editor/fonts/road-ui/RoadUI-Thin.woff2 +0 -0
  75. package/editor/fonts/road-ui/RoadUI-ThinOblique.woff +0 -0
  76. package/editor/fonts/road-ui/RoadUI-ThinOblique.woff2 +0 -0
  77. package/editor/fonts/road-ui/road-ui.css +113 -0
  78. package/editor/images/crypto/btc.svg +31 -0
  79. package/editor/images/crypto/eth.svg +11 -0
  80. package/editor/images/crypto/trx.svg +11 -0
  81. package/editor/images/crypto/usdt.svg +8 -0
  82. package/editor/index.html +23 -0
  83. package/editor/tyts-embed.js +242 -0
  84. package/package.json +43 -0
  85. package/static/harness.html +45 -0
@@ -0,0 +1,236 @@
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 n(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=n(i);fetch(i.href,s)}})();var IB=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var E1={exports:{}},_h={};var lv;function O6(){if(lv)return _h;lv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(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:e,type:r,key:l,ref:i!==void 0?i:null,props:s}}return _h.Fragment=t,_h.jsx=n,_h.jsxs=n,_h}var cv;function P6(){return cv||(cv=1,E1.exports=O6()),E1.exports}var T=P6(),T1={exports:{}},qn={};var uv;function I6(){if(uv)return qn;uv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=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"),y=Symbol.for("react.activity"),b=Symbol.iterator;function g(K){return K===null||typeof K!="object"?null:(K=b&&K[b]||K["@@iterator"],typeof K=="function"?K:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,L={};function D(K,P,Y){this.props=K,this.context=P,this.refs=L,this.updater=Y||C}D.prototype.isReactComponent={},D.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")},D.prototype.forceUpdate=function(K){this.updater.enqueueForceUpdate(this,K,"forceUpdate")};function H(){}H.prototype=D.prototype;function V(K,P,Y){this.props=K,this.context=P,this.refs=L,this.updater=Y||C}var W=V.prototype=new H;W.constructor=V,M(W,D.prototype),W.isPureReactComponent=!0;var gt=Array.isArray;function _t(){}var kt={H:null,A:null,T:null,S:null},xt=Object.prototype.hasOwnProperty;function rt(K,P,Y){var tt=Y.ref;return{$$typeof:e,type:K,key:P,ref:tt!==void 0?tt:null,props:Y}}function jt(K,P){return rt(K.type,P,K.props)}function J(K){return typeof K=="object"&&K!==null&&K.$$typeof===e}function ct(K){var P={"=":"=0",":":"=2"};return"$"+K.replace(/[=:]/g,function(Y){return P[Y]})}var X=/\/+/g;function bt(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,Y,tt,yt){var wt=typeof K;(wt==="undefined"||wt==="boolean")&&(K=null);var At=!1;if(K===null)At=!0;else switch(wt){case"bigint":case"string":case"number":At=!0;break;case"object":switch(K.$$typeof){case e:case t:At=!0;break;case p:return At=K._init,dt(At(K._payload),P,Y,tt,yt)}}if(At)return yt=yt(K),At=tt===""?"."+bt(K,0):tt,gt(yt)?(Y="",At!=null&&(Y=At.replace(X,"$&/")+"/"),dt(yt,P,Y,"",function(Zt){return Zt})):yt!=null&&(J(yt)&&(yt=jt(yt,Y+(yt.key==null||K&&K.key===yt.key?"":(""+yt.key).replace(X,"$&/")+"/")+At)),P.push(yt)),1;At=0;var qt=tt===""?".":tt+":";if(gt(K))for(var Rt=0;Rt<K.length;Rt++)tt=K[Rt],wt=qt+bt(tt,Rt),At+=dt(tt,P,Y,wt,yt);else if(Rt=g(K),typeof Rt=="function")for(K=Rt.call(K),Rt=0;!(tt=K.next()).done;)tt=tt.value,wt=qt+bt(tt,Rt++),At+=dt(tt,P,Y,wt,yt);else if(wt==="object"){if(typeof K.then=="function")return dt(Lt(K),P,Y,tt,yt);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 At}function st(K,P,Y){if(K==null)return K;var tt=[],yt=0;return dt(K,tt,"","",function(wt){return P.call(Y,wt,yt++)}),tt}function lt(K){if(K._status===-1){var P=K._result;P=P(),P.then(function(Y){(K._status===0||K._status===-1)&&(K._status=1,K._result=Y)},function(Y){(K._status===0||K._status===-1)&&(K._status=2,K._result=Y)}),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)},Mt={map:st,forEach:function(K,P,Y){st(K,function(){P.apply(this,arguments)},Y)},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(!J(K))throw Error("React.Children.only expected to receive a single React element child.");return K}};return qn.Activity=y,qn.Children=Mt,qn.Component=D,qn.Fragment=n,qn.Profiler=i,qn.PureComponent=V,qn.StrictMode=r,qn.Suspense=f,qn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=kt,qn.__COMPILER_RUNTIME={__proto__:null,c:function(K){return kt.H.useMemoCache(K)}},qn.cache=function(K){return function(){return K.apply(null,arguments)}},qn.cacheSignal=function(){return null},qn.cloneElement=function(K,P,Y){if(K==null)throw Error("The argument must be a React element, but you passed "+K+".");var tt=M({},K.props),yt=K.key;if(P!=null)for(wt in P.key!==void 0&&(yt=""+P.key),P)!xt.call(P,wt)||wt==="key"||wt==="__self"||wt==="__source"||wt==="ref"&&P.ref===void 0||(tt[wt]=P[wt]);var wt=arguments.length-2;if(wt===1)tt.children=Y;else if(1<wt){for(var At=Array(wt),qt=0;qt<wt;qt++)At[qt]=arguments[qt+2];tt.children=At}return rt(K.type,yt,tt)},qn.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},qn.createElement=function(K,P,Y){var tt,yt={},wt=null;if(P!=null)for(tt in P.key!==void 0&&(wt=""+P.key),P)xt.call(P,tt)&&tt!=="key"&&tt!=="__self"&&tt!=="__source"&&(yt[tt]=P[tt]);var At=arguments.length-2;if(At===1)yt.children=Y;else if(1<At){for(var qt=Array(At),Rt=0;Rt<At;Rt++)qt[Rt]=arguments[Rt+2];yt.children=qt}if(K&&K.defaultProps)for(tt in At=K.defaultProps,At)yt[tt]===void 0&&(yt[tt]=At[tt]);return rt(K,wt,yt)},qn.createRef=function(){return{current:null}},qn.forwardRef=function(K){return{$$typeof:c,render:K}},qn.isValidElement=J,qn.lazy=function(K){return{$$typeof:p,_payload:{_status:-1,_result:K},_init:lt}},qn.memo=function(K,P){return{$$typeof:d,type:K,compare:P===void 0?null:P}},qn.startTransition=function(K){var P=kt.T,Y={};kt.T=Y;try{var tt=K(),yt=kt.S;yt!==null&&yt(Y,tt),typeof tt=="object"&&tt!==null&&typeof tt.then=="function"&&tt.then(_t,zt)}catch(wt){zt(wt)}finally{P!==null&&Y.types!==null&&(P.types=Y.types),kt.T=P}},qn.unstable_useCacheRefresh=function(){return kt.H.useCacheRefresh()},qn.use=function(K){return kt.H.use(K)},qn.useActionState=function(K,P,Y){return kt.H.useActionState(K,P,Y)},qn.useCallback=function(K,P){return kt.H.useCallback(K,P)},qn.useContext=function(K){return kt.H.useContext(K)},qn.useDebugValue=function(){},qn.useDeferredValue=function(K,P){return kt.H.useDeferredValue(K,P)},qn.useEffect=function(K,P){return kt.H.useEffect(K,P)},qn.useEffectEvent=function(K){return kt.H.useEffectEvent(K)},qn.useId=function(){return kt.H.useId()},qn.useImperativeHandle=function(K,P,Y){return kt.H.useImperativeHandle(K,P,Y)},qn.useInsertionEffect=function(K,P){return kt.H.useInsertionEffect(K,P)},qn.useLayoutEffect=function(K,P){return kt.H.useLayoutEffect(K,P)},qn.useMemo=function(K,P){return kt.H.useMemo(K,P)},qn.useOptimistic=function(K,P){return kt.H.useOptimistic(K,P)},qn.useReducer=function(K,P,Y){return kt.H.useReducer(K,P,Y)},qn.useRef=function(K){return kt.H.useRef(K)},qn.useState=function(K){return kt.H.useState(K)},qn.useSyncExternalStore=function(K,P,Y){return kt.H.useSyncExternalStore(K,P,Y)},qn.useTransition=function(){return kt.H.useTransition()},qn.version="19.2.4",qn}var fv;function wp(){return fv||(fv=1,T1.exports=I6()),T1.exports}var U=wp();const Su=mk(U);var N1={exports:{}},Lh={},_1={exports:{}},L1={};var dv;function j6(){return dv||(dv=1,(function(e){function t(dt,st){var lt=dt.length;dt.push(st);t:for(;0<lt;){var zt=lt-1>>>1,Mt=dt[zt];if(0<i(Mt,st))dt[zt]=st,dt[lt]=Mt,lt=zt;else break t}}function n(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,Mt=dt.length,K=Mt>>>1;zt<K;){var P=2*(zt+1)-1,Y=dt[P],tt=P+1,yt=dt[tt];if(0>i(Y,lt))tt<Mt&&0>i(yt,Y)?(dt[zt]=yt,dt[tt]=lt,zt=tt):(dt[zt]=Y,dt[P]=lt,zt=P);else if(tt<Mt&&0>i(yt,lt))dt[zt]=yt,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(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var f=[],d=[],p=1,y=null,b=3,g=!1,C=!1,M=!1,L=!1,D=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function W(dt){for(var st=n(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=n(d)}}function gt(dt){if(M=!1,W(dt),!C)if(n(f)!==null)C=!0,_t||(_t=!0,ct());else{var st=n(d);st!==null&&Lt(gt,st.startTime-dt)}}var _t=!1,kt=-1,xt=5,rt=-1;function jt(){return L?!0:!(e.unstable_now()-rt<xt)}function J(){if(L=!1,_t){var dt=e.unstable_now();rt=dt;var st=!0;try{t:{C=!1,M&&(M=!1,H(kt),kt=-1),g=!0;var lt=b;try{e:{for(W(dt),y=n(f);y!==null&&!(y.expirationTime>dt&&jt());){var zt=y.callback;if(typeof zt=="function"){y.callback=null,b=y.priorityLevel;var Mt=zt(y.expirationTime<=dt);if(dt=e.unstable_now(),typeof Mt=="function"){y.callback=Mt,W(dt),st=!0;break e}y===n(f)&&r(f),W(dt)}else r(f);y=n(f)}if(y!==null)st=!0;else{var K=n(d);K!==null&&Lt(gt,K.startTime-dt),st=!1}}break t}finally{y=null,b=lt,g=!1}st=void 0}}finally{st?ct():_t=!1}}}var ct;if(typeof V=="function")ct=function(){V(J)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,bt=X.port2;X.port1.onmessage=J,ct=function(){bt.postMessage(null)}}else ct=function(){D(J,0)};function Lt(dt,st){kt=D(function(){dt(e.unstable_now())},st)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(dt){dt.callback=null},e.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"):xt=0<dt?Math.floor(1e3/dt):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.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}},e.unstable_requestPaint=function(){L=!0},e.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}},e.unstable_scheduleCallback=function(dt,st,lt){var zt=e.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 Mt=-1;break;case 2:Mt=250;break;case 5:Mt=1073741823;break;case 4:Mt=1e4;break;default:Mt=5e3}return Mt=lt+Mt,dt={id:p++,callback:st,priorityLevel:dt,startTime:lt,expirationTime:Mt,sortIndex:-1},lt>zt?(dt.sortIndex=lt,t(d,dt),n(f)===null&&dt===n(d)&&(M?(H(kt),kt=-1):M=!0,Lt(gt,lt-zt))):(dt.sortIndex=Mt,t(f,dt),C||g||(C=!0,_t||(_t=!0,ct()))),dt},e.unstable_shouldYield=jt,e.unstable_wrapCallback=function(dt){var st=b;return function(){var lt=b;b=st;try{return dt.apply(this,arguments)}finally{b=lt}}}})(L1)),L1}var hv;function z6(){return hv||(hv=1,_1.exports=j6()),_1.exports}var D1={exports:{}},Is={};var pv;function B6(){if(pv)return Is;pv=1;var e=wp();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 n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,d,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:""+y,children:f,containerInfo:d,implementation:p}}var l=e.__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 Is.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Is.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)},Is.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()}},Is.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))},Is.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Is.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,y=c(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,g=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:g}):p==="script"&&r.d.X(f,{crossOrigin:y,integrity:b,fetchPriority:g,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Is.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)},Is.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,y=c(p,d.crossOrigin);r.d.L(f,p,{crossOrigin:y,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})}},Is.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)},Is.requestFormReset=function(f){r.d.r(f)},Is.unstable_batchedUpdates=function(f,d){return f(d)},Is.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},Is.useFormStatus=function(){return l.H.useHostTransitionStatus()},Is.version="19.2.4",Is}var mv;function gk(){if(mv)return D1.exports;mv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),D1.exports=B6(),D1.exports}var gv;function F6(){if(gv)return Lh;gv=1;var e=z6(),t=wp(),n=gk();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 y=Object.assign,b=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),V=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),gt=Symbol.for("react.suspense"),_t=Symbol.for("react.suspense_list"),kt=Symbol.for("react.memo"),xt=Symbol.for("react.lazy"),rt=Symbol.for("react.activity"),jt=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function ct(o){return o===null||typeof o!="object"?null:(o=J&&o[J]||o["@@iterator"],typeof o=="function"?o:null)}var X=Symbol.for("react.client.reference");function bt(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===X?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case M:return"Fragment";case D:return"Profiler";case L:return"StrictMode";case gt:return"Suspense";case _t:return"SuspenseList";case rt:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case C:return"Portal";case V: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 kt:return a=o.displayName||null,a!==null?a:bt(o.type)||"Memo";case xt:a=o._payload,o=o._init;try{return bt(o(a))}catch{}}return null}var Lt=Array.isArray,dt=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,st=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,lt={pending:!1,data:null,method:null,action:null},zt=[],Mt=-1;function K(o){return{current:o}}function P(o){0>Mt||(o.current=zt[Mt],zt[Mt]=null,Mt--)}function Y(o,a){Mt++,zt[Mt]=o.current,o.current=a}var tt=K(null),yt=K(null),wt=K(null),At=K(null);function qt(o,a){switch(Y(wt,a),Y(yt,o),Y(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=Dx(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}P(tt),Y(tt,o)}function Rt(){P(tt),P(yt),P(wt)}function Zt(o){o.memoizedState!==null&&Y(At,o);var a=tt.current,u=Dx(a,o.type);a!==u&&(Y(yt,o),Y(tt,u))}function Me(o){yt.current===o&&(P(tt),P(yt)),At.current===o&&(P(At),Ch._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 be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(ee){var Jt=ee}Reflect.construct(o,[],be)}else{try{be.call()}catch(ee){Jt=ee}o.call(be.prototype)}}else{try{throw Error()}catch(ee){Jt=ee}(be=o())&&typeof be.catch=="function"&&be.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 Tt=O.split(`
4
+ `),Kt=et.split(`
5
+ `);for(x=h=0;h<Tt.length&&!Tt[h].includes("DetermineComponentFrameRoot");)h++;for(;x<Kt.length&&!Kt[x].includes("DetermineComponentFrameRoot");)x++;if(h===Tt.length||x===Kt.length)for(h=Tt.length-1,x=Kt.length-1;1<=h&&0<=x&&Tt[h]!==Kt[x];)x--;for(;1<=h&&0<=x;h--,x--)if(Tt[h]!==Kt[x]){if(h!==1||x!==1)do if(h--,x--,0>x||Tt[h]!==Kt[x]){var ae=`
6
+ `+Tt[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 xe=Object.prototype.hasOwnProperty,_e=e.unstable_scheduleCallback,Te=e.unstable_cancelCallback,De=e.unstable_shouldYield,$e=e.unstable_requestPaint,fn=e.unstable_now,In=e.unstable_getCurrentPriorityLevel,bn=e.unstable_ImmediatePriority,Nn=e.unstable_UserBlockingPriority,xn=e.unstable_NormalPriority,ze=e.unstable_LowPriority,Qe=e.unstable_IdlePriority,je=e.log,dr=e.unstable_setDisableYieldValue,mn=null,an=null;function dn(o){if(typeof je=="function"&&dr(o),an&&typeof an.setStrictMode=="function")try{an.setStrictMode(mn,o)}catch{}}var Vn=Math.clz32?Math.clz32:we,tn=Math.log,Qt=Math.LN2;function we(o){return o>>>=0,o===0?32:31-(tn(o)/Qt|0)|0}var ge=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 Wn(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 Yo(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function ci(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 Vo(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function Ke(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xs(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,Tt=o.expirationTimes,Kt=o.hiddenUpdates;for(u=O&~u;0<u;){var ae=31-Vn(u),be=1<<ae;et[ae]=0,Tt[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&=~be}h!==0&&Zi(o,h,0),S!==0&&x===0&&o.tag!==0&&(o.suspendedLanes|=S&~(O&~a))}function Zi(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-Vn(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-Vn(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:Gn(u),(u&(o.suspendedLanes|a))!==0?0:u}function Gn(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 ui(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:ev(o.type))}function Wo(o,a){var u=st.p;try{return st.p=o,a()}finally{st.p=u}}var pi=Math.random().toString(36).slice(2),Ar="__reactFiber$"+pi,or="__reactProps$"+pi,Kn="__reactContainer$"+pi,Xo="__reactEvents$"+pi,vs="__reactListeners$"+pi,Da="__reactHandles$"+pi,Go="__reactResources$"+pi,Ao="__reactMarker$"+pi;function Ll(o){delete o[Ar],delete o[or],delete o[Xo],delete o[vs],delete o[Da]}function aa(o){var a=o[Ar];if(a)return a;for(var u=o.parentNode;u;){if(a=u[Kn]||u[Ar]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=Bx(o);o!==null;){if(u=o[Ar])return u;o=Bx(o)}return a}o=u,u=o.parentNode}return null}function ws(o){if(o=o[Ar]||o[Kn]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function nl(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function Ko(o){var a=o[Go];return a||(a=o[Go]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function fi(o){o[Ao]=!0}var rl=new Set,Pi={};function Yr(o,a){Ss(o,a),Ss(o+"Capture",a)}function Ss(o,a){for(Pi[o]=a,o=0;o<a.length;o++)rl.add(a[o])}var Dl=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]*$"),oc={},jc={};function zc(o){return xe.call(jc,o)?!0:xe.call(oc,o)?!1:Dl.test(o)?jc[o]=!0:(oc[o]=!0,!1)}function Qi(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 mi(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 Oo(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function hr(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 uo(o){if(!o._valueTracker){var a=Oo(o)?"checked":"value";o._valueTracker=hr(o,a,""+o[a])}}function to(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=Oo(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function Ir(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 Pn=/[\n"\\]/g;function jr(o){return o.replace(Pn,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Ra(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 la(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)){uo(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),uo(o)}function te(o,a,u){a==="number"&&Ir(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function Mo(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 ca(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 Bc(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),uo(o)}function fo(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var il=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 Au(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||il.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function Mu(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&&Au(o,x,h)}else for(var S in a)a.hasOwnProperty(S)&&Au(o,S,a[S])}function sc(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 ac=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"]]),Rl=/^[\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 eo(o){return Rl.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Jo(){}var ks=null;function ol(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Oa=null,Sn=null;function lc(o){var a=ws(o);if(a&&(o=a.stateNode)){var u=o[or]||null;t:switch(o=a.stateNode,a.type){case"input":if(Ra(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="'+jr(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var x=h[or]||null;if(!x)throw Error(r(90));Ra(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&&to(h)}break t;case"textarea":ca(o,u.value,u.defaultValue);break t;case"select":a=u.value,a!=null&&Mo(o,!!u.multiple,a,!1)}}}var vr=!1;function cc(o,a,u){if(vr)return o(a,u);vr=!0;try{var h=o(a);return h}finally{if(vr=!1,(Oa!==null||Sn!==null)&&(Hp(),Oa&&(a=Oa,o=Sn,Sn=Oa=null,lc(a),o)))for(a=0;a<o.length;a++)lc(o[a])}}function ho(o,a){var u=o.stateNode;if(u===null)return null;var h=u[or]||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 _i=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sl=!1;if(_i)try{var As={};Object.defineProperty(As,"passive",{get:function(){sl=!0}}),window.addEventListener("test",As,As),window.removeEventListener("test",As,As)}catch{sl=!1}var qi=null,ua=null,Zo=null;function Ol(){if(Zo)return Zo;var o,a=ua,u=a.length,h,x="value"in qi?qi.value:qi.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 Zo=x.slice(o,1<h?1-h:void 0)}function po(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 Pa(){return!0}function Ia(){return!1}function gi(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)?Pa:Ia,this.isPropagationStopped=Ia,this}return y(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=Pa)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Pa)},persist:function(){},isPersistent:Pa}),a}var Po={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Co=gi(Po),Ms=y({},Po,{view:0,detail:0}),ja=gi(Ms),fa,Cs,Es,da=y({},Ms,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,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!==Es&&(Es&&o.type==="mousemove"?(fa=o.screenX-Es.screenX,Cs=o.screenY-Es.screenY):Cs=fa=0,Es=o),fa)},movementY:function(o){return"movementY"in o?o.movementY:Cs}}),al=gi(da),Qo=y({},da,{dataTransfer:0}),Ts=gi(Qo),Pl=y({},Ms,{relatedTarget:0}),Ns=gi(Pl),Il=y({},Po,{animationName:0,elapsedTime:0,pseudoElement:0}),A=gi(Il),B=y({},Po,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),mt=gi(B),Nt=y({},Po,{data:0}),Ft=gi(Nt),ie={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ve={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"},nn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ln(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=nn[o])?!!a[o]:!1}function Rn(){return ln}var zn=y({},Ms,{key:function(o){if(o.key){var a=ie[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=po(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?ve[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(o){return o.type==="keypress"?po(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?po(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),sr=gi(zn),Li=y({},da,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zr=gi(Li),Tr=y({},Ms,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn}),ue=gi(Tr),Qr=y({},Po,{propertyName:0,elapsedTime:0,pseudoElement:0}),di=gi(Qr),An=y({},da,{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}),vn=gi(An),za=y({},Po,{newState:0,oldState:0}),jl=gi(za),uc=[9,13,27,32],pr=_i&&"CompositionEvent"in window,mo=null;_i&&"documentMode"in document&&(mo=document.documentMode);var zl=_i&&"TextEvent"in window&&!mo,_s=_i&&(!pr||mo&&8<mo&&11>=mo),$i=" ",ha=!1;function Ba(o,a){switch(o){case"keyup":return uc.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fa(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Ys=!1;function go(o,a){switch(o){case"compositionend":return Fa(a);case"keypress":return a.which!==32?null:(ha=!0,$i);case"textInput":return o=a.data,o===$i&&ha?null:o;default:return null}}function pa(o,a){if(Ys)return o==="compositionend"||!pr&&Ba(o,a)?(o=Ol(),Zo=ua=qi=null,Ys=!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 _s&&a.locale!=="ko"?null:a.data;default:return null}}var Bl={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 fc(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!Bl[o.type]:a==="textarea"}function Io(o,a,u,h){Oa?Sn?Sn.push(h):Sn=[h]:Oa=h,a=Gp(a,"onChange"),0<a.length&&(u=new Co("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var jo=null,Eo=null;function dc(o){Mx(o,0)}function ts(o){var a=nl(o);if(to(a))return o}function Ua(o,a){if(o==="change")return a}var hi=!1;if(_i){var Nr;if(_i){var es="oninput"in document;if(!es){var Yi=document.createElement("div");Yi.setAttribute("oninput","return;"),es=typeof Yi.oninput=="function"}Nr=es}else Nr=!1;hi=Nr&&(!document.documentMode||9<document.documentMode)}function Vs(){jo&&(jo.detachEvent("onpropertychange",Fl),Eo=jo=null)}function Fl(o){if(o.propertyName==="value"&&ts(Eo)){var a=[];Io(a,Eo,o,ol(o)),cc(dc,a)}}function ll(o,a,u){o==="focusin"?(Vs(),jo=a,Eo=u,jo.attachEvent("onpropertychange",Fl)):o==="focusout"&&Vs()}function pe(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return ts(Eo)}function To(o,a){if(o==="click")return ts(a)}function Ws(o,a){if(o==="input"||o==="change")return ts(a)}function Ls(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var no=typeof Object.is=="function"?Object.is:Ls;function Xs(o,a){if(no(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(!xe.call(a,x)||!no(o[x],a[x]))return!1}return!0}function hc(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Ul(o,a){var u=hc(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=hc(u)}}function Ha(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?Ha(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function qa(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Ir(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=Ir(o.document)}return a}function Gs(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=_i&&"documentMode"in document&&11>=document.documentMode,ns=null,ma=null,yi=null,No=!1;function br(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;No||ns==null||ns!==Ir(h)||(h=ns,"selectionStart"in h&&Gs(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}),yi&&Xs(yi,h)||(yi=h,h=Gp(ma,"onSelect"),0<h.length&&(a=new Co("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=ns)))}function ar(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var Dr={animationend:ar("Animation","AnimationEnd"),animationiteration:ar("Animation","AnimationIteration"),animationstart:ar("Animation","AnimationStart"),transitionrun:ar("Transition","TransitionRun"),transitionstart:ar("Transition","TransitionStart"),transitioncancel:ar("Transition","TransitionCancel"),transitionend:ar("Transition","TransitionEnd")},bi={},Ks={};_i&&(Ks=document.createElement("div").style,"AnimationEvent"in window||(delete Dr.animationend.animation,delete Dr.animationiteration.animation,delete Dr.animationstart.animation),"TransitionEvent"in window||delete Dr.transitionend.transition);function Ds(o){if(bi[o])return bi[o];if(!Dr[o])return o;var a=Dr[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in Ks)return bi[o]=a[u];return o}var ga=Ds("animationend"),pc=Ds("animationiteration"),Cu=Ds("animationstart"),vf=Ds("transitionrun"),wf=Ds("transitionstart"),ad=Ds("transitioncancel"),Eu=Ds("transitionend"),Sf=new Map,ul="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(" ");ul.push("scrollEnd");function rs(o,a){Sf.set(o,a),Yr(a,[o])}var mc=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)},zo=[],fl=0,Fc=0;function gc(){for(var o=fl,a=Fc=fl=0;a<o;){var u=zo[a];zo[a++]=null;var h=zo[a];zo[a++]=null;var x=zo[a];zo[a++]=null;var S=zo[a];if(zo[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&&bc(u,x,S)}}function yc(o,a,u,h){zo[fl++]=o,zo[fl++]=a,zo[fl++]=u,zo[fl++]=h,Fc|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function Uc(o,a,u,h){return yc(o,a,u,h),ro(o)}function ya(o,a){return yc(o,null,null,a),ro(o)}function bc(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-Vn(u),o=S.hiddenUpdates,h=o[x],h===null?o[x]=[a]:h.push(a),a.lane=u|536870912),S):null}function ro(o){if(50<xh)throw xh=0,J0=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Vi={};function Hc(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 yo(o,a,u,h){return new Hc(o,a,u,h)}function qc(o){return o=o.prototype,!(!o||!o.isReactComponent)}function is(o,a){var u=o.alternate;return u===null?(u=yo(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 xc(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 Js(o,a,u,h,x,S){var O=0;if(h=o,typeof o=="function")qc(o)&&(O=1);else if(typeof o=="string")O=S6(o,u,tt.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case rt:return o=yo(31,u,a,x),o.elementType=rt,o.lanes=S,o;case M:return $a(u.children,x,S,a);case L:O=8,x|=24;break;case D:return o=yo(12,u,a,x|2),o.elementType=D,o.lanes=S,o;case gt:return o=yo(13,u,a,x),o.elementType=gt,o.lanes=S,o;case _t:return o=yo(19,u,a,x),o.elementType=_t,o.lanes=S,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case V:O=10;break t;case H:O=9;break t;case W:O=11;break t;case kt:O=14;break t;case xt:O=16,h=null;break t}O=29,u=Error(r(130,o===null?"null":typeof o,"")),h=null}return a=yo(O,u,a,x),a.elementType=o,a.type=h,a.lanes=S,a}function $a(o,a,u,h){return o=yo(7,o,h,a),o.lanes=u,o}function vc(o,a,u){return o=yo(6,o,null,a),o.lanes=u,o}function $c(o){var a=yo(18,null,null,0);return a.stateNode=o,a}function Hl(o,a,u){return a=yo(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var ql=new WeakMap;function bo(o,a){if(typeof o=="object"&&o!==null){var u=ql.get(o);return u!==void 0?u:(a={value:o,source:a,stack:on(a)},ql.set(o,a),a)}return{value:o,source:a,stack:on(a)}}var $l=[],Rs=0,Yc=null,wc=0,ss=[],as=0,Ya=null,ls=1,cs="";function xi(o,a){$l[Rs++]=wc,$l[Rs++]=Yc,Yc=o,wc=a}function Vc(o,a,u){ss[as++]=ls,ss[as++]=cs,ss[as++]=Ya,Ya=o;var h=ls;o=cs;var x=32-Vn(h)-1;h&=~(1<<x),u+=1;var S=32-Vn(a)+x;if(30<S){var O=x-x%5;S=(h&(1<<O)-1).toString(32),h>>=O,x-=O,ls=1<<32-Vn(a)+x|u<<x|h,cs=S+o}else ls=1<<S|u<<x|h,cs=o}function Zs(o){o.return!==null&&(xi(o,1),Vc(o,1,0))}function Yl(o){for(;o===Yc;)Yc=$l[--Rs],$l[Rs]=null,wc=$l[--Rs],$l[Rs]=null;for(;o===Ya;)Ya=ss[--as],ss[as]=null,cs=ss[--as],ss[as]=null,ls=ss[--as],ss[as]=null}function ld(o,a){ss[as++]=ls,ss[as++]=cs,ss[as++]=Ya,ls=a.id,cs=a.overflow,Ya=o}var io=null,Rr=null,er=!1,_o=null,ti=!1,Qs=Error(r(519));function ta(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Sc(bo(a,o)),Qs}function dl(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[Ar]=o,a[or]=h,u){case"dialog":ur("cancel",a),ur("close",a);break;case"iframe":case"object":case"embed":ur("load",a);break;case"video":case"audio":for(u=0;u<wh.length;u++)ur(wh[u],a);break;case"source":ur("error",a);break;case"img":case"image":case"link":ur("error",a),ur("load",a);break;case"details":ur("toggle",a);break;case"input":ur("invalid",a),la(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":ur("invalid",a);break;case"textarea":ur("invalid",a),Bc(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||Nx(a.textContent,u)?(h.popover!=null&&(ur("beforetoggle",a),ur("toggle",a)),h.onScroll!=null&&ur("scroll",a),h.onScrollEnd!=null&&ur("scrollend",a),h.onClick!=null&&(a.onclick=Jo),a=!0):a=!1,a||ta(o,!0)}function ea(o){for(io=o.return;io;)switch(io.tag){case 5:case 31:case 13:ti=!1;return;case 27:case 3:ti=!0;return;default:io=io.return}}function Ii(o){if(o!==io)return!1;if(!er)return ea(o),er=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||d1(o.type,o.memoizedProps)),u=!u),u&&Rr&&ta(o),ea(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Rr=zx(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Rr=zx(o)}else a===27?(a=Rr,zu(o.type)?(o=y1,y1=null,Rr=o):Rr=a):Rr=io?bl(o.stateNode.nextSibling):null;return!0}function ba(){Rr=io=null,er=!1}function kf(){var o=_o;return o!==null&&(Ca===null?Ca=o:Ca.push.apply(Ca,o),_o=null),o}function Sc(o){_o===null?_o=[o]:_o.push(o)}var Wc=K(null),Va=null,xa=null;function us(o,a,u){Y(Wc,a._currentValue),a._currentValue=u}function Os(o){o._currentValue=Wc.current,P(Wc)}function Vl(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 Wi(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 Tt=0;Tt<a.length;Tt++)if(et.context===a[Tt]){S.lanes|=u,et=S.alternate,et!==null&&(et.lanes|=u),Vl(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),Vl(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 va(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;no(x.pendingProps.value,O.value)||(o!==null?o.push(et):o=[et])}}else if(x===At.current){if(O=x.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(o!==null?o.push(Ch):o=[Ch])}x=x.return}o!==null&&Wi(a,o,u,h),a.flags|=262144}function Xc(o){for(o=o.firstContext;o!==null;){if(!no(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function hl(o){Va=o,xa=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Di(o){return Tu(Va,o)}function kc(o,a){return Va===null&&hl(o),Tu(o,a)}function Tu(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},xa===null){if(o===null)throw Error(r(308));xa=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else xa=xa.next=a;return u}var rh=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()})}},Ac=e.unstable_scheduleCallback,cd=e.unstable_NormalPriority,Vr={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wa(){return{controller:new rh,data:new Map,refCount:0}}function pl(o){o.refCount--,o.refCount===0&&Ac(cd,function(){o.controller.abort()})}var Wl=null,Gc=0,m=0,v=null;function E(o,a){if(Wl===null){var u=Wl=[];Gc=0,m=r1(),v={status:"pending",value:void 0,then:function(h){u.push(h)}}}return Gc++,a.then(R,R),a}function R(){if(--Gc===0&&Wl!==null){v!==null&&(v.status="fulfilled");var o=Wl;Wl=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){Qb=fn(),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:oi.pooledCache}function at(o,a){a===null?Y($,$.current):Y($,a.pool)}function pt(){var o=Q();return o===null?null:{parent:Vr._currentValue,pool:o}}var Dt=Error(r(460)),Wt=Error(r(474)),ht=Error(r(542)),Ot={then:function(){}};function Ht(o){return o=o.status,o==="fulfilled"||o==="rejected"}function re(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then(Jo,Jo),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,ke(o),o;default:if(typeof a.status=="string")a.then(Jo,Jo);else{if(o=oi,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,ke(o),o}throw ne=a,Dt}}function Yt(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(ne=u,Dt):u}}var ne=null;function ce(){if(ne===null)throw Error(r(459));var o=ne;return ne=null,o}function ke(o){if(o===Dt||o===ht)throw Error(r(483))}var ye=null,Je=0;function Ye(o){var a=Je;return Je+=1,ye===null&&(ye=[]),re(ye,o,a)}function Ln(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function en(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 Zn(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=is(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=vc(Gt,Ut.mode,he),Pt.return=Ut,Pt):(Pt=x(Pt,Gt),Pt.return=Ut,Pt)}function Tt(Ut,Pt,Gt,he){var kn=Gt.type;return kn===M?ae(Ut,Pt,Gt.props.children,he,Gt.key):Pt!==null&&(Pt.elementType===kn||typeof kn=="object"&&kn!==null&&kn.$$typeof===xt&&Yt(kn)===Pt.type)?(Pt=x(Pt,Gt.props),Ln(Pt,Gt),Pt.return=Ut,Pt):(Pt=Js(Gt.type,Gt.key,Gt.props,null,Ut.mode,he),Ln(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=Hl(Gt,Ut.mode,he),Pt.return=Ut,Pt):(Pt=x(Pt,Gt.children||[]),Pt.return=Ut,Pt)}function ae(Ut,Pt,Gt,he,kn){return Pt===null||Pt.tag!==7?(Pt=$a(Gt,Ut.mode,he,kn),Pt.return=Ut,Pt):(Pt=x(Pt,Gt),Pt.return=Ut,Pt)}function be(Ut,Pt,Gt){if(typeof Pt=="string"&&Pt!==""||typeof Pt=="number"||typeof Pt=="bigint")return Pt=vc(""+Pt,Ut.mode,Gt),Pt.return=Ut,Pt;if(typeof Pt=="object"&&Pt!==null){switch(Pt.$$typeof){case g:return Gt=Js(Pt.type,Pt.key,Pt.props,null,Ut.mode,Gt),Ln(Gt,Pt),Gt.return=Ut,Gt;case C:return Pt=Hl(Pt,Ut.mode,Gt),Pt.return=Ut,Pt;case xt:return Pt=Yt(Pt),be(Ut,Pt,Gt)}if(Lt(Pt)||ct(Pt))return Pt=$a(Pt,Ut.mode,Gt,null),Pt.return=Ut,Pt;if(typeof Pt.then=="function")return be(Ut,Ye(Pt),Gt);if(Pt.$$typeof===V)return be(Ut,kc(Ut,Pt),Gt);en(Ut,Pt)}return null}function Jt(Ut,Pt,Gt,he){var kn=Pt!==null?Pt.key:null;if(typeof Gt=="string"&&Gt!==""||typeof Gt=="number"||typeof Gt=="bigint")return kn!==null?null:et(Ut,Pt,""+Gt,he);if(typeof Gt=="object"&&Gt!==null){switch(Gt.$$typeof){case g:return Gt.key===kn?Tt(Ut,Pt,Gt,he):null;case C:return Gt.key===kn?Kt(Ut,Pt,Gt,he):null;case xt:return Gt=Yt(Gt),Jt(Ut,Pt,Gt,he)}if(Lt(Gt)||ct(Gt))return kn!==null?null:ae(Ut,Pt,Gt,he,null);if(typeof Gt.then=="function")return Jt(Ut,Pt,Ye(Gt),he);if(Gt.$$typeof===V)return Jt(Ut,Pt,kc(Ut,Gt),he);en(Ut,Gt)}return null}function ee(Ut,Pt,Gt,he,kn){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Ut=Ut.get(Gt)||null,et(Pt,Ut,""+he,kn);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case g:return Ut=Ut.get(he.key===null?Gt:he.key)||null,Tt(Pt,Ut,he,kn);case C:return Ut=Ut.get(he.key===null?Gt:he.key)||null,Kt(Pt,Ut,he,kn);case xt:return he=Yt(he),ee(Ut,Pt,Gt,he,kn)}if(Lt(he)||ct(he))return Ut=Ut.get(Gt)||null,ae(Pt,Ut,he,kn,null);if(typeof he.then=="function")return ee(Ut,Pt,Gt,Ye(he),kn);if(he.$$typeof===V)return ee(Ut,Pt,Gt,kc(Pt,he),kn);en(Pt,he)}return null}function sn(Ut,Pt,Gt,he){for(var kn=null,Cr=null,pn=Pt,Jn=Pt=0,yr=null;pn!==null&&Jn<Gt.length;Jn++){pn.index>Jn?(yr=pn,pn=null):yr=pn.sibling;var Er=Jt(Ut,pn,Gt[Jn],he);if(Er===null){pn===null&&(pn=yr);break}o&&pn&&Er.alternate===null&&a(Ut,pn),Pt=S(Er,Pt,Jn),Cr===null?kn=Er:Cr.sibling=Er,Cr=Er,pn=yr}if(Jn===Gt.length)return u(Ut,pn),er&&xi(Ut,Jn),kn;if(pn===null){for(;Jn<Gt.length;Jn++)pn=be(Ut,Gt[Jn],he),pn!==null&&(Pt=S(pn,Pt,Jn),Cr===null?kn=pn:Cr.sibling=pn,Cr=pn);return er&&xi(Ut,Jn),kn}for(pn=h(pn);Jn<Gt.length;Jn++)yr=ee(pn,Ut,Jn,Gt[Jn],he),yr!==null&&(o&&yr.alternate!==null&&pn.delete(yr.key===null?Jn:yr.key),Pt=S(yr,Pt,Jn),Cr===null?kn=yr:Cr.sibling=yr,Cr=yr);return o&&pn.forEach(function(qu){return a(Ut,qu)}),er&&xi(Ut,Jn),kn}function Dn(Ut,Pt,Gt,he){if(Gt==null)throw Error(r(151));for(var kn=null,Cr=null,pn=Pt,Jn=Pt=0,yr=null,Er=Gt.next();pn!==null&&!Er.done;Jn++,Er=Gt.next()){pn.index>Jn?(yr=pn,pn=null):yr=pn.sibling;var qu=Jt(Ut,pn,Er.value,he);if(qu===null){pn===null&&(pn=yr);break}o&&pn&&qu.alternate===null&&a(Ut,pn),Pt=S(qu,Pt,Jn),Cr===null?kn=qu:Cr.sibling=qu,Cr=qu,pn=yr}if(Er.done)return u(Ut,pn),er&&xi(Ut,Jn),kn;if(pn===null){for(;!Er.done;Jn++,Er=Gt.next())Er=be(Ut,Er.value,he),Er!==null&&(Pt=S(Er,Pt,Jn),Cr===null?kn=Er:Cr.sibling=Er,Cr=Er);return er&&xi(Ut,Jn),kn}for(pn=h(pn);!Er.done;Jn++,Er=Gt.next())Er=ee(pn,Ut,Jn,Er.value,he),Er!==null&&(o&&Er.alternate!==null&&pn.delete(Er.key===null?Jn:Er.key),Pt=S(Er,Pt,Jn),Cr===null?kn=Er:Cr.sibling=Er,Cr=Er);return o&&pn.forEach(function(R6){return a(Ut,R6)}),er&&xi(Ut,Jn),kn}function Kr(Ut,Pt,Gt,he){if(typeof Gt=="object"&&Gt!==null&&Gt.type===M&&Gt.key===null&&(Gt=Gt.props.children),typeof Gt=="object"&&Gt!==null){switch(Gt.$$typeof){case g:t:{for(var kn=Gt.key;Pt!==null;){if(Pt.key===kn){if(kn=Gt.type,kn===M){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===kn||typeof kn=="object"&&kn!==null&&kn.$$typeof===xt&&Yt(kn)===Pt.type){u(Ut,Pt.sibling),he=x(Pt,Gt.props),Ln(he,Gt),he.return=Ut,Ut=he;break t}u(Ut,Pt);break}else a(Ut,Pt);Pt=Pt.sibling}Gt.type===M?(he=$a(Gt.props.children,Ut.mode,he,Gt.key),he.return=Ut,Ut=he):(he=Js(Gt.type,Gt.key,Gt.props,null,Ut.mode,he),Ln(he,Gt),he.return=Ut,Ut=he)}return O(Ut);case C:t:{for(kn=Gt.key;Pt!==null;){if(Pt.key===kn)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=Hl(Gt,Ut.mode,he),he.return=Ut,Ut=he}return O(Ut);case xt:return Gt=Yt(Gt),Kr(Ut,Pt,Gt,he)}if(Lt(Gt))return sn(Ut,Pt,Gt,he);if(ct(Gt)){if(kn=ct(Gt),typeof kn!="function")throw Error(r(150));return Gt=kn.call(Gt),Dn(Ut,Pt,Gt,he)}if(typeof Gt.then=="function")return Kr(Ut,Pt,Ye(Gt),he);if(Gt.$$typeof===V)return Kr(Ut,Pt,kc(Ut,Gt),he);en(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=vc(Gt,Ut.mode,he),he.return=Ut,Ut=he),O(Ut)):u(Ut,Pt)}return function(Ut,Pt,Gt,he){try{Je=0;var kn=Kr(Ut,Pt,Gt,he);return ye=null,kn}catch(pn){if(pn===Dt||pn===ht)throw pn;var Cr=yo(29,pn,null,Ut.mode);return Cr.lanes=he,Cr.return=Ut,Cr}}}var zr=Zn(!0),Bn=Zn(!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 ei(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,(Lr&2)!==0){var x=h.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),h.pending=a,a=ro(o),bc(o,null,u),a}return yc(o,h,a,u),ro(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 ji(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 zi=!1;function Or(){if(zi){var o=v;if(o!==null)throw o}}function ni(o,a,u,h){zi=!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 Tt=et,Kt=Tt.next;Tt.next=null,O===null?S=Kt:O.next=Kt,O=Tt;var ae=o.alternate;ae!==null&&(ae=ae.updateQueue,et=ae.lastBaseUpdate,et!==O&&(et===null?ae.firstBaseUpdate=Kt:et.next=Kt,ae.lastBaseUpdate=Tt))}if(S!==null){var be=x.baseState;O=0,ae=Kt=Tt=null,et=S;do{var Jt=et.lane&-536870913,ee=Jt!==et.lane;if(ee?(gr&Jt)===Jt:(h&Jt)===Jt){Jt!==0&&Jt===m&&(zi=!0),ae!==null&&(ae=ae.next={lane:0,tag:et.tag,payload:et.payload,callback:null,next:null});t:{var sn=o,Dn=et;Jt=a;var Kr=u;switch(Dn.tag){case 1:if(sn=Dn.payload,typeof sn=="function"){be=sn.call(Kr,be,Jt);break t}be=sn;break t;case 3:sn.flags=sn.flags&-65537|128;case 0:if(sn=Dn.payload,Jt=typeof sn=="function"?sn.call(Kr,be,Jt):sn,Jt==null)break t;be=y({},be,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,Tt=be):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&&(Tt=be),x.baseState=Tt,x.firstBaseUpdate=Kt,x.lastBaseUpdate=ae,S===null&&(x.shared.lanes=0),Ru|=O,o.lanes=O,o.memoizedState=be}}function Bi(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function ri(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)Bi(u[o],a)}var Un=K(null),wn=K(0);function _r(o,a){o=au,Y(wn,o),Y(Un,a),au=o|a.baseLanes}function nr(){Y(wn,au),Y(Un,Un.current)}function w(){au=wn.current,P(Un),P(wn)}var k=K(null),_=null;function N(o){var a=o.alternate;Y(Z,Z.current&1),Y(k,o),_===null&&(a===null||Un.current!==null||a.memoizedState!==null)&&(_=o)}function j(o){Y(Z,Z.current),Y(k,o),_===null&&(_=o)}function G(o){o.tag===22?(Y(Z,Z.current),Y(k,o),_===null&&(_=o)):nt()}function nt(){Y(Z,Z.current),Y(k,k.current)}function z(o){P(k),_===o&&(_=null),P(Z)}var Z=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||m1(u)||g1(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 ot=0,it=null,I=null,Ct=null,It=!1,St=!1,Et=!1,vt=0,Bt=0,Vt=null,me=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(!no(o[u],a[u]))return!1;return!0}function Ze(o,a,u,h,x,S){return ot=S,it=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,dt.H=o===null||o.memoizedState===null?ub:C0,Et=!1,S=u(h,x),Et=!1,St&&(S=fe(a,u,h,x)),En(o),S}function En(o){dt.H=uh;var a=I!==null&&I.next!==null;if(ot=0,Ct=I=it=null,It=!1,Bt=0,Vt=null,a)throw Error(r(300));o===null||vo||(o=o.dependencies,o!==null&&Xc(o)&&(vo=!0))}function fe(o,a,u,h){it=o;var x=0;do{if(St&&(Vt=null),Bt=0,St=!1,25<=x)throw Error(r(301));if(x+=1,Ct=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=fb,S=a(u,h)}while(St);return S}function Xe(){var o=dt.H,a=o.useState()[0];return a=typeof a.then=="function"?Ae(a):a,o=o.useState()[0],(I!==null?I.memoizedState:null)!==o&&(it.flags|=1024),a}function Se(){var o=vt!==0;return vt=0,o}function Tn(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function $t(o){if(It){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}It=!1}ot=0,Ct=I=it=null,St=!1,Bt=vt=0,Vt=null}function Le(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?it.memoizedState=Ct=o:Ct=Ct.next=o,Ct}function Be(){if(I===null){var o=it.alternate;o=o!==null?o.memoizedState:null}else o=I.next;var a=Ct===null?it.memoizedState:Ct.next;if(a!==null)Ct=a,I=o;else{if(o===null)throw it.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},Ct===null?it.memoizedState=Ct=o:Ct=Ct.next=o}return Ct}function Fe(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ae(o){var a=Bt;return Bt+=1,Vt===null&&(Vt=[]),o=re(Vt,o,a),a=it,(Ct===null?a.memoizedState:Ct.next)===null&&(a=a.alternate,dt.H=a===null||a.memoizedState===null?ub:C0),o}function _n(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Ae(o);if(o.$$typeof===V)return Di(o)}throw Error(r(438,String(o)))}function qe(o){var a=null,u=it.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=it.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(),it.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 rr(o,a){return typeof a=="function"?a(o):a}function lr(o){var a=Be();return xr(a,I,o)}function xr(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,Tt=null,Kt=a,ae=!1;do{var be=Kt.lane&-536870913;if(be!==Kt.lane?(gr&be)===be:(ot&be)===be){var Jt=Kt.revertLane;if(Jt===0)Tt!==null&&(Tt=Tt.next={lane:0,revertLane:0,gesture:null,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null}),be===m&&(ae=!0);else if((ot&Jt)===Jt){Kt=Kt.next,Jt===m&&(ae=!0);continue}else be={lane:0,revertLane:Kt.revertLane,gesture:null,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null},Tt===null?(et=Tt=be,O=S):Tt=Tt.next=be,it.lanes|=Jt,Ru|=Jt;be=Kt.action,Et&&u(S,be),S=Kt.hasEagerState?Kt.eagerState:u(S,be)}else Jt={lane:be,revertLane:Kt.revertLane,gesture:Kt.gesture,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null},Tt===null?(et=Tt=Jt,O=S):Tt=Tt.next=Jt,it.lanes|=be,Ru|=be;Kt=Kt.next}while(Kt!==null&&Kt!==a);if(Tt===null?O=S:Tt.next=et,!no(S,o.memoizedState)&&(vo=!0,ae&&(u=v,u!==null)))throw u;o.memoizedState=S,o.baseState=O,o.baseQueue=Tt,h.lastRenderedState=S}return x===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function ii(o){var a=Be(),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);no(S,a.memoizedState)||(vo=!0),a.memoizedState=S,a.baseQueue===null&&(a.baseState=S),u.lastRenderedState=S}return[S,h]}function Wr(o,a,u){var h=it,x=Be(),S=er;if(S){if(u===void 0)throw Error(r(407));u=u()}else u=a();var O=!no((I||x).memoizedState,u);if(O&&(x.memoizedState=u,vo=!0),x=x.queue,wr(vi.bind(null,h,x,o),[o]),x.getSnapshot!==a||O||Ct!==null&&Ct.memoizedState.tag&1){if(h.flags|=2048,oo(9,{destroy:void 0},Mr.bind(null,h,x,u,a),null),oi===null)throw Error(r(349));S||(ot&127)!==0||mr(h,a,u)}return u}function mr(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=it.updateQueue,a===null?(a=Fe(),it.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function Mr(o,a,u,h){a.value=u,a.getSnapshot=h,xo(a)&&Kc(o)}function vi(o,a,u){return u(function(){xo(a)&&Kc(o)})}function xo(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!no(o,u)}catch{return!0}}function Kc(o){var a=ya(o,2);a!==null&&Ea(a,o,2)}function na(o){var a=Le();if(typeof o=="function"){var u=o;if(o=u(),Et){dn(!0);try{u()}finally{dn(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:o},a}function Af(o,a,u,h){return o.baseState=u,xr(o,I,typeof h=="function"?h:rr)}function Nu(o,a,u,h,x){if(_p(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,Xl(a,S)):(S.next=u.next,a.pending=u.next=S)}}function Xl(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),Tt=dt.S;Tt!==null&&Tt(O,et),Jc(o,a,et)}catch(Kt){ml(o,a,Kt)}finally{S!==null&&O.types!==null&&(S.types=O.types),dt.T=S}}else try{S=u(x,h),Jc(o,a,S)}catch(Kt){ml(o,a,Kt)}}function Jc(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){_u(o,a,h)},function(h){return ml(o,a,h)}):_u(o,a,u)}function _u(o,a,u){a.status="fulfilled",a.value=u,Zc(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,Xl(o,u)))}function ml(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,Zc(a),a=a.next;while(a!==h)}o.action=null}function Zc(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function Qc(o,a){return a}function Xr(o,a){if(er){var u=oi.formState;if(u!==null){t:{var h=it;if(er){if(Rr){e:{for(var x=Rr,S=ti;x.nodeType!==8;){if(!S){x=null;break e}if(x=bl(x.nextSibling),x===null){x=null;break e}}S=x.data,x=S==="F!"||S==="F"?x:null}if(x){Rr=bl(x.nextSibling),h=x.data==="F!";break t}}ta(h)}h=!1}h&&(a=u[0])}}return u=Le(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qc,lastRenderedState:a},u.queue=h,u=ab.bind(null,it,h),h.dispatch=u,h=na(!1),S=M0.bind(null,it,!1,h.queue),h=Le(),x={state:a,dispatch:null,action:o,pending:null},h.queue=x,u=Nu.bind(null,it,x,S,u),x.dispatch=u,h.memoizedState=o,[a,u,!1]}function Bo(o){var a=Be();return Br(a,I,o)}function Br(o,a,u){if(a=xr(o,a,Qc)[0],o=lr(rr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Ae(a)}catch(O){throw O===Dt?ht:O}else h=a;a=Be();var x=a.queue,S=x.dispatch;return u!==a.memoizedState&&(it.flags|=2048,oo(9,{destroy:void 0},Lo.bind(null,x,u),null)),[h,S,o]}function Lo(o,a){o.action=a}function Ps(o){var a=Be(),u=I;if(u!==null)return Br(a,u,o);Be(),a=a.memoizedState,u=Be();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function oo(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=it.updateQueue,a===null&&(a=Fe(),it.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 Pr(){return Be().memoizedState}function Fr(o,a,u,h){var x=Le();it.flags|=o,x.memoizedState=oo(1|a,{destroy:void 0},u,h===void 0?null:h)}function Sa(o,a,u,h){var x=Be();h=h===void 0?null:h;var S=x.memoizedState.inst;I!==null&&h!==null&&Ee(h,I.memoizedState.deps)?x.memoizedState=oo(a,S,u,h):(it.flags|=o,x.memoizedState=oo(1|a,S,u,h))}function tu(o,a){Fr(8390656,8,o,a)}function wr(o,a){Sa(2048,8,o,a)}function fs(o){it.flags|=4;var a=it.updateQueue;if(a===null)a=Fe(),it.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function gl(o){var a=Be().memoizedState;return fs({ref:a,nextImpl:o}),function(){if((Lr&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Mf(o,a){return Sa(4,2,o,a)}function ih(o,a){return Sa(4,4,o,a)}function oh(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 yl(o,a,u){u=u!=null?u.concat([o]):null,Sa(4,4,oh.bind(null,a,o),u)}function ra(){}function Ep(o,a){var u=Be();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 Tp(o,a){var u=Be();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&Ee(a,h[1]))return h[0];if(h=o(),Et){dn(!0);try{o()}finally{dn(!1)}}return u.memoizedState=[h,a],h}function sh(o,a,u){return u===void 0||(ot&1073741824)!==0&&(gr&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=ex(),it.lanes|=o,Ru|=o,u)}function Np(o,a,u,h){return no(u,a)?u:Un.current!==null?(o=sh(o,u,h),no(o,a)||(vo=!0),o):(ot&42)===0||(ot&1073741824)!==0&&(gr&261930)===0?(vo=!0,o.memoizedState=u):(o=ex(),it.lanes|=o,Ru|=o,a)}function ah(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,M0(o,!1,a,u);try{var Tt=x(),Kt=dt.S;if(Kt!==null&&Kt(et,Tt),Tt!==null&&typeof Tt=="object"&&typeof Tt.then=="function"){var ae=F(Tt,h);ch(o,a,ae,Ga(o))}else ch(o,a,h,Ga(o))}catch(be){ch(o,a,{then:function(){},status:"rejected",reason:be},Ga())}finally{st.p=S,O!==null&&et.types!==null&&(O.types=et.types),dt.T=O}}function k0(){}function lh(o,a,u,h){if(o.tag!==5)throw Error(r(476));var x=rb(o).queue;ah(o,x,a,lt,u===null?k0:function(){return ib(o),u(h)})}function rb(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:rr,lastRenderedState:lt},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function ib(o){var a=rb(o);a.next===null&&(a=o.alternate.memoizedState),ch(o,a.next.queue,{},Ga())}function A0(){return Di(Ch)}function ob(){return Be().memoizedState}function sb(){return Be().memoizedState}function NC(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=Ga();o=Mn(u);var h=jn(a,o,u);h!==null&&(Ea(h,a,u),kr(h,a,u)),a={cache:wa()},o.payload=a;return}a=a.return}}function _C(o,a,u){var h=Ga();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},_p(o)?lb(a,u):(u=Uc(o,a,u,h),u!==null&&(Ea(u,o,h),cb(u,a,h)))}function ab(o,a,u){var h=Ga();ch(o,a,u,h)}function ch(o,a,u,h){var x={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(_p(o))lb(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,no(et,O))return yc(o,a,x,0),oi===null&&gc(),!1}catch{}if(u=Uc(o,a,x,h),u!==null)return Ea(u,o,h),cb(u,a,h),!0}return!1}function M0(o,a,u,h){if(h={lane:2,revertLane:r1(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},_p(o)){if(a)throw Error(r(479))}else a=Uc(o,u,h,2),a!==null&&Ea(a,o,2)}function _p(o){var a=o.alternate;return o===it||a!==null&&a===it}function lb(o,a){St=It=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function cb(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,Xt(o,u)}}var uh={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};uh.useEffectEvent=se;var ub={readContext:Di,use:_n,useCallback:function(o,a){return Le().memoizedState=[o,a===void 0?null:a],o},useContext:Di,useEffect:tu,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,Fr(4194308,4,oh.bind(null,a,o),u)},useLayoutEffect:function(o,a){return Fr(4194308,4,o,a)},useInsertionEffect:function(o,a){Fr(4,2,o,a)},useMemo:function(o,a){var u=Le();a=a===void 0?null:a;var h=o();if(Et){dn(!0);try{o()}finally{dn(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=Le();if(u!==void 0){var x=u(a);if(Et){dn(!0);try{u(a)}finally{dn(!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=_C.bind(null,it,o),[h.memoizedState,o]},useRef:function(o){var a=Le();return o={current:o},a.memoizedState=o},useState:function(o){o=na(o);var a=o.queue,u=ab.bind(null,it,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:ra,useDeferredValue:function(o,a){var u=Le();return sh(u,o,a)},useTransition:function(){var o=na(!1);return o=ah.bind(null,it,o.queue,!0,!1),Le().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=it,x=Le();if(er){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),oi===null)throw Error(r(349));(gr&127)!==0||mr(h,a,u)}x.memoizedState=u;var S={value:u,getSnapshot:a};return x.queue=S,tu(vi.bind(null,h,S,o),[o]),h.flags|=2048,oo(9,{destroy:void 0},Mr.bind(null,h,S,u,a),null),u},useId:function(){var o=Le(),a=oi.identifierPrefix;if(er){var u=cs,h=ls;u=(h&~(1<<32-Vn(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=vt++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=me++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:A0,useFormState:Xr,useActionState:Xr,useOptimistic:function(o){var a=Le();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=M0.bind(null,it,!0,u),u.dispatch=a,[o,a]},useMemoCache:qe,useCacheRefresh:function(){return Le().memoizedState=NC.bind(null,it)},useEffectEvent:function(o){var a=Le(),u={impl:o};return a.memoizedState=u,function(){if((Lr&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},C0={readContext:Di,use:_n,useCallback:Ep,useContext:Di,useEffect:wr,useImperativeHandle:yl,useInsertionEffect:Mf,useLayoutEffect:ih,useMemo:Tp,useReducer:lr,useRef:Pr,useState:function(){return lr(rr)},useDebugValue:ra,useDeferredValue:function(o,a){var u=Be();return Np(u,I.memoizedState,o,a)},useTransition:function(){var o=lr(rr)[0],a=Be().memoizedState;return[typeof o=="boolean"?o:Ae(o),a]},useSyncExternalStore:Wr,useId:ob,useHostTransitionStatus:A0,useFormState:Bo,useActionState:Bo,useOptimistic:function(o,a){var u=Be();return Af(u,I,o,a)},useMemoCache:qe,useCacheRefresh:sb};C0.useEffectEvent=gl;var fb={readContext:Di,use:_n,useCallback:Ep,useContext:Di,useEffect:wr,useImperativeHandle:yl,useInsertionEffect:Mf,useLayoutEffect:ih,useMemo:Tp,useReducer:ii,useRef:Pr,useState:function(){return ii(rr)},useDebugValue:ra,useDeferredValue:function(o,a){var u=Be();return I===null?sh(u,o,a):Np(u,I.memoizedState,o,a)},useTransition:function(){var o=ii(rr)[0],a=Be().memoizedState;return[typeof o=="boolean"?o:Ae(o),a]},useSyncExternalStore:Wr,useId:ob,useHostTransitionStatus:A0,useFormState:Ps,useActionState:Ps,useOptimistic:function(o,a){var u=Be();return I!==null?Af(u,I,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:qe,useCacheRefresh:sb};fb.useEffectEvent=gl;function E0(o,a,u,h){a=o.memoizedState,u=u(h,a),u=u==null?a:y({},a,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var T0={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=Ga(),x=Mn(h);x.payload=a,u!=null&&(x.callback=u),a=jn(o,x,h),a!==null&&(Ea(a,o,h),kr(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=Ga(),x=Mn(h);x.tag=1,x.payload=a,u!=null&&(x.callback=u),a=jn(o,x,h),a!==null&&(Ea(a,o,h),kr(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=Ga(),h=Mn(u);h.tag=2,a!=null&&(h.callback=a),a=jn(o,h,u),a!==null&&(Ea(a,o,u),kr(a,o,u))}};function db(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?!Xs(u,h)||!Xs(x,S):!0}function hb(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&&T0.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=y({},u));for(var x in o)u[x]===void 0&&(u[x]=o[x])}return u}function pb(o){mc(o)}function mb(o){console.error(o)}function gb(o){mc(o)}function Lp(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function yb(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 N0(o,a,u){return u=Mn(u),u.tag=3,u.payload={element:null},u.callback=function(){Lp(o,a)},u}function bb(o){return o=Mn(o),o.tag=3,o}function xb(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(){yb(a,u,h)}}var O=u.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(o.callback=function(){yb(a,u,h),typeof x!="function"&&(Ou===null?Ou=new Set([this]):Ou.add(this));var et=h.stack;this.componentDidCatch(h.value,{componentStack:et!==null?et:""})})}function LC(o,a,u,h,x){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&va(a,u,x,!0),u=k.current,u!==null){switch(u.tag){case 31:case 13:return _===null?qp():u.alternate===null&&Xi===0&&(Xi=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),t1(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)),t1(o,h,x)),!1}throw Error(r(435,u.tag))}return t1(o,h,x),qp(),!1}if(er)return a=k.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,h!==Qs&&(o=Error(r(422),{cause:h}),Sc(bo(o,u)))):(h!==Qs&&(a=Error(r(423),{cause:h}),Sc(bo(a,u))),o=o.current.alternate,o.flags|=65536,x&=-x,o.lanes|=x,h=bo(h,u),x=N0(o.stateNode,h,x),ji(o,x),Xi!==4&&(Xi=2)),!1;var S=Error(r(520),{cause:h});if(S=bo(S,u),bh===null?bh=[S]:bh.push(S),Xi!==4&&(Xi=2),a===null)return!0;h=bo(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=x&-x,u.lanes|=o,o=N0(u.stateNode,h,o),ji(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"&&(Ou===null||!Ou.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=bb(x),xb(x,o,u,h),ji(u,x),!1}u=u.return}while(u!==null);return!1}var _0=Error(r(461)),vo=!1;function ds(o,a,u,h){a.child=o===null?Bn(a,null,u,h):zr(a,o.child,u,h)}function vb(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 hl(a),h=Ze(o,a,u,O,S,x),et=Se(),o!==null&&!vo?(Tn(o,a,x),eu(o,a,x)):(er&&et&&Zs(a),a.flags|=1,ds(o,a,h,x),a.child)}function wb(o,a,u,h,x){if(o===null){var S=u.type;return typeof S=="function"&&!qc(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,Sb(o,a,S,h,x)):(o=Js(u.type,null,h,a,a.mode,x),o.ref=a.ref,o.return=a,a.child=o)}if(S=o.child,!z0(o,x)){var O=S.memoizedProps;if(u=u.compare,u=u!==null?u:Xs,u(O,h)&&o.ref===a.ref)return eu(o,a,x)}return a.flags|=1,o=is(S,h),o.ref=a.ref,o.return=a,a.child=o}function Sb(o,a,u,h,x){if(o!==null){var S=o.memoizedProps;if(Xs(S,h)&&o.ref===a.ref)if(vo=!1,a.pendingProps=h=S,z0(o,x))(o.flags&131072)!==0&&(vo=!0);else return a.lanes=o.lanes,eu(o,a,x)}return L0(o,a,u,h,x)}function kb(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 Ab(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?_r(a,S):nr(),G(a);else return h=a.lanes=536870912,Ab(o,a,S!==null?S.baseLanes|u:u,u,h)}else S!==null?(at(a,S.cachePool),_r(a,S),nt(),a.memoizedState=null):(o!==null&&at(a,null),nr(),nt());return ds(o,a,x,u),a.child}function fh(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Ab(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),nr(),G(a),o!==null&&va(o,a,h,!0),a.childLanes=x,null}function Dp(o,a){return a=Op({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Mb(o,a,u){return zr(a,o.child,null,u),o=Dp(a,a.pendingProps),o.flags|=2,z(a),a.memoizedState=null,o}function DC(o,a,u){var h=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(er){if(h.mode==="hidden")return o=Dp(a,h),a.lanes=536870912,fh(null,o);if(j(a),(o=Rr)?(o=jx(o,ti),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Ya!==null?{id:ls,overflow:cs}:null,retryLane:536870912,hydrationErrors:null},u=$c(o),u.return=a,a.child=u,io=a,Rr=null)):o=null,o===null)throw ta(a);return a.lanes=536870912,null}return Dp(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=Mb(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(vo||va(o,a,u,!1),x=(u&o.childLanes)!==0,vo||x){if(h=oi,h!==null&&(O=Ei(h,u),O!==0&&O!==S.retryLane))throw S.retryLane=O,ya(o,O),Ea(h,o,O),_0;qp(),a=Mb(o,a,u)}else o=S.treeContext,Rr=bl(O.nextSibling),io=a,er=!0,_o=null,ti=!1,o!==null&&ld(a,o),a=Dp(a,h),a.flags|=4096;return a}return o=is(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function Rp(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 L0(o,a,u,h,x){return hl(a),u=Ze(o,a,u,h,void 0,x),h=Se(),o!==null&&!vo?(Tn(o,a,x),eu(o,a,x)):(er&&h&&Zs(a),a.flags|=1,ds(o,a,u,x),a.child)}function Cb(o,a,u,h,x,S){return hl(a),a.updateQueue=null,u=fe(a,h,u,x),En(o),h=Se(),o!==null&&!vo?(Tn(o,a,S),eu(o,a,S)):(er&&h&&Zs(a),a.flags|=1,ds(o,a,u,S),a.child)}function Eb(o,a,u,h,x){if(hl(a),a.stateNode===null){var S=Vi,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=T0,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):Vi,S.state=a.memoizedState,O=u.getDerivedStateFromProps,typeof O=="function"&&(E0(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&&T0.enqueueReplaceState(S,S.state,null),ni(a,h,S,x),Or(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){S=a.stateNode;var et=a.memoizedProps,Tt=Cf(u,et);S.props=Tt;var Kt=S.context,ae=u.contextType;O=Vi,typeof ae=="object"&&ae!==null&&(O=Di(ae));var be=u.getDerivedStateFromProps;ae=typeof be=="function"||typeof S.getSnapshotBeforeUpdate=="function",et=a.pendingProps!==et,ae||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(et||Kt!==O)&&hb(a,S,h,O),Ve=!1;var Jt=a.memoizedState;S.state=Jt,ni(a,h,S,x),Or(),Kt=a.memoizedState,et||Jt!==Kt||Ve?(typeof be=="function"&&(E0(a,u,be,h),Kt=a.memoizedState),(Tt=Ve||db(a,u,Tt,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=Tt):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{S=a.stateNode,ei(o,a),O=a.memoizedProps,ae=Cf(u,O),S.props=ae,be=a.pendingProps,Jt=S.context,Kt=u.contextType,Tt=Vi,typeof Kt=="object"&&Kt!==null&&(Tt=Di(Kt)),et=u.getDerivedStateFromProps,(Kt=typeof et=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(O!==be||Jt!==Tt)&&hb(a,S,h,Tt),Ve=!1,Jt=a.memoizedState,S.state=Jt,ni(a,h,S,x),Or();var ee=a.memoizedState;O!==be||Jt!==ee||Ve||o!==null&&o.dependencies!==null&&Xc(o.dependencies)?(typeof et=="function"&&(E0(a,u,et,h),ee=a.memoizedState),(ae=Ve||db(a,u,ae,h,Jt,ee,Tt)||o!==null&&o.dependencies!==null&&Xc(o.dependencies))?(Kt||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(h,ee,Tt),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(h,ee,Tt)),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=Tt,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,Rp(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=zr(a,o.child,null,x),a.child=zr(a,null,u,x)):ds(o,a,u,x),a.memoizedState=S.state,o=a.child):o=eu(o,a,x),o}function Tb(o,a,u,h){return ba(),a.flags|=256,ds(o,a,u,h),a.child}var D0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function R0(o){return{baseLanes:o,cachePool:pt()}}function O0(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=Xa),o}function Nb(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:(Z.current&2)!==0),O&&(x=!0,a.flags&=-129),O=(a.flags&32)!==0,a.flags&=-33,o===null){if(er){if(x?N(a):nt(),(o=Rr)?(o=jx(o,ti),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Ya!==null?{id:ls,overflow:cs}:null,retryLane:536870912,hydrationErrors:null},u=$c(o),u.return=a,a.child=u,io=a,Rr=null)):o=null,o===null)throw ta(a);return g1(o)?a.lanes=32:a.lanes=536870912,null}var et=h.children;return h=h.fallback,x?(nt(),x=a.mode,et=Op({mode:"hidden",children:et},x),h=$a(h,x,u,null),et.return=a,h.return=a,et.sibling=h,a.child=et,h=a.child,h.memoizedState=R0(u),h.childLanes=O0(o,O,u),a.memoizedState=D0,fh(null,h)):(N(a),P0(a,et))}var Tt=o.memoizedState;if(Tt!==null&&(et=Tt.dehydrated,et!==null)){if(S)a.flags&256?(N(a),a.flags&=-257,a=I0(o,a,u)):a.memoizedState!==null?(nt(),a.child=o.child,a.flags|=128,a=null):(nt(),et=h.fallback,x=a.mode,h=Op({mode:"visible",children:h.children},x),et=$a(et,x,u,null),et.flags|=2,h.return=a,et.return=a,h.sibling=et,a.child=h,zr(a,o.child,null,u),h=a.child,h.memoizedState=R0(u),h.childLanes=O0(o,O,u),a.memoizedState=D0,a=fh(null,h));else if(N(a),g1(et)){if(O=et.nextSibling&&et.nextSibling.dataset,O)var Kt=O.dgst;O=Kt,h=Error(r(419)),h.stack="",h.digest=O,Sc({value:h,source:null,stack:null}),a=I0(o,a,u)}else if(vo||va(o,a,u,!1),O=(u&o.childLanes)!==0,vo||O){if(O=oi,O!==null&&(h=Ei(O,u),h!==0&&h!==Tt.retryLane))throw Tt.retryLane=h,ya(o,h),Ea(O,o,h),_0;m1(et)||qp(),a=I0(o,a,u)}else m1(et)?(a.flags|=192,a.child=o.child,a=null):(o=Tt.treeContext,Rr=bl(et.nextSibling),io=a,er=!0,_o=null,ti=!1,o!==null&&ld(a,o),a=P0(a,h.children),a.flags|=4096);return a}return x?(nt(),et=h.fallback,x=a.mode,Tt=o.child,Kt=Tt.sibling,h=is(Tt,{mode:"hidden",children:h.children}),h.subtreeFlags=Tt.subtreeFlags&65011712,Kt!==null?et=is(Kt,et):(et=$a(et,x,u,null),et.flags|=2),et.return=a,h.return=a,h.sibling=et,a.child=h,fh(null,h),h=a.child,et=o.child.memoizedState,et===null?et=R0(u):(x=et.cachePool,x!==null?(Tt=Vr._currentValue,x=x.parent!==Tt?{parent:Tt,pool:Tt}:x):x=pt(),et={baseLanes:et.baseLanes|u,cachePool:x}),h.memoizedState=et,h.childLanes=O0(o,O,u),a.memoizedState=D0,fh(o.child,h)):(N(a),u=o.child,o=u.sibling,u=is(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 P0(o,a){return a=Op({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function Op(o,a){return o=yo(22,o,null,a),o.lanes=0,o}function I0(o,a,u){return zr(a,o.child,null,u),o=P0(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function _b(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),Vl(o.return,a,u)}function j0(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=Z.current,et=(O&2)!==0;if(et?(O=O&1|2,a.flags|=128):O&=1,Y(Z,O),ds(o,a,h,u),h=er?wc:0,!et&&o!==null&&(o.flags&128)!==0)t:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&_b(o,u,a);else if(o.tag===19)_b(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),j0(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}j0(a,!0,u,null,S,h);break;case"together":j0(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function eu(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),Ru|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(va(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=is(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=is(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function z0(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&Xc(o)))}function RC(o,a,u){switch(a.tag){case 3:qt(a,a.stateNode.containerInfo),us(a,Vr,o.memoizedState.cache),ba();break;case 27:case 5:Zt(a);break;case 4:qt(a,a.stateNode.containerInfo);break;case 10:us(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?Nb(o,a,u):(N(a),o=eu(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||(va(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),Y(Z,Z.current),h)break;return null;case 22:return a.lanes=0,kb(o,a,u,a.pendingProps);case 24:us(a,Vr,o.memoizedState.cache)}return eu(o,a,u)}function Db(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)vo=!0;else{if(!z0(o,u)&&(a.flags&128)===0)return vo=!1,RC(o,a,u);vo=(o.flags&131072)!==0}else vo=!1,er&&(a.flags&1048576)!==0&&Vc(a,wc,a.index);switch(a.lanes=0,a.tag){case 16:t:{var h=a.pendingProps;if(o=Yt(a.elementType),a.type=o,typeof o=="function")qc(o)?(h=Cf(o,h),a.tag=1,a=Eb(null,a,o,h,u)):(a.tag=0,a=L0(null,a,o,h,u));else{if(o!=null){var x=o.$$typeof;if(x===W){a.tag=11,a=vb(null,a,o,h,u);break t}else if(x===kt){a.tag=14,a=wb(null,a,o,h,u);break t}}throw a=bt(o)||o,Error(r(306,a,""))}}return a;case 0:return L0(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,x=Cf(h,a.pendingProps),Eb(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,ei(o,a),ni(a,h,null,u);var O=a.memoizedState;if(h=O.cache,us(a,Vr,h),h!==S.cache&&Wi(a,[Vr],u,!0),Or(),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=Tb(o,a,h,u);break t}else if(h!==x){x=bo(Error(r(424)),a),Sc(x),a=Tb(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,Rr=bl(o.firstChild),io=a,er=!0,_o=null,ti=!0,u=Bn(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(ba(),h===x){a=eu(o,a,u);break t}ds(o,a,h,u)}a=a.child}return a;case 26:return Rp(o,a),o===null?(u=qx(a.type,null,a.pendingProps,null))?a.memoizedState=u:er||(u=a.type,o=a.pendingProps,h=Kp(wt.current).createElement(u),h[Ar]=a,h[or]=o,hs(h,u,o),fi(h),a.stateNode=h):a.memoizedState=qx(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Zt(a),o===null&&er&&(h=a.stateNode=Fx(a.type,a.pendingProps,wt.current),io=a,ti=!0,x=Rr,zu(a.type)?(y1=x,Rr=bl(h.firstChild)):Rr=x),ds(o,a,a.pendingProps.children,u),Rp(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&er&&((x=h=Rr)&&(h=c6(h,a.type,a.pendingProps,ti),h!==null?(a.stateNode=h,io=a,Rr=bl(h.firstChild),ti=!1,x=!0):x=!1),x||ta(a)),Zt(a),x=a.type,S=a.pendingProps,O=o!==null?o.memoizedProps:null,h=S.children,d1(x,S)?h=null:O!==null&&d1(x,O)&&(a.flags|=32),a.memoizedState!==null&&(x=Ze(o,a,Xe,null,null,u),Ch._currentValue=x),Rp(o,a),ds(o,a,h,u),a.child;case 6:return o===null&&er&&((o=u=Rr)&&(u=u6(u,a.pendingProps,ti),u!==null?(a.stateNode=u,io=a,Rr=null,o=!0):o=!1),o||ta(a)),null;case 13:return Nb(o,a,u);case 4:return qt(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=zr(a,null,h,u):ds(o,a,h,u),a.child;case 11:return vb(o,a,a.type,a.pendingProps,u);case 7:return ds(o,a,a.pendingProps,u),a.child;case 8:return ds(o,a,a.pendingProps.children,u),a.child;case 12:return ds(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,us(a,a.type,h.value),ds(o,a,h.children,u),a.child;case 9:return x=a.type._context,h=a.pendingProps.children,hl(a),x=Di(x),h=h(x),a.flags|=1,ds(o,a,h,u),a.child;case 14:return wb(o,a,a.type,a.pendingProps,u);case 15:return Sb(o,a,a.type,a.pendingProps,u);case 19:return Lb(o,a,u);case 31:return DC(o,a,u);case 22:return kb(o,a,u,a.pendingProps);case 24:return hl(a),h=Di(Vr),o===null?(x=Q(),x===null&&(x=oi,S=wa(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:h,cache:x},Oe(a),us(a,Vr,x)):((o.lanes&u)!==0&&(ei(o,a),ni(a,null,null,u),Or()),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),us(a,Vr,h)):(h=S.cache,us(a,Vr,h),h!==x.cache&&Wi(a,[Vr],u,!0))),ds(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function nu(o){o.flags|=4}function B0(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(ox())o.flags|=8192;else throw ne=Ot,Wt}else o.flags&=-16777217}function Rb(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Xx(a))if(ox())o.flags|=8192;else throw ne=Ot,Wt}function Pp(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?Hi():536870912,o.lanes|=a,hd|=a)}function dh(o,a){if(!er)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 OC(o,a,u){var h=a.pendingProps;switch(Yl(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),Os(Vr),Rt(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(Ii(a)?nu(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?(nu(a),S!==null?(wi(a),Rb(a,S)):(wi(a),B0(a,x,null,h,u))):S?S!==o.memoizedState?(nu(a),wi(a),Rb(a,S)):(wi(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&nu(a),wi(a),B0(a,x,o,h,u)),null;case 27:if(Me(a),u=wt.current,x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&nu(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return wi(a),null}o=tt.current,Ii(a)?dl(a):(o=Fx(x,h,u),a.stateNode=o,nu(a))}return wi(a),null;case 5:if(Me(a),x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&nu(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return wi(a),null}if(S=tt.current,Ii(a))dl(a);else{var O=Kp(wt.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[or]=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(hs(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&&nu(a)}}return wi(a),B0(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&nu(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=wt.current,Ii(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,x=io,x!==null)switch(x.tag){case 27:case 5:h=x.memoizedProps}o[Ar]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||Nx(o.nodeValue,u)),o||ta(a,!0)}else o=Kp(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=Ii(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 ba(),(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=Ii(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 ba(),(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),Pp(a,a.updateQueue),wi(a),null);case 4:return Rt(),o===null&&a1(a.stateNode.containerInfo),wi(a),null;case 10:return Os(a.type),wi(a),null;case 19:if(P(Z),h=a.memoizedState,h===null)return wi(a),null;if(x=(a.flags&128)!==0,S=h.rendering,S===null)if(x)dh(h,!1);else{if(Xi!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(S=ut(o),S!==null){for(a.flags|=128,dh(h,!1),o=S.updateQueue,a.updateQueue=o,Pp(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)xc(u,o),u=u.sibling;return Y(Z,Z.current&1|2),er&&xi(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&fn()>Fp&&(a.flags|=128,x=!0,dh(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,Pp(a,o),dh(h,!0),h.tail===null&&h.tailMode==="hidden"&&!S.alternate&&!er)return wi(a),null}else 2*fn()-h.renderingStartTime>Fp&&u!==536870912&&(a.flags|=128,x=!0,dh(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=fn(),o.sibling=null,u=Z.current,Y(Z,x?u&1|2:u&1),er&&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&&Pp(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),Os(Vr),wi(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function PC(o,a){switch(Yl(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Os(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 Me(a),null;case 31:if(a.memoizedState!==null){if(z(a),a.alternate===null)throw Error(r(340));ba()}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));ba()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return P(Z),null;case 4:return Rt(),null;case 10:return Os(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 Os(Vr),null;case 25:return null;default:return null}}function Ob(o,a){switch(Yl(a),a.tag){case 3:Os(Vr),Rt();break;case 26:case 27:case 5:Me(a);break;case 4:Rt();break;case 31:a.memoizedState!==null&&z(a);break;case 13:z(a);break;case 19:P(Z);break;case 10:Os(a.type);break;case 22:case 23:z(a),w(),o!==null&&P($);break;case 24:Os(Vr)}}function hh(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){Hr(a,a.return,et)}}function Lu(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 Tt=u,Kt=et;try{Kt()}catch(ae){Hr(x,Tt,ae)}}}h=h.next}while(h!==S)}}catch(ae){Hr(a,a.return,ae)}}function Pb(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{ri(a,u)}catch(h){Hr(o,o.return,h)}}}function Ib(o,a,u){u.props=Cf(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){Hr(o,a,h)}}function ph(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){Hr(o,a,x)}}function Mc(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(x){Hr(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){Hr(o,a,x)}else u.current=null}function jb(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){Hr(o,o.return,x)}}function F0(o,a,u){try{var h=o.stateNode;r6(h,o.type,u,a),h[or]=a}catch(x){Hr(o,o.return,x)}}function zb(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&zu(o.type)||o.tag===4}function U0(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&&zu(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 H0(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=Jo));else if(h!==4&&(h===27&&zu(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(H0(o,a,u),o=o.sibling;o!==null;)H0(o,a,u),o=o.sibling}function Ip(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&&zu(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(Ip(o,a,u),o=o.sibling;o!==null;)Ip(o,a,u),o=o.sibling}function Bb(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);hs(a,h,u),a[Ar]=o,a[or]=u}catch(S){Hr(o,o.return,S)}}var ru=!1,wo=!1,q0=!1,Fb=typeof WeakSet=="function"?WeakSet:Set,Fo=null;function IC(o,a){if(o=o.containerInfo,u1=rm,o=qa(o),Gs(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,Tt=-1,Kt=0,ae=0,be=o,Jt=null;e:for(;;){for(var ee;be!==u||x!==0&&be.nodeType!==3||(et=O+x),be!==S||h!==0&&be.nodeType!==3||(Tt=O+h),be.nodeType===3&&(O+=be.nodeValue.length),(ee=be.firstChild)!==null;)Jt=be,be=ee;for(;;){if(be===o)break e;if(Jt===u&&++Kt===x&&(et=O),Jt===S&&++ae===h&&(Tt=O),(ee=be.nextSibling)!==null)break;be=Jt,Jt=be.parentNode}be=ee}u=et===-1||Tt===-1?null:{start:et,end:Tt}}else u=null}u=u||{start:0,end:0}}else u=null;for(f1={focusedElem:o,selectionRange:u},rm=!1,Fo=a;Fo!==null;)if(a=Fo,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Fo=o;else for(;Fo!==null;){switch(a=Fo,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 sn=Cf(u.type,x);o=h.getSnapshotBeforeUpdate(sn,S),h.__reactInternalSnapshotBeforeUpdate=o}catch(Dn){Hr(u,u.return,Dn)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)p1(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":p1(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,Fo=o;break}Fo=a.return}}function Ub(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:ou(o,u),h&4&&hh(5,u);break;case 1:if(ou(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(O){Hr(u,u.return,O)}else{var x=Cf(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(x,a,o.__reactInternalSnapshotBeforeUpdate)}catch(O){Hr(u,u.return,O)}}h&64&&Pb(u),h&512&&ph(u,u.return);break;case 3:if(ou(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{ri(o,a)}catch(O){Hr(u,u.return,O)}}break;case 27:a===null&&h&4&&Bb(u);case 26:case 5:ou(o,u),a===null&&h&4&&jb(u),h&512&&ph(u,u.return);break;case 12:ou(o,u);break;case 31:ou(o,u),h&4&&$b(o,u);break;case 13:ou(o,u),h&4&&Yb(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=YC.bind(null,u),f6(o,u))));break;case 22:if(h=u.memoizedState!==null||ru,!h){a=a!==null&&a.memoizedState!==null||wo,x=ru;var S=wo;ru=h,(wo=a)&&!S?su(o,u,(u.subtreeFlags&8772)!==0):ou(o,u),ru=x,wo=S}break;case 30:break;default:ou(o,u)}}function Hb(o){var a=o.alternate;a!==null&&(o.alternate=null,Hb(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 Ri=null,ka=!1;function iu(o,a,u){for(u=u.child;u!==null;)qb(o,a,u),u=u.sibling}function qb(o,a,u){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(mn,u)}catch{}switch(u.tag){case 26:wo||Mc(u,a),iu(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:wo||Mc(u,a);var h=Ri,x=ka;zu(u.type)&&(Ri=u.stateNode,ka=!1),iu(o,a,u),kh(u.stateNode),Ri=h,ka=x;break;case 5:wo||Mc(u,a);case 6:if(h=Ri,x=ka,Ri=null,iu(o,a,u),Ri=h,ka=x,Ri!==null)if(ka)try{(Ri.nodeType===9?Ri.body:Ri.nodeName==="HTML"?Ri.ownerDocument.body:Ri).removeChild(u.stateNode)}catch(S){Hr(u,a,S)}else try{Ri.removeChild(u.stateNode)}catch(S){Hr(u,a,S)}break;case 18:Ri!==null&&(ka?(o=Ri,Px(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),wd(o)):Px(Ri,u.stateNode));break;case 4:h=Ri,x=ka,Ri=u.stateNode.containerInfo,ka=!0,iu(o,a,u),Ri=h,ka=x;break;case 0:case 11:case 14:case 15:Lu(2,u,a),wo||Lu(4,u,a),iu(o,a,u);break;case 1:wo||(Mc(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&Ib(u,a,h)),iu(o,a,u);break;case 21:iu(o,a,u);break;case 22:wo=(h=wo)||u.memoizedState!==null,iu(o,a,u),wo=h;break;default:iu(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{wd(o)}catch(u){Hr(a,a.return,u)}}}function Yb(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{wd(o)}catch(u){Hr(a,a.return,u)}}function jC(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Fb),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Fb),a;default:throw Error(r(435,o.tag))}}function jp(o,a){var u=jC(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var x=VC.bind(null,o,h);h.then(x,x)}})}function Aa(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(zu(et.type)){Ri=et.stateNode,ka=!1;break t}break;case 5:Ri=et.stateNode,ka=!1;break t;case 3:case 4:Ri=et.stateNode.containerInfo,ka=!0;break t}et=et.return}if(Ri===null)throw Error(r(160));qb(S,O,x),Ri=null,ka=!1,S=x.alternate,S!==null&&(S.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Vb(a,o),a=a.sibling}var Gl=null;function Vb(o,a){var u=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Aa(a,o),Ma(o),h&4&&(Lu(3,o,o.return),hh(3,o),Lu(5,o,o.return));break;case 1:Aa(a,o),Ma(o),h&512&&(wo||u===null||Mc(u,u.return)),h&64&&ru&&(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=Gl;if(Aa(a,o),Ma(o),h&512&&(wo||u===null||Mc(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[Ao]||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"))),hs(S,h,u),S[Ar]=o,fi(S),h=S;break t;case"link":var O=Vx("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),hs(S,h,u),x.head.appendChild(S);break;case"meta":if(O=Vx("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),hs(S,h,u),x.head.appendChild(S);break;default:throw Error(r(468,h))}S[Ar]=o,fi(S),h=S}o.stateNode=h}else Wx(x,o.type,o.stateNode);else o.stateNode=Yx(x,h,o.memoizedProps);else S!==h?(S===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):S.count--,h===null?Wx(x,o.type,o.stateNode):Yx(x,h,o.memoizedProps)):h===null&&o.stateNode!==null&&F0(o,o.memoizedProps,u.memoizedProps)}break;case 27:Aa(a,o),Ma(o),h&512&&(wo||u===null||Mc(u,u.return)),u!==null&&h&4&&F0(o,o.memoizedProps,u.memoizedProps);break;case 5:if(Aa(a,o),Ma(o),h&512&&(wo||u===null||Mc(u,u.return)),o.flags&32){x=o.stateNode;try{fo(x,"")}catch(sn){Hr(o,o.return,sn)}}h&4&&o.stateNode!=null&&(x=o.memoizedProps,F0(o,x,u!==null?u.memoizedProps:x)),h&1024&&(q0=!0);break;case 6:if(Aa(a,o),Ma(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,u=o.stateNode;try{u.nodeValue=h}catch(sn){Hr(o,o.return,sn)}}break;case 3:if(Qp=null,x=Gl,Gl=Jp(a.containerInfo),Aa(a,o),Gl=x,Ma(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{wd(a.containerInfo)}catch(sn){Hr(o,o.return,sn)}q0&&(q0=!1,Wb(o));break;case 4:h=Gl,Gl=Jp(o.stateNode.containerInfo),Aa(a,o),Ma(o),Gl=h;break;case 12:Aa(a,o),Ma(o);break;case 31:Aa(a,o),Ma(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,jp(o,h)));break;case 13:Aa(a,o),Ma(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Bp=fn()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,jp(o,h)));break;case 22:x=o.memoizedState!==null;var Tt=u!==null&&u.memoizedState!==null,Kt=ru,ae=wo;if(ru=Kt||x,wo=ae||Tt,Aa(a,o),wo=ae,ru=Kt,Ma(o),h&8192)t:for(a=o.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(u===null||Tt||ru||wo||Ef(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){Tt=u=a;try{if(S=Tt.stateNode,x)O=S.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{et=Tt.stateNode;var be=Tt.memoizedProps.style,Jt=be!=null&&be.hasOwnProperty("display")?be.display:null;et.style.display=Jt==null||typeof Jt=="boolean"?"":(""+Jt).trim()}}catch(sn){Hr(Tt,Tt.return,sn)}}}else if(a.tag===6){if(u===null){Tt=a;try{Tt.stateNode.nodeValue=x?"":Tt.memoizedProps}catch(sn){Hr(Tt,Tt.return,sn)}}}else if(a.tag===18){if(u===null){Tt=a;try{var ee=Tt.stateNode;x?Ix(ee,!0):Ix(Tt.stateNode,!1)}catch(sn){Hr(Tt,Tt.return,sn)}}}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,jp(o,u))));break;case 19:Aa(a,o),Ma(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,jp(o,h)));break;case 30:break;case 21:break;default:Aa(a,o),Ma(o)}}function Ma(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=U0(o);Ip(o,S,x);break;case 5:var O=u.stateNode;u.flags&32&&(fo(O,""),u.flags&=-33);var et=U0(o);Ip(o,et,O);break;case 3:case 4:var Tt=u.stateNode.containerInfo,Kt=U0(o);H0(o,Kt,Tt);break;default:throw Error(r(161))}}catch(ae){Hr(o,o.return,ae)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Wb(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Wb(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function ou(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Ub(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:Lu(4,a,a.return),Ef(a);break;case 1:Mc(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&Ib(a,a.return,u),Ef(a);break;case 27:kh(a.stateNode);case 26:case 5:Mc(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 su(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:su(x,S,u),hh(4,S);break;case 1:if(su(x,S,u),h=S,x=h.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(Kt){Hr(h,h.return,Kt)}if(h=S,x=h.updateQueue,x!==null){var et=h.stateNode;try{var Tt=x.shared.hiddenCallbacks;if(Tt!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Tt.length;x++)Bi(Tt[x],et)}catch(Kt){Hr(h,h.return,Kt)}}u&&O&64&&Pb(S),ph(S,S.return);break;case 27:Bb(S);case 26:case 5:su(x,S,u),u&&h===null&&O&4&&jb(S),ph(S,S.return);break;case 12:su(x,S,u);break;case 31:su(x,S,u),u&&O&4&&$b(x,S);break;case 13:su(x,S,u),u&&O&4&&Yb(x,S);break;case 22:S.memoizedState===null&&su(x,S,u),ph(S,S.return);break;case 30:break;default:su(x,S,u)}a=a.sibling}}function $0(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&&pl(u))}function Y0(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&pl(o))}function Kl(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Xb(o,a,u,h),a=a.sibling}function Xb(o,a,u,h){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Kl(o,a,u,h),x&2048&&hh(9,a);break;case 1:Kl(o,a,u,h);break;case 3:Kl(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&&pl(o)));break;case 12:if(x&2048){Kl(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(Tt){Hr(a,a.return,Tt)}}else Kl(o,a,u,h);break;case 31:Kl(o,a,u,h);break;case 13:Kl(o,a,u,h);break;case 23:break;case 22:S=a.stateNode,O=a.alternate,a.memoizedState!==null?S._visibility&2?Kl(o,a,u,h):mh(o,a):S._visibility&2?Kl(o,a,u,h):(S._visibility|=2,ud(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),x&2048&&$0(O,a);break;case 24:Kl(o,a,u,h),x&2048&&Y0(a.alternate,a);break;default:Kl(o,a,u,h)}}function ud(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,Tt=h,Kt=O.flags;switch(O.tag){case 0:case 11:case 15:ud(S,O,et,Tt,x),hh(8,O);break;case 23:break;case 22:var ae=O.stateNode;O.memoizedState!==null?ae._visibility&2?ud(S,O,et,Tt,x):mh(S,O):(ae._visibility|=2,ud(S,O,et,Tt,x)),x&&Kt&2048&&$0(O.alternate,O);break;case 24:ud(S,O,et,Tt,x),x&&Kt&2048&&Y0(O.alternate,O);break;default:ud(S,O,et,Tt,x)}a=a.sibling}}function mh(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:mh(u,h),x&2048&&$0(h.alternate,h);break;case 24:mh(u,h),x&2048&&Y0(h.alternate,h);break;default:mh(u,h)}a=a.sibling}}var gh=8192;function fd(o,a,u){if(o.subtreeFlags&gh)for(o=o.child;o!==null;)Gb(o,a,u),o=o.sibling}function Gb(o,a,u){switch(o.tag){case 26:fd(o,a,u),o.flags&gh&&o.memoizedState!==null&&k6(u,Gl,o.memoizedState,o.memoizedProps);break;case 5:fd(o,a,u);break;case 3:case 4:var h=Gl;Gl=Jp(o.stateNode.containerInfo),fd(o,a,u),Gl=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=gh,gh=16777216,fd(o,a,u),gh=h):fd(o,a,u));break;default:fd(o,a,u)}}function Kb(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 yh(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];Fo=h,Zb(h,o)}Kb(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Jb(o),o=o.sibling}function Jb(o){switch(o.tag){case 0:case 11:case 15:yh(o),o.flags&2048&&Lu(9,o,o.return);break;case 3:yh(o);break;case 12:yh(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,zp(o)):yh(o);break;default:yh(o)}}function zp(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];Fo=h,Zb(h,o)}Kb(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Lu(8,a,a.return),zp(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,zp(a));break;default:zp(a)}o=o.sibling}}function Zb(o,a){for(;Fo!==null;){var u=Fo;switch(u.tag){case 0:case 11:case 15:Lu(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:pl(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,Fo=h;else t:for(u=o;Fo!==null;){h=Fo;var x=h.sibling,S=h.return;if(Hb(h),h===u){Fo=null;break t}if(x!==null){x.return=S,Fo=x;break t}Fo=S}}}var zC={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}},BC=typeof WeakMap=="function"?WeakMap:Map,Lr=0,oi=null,cr=null,gr=0,Ur=0,Wa=null,Du=!1,dd=!1,V0=!1,au=0,Xi=0,Ru=0,Tf=0,W0=0,Xa=0,hd=0,bh=null,Ca=null,X0=!1,Bp=0,Qb=0,Fp=1/0,Up=null,Ou=null,Do=0,Pu=null,pd=null,lu=0,G0=0,K0=null,tx=null,xh=0,J0=null;function Ga(){return(Lr&2)!==0&&gr!==0?gr&-gr:dt.T!==null?r1():Ti()}function ex(){if(Xa===0)if((gr&536870912)===0||er){var o=We;We<<=1,(We&3932160)===0&&(We=262144),Xa=o}else Xa=536870912;return o=k.current,o!==null&&(o.flags|=32),Xa}function Ea(o,a,u){(o===oi&&(Ur===2||Ur===9)||o.cancelPendingCommit!==null)&&(md(o,0),Iu(o,gr,Xa,!1)),Ke(o,u),((Lr&2)===0||o!==oi)&&(o===oi&&((Lr&2)===0&&(Tf|=u),Xi===4&&Iu(o,gr,Xa,!1)),Cc(o))}function nx(o,a,u){if((Lr&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||Yo(o,a),x=h?HC(o,a):Q0(o,a,!0),S=h;do{if(x===0){dd&&!h&&Iu(o,a,0,!1);break}else{if(u=o.current.alternate,S&&!FC(u)){x=Q0(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=bh;var Tt=et.current.memoizedState.isDehydrated;if(Tt&&(md(et,O).flags|=256),O=Q0(et,O,!1),O!==2){if(V0&&!Tt){et.errorRecoveryDisabledLanes|=S,Tf|=S,x=4;break t}S=Ca,Ca=x,S!==null&&(Ca===null?Ca=S:Ca.push.apply(Ca,S))}x=O}if(S=!1,x!==2)continue}}if(x===1){md(o,0),Iu(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:Iu(h,a,Xa,!Du);break t;case 2:Ca=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(x=Bp+300-fn(),10<x)){if(Iu(h,a,Xa,!Du),Wn(h,0,!0)!==0)break t;lu=a,h.timeoutHandle=Rx(rx.bind(null,h,u,Ca,Up,X0,a,Xa,Tf,hd,Du,S,"Throttled",-0,0),x);break t}rx(h,u,Ca,Up,X0,a,Xa,Tf,hd,Du,S,null,-0,0)}}break}while(!0);Cc(o)}function rx(o,a,u,h,x,S,O,et,Tt,Kt,ae,be,Jt,ee){if(o.timeoutHandle=-1,be=a.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jo},Gb(a,S,be);var sn=(S&62914560)===S?Bp-fn():(S&4194048)===S?Qb-fn():0;if(sn=A6(be,sn),sn!==null){lu=S,o.cancelPendingCommit=sn(fx.bind(null,o,a,S,u,h,x,O,et,Tt,ae,be,null,Jt,ee)),Iu(o,S,O,!Kt);return}}fx(o,a,S,u,h,x,O,et,Tt)}function FC(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(!no(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 Iu(o,a,u,h){a&=~W0,a&=~Tf,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var x=a;0<x;){var S=31-Vn(x),O=1<<S;h[S]=-1,x&=~O}u!==0&&Zi(o,u,a)}function Hp(){return(Lr&6)===0?(vh(0),!1):!0}function Z0(){if(cr!==null){if(Ur===0)var o=cr.return;else o=cr,xa=Va=null,$t(o),ye=null,Je=0,o=cr;for(;o!==null;)Ob(o.alternate,o),o=o.return;cr=null}}function md(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,s6(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),lu=0,Z0(),oi=o,cr=u=is(o.current,null),gr=a,Ur=0,Wa=null,Du=!1,dd=Yo(o,a),V0=!1,hd=Xa=W0=Tf=Ru=Xi=0,Ca=bh=null,X0=!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-Vn(h),S=1<<x;a|=o[x],h&=~S}return au=a,gc(),u}function ix(o,a){it=null,dt.H=uh,a===Dt||a===ht?(a=ce(),Ur=3):a===Wt?(a=ce(),Ur=4):Ur=a===_0?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Wa=a,cr===null&&(Xi=1,Lp(o,bo(a,o.current)))}function ox(){var o=k.current;return o===null?!0:(gr&4194048)===gr?_===null:(gr&62914560)===gr||(gr&536870912)!==0?o===_:!1}function sx(){var o=dt.H;return dt.H=uh,o===null?uh:o}function ax(){var o=dt.A;return dt.A=zC,o}function qp(){Xi=4,Du||(gr&4194048)!==gr&&k.current!==null||(dd=!0),(Ru&134217727)===0&&(Tf&134217727)===0||oi===null||Iu(oi,gr,Xa,!1)}function Q0(o,a,u){var h=Lr;Lr|=2;var x=sx(),S=ax();(oi!==o||gr!==a)&&(Up=null,md(o,a)),a=!1;var O=Xi;t:do try{if(Ur!==0&&cr!==null){var et=cr,Tt=Wa;switch(Ur){case 8:Z0(),O=6;break t;case 3:case 2:case 9:case 6:k.current===null&&(a=!0);var Kt=Ur;if(Ur=0,Wa=null,gd(o,et,Tt,Kt),u&&dd){O=0;break t}break;default:Kt=Ur,Ur=0,Wa=null,gd(o,et,Tt,Kt)}}UC(),O=Xi;break}catch(ae){ix(o,ae)}while(!0);return a&&o.shellSuspendCounter++,xa=Va=null,Lr=h,dt.H=x,dt.A=S,cr===null&&(oi=null,gr=0,gc()),O}function UC(){for(;cr!==null;)lx(cr)}function HC(o,a){var u=Lr;Lr|=2;var h=sx(),x=ax();oi!==o||gr!==a?(Up=null,Fp=fn()+500,md(o,a)):dd=Yo(o,a);t:do try{if(Ur!==0&&cr!==null){a=cr;var S=Wa;e:switch(Ur){case 1:Ur=0,Wa=null,gd(o,a,S,1);break;case 2:case 9:if(Ht(S)){Ur=0,Wa=null,cx(a);break}a=function(){Ur!==2&&Ur!==9||oi!==o||(Ur=7),Cc(o)},S.then(a,a);break t;case 3:Ur=7;break t;case 4:Ur=5;break t;case 7:Ht(S)?(Ur=0,Wa=null,cx(a)):(Ur=0,Wa=null,gd(o,a,S,7));break;case 5:var O=null;switch(cr.tag){case 26:O=cr.memoizedState;case 5:case 27:var et=cr;if(O?Xx(O):et.stateNode.complete){Ur=0,Wa=null;var Tt=et.sibling;if(Tt!==null)cr=Tt;else{var Kt=et.return;Kt!==null?(cr=Kt,$p(Kt)):cr=null}break e}}Ur=0,Wa=null,gd(o,a,S,5);break;case 6:Ur=0,Wa=null,gd(o,a,S,6);break;case 8:Z0(),Xi=6;break t;default:throw Error(r(462))}}qC();break}catch(ae){ix(o,ae)}while(!0);return xa=Va=null,dt.H=h,dt.A=x,Lr=u,cr!==null?0:(oi=null,gr=0,gc(),Xi)}function qC(){for(;cr!==null&&!De();)lx(cr)}function lx(o){var a=Db(o.alternate,o,au);o.memoizedProps=o.pendingProps,a===null?$p(o):cr=a}function cx(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=Cb(u,a,a.pendingProps,a.type,void 0,gr);break;case 11:a=Cb(u,a,a.pendingProps,a.type.render,a.ref,gr);break;case 5:$t(a);default:Ob(u,a),a=cr=xc(a,au),a=Db(u,a,au)}o.memoizedProps=o.pendingProps,a===null?$p(o):cr=a}function gd(o,a,u,h){xa=Va=null,$t(a),ye=null,Je=0;var x=a.return;try{if(LC(o,x,a,u,gr)){Xi=1,Lp(o,bo(u,o.current)),cr=null;return}}catch(S){if(x!==null)throw cr=x,S;Xi=1,Lp(o,bo(u,o.current)),cr=null;return}a.flags&32768?(er||h===1?o=!0:dd||(gr&536870912)!==0?o=!1:(Du=o=!0,(h===2||h===9||h===3||h===6)&&(h=k.current,h!==null&&h.tag===13&&(h.flags|=16384))),ux(a,o)):$p(a)}function $p(o){var a=o;do{if((a.flags&32768)!==0){ux(a,Du);return}o=a.return;var u=OC(a.alternate,a,au);if(u!==null){cr=u;return}if(a=a.sibling,a!==null){cr=a;return}cr=a=o}while(a!==null);Xi===0&&(Xi=5)}function ux(o,a){do{var u=PC(o.alternate,o);if(u!==null){u.flags&=32767,cr=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){cr=o;return}cr=o=u}while(o!==null);Xi=6,cr=null}function fx(o,a,u,h,x,S,O,et,Tt){o.cancelPendingCommit=null;do Yp();while(Do!==0);if((Lr&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(S=a.lanes|a.childLanes,S|=Fc,xs(o,u,S,O,et,Tt),o===oi&&(cr=oi=null,gr=0),pd=a,Pu=o,lu=u,G0=S,K0=x,tx=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,WC(xn,function(){return gx(),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=Lr,Lr|=4;try{IC(o,a,u)}finally{Lr=O,st.p=x,dt.T=h}}Do=1,dx(),hx(),px()}}function dx(){if(Do===1){Do=0;var o=Pu,a=pd,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=Lr;Lr|=4;try{Vb(a,o);var S=f1,O=qa(o.containerInfo),et=S.focusedElem,Tt=S.selectionRange;if(O!==et&&et&&et.ownerDocument&&Ha(et.ownerDocument.documentElement,et)){if(Tt!==null&&Gs(et)){var Kt=Tt.start,ae=Tt.end;if(ae===void 0&&(ae=Kt),"selectionStart"in et)et.selectionStart=Kt,et.selectionEnd=Math.min(ae,et.value.length);else{var be=et.ownerDocument||document,Jt=be&&be.defaultView||window;if(Jt.getSelection){var ee=Jt.getSelection(),sn=et.textContent.length,Dn=Math.min(Tt.start,sn),Kr=Tt.end===void 0?Dn:Math.min(Tt.end,sn);!ee.extend&&Dn>Kr&&(O=Kr,Kr=Dn,Dn=O);var Ut=Ul(et,Dn),Pt=Ul(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=be.createRange();Gt.setStart(Ut.node,Ut.offset),ee.removeAllRanges(),Dn>Kr?(ee.addRange(Gt),ee.extend(Pt.node,Pt.offset)):(Gt.setEnd(Pt.node,Pt.offset),ee.addRange(Gt))}}}}for(be=[],ee=et;ee=ee.parentNode;)ee.nodeType===1&&be.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof et.focus=="function"&&et.focus(),et=0;et<be.length;et++){var he=be[et];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}rm=!!u1,f1=u1=null}finally{Lr=x,st.p=h,dt.T=u}}o.current=a,Do=2}}function hx(){if(Do===2){Do=0;var o=Pu,a=pd,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=Lr;Lr|=4;try{Ub(o,a.alternate,a)}finally{Lr=x,st.p=h,dt.T=u}}Do=3}}function px(){if(Do===4||Do===3){Do=0,$e();var o=Pu,a=pd,u=lu,h=tx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Do=5:(Do=0,pd=Pu=null,mx(o,o.pendingLanes));var x=o.pendingLanes;if(x===0&&(Ou=null),ui(u),a=a.stateNode,an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(mn,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}}(lu&3)!==0&&Yp(),Cc(o),x=o.pendingLanes,(u&261930)!==0&&(x&42)!==0?o===J0?xh++:(xh=0,J0=o):xh=0,vh(0)}}function mx(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,pl(a)))}function Yp(){return dx(),hx(),px(),gx()}function gx(){if(Do!==5)return!1;var o=Pu,a=G0;G0=0;var u=ui(lu),h=dt.T,x=st.p;try{st.p=32>u?32:u,dt.T=null,u=K0,K0=null;var S=Pu,O=lu;if(Do=0,pd=Pu=null,lu=0,(Lr&6)!==0)throw Error(r(331));var et=Lr;if(Lr|=4,Jb(S.current),Xb(S,S.current,O,u),Lr=et,vh(0,!1),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(mn,S)}catch{}return!0}finally{st.p=x,dt.T=h,mx(o,a)}}function yx(o,a,u){a=bo(u,a),a=N0(o.stateNode,a,2),o=jn(o,a,2),o!==null&&(Ke(o,2),Cc(o))}function Hr(o,a,u){if(o.tag===3)yx(o,o,u);else for(;a!==null;){if(a.tag===3){yx(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ou===null||!Ou.has(h))){o=bo(u,o),u=bb(2),h=jn(a,u,2),h!==null&&(xb(u,h,a,o),Ke(h,2),Cc(h));break}}a=a.return}}function t1(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new BC;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)||(V0=!0,x.add(u),o=$C.bind(null,o,a,u),a.then(o,o))}function $C(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,oi===o&&(gr&u)===u&&(Xi===4||Xi===3&&(gr&62914560)===gr&&300>fn()-Bp?(Lr&2)===0&&md(o,0):W0|=u,hd===gr&&(hd=0)),Cc(o)}function bx(o,a){a===0&&(a=Hi()),o=ya(o,a),o!==null&&(Ke(o,a),Cc(o))}function YC(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),bx(o,u)}function VC(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),bx(o,u)}function WC(o,a){return _e(o,a)}var Vp=null,yd=null,e1=!1,Wp=!1,n1=!1,ju=0;function Cc(o){o!==yd&&o.next===null&&(yd===null?Vp=yd=o:yd=yd.next=o),Wp=!0,e1||(e1=!0,GC())}function vh(o,a){if(!n1&&Wp){n1=!0;do for(var u=!1,h=Vp;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-Vn(42|o)+1)-1,S&=x&~(O&~et),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(u=!0,Sx(h,S))}else S=gr,S=Wn(h,h===oi?S:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(S&3)===0||Yo(h,S)||(u=!0,Sx(h,S));h=h.next}while(u);n1=!1}}function XC(){xx()}function xx(){Wp=e1=!1;var o=0;ju!==0&&o6()&&(o=ju);for(var a=fn(),u=null,h=Vp;h!==null;){var x=h.next,S=vx(h,a);S===0?(h.next=null,u===null?Vp=x:u.next=x,x===null&&(yd=u)):(u=h,(o!==0||(S&3)!==0)&&(Wp=!0)),h=x}Do!==0&&Do!==5||vh(o),ju!==0&&(ju=0)}function vx(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,x=o.expirationTimes,S=o.pendingLanes&-62914561;0<S;){var O=31-Vn(S),et=1<<O,Tt=x[O];Tt===-1?((et&u)===0||(et&h)!==0)&&(x[O]=ci(et,a)):Tt<=a&&(o.expiredLanes|=et),S&=~et}if(a=oi,u=gr,u=Wn(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(Ur===2||Ur===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Te(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||Yo(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Te(h),ui(u)){case 2:case 8:u=Nn;break;case 32:u=xn;break;case 268435456:u=Qe;break;default:u=xn}return h=wx.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 wx(o,a){if(Do!==0&&Do!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(Yp()&&o.callbackNode!==u)return null;var h=gr;return h=Wn(o,o===oi?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(nx(o,h,a),vx(o,fn()),o.callbackNode!=null&&o.callbackNode===u?wx.bind(null,o):null)}function Sx(o,a){if(Yp())return null;nx(o,a,!0)}function GC(){a6(function(){(Lr&6)!==0?_e(bn,XC):xx()})}function r1(){if(ju===0){var o=m;o===0&&(o=ge,ge<<=1,(ge&261888)===0&&(ge=256)),ju=o}return ju}function kx(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:eo(""+o)}function Ax(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 KC(o,a,u,h,x){if(a==="submit"&&u&&u.stateNode===x){var S=kx((x[or]||null).action),O=h.submitter;O&&(a=(a=O[or]||null)?kx(a.formAction):O.getAttribute("formAction"),a!==null&&(S=a,O=null));var et=new Co("action","action",null,h,x);o.push({event:et,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(ju!==0){var Tt=O?Ax(x,O):new FormData(x);lh(u,{pending:!0,data:Tt,method:x.method,action:S},null,Tt)}}else typeof S=="function"&&(et.preventDefault(),Tt=O?Ax(x,O):new FormData(x),lh(u,{pending:!0,data:Tt,method:x.method,action:S},S,Tt))},currentTarget:x}]})}}for(var i1=0;i1<ul.length;i1++){var o1=ul[i1],JC=o1.toLowerCase(),ZC=o1[0].toUpperCase()+o1.slice(1);rs(JC,"on"+ZC)}rs(ga,"onAnimationEnd"),rs(pc,"onAnimationIteration"),rs(Cu,"onAnimationStart"),rs("dblclick","onDoubleClick"),rs("focusin","onFocus"),rs("focusout","onBlur"),rs(vf,"onTransitionRun"),rs(wf,"onTransitionStart"),rs(ad,"onTransitionCancel"),rs(Eu,"onTransitionEnd"),Ss("onMouseEnter",["mouseout","mouseover"]),Ss("onMouseLeave",["mouseout","mouseover"]),Ss("onPointerEnter",["pointerout","pointerover"]),Ss("onPointerLeave",["pointerout","pointerover"]),Yr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Yr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Yr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Yr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Yr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Yr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wh="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(" "),QC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wh));function Mx(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],Tt=et.instance,Kt=et.currentTarget;if(et=et.listener,Tt!==S&&x.isPropagationStopped())break t;S=et,x.currentTarget=Kt;try{S(x)}catch(ae){mc(ae)}x.currentTarget=null,S=Tt}else for(O=0;O<h.length;O++){if(et=h[O],Tt=et.instance,Kt=et.currentTarget,et=et.listener,Tt!==S&&x.isPropagationStopped())break t;S=et,x.currentTarget=Kt;try{S(x)}catch(ae){mc(ae)}x.currentTarget=null,S=Tt}}}}function ur(o,a){var u=a[Xo];u===void 0&&(u=a[Xo]=new Set);var h=o+"__bubble";u.has(h)||(Cx(a,o,2,!1),u.add(h))}function s1(o,a,u){var h=0;a&&(h|=4),Cx(u,o,h,a)}var Xp="_reactListening"+Math.random().toString(36).slice(2);function a1(o){if(!o[Xp]){o[Xp]=!0,rl.forEach(function(u){u!=="selectionchange"&&(QC.has(u)||s1(u,!1,o),s1(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Xp]||(a[Xp]=!0,s1("selectionchange",!1,a))}}function Cx(o,a,u,h){switch(ev(a)){case 2:var x=E6;break;case 8:x=T6;break;default:x=S1}u=x.bind(null,a,u,o),x=void 0,!sl||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 l1(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 Tt=O.tag;if((Tt===3||Tt===4)&&O.stateNode.containerInfo===x)return;O=O.return}for(;et!==null;){if(O=aa(et),O===null)return;if(Tt=O.tag,Tt===5||Tt===6||Tt===26||Tt===27){h=S=O;continue t}et=et.parentNode}}h=h.return}cc(function(){var Kt=S,ae=ol(u),be=[];t:{var Jt=Sf.get(o);if(Jt!==void 0){var ee=Co,sn=o;switch(o){case"keypress":if(po(u)===0)break t;case"keydown":case"keyup":ee=sr;break;case"focusin":sn="focus",ee=Ns;break;case"focusout":sn="blur",ee=Ns;break;case"beforeblur":case"afterblur":ee=Ns;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=al;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Ts;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=ue;break;case ga:case pc:case Cu:ee=A;break;case Eu:ee=di;break;case"scroll":case"scrollend":ee=ja;break;case"wheel":ee=vn;break;case"copy":case"cut":case"paste":ee=mt;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Zr;break;case"toggle":case"beforetoggle":ee=jl}var Dn=(a&4)!==0,Kr=!Dn&&(o==="scroll"||o==="scrollend"),Ut=Dn?Jt!==null?Jt+"Capture":null:Jt;Dn=[];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=ho(Pt,Ut),he!=null&&Dn.push(Sh(Pt,he,Gt))),Kr)break;Pt=Pt.return}0<Dn.length&&(Jt=new ee(Jt,sn,null,u,ae),be.push({event:Jt,listeners:Dn}))}}if((a&7)===0){t:{if(Jt=o==="mouseover"||o==="pointerover",ee=o==="mouseout"||o==="pointerout",Jt&&u!==ks&&(sn=u.relatedTarget||u.fromElement)&&(aa(sn)||sn[Kn]))break t;if((ee||Jt)&&(Jt=ae.window===ae?ae:(Jt=ae.ownerDocument)?Jt.defaultView||Jt.parentWindow:window,ee?(sn=u.relatedTarget||u.toElement,ee=Kt,sn=sn?aa(sn):null,sn!==null&&(Kr=s(sn),Dn=sn.tag,sn!==Kr||Dn!==5&&Dn!==27&&Dn!==6)&&(sn=null)):(ee=null,sn=Kt),ee!==sn)){if(Dn=al,he="onMouseLeave",Ut="onMouseEnter",Pt="mouse",(o==="pointerout"||o==="pointerover")&&(Dn=Zr,he="onPointerLeave",Ut="onPointerEnter",Pt="pointer"),Kr=ee==null?Jt:nl(ee),Gt=sn==null?Jt:nl(sn),Jt=new Dn(he,Pt+"leave",ee,u,ae),Jt.target=Kr,Jt.relatedTarget=Gt,he=null,aa(ae)===Kt&&(Dn=new Dn(Ut,Pt+"enter",sn,u,ae),Dn.target=Gt,Dn.relatedTarget=Kr,he=Dn),Kr=he,ee&&sn)e:{for(Dn=t6,Ut=ee,Pt=sn,Gt=0,he=Ut;he;he=Dn(he))Gt++;he=0;for(var kn=Pt;kn;kn=Dn(kn))he++;for(;0<Gt-he;)Ut=Dn(Ut),Gt--;for(;0<he-Gt;)Pt=Dn(Pt),he--;for(;Gt--;){if(Ut===Pt||Pt!==null&&Ut===Pt.alternate){Dn=Ut;break e}Ut=Dn(Ut),Pt=Dn(Pt)}Dn=null}else Dn=null;ee!==null&&Ex(be,Jt,ee,Dn,!1),sn!==null&&Kr!==null&&Ex(be,Kr,sn,Dn,!0)}}t:{if(Jt=Kt?nl(Kt):window,ee=Jt.nodeName&&Jt.nodeName.toLowerCase(),ee==="select"||ee==="input"&&Jt.type==="file")var Cr=Ua;else if(fc(Jt))if(hi)Cr=Ws;else{Cr=pe;var pn=ll}else ee=Jt.nodeName,!ee||ee.toLowerCase()!=="input"||Jt.type!=="checkbox"&&Jt.type!=="radio"?Kt&&sc(Kt.elementType)&&(Cr=Ua):Cr=To;if(Cr&&(Cr=Cr(o,Kt))){Io(be,Cr,u,ae);break t}pn&&pn(o,Jt,Kt),o==="focusout"&&Kt&&Jt.type==="number"&&Kt.memoizedProps.value!=null&&te(Jt,"number",Jt.value)}switch(pn=Kt?nl(Kt):window,o){case"focusin":(fc(pn)||pn.contentEditable==="true")&&(ns=pn,ma=Kt,yi=null);break;case"focusout":yi=ma=ns=null;break;case"mousedown":No=!0;break;case"contextmenu":case"mouseup":case"dragend":No=!1,br(be,u,ae);break;case"selectionchange":if(cl)break;case"keydown":case"keyup":br(be,u,ae)}var Jn;if(pr)t:{switch(o){case"compositionstart":var yr="onCompositionStart";break t;case"compositionend":yr="onCompositionEnd";break t;case"compositionupdate":yr="onCompositionUpdate";break t}yr=void 0}else Ys?Ba(o,u)&&(yr="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(yr="onCompositionStart");yr&&(_s&&u.locale!=="ko"&&(Ys||yr!=="onCompositionStart"?yr==="onCompositionEnd"&&Ys&&(Jn=Ol()):(qi=ae,ua="value"in qi?qi.value:qi.textContent,Ys=!0)),pn=Gp(Kt,yr),0<pn.length&&(yr=new Ft(yr,o,null,u,ae),be.push({event:yr,listeners:pn}),Jn?yr.data=Jn:(Jn=Fa(u),Jn!==null&&(yr.data=Jn)))),(Jn=zl?go(o,u):pa(o,u))&&(yr=Gp(Kt,"onBeforeInput"),0<yr.length&&(pn=new Ft("onBeforeInput","beforeinput",null,u,ae),be.push({event:pn,listeners:yr}),pn.data=Jn)),KC(be,o,Kt,u,ae)}Mx(be,a)})}function Sh(o,a,u){return{instance:o,listener:a,currentTarget:u}}function Gp(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=ho(o,u),x!=null&&h.unshift(Sh(o,x,S)),x=ho(o,a),x!=null&&h.push(Sh(o,x,S))),o.tag===3)return h;o=o.return}return[]}function t6(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Ex(o,a,u,h,x){for(var S=a._reactName,O=[];u!==null&&u!==h;){var et=u,Tt=et.alternate,Kt=et.stateNode;if(et=et.tag,Tt!==null&&Tt===h)break;et!==5&&et!==26&&et!==27||Kt===null||(Tt=Kt,x?(Kt=ho(u,S),Kt!=null&&O.unshift(Sh(u,Kt,Tt))):x||(Kt=ho(u,S),Kt!=null&&O.push(Sh(u,Kt,Tt)))),u=u.return}O.length!==0&&o.push({event:a,listeners:O})}var e6=/\r\n?/g,n6=/\u0000|\uFFFD/g;function Tx(o){return(typeof o=="string"?o:""+o).replace(e6,`
9
+ `).replace(n6,"")}function Nx(o,a){return a=Tx(a),Tx(o)===a}function Gr(o,a,u,h,x,S){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||fo(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&fo(o,""+h);break;case"className":mi(o,"class",h);break;case"tabIndex":mi(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":mi(o,u,h);break;case"style":Mu(o,h,S);break;case"data":if(a!=="object"){mi(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=eo(""+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=eo(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=Jo);break;case"onScroll":h!=null&&ur("scroll",o);break;case"onScrollEnd":h!=null&&ur("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=eo(""+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":ur("beforetoggle",o),ur("toggle",o),Qi(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":Qi(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=ac.get(u)||u,Qi(o,u,h))}}function c1(o,a,u,h,x,S){switch(u){case"style":Mu(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"?fo(o,h):(typeof h=="number"||typeof h=="bigint")&&fo(o,""+h);break;case"onScroll":h!=null&&ur("scroll",o);break;case"onScrollEnd":h!=null&&ur("scrollend",o);break;case"onClick":h!=null&&(o.onclick=Jo);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[or]||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,""):Qi(o,u,h)}}}function hs(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ur("error",o),ur("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":ur("invalid",o);var et=S=O=x=null,Tt=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":Tt=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)}}la(o,S,et,Tt,Kt,O,x,!1);return;case"select":ur("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?Mo(o,!!h,a,!1):u!=null&&Mo(o,!!h,u,!0);return;case"textarea":ur("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)}Bc(o,h,x,S);return;case"option":for(Tt in u)u.hasOwnProperty(Tt)&&(h=u[Tt],h!=null)&&(Tt==="selected"?o.selected=h&&typeof h!="function"&&typeof h!="symbol":Gr(o,a,Tt,h,u,null));return;case"dialog":ur("beforetoggle",o),ur("toggle",o),ur("cancel",o),ur("close",o);break;case"iframe":case"object":ur("load",o);break;case"video":case"audio":for(h=0;h<wh.length;h++)ur(wh[h],o);break;case"image":ur("error",o),ur("load",o);break;case"details":ur("toggle",o);break;case"embed":case"source":case"link":ur("error",o),ur("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(sc(a)){for(ae in u)u.hasOwnProperty(ae)&&(h=u[ae],h!==void 0&&c1(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 r6(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,Tt=null,Kt=null,ae=null;for(ee in u){var be=u[ee];if(u.hasOwnProperty(ee)&&be!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":Tt=be;default:h.hasOwnProperty(ee)||Gr(o,a,ee,null,h,be)}}for(var Jt in h){var ee=h[Jt];if(be=u[Jt],h.hasOwnProperty(Jt)&&(ee!=null||be!=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!==be&&Gr(o,a,Jt,ee,h,be)}}Ra(o,O,et,Tt,Kt,ae,S,x);return;case"select":ee=O=et=Jt=null;for(S in u)if(Tt=u[S],u.hasOwnProperty(S)&&Tt!=null)switch(S){case"value":break;case"multiple":ee=Tt;default:h.hasOwnProperty(S)||Gr(o,a,S,null,h,Tt)}for(x in h)if(S=h[x],Tt=u[x],h.hasOwnProperty(x)&&(S!=null||Tt!=null))switch(x){case"value":Jt=S;break;case"defaultValue":et=S;break;case"multiple":O=S;default:S!==Tt&&Gr(o,a,x,S,h,Tt)}a=et,u=O,h=ee,Jt!=null?Mo(o,!!u,Jt,!1):!!h!=!!u&&(a!=null?Mo(o,!!u,a,!0):Mo(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)}ca(o,Jt,ee);return;case"option":for(var sn in u)Jt=u[sn],u.hasOwnProperty(sn)&&Jt!=null&&!h.hasOwnProperty(sn)&&(sn==="selected"?o.selected=!1:Gr(o,a,sn,null,h,Jt));for(Tt in h)Jt=h[Tt],ee=u[Tt],h.hasOwnProperty(Tt)&&Jt!==ee&&(Jt!=null||ee!=null)&&(Tt==="selected"?o.selected=Jt&&typeof Jt!="function"&&typeof Jt!="symbol":Gr(o,a,Tt,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 Dn in u)Jt=u[Dn],u.hasOwnProperty(Dn)&&Jt!=null&&!h.hasOwnProperty(Dn)&&Gr(o,a,Dn,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(sc(a)){for(var Kr in u)Jt=u[Kr],u.hasOwnProperty(Kr)&&Jt!==void 0&&!h.hasOwnProperty(Kr)&&c1(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||c1(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(be in h)Jt=h[be],ee=u[be],!h.hasOwnProperty(be)||Jt===ee||Jt==null&&ee==null||Gr(o,a,be,Jt,h,ee)}function _x(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function i6(){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&&_x(O)){for(O=0,et=x.responseEnd,h+=1;h<u.length;h++){var Tt=u[h],Kt=Tt.startTime;if(Kt>et)break;var ae=Tt.transferSize,be=Tt.initiatorType;ae&&_x(be)&&(Tt=Tt.responseEnd,O+=ae*(Tt<et?1:(et-Kt)/(Tt-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 u1=null,f1=null;function Kp(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 Dx(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 d1(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 h1=null;function o6(){var o=window.event;return o&&o.type==="popstate"?o===h1?!1:(h1=o,!0):(h1=null,!1)}var Rx=typeof setTimeout=="function"?setTimeout:void 0,s6=typeof clearTimeout=="function"?clearTimeout:void 0,Ox=typeof Promise=="function"?Promise:void 0,a6=typeof queueMicrotask=="function"?queueMicrotask:typeof Ox<"u"?function(o){return Ox.resolve(null).then(o).catch(l6)}:Rx;function l6(o){setTimeout(function(){throw o})}function zu(o){return o==="head"}function Px(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),wd(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")kh(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,kh(u);for(var S=u.firstChild;S;){var O=S.nextSibling,et=S.nodeName;S[Ao]||et==="SCRIPT"||et==="STYLE"||et==="LINK"&&S.rel.toLowerCase()==="stylesheet"||u.removeChild(S),S=O}}else u==="body"&&kh(o.ownerDocument.body);u=x}while(u);wd(a)}function Ix(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 p1(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":p1(u),Ll(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function c6(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[Ao])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=bl(o.nextSibling),o===null)break}return null}function u6(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=bl(o.nextSibling),o===null))return null;return o}function jx(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=bl(o.nextSibling),o===null))return null;return o}function m1(o){return o.data==="$?"||o.data==="$~"}function g1(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function f6(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 bl(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 y1=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 bl(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function Bx(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 Fx(o,a,u){switch(a=Kp(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 kh(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);Ll(o)}var xl=new Map,Ux=new Set;function Jp(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var cu=st.d;st.d={f:d6,r:h6,D:p6,C:m6,L:g6,m:y6,X:x6,S:b6,M:v6};function d6(){var o=cu.f(),a=Hp();return o||a}function h6(o){var a=ws(o);a!==null&&a.tag===5&&a.type==="form"?ib(a):cu.r(o)}var bd=typeof document>"u"?null:document;function Hx(o,a,u){var h=bd;if(h&&typeof a=="string"&&a){var x=jr(a);x='link[rel="'+o+'"][href="'+x+'"]',typeof u=="string"&&(x+='[crossorigin="'+u+'"]'),Ux.has(x)||(Ux.add(x),o={rel:o,crossOrigin:u,href:a},h.querySelector(x)===null&&(a=h.createElement("link"),hs(a,"link",o),fi(a),h.head.appendChild(a)))}}function p6(o){cu.D(o),Hx("dns-prefetch",o,null)}function m6(o,a){cu.C(o,a),Hx("preconnect",o,a)}function g6(o,a,u){cu.L(o,a,u);var h=bd;if(h&&o&&a){var x='link[rel="preload"][as="'+jr(a)+'"]';a==="image"&&u&&u.imageSrcSet?(x+='[imagesrcset="'+jr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(x+='[imagesizes="'+jr(u.imageSizes)+'"]')):x+='[href="'+jr(o)+'"]';var S=x;switch(a){case"style":S=xd(o);break;case"script":S=vd(o)}xl.has(S)||(o=y({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),xl.set(S,o),h.querySelector(x)!==null||a==="style"&&h.querySelector(Ah(S))||a==="script"&&h.querySelector(Mh(S))||(a=h.createElement("link"),hs(a,"link",o),fi(a),h.head.appendChild(a)))}}function y6(o,a){cu.m(o,a);var u=bd;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+jr(h)+'"][href="'+jr(o)+'"]',S=x;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=vd(o)}if(!xl.has(S)&&(o=y({rel:"modulepreload",href:o},a),xl.set(S,o),u.querySelector(x)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Mh(S)))return}h=u.createElement("link"),hs(h,"link",o),fi(h),u.head.appendChild(h)}}}function b6(o,a,u){cu.S(o,a,u);var h=bd;if(h&&o){var x=Ko(h).hoistableStyles,S=xd(o);a=a||"default";var O=x.get(S);if(!O){var et={loading:0,preload:null};if(O=h.querySelector(Ah(S)))et.loading=5;else{o=y({rel:"stylesheet",href:o,"data-precedence":a},u),(u=xl.get(S))&&b1(o,u);var Tt=O=h.createElement("link");fi(Tt),hs(Tt,"link",o),Tt._p=new Promise(function(Kt,ae){Tt.onload=Kt,Tt.onerror=ae}),Tt.addEventListener("load",function(){et.loading|=1}),Tt.addEventListener("error",function(){et.loading|=2}),et.loading|=4,Zp(O,a,h)}O={type:"stylesheet",instance:O,count:1,state:et},x.set(S,O)}}}function x6(o,a){cu.X(o,a);var u=bd;if(u&&o){var h=Ko(u).hoistableScripts,x=vd(o),S=h.get(x);S||(S=u.querySelector(Mh(x)),S||(o=y({src:o,async:!0},a),(a=xl.get(x))&&x1(o,a),S=u.createElement("script"),fi(S),hs(S,"link",o),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function v6(o,a){cu.M(o,a);var u=bd;if(u&&o){var h=Ko(u).hoistableScripts,x=vd(o),S=h.get(x);S||(S=u.querySelector(Mh(x)),S||(o=y({src:o,async:!0,type:"module"},a),(a=xl.get(x))&&x1(o,a),S=u.createElement("script"),fi(S),hs(S,"link",o),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function qx(o,a,u,h){var x=(x=wt.current)?Jp(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=xd(u.href),u=Ko(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=xd(u.href);var S=Ko(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(Ah(o)))&&!S._p&&(O.instance=S,O.state.loading=5),xl.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},xl.set(o,u),S||w6(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=vd(u),u=Ko(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 xd(o){return'href="'+jr(o)+'"'}function Ah(o){return'link[rel="stylesheet"]['+o+"]"}function $x(o){return y({},o,{"data-precedence":o.precedence,precedence:null})}function w6(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}),hs(a,"link",u),fi(a),o.head.appendChild(a))}function vd(o){return'[src="'+jr(o)+'"]'}function Mh(o){return"script[async]"+o}function Yx(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+jr(u.href)+'"]');if(h)return a.instance=h,fi(h),h;var x=y({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(o.ownerDocument||o).createElement("style"),fi(h),hs(h,"style",x),Zp(h,u.precedence,o),a.instance=h;case"stylesheet":x=xd(u.href);var S=o.querySelector(Ah(x));if(S)return a.state.loading|=4,a.instance=S,fi(S),S;h=$x(u),(x=xl.get(x))&&b1(h,x),S=(o.ownerDocument||o).createElement("link"),fi(S);var O=S;return O._p=new Promise(function(et,Tt){O.onload=et,O.onerror=Tt}),hs(S,"link",h),a.state.loading|=4,Zp(S,u.precedence,o),a.instance=S;case"script":return S=vd(u.src),(x=o.querySelector(Mh(S)))?(a.instance=x,fi(x),x):(h=u,(x=xl.get(S))&&(h=y({},u),x1(h,x)),o=o.ownerDocument||o,x=o.createElement("script"),fi(x),hs(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,Zp(h,u.precedence,o));return a.instance}function Zp(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 b1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function x1(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var Qp=null;function Vx(o,a,u){if(Qp===null){var h=new Map,x=Qp=new Map;x.set(u,h)}else x=Qp,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[Ao]||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 Wx(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function S6(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 Xx(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function k6(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=xd(h.href),S=a.querySelector(Ah(x));if(S){a=S._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=tm.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=S,fi(S);return}S=a.ownerDocument||a,h=$x(h),(x=xl.get(x))&&b1(h,x),S=S.createElement("link"),fi(S);var O=S;O._p=new Promise(function(et,Tt){O.onload=et,O.onerror=Tt}),hs(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=tm.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var v1=0;function A6(o,a){return o.stylesheets&&o.count===0&&nm(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&nm(o,o.stylesheets),o.unsuspend){var S=o.unsuspend;o.unsuspend=null,S()}},6e4+a);0<o.imgBytes&&v1===0&&(v1=62500*i6());var x=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&nm(o,o.stylesheets),o.unsuspend)){var S=o.unsuspend;o.unsuspend=null,S()}},(o.imgBytes>v1?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(x)}}:null}function tm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var em=null;function nm(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,em=new Map,a.forEach(M6,o),em=null,tm.call(o))}function M6(o,a){if(!(a.state.loading&4)){var u=em.get(o);if(u)var h=u.get(null);else{u=new Map,em.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=tm.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 Ch={$$typeof:V,Provider:null,Consumer:null,_currentValue:lt,_currentValue2:lt,_threadCount:0};function C6(o,a,u,h,x,S,O,et,Tt){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=Vo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vo(0),this.hiddenUpdates=Vo(null),this.identifierPrefix=h,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Tt,this.incompleteTransitions=new Map}function Gx(o,a,u,h,x,S,O,et,Tt,Kt,ae,be){return o=new C6(o,a,u,O,Tt,Kt,ae,be,et),a=1,S===!0&&(a|=24),S=yo(3,null,null,a),o.current=S,S.stateNode=o,a=wa(),a.refCount++,o.pooledCache=a,a.refCount++,S.memoizedState={element:h,isDehydrated:u,cache:a},Oe(S),o}function Kx(o){return o?(o=Vi,o):Vi}function Jx(o,a,u,h,x,S){x=Kx(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&&(Ea(u,o,a),kr(u,o,a))}function Zx(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function w1(o,a){Zx(o,a),(o=o.alternate)&&Zx(o,a)}function Qx(o){if(o.tag===13||o.tag===31){var a=ya(o,67108864);a!==null&&Ea(a,o,67108864),w1(o,67108864)}}function tv(o){if(o.tag===13||o.tag===31){var a=Ga();a=Gn(a);var u=ya(o,a);u!==null&&Ea(u,o,a),w1(o,a)}}var rm=!0;function E6(o,a,u,h){var x=dt.T;dt.T=null;var S=st.p;try{st.p=2,S1(o,a,u,h)}finally{st.p=S,dt.T=x}}function T6(o,a,u,h){var x=dt.T;dt.T=null;var S=st.p;try{st.p=8,S1(o,a,u,h)}finally{st.p=S,dt.T=x}}function S1(o,a,u,h){if(rm){var x=k1(h);if(x===null)l1(o,a,h,im,u),nv(o,h);else if(_6(x,o,a,u,h))h.stopPropagation();else if(nv(o,h),a&4&&-1<N6.indexOf(o)){for(;x!==null;){var S=ws(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 Tt=1<<31-Vn(O);et.entanglements[1]|=Tt,O&=~Tt}Cc(S),(Lr&6)===0&&(Fp=fn()+500,vh(0))}}break;case 31:case 13:et=ya(S,2),et!==null&&Ea(et,S,2),Hp(),w1(S,2)}if(S=k1(h),S===null&&l1(o,a,h,im,u),S===x)break;x=S}x!==null&&h.stopPropagation()}else l1(o,a,h,null,u)}}function k1(o){return o=ol(o),A1(o)}var im=null;function A1(o){if(im=null,o=aa(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 im=o,null}function ev(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(In()){case bn:return 2;case Nn:return 8;case xn:case ze:return 32;case Qe:return 268435456;default:return 32}default:return 32}}var M1=!1,Bu=null,Fu=null,Uu=null,Eh=new Map,Th=new Map,Hu=[],N6="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 nv(o,a){switch(o){case"focusin":case"focusout":Bu=null;break;case"dragenter":case"dragleave":Fu=null;break;case"mouseover":case"mouseout":Uu=null;break;case"pointerover":case"pointerout":Eh.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Th.delete(a.pointerId)}}function Nh(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=ws(a),a!==null&&Qx(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),o)}function _6(o,a,u,h,x){switch(a){case"focusin":return Bu=Nh(Bu,o,a,u,h,x),!0;case"dragenter":return Fu=Nh(Fu,o,a,u,h,x),!0;case"mouseover":return Uu=Nh(Uu,o,a,u,h,x),!0;case"pointerover":var S=x.pointerId;return Eh.set(S,Nh(Eh.get(S)||null,o,a,u,h,x)),!0;case"gotpointercapture":return S=x.pointerId,Th.set(S,Nh(Th.get(S)||null,o,a,u,h,x)),!0}return!1}function rv(o){var a=aa(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,Wo(o.priority,function(){tv(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,Wo(o.priority,function(){tv(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 om(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=k1(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);ks=h,u.target.dispatchEvent(h),ks=null}else return a=ws(u),a!==null&&Qx(a),o.blockedOn=u,!1;a.shift()}return!0}function iv(o,a,u){om(o)&&u.delete(a)}function L6(){M1=!1,Bu!==null&&om(Bu)&&(Bu=null),Fu!==null&&om(Fu)&&(Fu=null),Uu!==null&&om(Uu)&&(Uu=null),Eh.forEach(iv),Th.forEach(iv)}function sm(o,a){o.blockedOn===a&&(o.blockedOn=null,M1||(M1=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,L6)))}var am=null;function ov(o){am!==o&&(am=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){am===o&&(am=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(A1(h||u)===null)continue;break}var S=ws(u);S!==null&&(o.splice(a,3),a-=3,lh(S,{pending:!0,data:x,method:u.method,action:h},h,x))}}))}function wd(o){function a(Tt){return sm(Tt,o)}Bu!==null&&sm(Bu,o),Fu!==null&&sm(Fu,o),Uu!==null&&sm(Uu,o),Eh.forEach(a),Th.forEach(a);for(var u=0;u<Hu.length;u++){var h=Hu[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Hu.length&&(u=Hu[0],u.blockedOn===null);)rv(u),u.blockedOn===null&&Hu.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[or]||null;if(typeof S=="function")O||ov(u);else if(O){var et=null;if(S&&S.hasAttribute("formAction")){if(x=S,O=S[or]||null)et=O.formAction;else if(A1(x)!==null)continue}else et=O.action;typeof et=="function"?u[h+1]=et:(u.splice(h,3),h-=3),ov(u)}}}function sv(){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 C1(o){this._internalRoot=o}lm.prototype.render=C1.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=Ga();Jx(u,h,o,a,null,null)},lm.prototype.unmount=C1.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Jx(o.current,2,null,o,null,null),Hp(),a[Kn]=null}};function lm(o){this._internalRoot=o}lm.prototype.unstable_scheduleHydration=function(o){if(o){var a=Ti();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Hu.length&&a!==0&&a<Hu[u].priority;u++);Hu.splice(u,0,o),u===0&&rv(o)}};var av=t.version;if(av!=="19.2.4")throw Error(r(527,av,"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 D6={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:dt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cm.isDisabled&&cm.supportsFiber)try{mn=cm.inject(D6),an=cm}catch{}}return Lh.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",x=pb,S=mb,O=gb;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=Gx(o,1,!1,null,null,u,h,null,x,S,O,sv),o[Kn]=a.current,a1(o),new C1(a)},Lh.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,x="",S=pb,O=mb,et=gb,Tt=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&&(Tt=u.formState)),a=Gx(o,1,!0,a,u??null,h,x,Tt,S,O,et,sv),a.context=Kx(null),u=a.current,h=Ga(),h=Gn(h),x=Mn(h),x.callback=null,jn(u,x,h),u=h,a.current.lanes=u,Ke(a,u),Cc(a),o[Kn]=a.current,a1(o),new lm(a)},Lh.version="19.2.4",Lh}var yv;function U6(){if(yv)return N1.exports;yv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),N1.exports=F6(),N1.exports}var H6=U6();const ps=[];for(let e=0;e<256;++e)ps.push((e+256).toString(16).slice(1));function q6(e,t=0){return(ps[e[t+0]]+ps[e[t+1]]+ps[e[t+2]]+ps[e[t+3]]+"-"+ps[e[t+4]]+ps[e[t+5]]+"-"+ps[e[t+6]]+ps[e[t+7]]+"-"+ps[e[t+8]]+ps[e[t+9]]+"-"+ps[e[t+10]]+ps[e[t+11]]+ps[e[t+12]]+ps[e[t+13]]+ps[e[t+14]]+ps[e[t+15]]).toLowerCase()}let R1;const $6=new Uint8Array(16);function Y6(){if(!R1){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");R1=crypto.getRandomValues.bind(crypto)}return R1($6)}const V6=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),bv={randomUUID:V6};function W6(e,t,n){e=e||{};const r=e.random??e.rng?.()??Y6();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,q6(r)}function vl(e,t,n){return bv.randomUUID&&!e?bv.randomUUID():W6(e)}const X6="modulepreload",G6=function(e,t){return new URL(e,t).href},xv={},O1=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let d=function(p){return Promise.all(p.map(y=>Promise.resolve(y).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(n.map(p=>{if(p=G6(p,r),p in xv)return;xv[p]=!0;const y=p.endsWith(".css"),b=y?'[rel="stylesheet"]':"";if(r)for(let C=l.length-1;C>=0;C--){const M=l[C];if(M.href===p&&(!y||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${b}`))return;const g=document.createElement("link");if(g.rel=y?"stylesheet":X6,y||(g.as="script"),g.crossOrigin="",g.href=p,f&&g.setAttribute("nonce",f),document.head.appendChild(g),y)return new Promise((C,M)=>{g.addEventListener("load",C),g.addEventListener("error",()=>M(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 $r(e){"@babel/helpers - typeof";return $r=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},$r(e)}var nc=Uint8Array,Qa=Uint16Array,t5=Int32Array,e5=new nc([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]),n5=new nc([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]),vv=new nc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yk=function(e,t){for(var n=new Qa(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new t5(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},bk=yk(e5,2),K6=bk.b,Ky=bk.r;K6[28]=258,Ky[258]=28;var J6=yk(n5,0),wv=J6.r,Jy=new Qa(32768);for(var Ci=0;Ci<32768;++Ci){var $u=(Ci&43690)>>1|(Ci&21845)<<1;$u=($u&52428)>>2|($u&13107)<<2,$u=($u&61680)>>4|($u&3855)<<4,Jy[Ci]=(($u&65280)>>8|($u&255)<<8)>>1}var Vh=(function(e,t,n){for(var r=e.length,i=0,s=new Qa(t);i<r;++i)e[i]&&++s[e[i]-1];var l=new Qa(t);for(i=1;i<t;++i)l[i]=l[i-1]+s[i-1]<<1;var c;if(n){c=new Qa(1<<t);var f=15-t;for(i=0;i<r;++i)if(e[i])for(var d=i<<4|e[i],p=t-e[i],y=l[e[i]-1]++<<p,b=y|(1<<p)-1;y<=b;++y)c[Jy[y]>>f]=d}else for(c=new Qa(r),i=0;i<r;++i)e[i]&&(c[i]=Jy[l[e[i]-1]++]>>15-e[i]);return c}),Wf=new nc(288);for(var Ci=0;Ci<144;++Ci)Wf[Ci]=8;for(var Ci=144;Ci<256;++Ci)Wf[Ci]=9;for(var Ci=256;Ci<280;++Ci)Wf[Ci]=7;for(var Ci=280;Ci<288;++Ci)Wf[Ci]=8;var ng=new nc(32);for(var Ci=0;Ci<32;++Ci)ng[Ci]=5;var Z6=Vh(Wf,9,0),Q6=Vh(ng,5,0),xk=function(e){return(e+7)/8|0},tE=function(e,t,n){return(n==null||n>e.length)&&(n=e.length),new nc(e.subarray(t,n))},uu=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Dh=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},P1=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return{t:wk,l:0};if(i==1){var l=new nc(n[0].s+1);return l[n[0].s]=1,{t:l,l:1}}n.sort(function(gt,_t){return gt.f-_t.f}),n.push({s:-1,f:25001});var c=n[0],f=n[1],d=0,p=1,y=2;for(n[0]={s:-1,f:c.f+f.f,l:c,r:f};p!=i-1;)c=n[n[d].f<n[y].f?d++:y++],f=n[d!=p&&n[d].f<n[y].f?d++:y++],n[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 g=new Qa(b+1),C=Zy(n[p-1],g,0);if(C>t){var r=0,M=0,L=C-t,D=1<<L;for(s.sort(function(_t,kt){return g[kt.s]-g[_t.s]||_t.f-kt.f});r<i;++r){var H=s[r].s;if(g[H]>t)M+=D-(1<<C-g[H]),g[H]=t;else break}for(M>>=L;M>0;){var V=s[r].s;g[V]<t?M-=1<<t-g[V]++-1:++r}for(;r>=0&&M;--r){var W=s[r].s;g[W]==t&&(--g[W],++M)}C=t}return{t:new nc(g),l:C}},Zy=function(e,t,n){return e.s==-1?Math.max(Zy(e.l,t,n+1),Zy(e.r,t,n+1)):t[e.s]=n},Sv=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Qa(++t),r=0,i=e[0],s=1,l=function(f){n[r++]=f},c=1;c<=t;++c)if(e[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=e[c]}return{c:n.subarray(0,r),n:t}},Rh=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},vk=function(e,t,n){var r=n.length,i=xk(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},kv=function(e,t,n,r,i,s,l,c,f,d,p){uu(t,p++,n),++i[256];for(var y=P1(i,15),b=y.t,g=y.l,C=P1(s,15),M=C.t,L=C.l,D=Sv(b),H=D.c,V=D.n,W=Sv(M),gt=W.c,_t=W.n,kt=new Qa(19),xt=0;xt<H.length;++xt)++kt[H[xt]&31];for(var xt=0;xt<gt.length;++xt)++kt[gt[xt]&31];for(var rt=P1(kt,7),jt=rt.t,J=rt.l,ct=19;ct>4&&!jt[vv[ct-1]];--ct);var X=d+5<<3,bt=Rh(i,Wf)+Rh(s,ng)+l,Lt=Rh(i,b)+Rh(s,M)+l+14+3*ct+Rh(kt,jt)+2*kt[16]+3*kt[17]+7*kt[18];if(f>=0&&X<=bt&&X<=Lt)return vk(t,p,e.subarray(f,f+d));var dt,st,lt,zt;if(uu(t,p,1+(Lt<bt)),p+=2,Lt<bt){dt=Vh(b,g,0),st=b,lt=Vh(M,L,0),zt=M;var Mt=Vh(jt,J,0);uu(t,p,V-257),uu(t,p+5,_t-1),uu(t,p+10,ct-4),p+=14;for(var xt=0;xt<ct;++xt)uu(t,p+3*xt,jt[vv[xt]]);p+=3*ct;for(var K=[H,gt],P=0;P<2;++P)for(var Y=K[P],xt=0;xt<Y.length;++xt){var tt=Y[xt]&31;uu(t,p,Mt[tt]),p+=jt[tt],tt>15&&(uu(t,p,Y[xt]>>5&127),p+=Y[xt]>>12)}}else dt=Z6,st=Wf,lt=Q6,zt=ng;for(var xt=0;xt<c;++xt){var yt=r[xt];if(yt>255){var tt=yt>>18&31;Dh(t,p,dt[tt+257]),p+=st[tt+257],tt>7&&(uu(t,p,yt>>23&31),p+=e5[tt]);var wt=yt&31;Dh(t,p,lt[wt]),p+=zt[wt],wt>3&&(Dh(t,p,yt>>5&8191),p+=n5[wt])}else Dh(t,p,dt[yt]),p+=st[yt]}return Dh(t,p,dt[256]),p+st[256]},eE=new t5([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),wk=new nc(0),nE=function(e,t,n,r,i,s){var l=s.z||e.length,c=new nc(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 y=eE[t-1],b=y>>13,g=y&8191,C=(1<<n)-1,M=s.p||new Qa(32768),L=s.h||new Qa(C+1),D=Math.ceil(n/3),H=2*D,V=function(Ue){return(e[Ue]^e[Ue+1]<<D^e[Ue+2]<<H)&C},W=new t5(25e3),gt=new Qa(288),_t=new Qa(32),kt=0,xt=0,rt=s.i||0,jt=0,J=s.w||0,ct=0;rt+2<l;++rt){var X=V(rt),bt=rt&32767,Lt=L[X];if(M[bt]=Lt,L[X]=bt,J<=rt){var dt=l-rt;if((kt>7e3||jt>24576)&&(dt>423||!d)){p=kv(e,f,0,W,gt,_t,xt,jt,ct,rt-ct,p),jt=kt=xt=0,ct=rt;for(var st=0;st<286;++st)gt[st]=0;for(var st=0;st<30;++st)_t[st]=0}var lt=2,zt=0,Mt=g,K=bt-Lt&32767;if(dt>2&&X==V(rt-K))for(var P=Math.min(b,dt)-1,Y=Math.min(32767,rt),tt=Math.min(258,dt);K<=Y&&--Mt&&bt!=Lt;){if(e[rt+lt]==e[rt+lt-K]){for(var yt=0;yt<tt&&e[rt+yt]==e[rt+yt-K];++yt);if(yt>lt){if(lt=yt,zt=K,yt>P)break;for(var wt=Math.min(K,yt-2),At=0,st=0;st<wt;++st){var qt=rt-K+st&32767,Rt=M[qt],Zt=qt-Rt&32767;Zt>At&&(At=Zt,Lt=qt)}}}bt=Lt,Lt=M[bt],K+=bt-Lt&32767}if(zt){W[jt++]=268435456|Ky[lt]<<18|wv[zt];var Me=Ky[lt]&31,le=wv[zt]&31;xt+=e5[Me]+n5[le],++gt[257+Me],++_t[le],J=rt+lt,++kt}else W[jt++]=e[rt],++gt[e[rt]]}}for(rt=Math.max(rt,J);rt<l;++rt)W[jt++]=e[rt],++gt[e[rt]];p=kv(e,f,d,W,gt,_t,xt,jt,ct,rt-ct,p),d||(s.r=p&7|f[p/8|0]<<3,p-=7,s.h=L,s.p=M,s.i=rt,s.w=J)}else{for(var rt=s.w||0;rt<l+d;rt+=65535){var Ie=rt+65535;Ie>=l&&(f[p/8|0]=d,Ie=l),p=vk(f,p+1,e.subarray(rt,Ie))}s.i=l}return tE(c,0,r+xk(p)+i)},Sk=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,s=n.length|0,l=0;l!=s;){for(var c=Math.min(l+2655,s);l<c;++l)i+=r+=n[l];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},rE=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),l=new nc(s.length+e.length);l.set(s),l.set(e,s.length),e=l,i.w=s.length}return nE(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},kk=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},iE=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=Sk();i.p(t.dictionary),kk(e,2,i.d())}};function Qy(e,t){t||(t={});var n=Sk();n.p(e);var r=rE(e,t,t.dictionary?6:2,4);return iE(r,t),kk(r,r.length-4,n.d()),r}var oE=typeof TextDecoder<"u"&&new TextDecoder,sE=0;try{oE.decode(wk,{stream:!0}),sE=1}catch{}function aE(e){if(Array.isArray(e))return e}function lE(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,l,c=[],f=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(f=(r=s.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(p){d=!0,i=p}finally{try{if(!f&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw i}}return c}}function Av(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function cE(e,t){if(e){if(typeof e=="string")return Av(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Av(e,t):void 0}}function uE(){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 Mv(e,t){return aE(e)||lE(e,t)||cE(e,t)||uE()}function Cv(e,t="utf8"){return new TextDecoder(t).decode(e)}const fE=new TextEncoder;function dE(e){return fE.encode(e)}const hE=1024*8,pE=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),I1={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 r5{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=hE,n={}){let r=!1;typeof t=="number"?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);const i=n.offset?n.offset>>>0:0,s=t.byteLength-i;let l=i;(ArrayBuffer.isView(t)||t instanceof r5)&&(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,n){const r=I1[n].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,s=this.buffer.slice(i,i+r);if(this.littleEndian===pE&&n!=="uint8"&&n!=="int8"){const c=new Uint8Array(this.buffer.slice(i,i+r));c.reverse();const f=new I1[n](c.buffer);return this.offset+=r,f.reverse(),f}const l=new I1[n](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 n="";for(let r=0;r<t;r++)n+=this.readChar();return n}readUtf8(t=1){return Cv(this.readBytes(t))}decodeText(t=1,n="utf8"){return Cv(this.readBytes(t),n)}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 n=0;n<t.length;n++)this._data.setUint8(this.offset++,t[n]);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 n=0;n<t.length;n++)this.writeUint8(t.charCodeAt(n));return this}writeUtf8(t){return this.writeBytes(dE(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 th(e){let t=e.length;for(;--t>=0;)e[t]=0}const mE=3,gE=258,Ak=29,yE=256,bE=yE+1+Ak,Mk=30,xE=512,vE=new Array((bE+2)*2);th(vE);const wE=new Array(Mk*2);th(wE);const SE=new Array(xE);th(SE);const kE=new Array(gE-mE+1);th(kE);const AE=new Array(Ak);th(AE);const ME=new Array(Mk);th(ME);const CE=(e,t,n,r)=>{let i=e&65535|0,s=e>>>16&65535|0,l=0;for(;n!==0;){l=n>2e3?2e3:n,n-=l;do i=i+t[r++]|0,s=s+i|0;while(--l);i%=65521,s%=65521}return i|s<<16|0};var t2=CE;const EE=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},TE=new Uint32Array(EE()),NE=(e,t,n,r)=>{const i=TE,s=r+n;e^=-1;for(let l=r;l<s;l++)e=e>>>8^i[(e^t[l])&255];return e^-1};var Ec=NE,e2={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"},Ck={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 _E=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var LE=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)_E(n,r)&&(e[r]=n[r])}}return e},DE=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,i=0,s=e.length;r<s;r++){let l=e[r];n.set(l,i),i+=l.length}return n},Ek={assign:LE,flattenChunks:DE};let Tk=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Tk=!1}const lp=new Uint8Array(256);for(let e=0;e<256;e++)lp[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;lp[254]=lp[254]=1;var RE=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,s,l=e.length,c=0;for(i=0;i<l;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<l&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(c),s=0,i=0;s<c;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<l&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|n&63):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|n&63):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|n&63);return t};const OE=(e,t)=>{if(t<65534&&e.subarray&&Tk)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var PE=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const s=new Array(n*2);for(i=0,r=0;r<n;){let l=e[r++];if(l<128){s[i++]=l;continue}let c=lp[l];if(c>4){s[i++]=65533,r+=c-1;continue}for(l&=c===2?31:c===3?15:7;c>1&&r<n;)l=l<<6|e[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 OE(s,i)},IE=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+lp[e[n]]>t?n:t},n2={string2buf:RE,buf2string:PE,utf8border:IE};function jE(){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 zE=jE;const um=16209,BE=16191;var FE=function(t,n){let r,i,s,l,c,f,d,p,y,b,g,C,M,L,D,H,V,W,gt,_t,kt,xt,rt,jt;const J=t.state;r=t.next_in,rt=t.input,i=r+(t.avail_in-5),s=t.next_out,jt=t.output,l=s-(n-t.avail_out),c=s+(t.avail_out-257),f=J.dmax,d=J.wsize,p=J.whave,y=J.wnext,b=J.window,g=J.hold,C=J.bits,M=J.lencode,L=J.distcode,D=(1<<J.lenbits)-1,H=(1<<J.distbits)-1;t:do{C<15&&(g+=rt[r++]<<C,C+=8,g+=rt[r++]<<C,C+=8),V=M[g&D];e:for(;;){if(W=V>>>24,g>>>=W,C-=W,W=V>>>16&255,W===0)jt[s++]=V&65535;else if(W&16){gt=V&65535,W&=15,W&&(C<W&&(g+=rt[r++]<<C,C+=8),gt+=g&(1<<W)-1,g>>>=W,C-=W),C<15&&(g+=rt[r++]<<C,C+=8,g+=rt[r++]<<C,C+=8),V=L[g&H];n:for(;;){if(W=V>>>24,g>>>=W,C-=W,W=V>>>16&255,W&16){if(_t=V&65535,W&=15,C<W&&(g+=rt[r++]<<C,C+=8,C<W&&(g+=rt[r++]<<C,C+=8)),_t+=g&(1<<W)-1,_t>f){t.msg="invalid distance too far back",J.mode=um;break t}if(g>>>=W,C-=W,W=s-l,_t>W){if(W=_t-W,W>p&&J.sane){t.msg="invalid distance too far back",J.mode=um;break t}if(kt=0,xt=b,y===0){if(kt+=d-W,W<gt){gt-=W;do jt[s++]=b[kt++];while(--W);kt=s-_t,xt=jt}}else if(y<W){if(kt+=d+y-W,W-=y,W<gt){gt-=W;do jt[s++]=b[kt++];while(--W);if(kt=0,y<gt){W=y,gt-=W;do jt[s++]=b[kt++];while(--W);kt=s-_t,xt=jt}}}else if(kt+=y-W,W<gt){gt-=W;do jt[s++]=b[kt++];while(--W);kt=s-_t,xt=jt}for(;gt>2;)jt[s++]=xt[kt++],jt[s++]=xt[kt++],jt[s++]=xt[kt++],gt-=3;gt&&(jt[s++]=xt[kt++],gt>1&&(jt[s++]=xt[kt++]))}else{kt=s-_t;do jt[s++]=jt[kt++],jt[s++]=jt[kt++],jt[s++]=jt[kt++],gt-=3;while(gt>2);gt&&(jt[s++]=jt[kt++],gt>1&&(jt[s++]=jt[kt++]))}}else if((W&64)===0){V=L[(V&65535)+(g&(1<<W)-1)];continue n}else{t.msg="invalid distance code",J.mode=um;break t}break}}else if((W&64)===0){V=M[(V&65535)+(g&(1<<W)-1)];continue e}else if(W&32){J.mode=BE;break t}else{t.msg="invalid literal/length code",J.mode=um;break t}break}}while(r<i&&s<c);gt=C>>3,r-=gt,C-=gt<<3,g&=(1<<C)-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),J.hold=g,J.bits=C};const Sd=15,Ev=852,Tv=592,Nv=0,j1=1,_v=2,UE=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]),HE=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]),qE=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]),$E=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]),YE=(e,t,n,r,i,s,l,c)=>{const f=c.bits;let d=0,p=0,y=0,b=0,g=0,C=0,M=0,L=0,D=0,H=0,V,W,gt,_t,kt,xt=null,rt;const jt=new Uint16Array(Sd+1),J=new Uint16Array(Sd+1);let ct=null,X,bt,Lt;for(d=0;d<=Sd;d++)jt[d]=0;for(p=0;p<r;p++)jt[t[n+p]]++;for(g=f,b=Sd;b>=1&&jt[b]===0;b--);if(g>b&&(g=b),b===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,c.bits=1,0;for(y=1;y<b&&jt[y]===0;y++);for(g<y&&(g=y),L=1,d=1;d<=Sd;d++)if(L<<=1,L-=jt[d],L<0)return-1;if(L>0&&(e===Nv||b!==1))return-1;for(J[1]=0,d=1;d<Sd;d++)J[d+1]=J[d]+jt[d];for(p=0;p<r;p++)t[n+p]!==0&&(l[J[t[n+p]]++]=p);if(e===Nv?(xt=ct=l,rt=20):e===j1?(xt=UE,ct=HE,rt=257):(xt=qE,ct=$E,rt=0),H=0,p=0,d=y,kt=s,C=g,M=0,gt=-1,D=1<<g,_t=D-1,e===j1&&D>Ev||e===_v&&D>Tv)return 1;for(;;){X=d-M,l[p]+1<rt?(bt=0,Lt=l[p]):l[p]>=rt?(bt=ct[l[p]-rt],Lt=xt[l[p]-rt]):(bt=96,Lt=0),V=1<<d-M,W=1<<C,y=W;do W-=V,i[kt+(H>>M)+W]=X<<24|bt<<16|Lt|0;while(W!==0);for(V=1<<d-1;H&V;)V>>=1;if(V!==0?(H&=V-1,H+=V):H=0,p++,--jt[d]===0){if(d===b)break;d=t[n+l[p]]}if(d>g&&(H&_t)!==gt){for(M===0&&(M=g),kt+=y,C=d-M,L=1<<C;C+M<b&&(L-=jt[C+M],!(L<=0));)C++,L<<=1;if(D+=1<<C,e===j1&&D>Ev||e===_v&&D>Tv)return 1;gt=H&_t,i[gt]=g<<24|C<<16|kt-s|0}}return H!==0&&(i[kt+H]=d-M<<24|64<<16|0),c.bits=g,0};var Wh=YE;const VE=0,Nk=1,_k=2,{Z_FINISH:Lv,Z_BLOCK:WE,Z_TREES:fm,Z_OK:Xf,Z_STREAM_END:XE,Z_NEED_DICT:GE,Z_STREAM_ERROR:_l,Z_DATA_ERROR:Lk,Z_MEM_ERROR:Dk,Z_BUF_ERROR:KE,Z_DEFLATED:Dv}=Ck,e0=16180,Rv=16181,Ov=16182,Pv=16183,Iv=16184,jv=16185,zv=16186,Bv=16187,Fv=16188,Uv=16189,rg=16190,fu=16191,z1=16192,Hv=16193,B1=16194,qv=16195,$v=16196,Yv=16197,Vv=16198,dm=16199,hm=16200,Wv=16201,Xv=16202,Gv=16203,Kv=16204,Jv=16205,F1=16206,Zv=16207,Qv=16208,Oi=16209,Rk=16210,Ok=16211,JE=852,ZE=592,QE=15,tT=QE,tw=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function eT(){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 rd=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<e0||t.mode>Ok?1:0},Pk=e=>{if(rd(e))return _l;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=e0,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(JE),t.distcode=t.distdyn=new Int32Array(ZE),t.sane=1,t.back=-1,Xf},Ik=e=>{if(rd(e))return _l;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Pk(e)},jk=(e,t)=>{let n;if(rd(e))return _l;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?_l:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Ik(e))},zk=(e,t)=>{if(!e)return _l;const n=new eT;e.state=n,n.strm=e,n.window=null,n.mode=e0;const r=jk(e,t);return r!==Xf&&(e.state=null),r},nT=e=>zk(e,tT);let ew=!0,U1,H1;const rT=e=>{if(ew){U1=new Int32Array(512),H1=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Wh(Nk,e.lens,0,288,U1,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Wh(_k,e.lens,0,32,H1,0,e.work,{bits:5}),ew=!1}e.lencode=U1,e.lenbits=9,e.distcode=H1,e.distbits=5},Bk=(e,t,n,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(n-r,n-r+i),s.wnext),r-=i,r?(s.window.set(t.subarray(n-r,n),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},iT=(e,t)=>{let n,r,i,s,l,c,f,d,p,y,b,g,C,M,L=0,D,H,V,W,gt,_t,kt,xt;const rt=new Uint8Array(4);let jt,J;const ct=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(rd(e)||!e.output||!e.input&&e.avail_in!==0)return _l;n=e.state,n.mode===fu&&(n.mode=z1),l=e.next_out,i=e.output,f=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,d=n.hold,p=n.bits,y=c,b=f,xt=Xf;t:for(;;)switch(n.mode){case e0:if(n.wrap===0){n.mode=z1;break}for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.wrap&2&&d===35615){n.wbits===0&&(n.wbits=15),n.check=0,rt[0]=d&255,rt[1]=d>>>8&255,n.check=Ec(n.check,rt,2,0),d=0,p=0,n.mode=Rv;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((d&255)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=Oi;break}if((d&15)!==Dv){e.msg="unknown compression method",n.mode=Oi;break}if(d>>>=4,p-=4,kt=(d&15)+8,n.wbits===0&&(n.wbits=kt),kt>15||kt>n.wbits){e.msg="invalid window size",n.mode=Oi;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=d&512?Uv:fu,d=0,p=0;break;case Rv:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.flags=d,(n.flags&255)!==Dv){e.msg="unknown compression method",n.mode=Oi;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Oi;break}n.head&&(n.head.text=d>>8&1),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,n.check=Ec(n.check,rt,2,0)),d=0,p=0,n.mode=Ov;case Ov:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.head&&(n.head.time=d),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,rt[2]=d>>>16&255,rt[3]=d>>>24&255,n.check=Ec(n.check,rt,4,0)),d=0,p=0,n.mode=Pv;case Pv:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.head&&(n.head.xflags=d&255,n.head.os=d>>8),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,n.check=Ec(n.check,rt,2,0)),d=0,p=0,n.mode=Iv;case Iv:if(n.flags&1024){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.length=d,n.head&&(n.head.extra_len=d),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,n.check=Ec(n.check,rt,2,0)),d=0,p=0}else n.head&&(n.head.extra=null);n.mode=jv;case jv:if(n.flags&1024&&(g=n.length,g>c&&(g=c),g&&(n.head&&(kt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(s,s+g),kt)),n.flags&512&&n.wrap&4&&(n.check=Ec(n.check,r,g,s)),c-=g,s+=g,n.length-=g),n.length))break t;n.length=0,n.mode=zv;case zv:if(n.flags&2048){if(c===0)break t;g=0;do kt=r[s+g++],n.head&&kt&&n.length<65536&&(n.head.name+=String.fromCharCode(kt));while(kt&&g<c);if(n.flags&512&&n.wrap&4&&(n.check=Ec(n.check,r,g,s)),c-=g,s+=g,kt)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=Bv;case Bv:if(n.flags&4096){if(c===0)break t;g=0;do kt=r[s+g++],n.head&&kt&&n.length<65536&&(n.head.comment+=String.fromCharCode(kt));while(kt&&g<c);if(n.flags&512&&n.wrap&4&&(n.check=Ec(n.check,r,g,s)),c-=g,s+=g,kt)break t}else n.head&&(n.head.comment=null);n.mode=Fv;case Fv:if(n.flags&512){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.wrap&4&&d!==(n.check&65535)){e.msg="header crc mismatch",n.mode=Oi;break}d=0,p=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=fu;break;case Uv:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.adler=n.check=tw(d),d=0,p=0,n.mode=rg;case rg:if(n.havedict===0)return e.next_out=l,e.avail_out=f,e.next_in=s,e.avail_in=c,n.hold=d,n.bits=p,GE;e.adler=n.check=1,n.mode=fu;case fu:if(t===WE||t===fm)break t;case z1:if(n.last){d>>>=p&7,p-=p&7,n.mode=F1;break}for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}switch(n.last=d&1,d>>>=1,p-=1,d&3){case 0:n.mode=Hv;break;case 1:if(rT(n),n.mode=dm,t===fm){d>>>=2,p-=2;break t}break;case 2:n.mode=$v;break;case 3:e.msg="invalid block type",n.mode=Oi}d>>>=2,p-=2;break;case Hv: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)){e.msg="invalid stored block lengths",n.mode=Oi;break}if(n.length=d&65535,d=0,p=0,n.mode=B1,t===fm)break t;case B1:n.mode=qv;case qv:if(g=n.length,g){if(g>c&&(g=c),g>f&&(g=f),g===0)break t;i.set(r.subarray(s,s+g),l),c-=g,s+=g,f-=g,l+=g,n.length-=g;break}n.mode=fu;break;case $v:for(;p<14;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.nlen=(d&31)+257,d>>>=5,p-=5,n.ndist=(d&31)+1,d>>>=5,p-=5,n.ncode=(d&15)+4,d>>>=4,p-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Oi;break}n.have=0,n.mode=Yv;case Yv:for(;n.have<n.ncode;){for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.lens[ct[n.have++]]=d&7,d>>>=3,p-=3}for(;n.have<19;)n.lens[ct[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,jt={bits:n.lenbits},xt=Wh(VE,n.lens,0,19,n.lencode,0,n.work,jt),n.lenbits=jt.bits,xt){e.msg="invalid code lengths set",n.mode=Oi;break}n.have=0,n.mode=Vv;case Vv:for(;n.have<n.nlen+n.ndist;){for(;L=n.lencode[d&(1<<n.lenbits)-1],D=L>>>24,H=L>>>16&255,V=L&65535,!(D<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(V<16)d>>>=D,p-=D,n.lens[n.have++]=V;else{if(V===16){for(J=D+2;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(d>>>=D,p-=D,n.have===0){e.msg="invalid bit length repeat",n.mode=Oi;break}kt=n.lens[n.have-1],g=3+(d&3),d>>>=2,p-=2}else if(V===17){for(J=D+3;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=D,p-=D,kt=0,g=3+(d&7),d>>>=3,p-=3}else{for(J=D+7;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=D,p-=D,kt=0,g=11+(d&127),d>>>=7,p-=7}if(n.have+g>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Oi;break}for(;g--;)n.lens[n.have++]=kt}}if(n.mode===Oi)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Oi;break}if(n.lenbits=9,jt={bits:n.lenbits},xt=Wh(Nk,n.lens,0,n.nlen,n.lencode,0,n.work,jt),n.lenbits=jt.bits,xt){e.msg="invalid literal/lengths set",n.mode=Oi;break}if(n.distbits=6,n.distcode=n.distdyn,jt={bits:n.distbits},xt=Wh(_k,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,jt),n.distbits=jt.bits,xt){e.msg="invalid distances set",n.mode=Oi;break}if(n.mode=dm,t===fm)break t;case dm:n.mode=hm;case hm:if(c>=6&&f>=258){e.next_out=l,e.avail_out=f,e.next_in=s,e.avail_in=c,n.hold=d,n.bits=p,FE(e,b),l=e.next_out,i=e.output,f=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,d=n.hold,p=n.bits,n.mode===fu&&(n.back=-1);break}for(n.back=0;L=n.lencode[d&(1<<n.lenbits)-1],D=L>>>24,H=L>>>16&255,V=L&65535,!(D<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(H&&(H&240)===0){for(W=D,gt=H,_t=V;L=n.lencode[_t+((d&(1<<W+gt)-1)>>W)],D=L>>>24,H=L>>>16&255,V=L&65535,!(W+D<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=W,p-=W,n.back+=W}if(d>>>=D,p-=D,n.back+=D,n.length=V,H===0){n.mode=Jv;break}if(H&32){n.back=-1,n.mode=fu;break}if(H&64){e.msg="invalid literal/length code",n.mode=Oi;break}n.extra=H&15,n.mode=Wv;case Wv:if(n.extra){for(J=n.extra;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,p-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Xv;case Xv:for(;L=n.distcode[d&(1<<n.distbits)-1],D=L>>>24,H=L>>>16&255,V=L&65535,!(D<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if((H&240)===0){for(W=D,gt=H,_t=V;L=n.distcode[_t+((d&(1<<W+gt)-1)>>W)],D=L>>>24,H=L>>>16&255,V=L&65535,!(W+D<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=W,p-=W,n.back+=W}if(d>>>=D,p-=D,n.back+=D,H&64){e.msg="invalid distance code",n.mode=Oi;break}n.offset=V,n.extra=H&15,n.mode=Gv;case Gv:if(n.extra){for(J=n.extra;p<J;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,p-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Oi;break}n.mode=Kv;case Kv:if(f===0)break t;if(g=b-f,n.offset>g){if(g=n.offset-g,g>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Oi;break}g>n.wnext?(g-=n.wnext,C=n.wsize-g):C=n.wnext-g,g>n.length&&(g=n.length),M=n.window}else M=i,C=l-n.offset,g=n.length;g>f&&(g=f),f-=g,n.length-=g;do i[l++]=M[C++];while(--g);n.length===0&&(n.mode=hm);break;case Jv:if(f===0)break t;i[l++]=n.length,f--,n.mode=hm;break;case F1:if(n.wrap){for(;p<32;){if(c===0)break t;c--,d|=r[s++]<<p,p+=8}if(b-=f,e.total_out+=b,n.total+=b,n.wrap&4&&b&&(e.adler=n.check=n.flags?Ec(n.check,i,b,l-b):t2(n.check,i,b,l-b)),b=f,n.wrap&4&&(n.flags?d:tw(d))!==n.check){e.msg="incorrect data check",n.mode=Oi;break}d=0,p=0}n.mode=Zv;case Zv:if(n.wrap&&n.flags){for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.wrap&4&&d!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=Oi;break}d=0,p=0}n.mode=Qv;case Qv:xt=XE;break t;case Oi:xt=Lk;break t;case Rk:return Dk;case Ok:default:return _l}return e.next_out=l,e.avail_out=f,e.next_in=s,e.avail_in=c,n.hold=d,n.bits=p,(n.wsize||b!==e.avail_out&&n.mode<Oi&&(n.mode<F1||t!==Lv))&&Bk(e,e.output,e.next_out,b-e.avail_out),y-=e.avail_in,b-=e.avail_out,e.total_in+=y,e.total_out+=b,n.total+=b,n.wrap&4&&b&&(e.adler=n.check=n.flags?Ec(n.check,i,b,e.next_out-b):t2(n.check,i,b,e.next_out-b)),e.data_type=n.bits+(n.last?64:0)+(n.mode===fu?128:0)+(n.mode===dm||n.mode===B1?256:0),(y===0&&b===0||t===Lv)&&xt===Xf&&(xt=KE),xt},oT=e=>{if(rd(e))return _l;let t=e.state;return t.window&&(t.window=null),e.state=null,Xf},sT=(e,t)=>{if(rd(e))return _l;const n=e.state;return(n.wrap&2)===0?_l:(n.head=t,t.done=!1,Xf)},aT=(e,t)=>{const n=t.length;let r,i,s;return rd(e)||(r=e.state,r.wrap!==0&&r.mode!==rg)?_l:r.mode===rg&&(i=1,i=t2(i,t,n,0),i!==r.check)?Lk:(s=Bk(e,t,n,n),s?(r.mode=Rk,Dk):(r.havedict=1,Xf))};var lT=Ik,cT=jk,uT=Pk,fT=nT,dT=zk,hT=iT,pT=oT,mT=sT,gT=aT,yT="pako inflate (from Nodeca project)",bu={inflateReset:lT,inflateReset2:cT,inflateResetKeep:uT,inflateInit:fT,inflateInit2:dT,inflate:hT,inflateEnd:pT,inflateGetHeader:mT,inflateSetDictionary:gT,inflateInfo:yT};function bT(){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 xT=bT;const Fk=Object.prototype.toString,{Z_NO_FLUSH:vT,Z_FINISH:wT,Z_OK:cp,Z_STREAM_END:q1,Z_NEED_DICT:$1,Z_STREAM_ERROR:ST,Z_DATA_ERROR:nw,Z_MEM_ERROR:kT}=Ck;function Sp(e){this.options=Ek.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zE,this.strm.avail_out=0;let n=bu.inflateInit2(this.strm,t.windowBits);if(n!==cp)throw new Error(e2[n]);if(this.header=new xT,bu.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=n2.string2buf(t.dictionary):Fk.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=bu.inflateSetDictionary(this.strm,t.dictionary),n!==cp)))throw new Error(e2[n])}Sp.prototype.push=function(e,t){const n=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?wT:vT,Fk.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),s=bu.inflate(n,l),s===$1&&i&&(s=bu.inflateSetDictionary(n,i),s===cp?s=bu.inflate(n,l):s===nw&&(s=$1));n.avail_in>0&&s===q1&&n.state.wrap>0&&e[n.next_in]!==0;)bu.inflateReset(n),s=bu.inflate(n,l);switch(s){case ST:case nw:case $1:case kT:return this.onEnd(s),this.ended=!0,!1}if(c=n.avail_out,n.next_out&&(n.avail_out===0||s===q1))if(this.options.to==="string"){let f=n2.utf8border(n.output,n.next_out),d=n.next_out-f,p=n2.buf2string(n.output,f);n.next_out=d,n.avail_out=r-d,d&&n.output.set(n.output.subarray(f,f+d),0),this.onData(p)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(s===cp&&c===0)){if(s===q1)return s=bu.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Sp.prototype.onData=function(e){this.chunks.push(e)};Sp.prototype.onEnd=function(e){e===cp&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ek.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function AT(e,t){const n=new Sp(t);if(n.push(e),n.err)throw n.msg||e2[n.err];return n.result}var MT=Sp,CT=AT,ET={Inflate:MT,inflate:CT};const{Inflate:TT,inflate:NT}=ET;var rw=TT,_T=NT;const Uk=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;Uk[e]=t}const iw=4294967295;function LT(e,t,n){let r=e;for(let i=0;i<n;i++)r=Uk[(r^t[i])&255]^r>>>8;return r}function DT(e,t){return(LT(iw,e,t)^iw)>>>0}function ow(e,t,n){const r=e.readUint32(),i=DT(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw new Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function Hk(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function qk(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function $k(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function Yk(e,t,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)t[s]=e[s];for(;s<r;s++)t[s]=e[s]+(t[s-i]>>1)&255}else{for(;s<i;s++)t[s]=e[s]+(n[s]>>1)&255;for(;s<r;s++)t[s]=e[s]+(t[s-i]+n[s]>>1)&255}}function Vk(e,t,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)t[s]=e[s];for(;s<r;s++)t[s]=e[s]+t[s-i]&255}else{for(;s<i;s++)t[s]=e[s]+n[s]&255;for(;s<r;s++)t[s]=e[s]+RT(t[s-i],n[s],n[s-i])&255}}function RT(e,t,n){const r=e+t-n,i=Math.abs(r-e),s=Math.abs(r-t),l=Math.abs(r-n);return i<=s&&i<=l?e:s<=l?t:n}function OT(e,t,n,r,i,s){switch(e){case 0:Hk(t,n,i);break;case 1:qk(t,n,i,s);break;case 2:$k(t,n,r,i);break;case 3:Yk(t,n,r,i,s);break;case 4:Vk(t,n,r,i,s);break;default:throw new Error(`Unsupported filter: ${e}`)}}const PT=new Uint16Array([255]),IT=new Uint8Array(PT.buffer),jT=IT[0]===255;function zT(e){const{data:t,width:n,height:r,channels:i,depth:s}=e,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*n*c);let d=0;for(let p=0;p<7;p++){const y=l[p],b=Math.ceil((n-y.x)/y.xStep),g=Math.ceil((r-y.y)/y.yStep);if(b<=0||g<=0)continue;const C=b*c,M=new Uint8Array(C);for(let L=0;L<g;L++){const D=t[d++],H=t.subarray(d,d+C);d+=C;const V=new Uint8Array(C);OT(D,H,V,M,C,c),M.set(V);for(let W=0;W<b;W++){const gt=y.x+W*y.xStep,_t=y.y+L*y.yStep;if(!(gt>=n||_t>=r))for(let kt=0;kt<c;kt++)f[(_t*n+gt)*c+kt]=V[W*c+kt]}}}if(s===16){const p=new Uint16Array(f.buffer);if(jT)for(let y=0;y<p.length;y++)p[y]=BT(p[y]);return p}else return f}function BT(e){return(e&255)<<8|e>>8&255}const FT=new Uint16Array([255]),UT=new Uint8Array(FT.buffer),HT=UT[0]===255,qT=new Uint8Array(0);function sw(e){const{data:t,width:n,height:r,channels:i,depth:s}=e,l=Math.ceil(s/8)*i,c=Math.ceil(s/8*i*n),f=new Uint8Array(r*c);let d=qT,p=0,y,b;for(let g=0;g<r;g++){switch(y=t.subarray(p+1,p+1+c),b=f.subarray(g*c,(g+1)*c),t[p]){case 0:Hk(y,b,c);break;case 1:qk(y,b,c,l);break;case 2:$k(y,b,d,c);break;case 3:Yk(y,b,d,c,l);break;case 4:Vk(y,b,d,c,l);break;default:throw new Error(`Unsupported filter: ${t[p]}`)}d=b,p+=c+1}if(s===16){const g=new Uint16Array(f.buffer);if(HT)for(let C=0;C<g.length;C++)g[C]=$T(g[C]);return g}else return f}function $T(e){return(e&255)<<8|e>>8&255}const Hm=Uint8Array.of(137,80,78,71,13,10,26,10);function aw(e){if(!YT(e.readBytes(Hm.length)))throw new Error("wrong PNG signature")}function YT(e){if(e.length<Hm.length)return!1;for(let t=0;t<Hm.length;t++)if(e[t]!==Hm[t])return!1;return!0}const VT="tEXt",WT=0,Wk=new TextDecoder("latin1");function XT(e){if(KT(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const GT=/^[\u0000-\u00FF]*$/;function KT(e){if(!GT.test(e))throw new Error("invalid latin1 text")}function JT(e,t,n){const r=Xk(t);e[r]=ZT(t,n-r.length-1)}function Xk(e){for(e.mark();e.readByte()!==WT;);const t=e.offset;e.reset();const n=Wk.decode(e.readBytes(t-e.offset-1));return e.skip(1),XT(n),n}function ZT(e,t){return Wk.decode(e.readBytes(t))}const Ka={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},Y1={UNKNOWN:-1,DEFLATE:0},lw={UNKNOWN:-1,ADAPTIVE:0},V1={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},pm={NONE:0,BACKGROUND:1,PREVIOUS:2},W1={SOURCE:0,OVER:1};class QT extends r5{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,n={}){super(t);const{checkCrc:r=!1}=n;this._checkCrc=r,this._inflator=new rw,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=Y1.UNKNOWN,this._filterMethod=lw.UNKNOWN,this._interlaceMethod=V1.UNKNOWN,this._colorType=Ka.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(aw(this);!this._end;){const t=this.readUint32(),n=this.readChars(4);this.decodeChunk(t,n)}return this.decodeImage(),this._png}decodeApng(){for(aw(this);!this._end;){const t=this.readUint32(),n=this.readChars(4);this.decodeApngChunk(t,n)}return this.decodeApngImage(),this._apng}decodeChunk(t,n){const r=this.offset;switch(n){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 VT:JT(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 ${n}`);this._checkCrc?ow(this,t+4,n):this.skip(4)}decodeApngChunk(t,n){const r=this.offset;switch(n!=="fdAT"&&n!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),n){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,n),this.offset=r+t;break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?ow(this,t+4,n):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=tN(this.readUint8());const n=this.readUint8();this._colorType=n;let r;switch(n){case Ka.GREYSCALE:r=1;break;case Ka.TRUECOLOUR:r=3;break;case Ka.INDEXED_COLOUR:r=1;break;case Ka.GREYSCALE_ALPHA:r=2;break;case Ka.TRUECOLOUR_ALPHA:r=4;break;case Ka.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=r,this._compressionMethod=this.readUint8(),this._compressionMethod!==Y1.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 n=t/3;this._hasPalette=!0;const r=[];this._palette=r;for(let i=0;i<n;i++)r.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;const n=t,r=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,r,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let n=t,r=this.offset+this.byteOffset;if(r+=4,n-=4,this._inflator.push(new Uint8Array(this.buffer,r,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodetRNS(t){switch(this._colorType){case Ka.GREYSCALE:case Ka.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 n=0;n<t/2;n++)this._transparency[n]=this.readUint16();break}case Ka.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 n=0;for(;n<t;n++){const r=this.readByte();this._palette[n].push(r)}for(;n<this._palette.length;n++)this._palette[n].push(255);break}case Ka.UNKNOWN:case Ka.GREYSCALE_ALPHA:case Ka.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(t){const n=Xk(this),r=this.readUint8();if(r!==Y1.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${r}`);const i=this.readBytes(t-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:_T(i)}}decodepHYs(){const t=this.readUint32(),n=this.readUint32(),r=this.readByte();this._png.resolution={x:t,y:n,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 n={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=sw({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)n.data=r.data;else{const i=this._apng.frames.at(t-1);this.disposeFrame(r,i,n),this.addFrameDataToCanvas(n,r)}this._apng.frames.push(n)}}return this._apng}disposeFrame(t,n,r){switch(t.disposeOp){case pm.NONE:break;case pm.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 pm.PREVIOUS:r.data.set(n.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,n){const r=1<<this._png.depth,i=(s,l)=>{const c=((s+n.yOffset)*this._png.width+n.xOffset+l)*this._png.channels,f=(s*n.width+l)*this._png.channels;return{index:c,frameIndex:f}};switch(n.blendOp){case W1.SOURCE:for(let s=0;s<n.height;s++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++)t.data[c+d]=n.data[f+d]}break;case W1.OVER:for(let s=0;s<n.height;s++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++){const p=n.data[f+this._png.channels-1]/r,y=d%(this._png.channels-1)===0?1:n.data[f+d],b=Math.floor(p*y+(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!==lw.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===V1.NO_INTERLACE)this._png.data=sw({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===V1.ADAM7)this._png.data=zT({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,n=this._frames.at(-1);n?n.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:pm.NONE,blendOp:W1.SOURCE,data:t}),this._inflator=new rw,this._writingDataChunks=!1}}function tN(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var cw;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(cw||(cw={}));function eN(e,t){return new QT(e,t).decode()}var Xn=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function X1(){Xn.console&&typeof Xn.console.log=="function"&&Xn.console.log.apply(Xn.console,arguments)}var si={log:X1,warn:function(e){Xn.console&&(typeof Xn.console.warn=="function"?Xn.console.warn.apply(Xn.console,arguments):X1.call(null,arguments))},error:function(e){Xn.console&&(typeof Xn.console.error=="function"?Xn.console.error.apply(Xn.console,arguments):X1(e))}};function G1(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Df(r.response,t,n)},r.onerror=function(){si.error("could not download file")},r.send()}function uw(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function mm(e){try{e.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),e.dispatchEvent(t)}}var Df=Xn.saveAs||((typeof window>"u"?"undefined":$r(window))!=="object"||window!==Xn?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,n){var r=Xn.URL||Xn.webkitURL,i=document.createElement("a");t=t||e.name||"download",i.download=t,i.rel="noopener",typeof e=="string"?(i.href=e,i.origin!==location.origin?uw(i.href)?G1(e,t,n):mm(i,i.target="_blank"):mm(i)):(i.href=r.createObjectURL(e),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){mm(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download",typeof e=="string")if(uw(e))G1(e,t,n);else{var r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){mm(r)})}else navigator.msSaveOrOpenBlob((function(i,s){return s===void 0?s={autoBom:!1}:$r(s)!=="object"&&(si.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})(e,n),t)}:function(e,t,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return G1(e,t,n);var i=e.type==="application/octet-stream",s=/constructor/i.test(Xn.HTMLElement)||Xn.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||i&&s)&&(typeof FileReader>"u"?"undefined":$r(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(e)}else{var f=Xn.URL||Xn.webkitURL,d=f.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}});function Gk(e){var t;e=e||"",this.ok=!1,e.charAt(0)=="#"&&(e=e.substr(1,6)),e={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"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var n=[{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<n.length;r++){var i=n[r].re,s=n[r].process,l=i.exec(e);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 qm=Xn.atob.bind(Xn),fw=Xn.btoa.bind(Xn);function K1(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];n=js(n,r,i,s,t[0],7,-680876936),s=js(s,n,r,i,t[1],12,-389564586),i=js(i,s,n,r,t[2],17,606105819),r=js(r,i,s,n,t[3],22,-1044525330),n=js(n,r,i,s,t[4],7,-176418897),s=js(s,n,r,i,t[5],12,1200080426),i=js(i,s,n,r,t[6],17,-1473231341),r=js(r,i,s,n,t[7],22,-45705983),n=js(n,r,i,s,t[8],7,1770035416),s=js(s,n,r,i,t[9],12,-1958414417),i=js(i,s,n,r,t[10],17,-42063),r=js(r,i,s,n,t[11],22,-1990404162),n=js(n,r,i,s,t[12],7,1804603682),s=js(s,n,r,i,t[13],12,-40341101),i=js(i,s,n,r,t[14],17,-1502002290),n=zs(n,r=js(r,i,s,n,t[15],22,1236535329),i,s,t[1],5,-165796510),s=zs(s,n,r,i,t[6],9,-1069501632),i=zs(i,s,n,r,t[11],14,643717713),r=zs(r,i,s,n,t[0],20,-373897302),n=zs(n,r,i,s,t[5],5,-701558691),s=zs(s,n,r,i,t[10],9,38016083),i=zs(i,s,n,r,t[15],14,-660478335),r=zs(r,i,s,n,t[4],20,-405537848),n=zs(n,r,i,s,t[9],5,568446438),s=zs(s,n,r,i,t[14],9,-1019803690),i=zs(i,s,n,r,t[3],14,-187363961),r=zs(r,i,s,n,t[8],20,1163531501),n=zs(n,r,i,s,t[13],5,-1444681467),s=zs(s,n,r,i,t[2],9,-51403784),i=zs(i,s,n,r,t[7],14,1735328473),n=Bs(n,r=zs(r,i,s,n,t[12],20,-1926607734),i,s,t[5],4,-378558),s=Bs(s,n,r,i,t[8],11,-2022574463),i=Bs(i,s,n,r,t[11],16,1839030562),r=Bs(r,i,s,n,t[14],23,-35309556),n=Bs(n,r,i,s,t[1],4,-1530992060),s=Bs(s,n,r,i,t[4],11,1272893353),i=Bs(i,s,n,r,t[7],16,-155497632),r=Bs(r,i,s,n,t[10],23,-1094730640),n=Bs(n,r,i,s,t[13],4,681279174),s=Bs(s,n,r,i,t[0],11,-358537222),i=Bs(i,s,n,r,t[3],16,-722521979),r=Bs(r,i,s,n,t[6],23,76029189),n=Bs(n,r,i,s,t[9],4,-640364487),s=Bs(s,n,r,i,t[12],11,-421815835),i=Bs(i,s,n,r,t[15],16,530742520),n=Fs(n,r=Bs(r,i,s,n,t[2],23,-995338651),i,s,t[0],6,-198630844),s=Fs(s,n,r,i,t[7],10,1126891415),i=Fs(i,s,n,r,t[14],15,-1416354905),r=Fs(r,i,s,n,t[5],21,-57434055),n=Fs(n,r,i,s,t[12],6,1700485571),s=Fs(s,n,r,i,t[3],10,-1894986606),i=Fs(i,s,n,r,t[10],15,-1051523),r=Fs(r,i,s,n,t[1],21,-2054922799),n=Fs(n,r,i,s,t[8],6,1873313359),s=Fs(s,n,r,i,t[15],10,-30611744),i=Fs(i,s,n,r,t[6],15,-1560198380),r=Fs(r,i,s,n,t[13],21,1309151649),n=Fs(n,r,i,s,t[4],6,-145523070),s=Fs(s,n,r,i,t[11],10,-1120210379),i=Fs(i,s,n,r,t[2],15,718787259),r=Fs(r,i,s,n,t[9],21,-343485551),e[0]=of(n,e[0]),e[1]=of(r,e[1]),e[2]=of(i,e[2]),e[3]=of(s,e[3])}function n0(e,t,n,r,i,s){return t=of(of(t,e),of(r,s)),of(t<<i|t>>>32-i,n)}function js(e,t,n,r,i,s,l){return n0(t&n|~t&r,e,t,i,s,l)}function zs(e,t,n,r,i,s,l){return n0(t&r|n&~r,e,t,i,s,l)}function Bs(e,t,n,r,i,s,l){return n0(t^n^r,e,t,i,s,l)}function Fs(e,t,n,r,i,s,l){return n0(n^(t|~r),e,t,i,s,l)}function Kk(e){var t,n=e.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)K1(r,nN(e.substring(t-64,t)));e=e.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<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(K1(r,i),t=0;t<16;t++)i[t]=0;return i[14]=8*n,K1(r,i),r}function nN(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}var dw="0123456789abcdef".split("");function rN(e){for(var t="",n=0;n<4;n++)t+=dw[e>>8*n+4&15]+dw[e>>8*n&15];return t}function iN(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function r2(e){return Kk(e).map(iN).join("")}var oN=(function(e){for(var t=0;t<e.length;t++)e[t]=rN(e[t]);return e.join("")})(Kk("hello"))!="5d41402abc4b2a76b9719d911017c592";function of(e,t){if(oN){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}return e+t&4294967295}function i2(e,t){var n,r,i,s;if(e!==n){for(var l=(i=e,s=1+(256/e.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}n=e,r=c}else c=r;var y=t.length,b=0,g=0,C="";for(f=0;f<y;f++)g=(g+(p=c[b=(b+1)%256]))%256,c[b]=c[g],c[g]=p,l=c[(c[b]+c[g])%256],C+=String.fromCharCode(t.charCodeAt(f)^l);return C}var hw={print:4,modify:8,copy:16,"annot-forms":32};function _d(e,t,n,r){this.v=1,this.r=2;var i=192;e.forEach(function(c){if(hw.perm!==void 0)throw new Error("Invalid permission: "+c);i+=hw[c]}),this.padding="(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz";var s=(t+this.padding).substr(0,32),l=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,l),this.P=-(1+(255^i)),this.encryptionKey=r2(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=i2(this.encryptionKey,this.padding)}function Ld(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",n=e.length,r=0;r<n;r++){var i=e.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):e[r]}return t}function pw(e){if($r(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(n,r,i){if(i=i||!1,typeof n!="string"||typeof r!="function"||typeof i!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(n)||(t[n]={});var s=Math.random().toString(35);return t[n][s]=[r,!!i],s},this.unsubscribe=function(n){for(var r in t)if(t[r][n])return delete t[r][n],Object.keys(t[r]).length===0&&delete t[r],!0;return!1},this.publish=function(n){if(t.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var s in t[n]){var l=t[n][s];try{l[0].apply(e,r)}catch(c){Xn.console&&si.error("jsPDF PubSub Error",c.message,c)}l[1]&&i.push(s)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function ig(e){if(!(this instanceof ig))return new ig(e);var t="opacity,stroke-opacity".split(",");for(var n in e)e.hasOwnProperty(n)&&t.indexOf(n)>=0&&(this[n]=e[n]);this.id="",this.objectNumber=-1}function Jk(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function Rf(e,t,n,r,i){if(!(this instanceof Rf))return new Rf(e,t,n,r,i);this.type=e==="axial"?2:3,this.coords=t,this.colors=n,Jk.call(this,r,i)}function Id(e,t,n,r,i){if(!(this instanceof Id))return new Id(e,t,n,r,i);this.boundingBox=e,this.xStep=t,this.yStep=n,this.stream="",this.cloneIndex=0,Jk.call(this,r,i)}function gn(e){var t,n=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;$r(e=e||{})==="object"&&(n=e.orientation,r=e.unit||r,i=e.format||i,s=e.compress||e.compressPdf||s,(p=e.encryption||null)!==null&&(p.userPassword=p.userPassword||"",p.ownerPassword=p.ownerPassword||"",p.userPermissions=p.userPermissions||[]),c=typeof e.userUnit=="number"?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(f=e.floatPrecision),d=e.defaultPathOperation||"S"),l=e.filters||(s===!0?["FlateEncode"]:l),r=r||"mm",n=(""+(n||"P")).toLowerCase();var y=e.putOnlyUsedFonts||!1,b={},g={internal:{},__private__:{}};g.__private__.PubSub=pw;var C="1.3",M=g.__private__.getPdfVersion=function(){return C};g.__private__.setPdfVersion=function(A){C=A};var L={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]};g.__private__.getPageFormats=function(){return L};var D=g.__private__.getPageFormat=function(A){return L[A]};i=i||"a4";var H="compat",V="advanced",W=H;function gt(){this.saveGraphicsState(),ft(new Ke(Qe,0,0,-Qe,0,Ns()*Qe).toString()+" cm"),this.setFontSize(this.getFontSize()/Qe),d="n",W=V}function _t(){this.restoreGraphicsState(),d="S",W=H}var kt=g.__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};g.advancedAPI=function(A){var B=W===H;return B&&gt.call(this),typeof A!="function"||(A(this),B&&_t.call(this)),this},g.compatAPI=function(A){var B=W===V;return B&&_t.call(this),typeof A!="function"||(A(this),B&&gt.call(this)),this},g.isAdvancedAPI=function(){return W===V};var xt,rt=function(A){if(W!==V)throw new Error(A+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},jt=g.roundToPrecision=g.__private__.roundToPrecision=function(A,B){var mt=t||B;if(isNaN(A)||isNaN(mt))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return A.toFixed(mt).replace(/0+$/,"")};xt=g.hpf=g.__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 J=g.f2=g.__private__.f2=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.f2");return jt(A,2)},ct=g.__private__.f3=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.f3");return jt(A,3)},X=g.scale=g.__private__.scale=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.scale");return W===H?A*Qe:W===V?A:void 0},bt=function(A){return X((function(B){return W===H?Ns()-B:W===V?B:void 0})(A))};g.__private__.setPrecision=g.setPrecision=function(A){typeof parseInt(A,10)=="number"&&(t=parseInt(A,10))};var Lt,dt="00000000000000000000000000000000",st=g.__private__.getFileId=function(){return dt},lt=g.__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&&(Pn=new _d(p.userPermissions,p.userPassword,p.ownerPassword,dt)),dt};g.setFileId=function(A){return lt(A),this},g.getFileId=function(){return st()};var zt=g.__private__.convertDateToPDFDate=function(A){var B=A.getTimezoneOffset(),mt=B<0?"+":"-",Nt=Math.floor(Math.abs(B/60)),Ft=Math.abs(B%60),ie=[mt,tt(Nt),"'",tt(Ft),"'"].join("");return["D:",A.getFullYear(),tt(A.getMonth()+1),tt(A.getDate()),tt(A.getHours()),tt(A.getMinutes()),tt(A.getSeconds()),ie].join("")},Mt=g.__private__.convertPDFDateToDate=function(A){var B=parseInt(A.substr(2,4),10),mt=parseInt(A.substr(6,2),10)-1,Nt=parseInt(A.substr(8,2),10),Ft=parseInt(A.substr(10,2),10),ie=parseInt(A.substr(12,2),10),ve=parseInt(A.substr(14,2),10);return new Date(B,mt,Nt,Ft,ie,ve,0)},K=g.__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=g.__private__.getCreationDate=function(A){var B=Lt;return A==="jsDate"&&(B=Mt(Lt)),B};g.setCreationDate=function(A){return K(A),this},g.getCreationDate=function(A){return P(A)};var Y,tt=g.__private__.padd2=function(A){return("0"+parseInt(A)).slice(-2)},yt=g.__private__.padd2Hex=function(A){return("00"+(A=A.toString())).substr(A.length)},wt=0,At=[],qt=[],Rt=0,Zt=[],Me=[],le=!1,Ie=qt;g.__private__.setCustomOutputDestination=function(A){le=!0,Ie=A};var Ue=function(A){le||(Ie=A)};g.__private__.resetCustomOutputDestination=function(){le=!1,Ie=qt};var ft=g.__private__.out=function(A){return A=A.toString(),Rt+=A.length+1,Ie.push(A),Ie},Re=g.__private__.write=function(A){return ft(arguments.length===1?A.toString():Array.prototype.join.call(arguments," "))},rn=g.__private__.getArrayBuffer=function(A){for(var B=A.length,mt=new ArrayBuffer(B),Nt=new Uint8Array(mt);B--;)Nt[B]=A.charCodeAt(B);return mt},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]];g.__private__.getStandardFonts=function(){return on};var xe=e.fontSize||16;g.__private__.setFontSize=g.setFontSize=function(A){return xe=W===V?A/Qe:A,this};var _e,Te=g.__private__.getFontSize=g.getFontSize=function(){return W===H?xe:xe*Qe},De=e.R2L||!1;g.__private__.setR2L=g.setR2L=function(A){return De=A,this},g.__private__.getR2L=g.getR2L=function(){return De};var $e,fn=g.__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)};g.__private__.getZoomMode=function(){return _e};var In,bn=g.__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.');$e=A};g.__private__.getPageMode=function(){return $e};var Nn=g.__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.');In=A};g.__private__.getLayoutMode=function(){return In},g.__private__.setDisplayMode=g.setDisplayMode=function(A,B,mt){return fn(A),Nn(B),bn(mt),this};var xn={title:"",subject:"",author:"",keywords:"",creator:""};g.__private__.getDocumentProperty=function(A){if(Object.keys(xn).indexOf(A)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return xn[A]},g.__private__.getDocumentProperties=function(){return xn},g.__private__.setDocumentProperties=g.setProperties=g.setDocumentProperties=function(A){for(var B in xn)xn.hasOwnProperty(B)&&A[B]&&(xn[B]=A[B]);return this},g.__private__.setDocumentProperty=function(A,B){if(Object.keys(xn).indexOf(A)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return xn[A]=B};var ze,Qe,je,dr,mn,an={},dn={},Vn=[],tn={},Qt={},we={},ge={},We=null,He=0,Pe=[],Wn=new pw(g),Yo=e.hotfixes||[],ci={},Hi={},Vo=[],Ke=function A(B,mt,Nt,Ft,ie,ve){if(!(this instanceof A))return new A(B,mt,Nt,Ft,ie,ve);isNaN(B)&&(B=1),isNaN(mt)&&(mt=0),isNaN(Nt)&&(Nt=0),isNaN(Ft)&&(Ft=1),isNaN(ie)&&(ie=0),isNaN(ve)&&(ve=0),this._matrix=[B,mt,Nt,Ft,ie,ve]};Object.defineProperty(Ke.prototype,"sx",{get:function(){return this._matrix[0]},set:function(A){this._matrix[0]=A}}),Object.defineProperty(Ke.prototype,"shy",{get:function(){return this._matrix[1]},set:function(A){this._matrix[1]=A}}),Object.defineProperty(Ke.prototype,"shx",{get:function(){return this._matrix[2]},set:function(A){this._matrix[2]=A}}),Object.defineProperty(Ke.prototype,"sy",{get:function(){return this._matrix[3]},set:function(A){this._matrix[3]=A}}),Object.defineProperty(Ke.prototype,"tx",{get:function(){return this._matrix[4]},set:function(A){this._matrix[4]=A}}),Object.defineProperty(Ke.prototype,"ty",{get:function(){return this._matrix[5]},set:function(A){this._matrix[5]=A}}),Object.defineProperty(Ke.prototype,"a",{get:function(){return this._matrix[0]},set:function(A){this._matrix[0]=A}}),Object.defineProperty(Ke.prototype,"b",{get:function(){return this._matrix[1]},set:function(A){this._matrix[1]=A}}),Object.defineProperty(Ke.prototype,"c",{get:function(){return this._matrix[2]},set:function(A){this._matrix[2]=A}}),Object.defineProperty(Ke.prototype,"d",{get:function(){return this._matrix[3]},set:function(A){this._matrix[3]=A}}),Object.defineProperty(Ke.prototype,"e",{get:function(){return this._matrix[4]},set:function(A){this._matrix[4]=A}}),Object.defineProperty(Ke.prototype,"f",{get:function(){return this._matrix[5]},set:function(A){this._matrix[5]=A}}),Object.defineProperty(Ke.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ke.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ke.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ke.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Ke.prototype.join=function(A){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(xt).join(A)},Ke.prototype.multiply=function(A){var B=A.sx*this.sx+A.shy*this.shx,mt=A.sx*this.shy+A.shy*this.sy,Nt=A.shx*this.sx+A.sy*this.shx,Ft=A.shx*this.shy+A.sy*this.sy,ie=A.tx*this.sx+A.ty*this.shx+this.tx,ve=A.tx*this.shy+A.ty*this.sy+this.ty;return new Ke(B,mt,Nt,Ft,ie,ve)},Ke.prototype.decompose=function(){var A=this.sx,B=this.shy,mt=this.shx,Nt=this.sy,Ft=this.tx,ie=this.ty,ve=Math.sqrt(A*A+B*B),nn=(A/=ve)*mt+(B/=ve)*Nt;mt-=A*nn,Nt-=B*nn;var ln=Math.sqrt(mt*mt+Nt*Nt);return nn/=ln,A*(Nt/=ln)<B*(mt/=ln)&&(A=-A,B=-B,nn=-nn,ve=-ve),{scale:new Ke(ve,0,0,ln,0,0),translate:new Ke(1,0,0,1,Ft,ie),rotate:new Ke(A,B,-B,A,0,0),skew:new Ke(1,0,nn,1,0,0)}},Ke.prototype.toString=function(A){return this.join(" ")},Ke.prototype.inversed=function(){var A=this.sx,B=this.shy,mt=this.shx,Nt=this.sy,Ft=this.tx,ie=this.ty,ve=1/(A*Nt-B*mt),nn=Nt*ve,ln=-B*ve,Rn=-mt*ve,zn=A*ve;return new Ke(nn,ln,Rn,zn,-nn*Ft-Rn*ie,-ln*Ft-zn*ie)},Ke.prototype.applyToPoint=function(A){var B=A.x*this.sx+A.y*this.shx+this.tx,mt=A.x*this.shy+A.y*this.sy+this.ty;return new Co(B,mt)},Ke.prototype.applyToRectangle=function(A){var B=this.applyToPoint(A),mt=this.applyToPoint(new Co(A.x+A.w,A.y+A.h));return new Ms(B.x,B.y,mt.x-B.x,mt.y-B.y)},Ke.prototype.clone=function(){var A=this.sx,B=this.shy,mt=this.shx,Nt=this.sy,Ft=this.tx,ie=this.ty;return new Ke(A,B,mt,Nt,Ft,ie)},g.Matrix=Ke;var xs=g.matrixMult=function(A,B){return B.multiply(A)},Zi=new Ke(1,0,0,1,0,0);g.unitMatrix=g.identityMatrix=Zi;var Xt=function(A,B){if(!Qt[A]){var mt=(B instanceof Rf?"Sh":"P")+(Object.keys(tn).length+1).toString(10);B.id=mt,Qt[A]=mt,tn[mt]=B,Wn.publish("addPattern",B)}};g.ShadingPattern=Rf,g.TilingPattern=Id,g.addShadingPattern=function(A,B){return rt("addShadingPattern()"),Xt(A,B),this},g.beginTilingPattern=function(A){rt("beginTilingPattern()"),fa(A.boundingBox[0],A.boundingBox[1],A.boundingBox[2]-A.boundingBox[0],A.boundingBox[3]-A.boundingBox[1],A.matrix)},g.endTilingPattern=function(A,B){rt("endTilingPattern()"),B.stream=Me[Y].join(`
11
+ `),Xt(A,B),Wn.publish("endTilingPattern",B),Vo.pop().restore()};var Ei,Gn=g.__private__.newObject=function(){var A=ui();return Ti(A,!0),A},ui=g.__private__.newObjectDeferred=function(){return wt++,At[wt]=function(){return Rt},wt},Ti=function(A,B){return B=typeof B=="boolean"&&B,At[A]=Rt,B&&ft(A+" 0 obj"),A},Wo=g.__private__.newAdditionalObject=function(){var A={objId:ui(),content:""};return Zt.push(A),A},pi=ui(),Ar=ui(),or=g.__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 mt=parseFloat(B[0]);B=[mt,mt,mt,"r"]}for(var Nt="#",Ft=0;Ft<3;Ft++)Nt+=("0"+Math.floor(255*parseFloat(B[Ft])).toString(16)).slice(-2);return Nt},Kn=g.__private__.encodeColorString=function(A){var B;typeof A=="string"&&(A={ch1:A});var mt=A.ch1,Nt=A.ch2,Ft=A.ch3,ie=A.ch4,ve=A.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof mt=="string"&&mt.charAt(0)!=="#"){var nn=new Gk(mt);if(nn.ok)mt=nn.toHex();else if(!/^\d*\.?\d*$/.test(mt))throw new Error('Invalid color "'+mt+'" passed to jsPDF.encodeColorString.')}if(typeof mt=="string"&&/^#[0-9A-Fa-f]{3}$/.test(mt)&&(mt="#"+mt[1]+mt[1]+mt[2]+mt[2]+mt[3]+mt[3]),typeof mt=="string"&&/^#[0-9A-Fa-f]{6}$/.test(mt)){var ln=parseInt(mt.substr(1),16);mt=ln>>16&255,Nt=ln>>8&255,Ft=255&ln}if(Nt===void 0||ie===void 0&&mt===Nt&&Nt===Ft)B=typeof mt=="string"?mt+" "+ve[0]:A.precision===2?J(mt/255)+" "+ve[0]:ct(mt/255)+" "+ve[0];else if(ie===void 0||$r(ie)==="object"){if(ie&&!isNaN(ie.a)&&ie.a===0)return["1.","1.","1.",ve[1]].join(" ");B=typeof mt=="string"?[mt,Nt,Ft,ve[1]].join(" "):A.precision===2?[J(mt/255),J(Nt/255),J(Ft/255),ve[1]].join(" "):[ct(mt/255),ct(Nt/255),ct(Ft/255),ve[1]].join(" ")}else B=typeof mt=="string"?[mt,Nt,Ft,ie,ve[2]].join(" "):A.precision===2?[J(mt),J(Nt),J(Ft),J(ie),ve[2]].join(" "):[ct(mt),ct(Nt),ct(Ft),ct(ie),ve[2]].join(" ");return B},Xo=g.__private__.getFilters=function(){return l},vs=g.__private__.putStream=function(A){var B=(A=A||{}).data||"",mt=A.filters||Xo(),Nt=A.alreadyAppliedFilters||[],Ft=A.addLength1||!1,ie=B.length,ve=A.objectId,nn=function(ue){return ue};if(p!==null&&ve===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");p!==null&&(nn=Pn.encryptor(ve,0));var ln={};mt===!0&&(mt=["FlateEncode"]);var Rn=A.additionalKeyValues||[],zn=(ln=gn.API.processDataByFilters!==void 0?gn.API.processDataByFilters(B,mt):{data:B,reverseChain:[]}).reverseChain+(Array.isArray(Nt)?Nt.join(" "):Nt.toString());if(ln.data.length!==0&&(Rn.push({key:"Length",value:ln.data.length}),Ft===!0&&Rn.push({key:"Length1",value:ie})),zn.length!=0)if(zn.split("/").length-1==1)Rn.push({key:"Filter",value:zn});else{Rn.push({key:"Filter",value:"["+zn+"]"});for(var sr=0;sr<Rn.length;sr+=1)if(Rn[sr].key==="DecodeParms"){for(var Li=[],Zr=0;Zr<ln.reverseChain.split("/").length-1;Zr+=1)Li.push("null");Li.push(Rn[sr].value),Rn[sr].value="["+Li.join(" ")+"]"}}ft("<<");for(var Tr=0;Tr<Rn.length;Tr++)ft("/"+Rn[Tr].key+" "+Rn[Tr].value);ft(">>"),ln.data.length!==0&&(ft("stream"),ft(nn(ln.data)),ft("endstream"))},Da=g.__private__.putPage=function(A){var B=A.number,mt=A.data,Nt=A.objId,Ft=A.contentsObjId;Ti(Nt,!0),ft("<</Type /Page"),ft("/Parent "+A.rootDictionaryObjId+" 0 R"),ft("/Resources "+A.resourceDictionaryObjId+" 0 R"),ft("/MediaBox ["+parseFloat(xt(A.mediaBox.bottomLeftX))+" "+parseFloat(xt(A.mediaBox.bottomLeftY))+" "+xt(A.mediaBox.topRightX)+" "+xt(A.mediaBox.topRightY)+"]"),A.cropBox!==null&&ft("/CropBox ["+xt(A.cropBox.bottomLeftX)+" "+xt(A.cropBox.bottomLeftY)+" "+xt(A.cropBox.topRightX)+" "+xt(A.cropBox.topRightY)+"]"),A.bleedBox!==null&&ft("/BleedBox ["+xt(A.bleedBox.bottomLeftX)+" "+xt(A.bleedBox.bottomLeftY)+" "+xt(A.bleedBox.topRightX)+" "+xt(A.bleedBox.topRightY)+"]"),A.trimBox!==null&&ft("/TrimBox ["+xt(A.trimBox.bottomLeftX)+" "+xt(A.trimBox.bottomLeftY)+" "+xt(A.trimBox.topRightX)+" "+xt(A.trimBox.topRightY)+"]"),A.artBox!==null&&ft("/ArtBox ["+xt(A.artBox.bottomLeftX)+" "+xt(A.artBox.bottomLeftY)+" "+xt(A.artBox.topRightX)+" "+xt(A.artBox.topRightY)+"]"),typeof A.userUnit=="number"&&A.userUnit!==1&&ft("/UserUnit "+A.userUnit),Wn.publish("putPage",{objId:Nt,pageContext:Pe[B],pageNumber:B,page:mt}),ft("/Contents "+Ft+" 0 R"),ft(">>"),ft("endobj");var ie=mt.join(`
12
+ `);return W===V&&(ie+=`
13
+ Q`),Ti(Ft,!0),vs({data:ie,filters:Xo(),objectId:Ft}),ft("endobj"),Nt},Go=g.__private__.putPages=function(){var A,B,mt=[];for(A=1;A<=He;A++)Pe[A].objId=ui(),Pe[A].contentsObjId=ui();for(A=1;A<=He;A++)mt.push(Da({number:A,data:Me[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:pi,resourceDictionaryObjId:Ar}));Ti(pi,!0),ft("<</Type /Pages");var Nt="/Kids [";for(B=0;B<He;B++)Nt+=mt[B]+" 0 R ";ft(Nt+"]"),ft("/Count "+He),ft(">>"),ft("endobj"),Wn.publish("postPutPages")},Ao=function(A){Wn.publish("putFont",{font:A,out:ft,newObject:Gn,putStream:vs}),A.isAlreadyPutted!==!0&&(A.objectNumber=Gn(),ft("<<"),ft("/Type /Font"),ft("/BaseFont /"+Ld(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=Gn();var B=[];B.push({key:"Type",value:"/XObject"}),B.push({key:"Subtype",value:"/Form"}),B.push({key:"BBox",value:"["+[xt(A.x),xt(A.y),xt(A.x+A.width),xt(A.y+A.height)].join(" ")+"]"}),B.push({key:"Matrix",value:"["+A.matrix.toString()+"]"});var mt=A.pages[1].join(`
14
+ `);vs({data:mt,additionalKeyValues:B,objectId:A.objectNumber}),ft("endobj")},aa=function(A,B){B||(B=21);var mt=Gn(),Nt=(function(ve,nn){var ln,Rn=[],zn=1/(nn-1);for(ln=0;ln<1;ln+=zn)Rn.push(ln);if(Rn.push(1),ve[0].offset!=0){var sr={offset:0,color:ve[0].color};ve.unshift(sr)}if(ve[ve.length-1].offset!=1){var Li={offset:1,color:ve[ve.length-1].color};ve.push(Li)}for(var Zr="",Tr=0,ue=0;ue<Rn.length;ue++){for(ln=Rn[ue];ln>ve[Tr+1].offset;)Tr++;var Qr=ve[Tr].offset,di=(ln-Qr)/(ve[Tr+1].offset-Qr),An=ve[Tr].color,vn=ve[Tr+1].color;Zr+=yt(Math.round((1-di)*An[0]+di*vn[0]).toString(16))+yt(Math.round((1-di)*An[1]+di*vn[1]).toString(16))+yt(Math.round((1-di)*An[2]+di*vn[2]).toString(16))}return Zr.trim()})(A.colors,B),Ft=[];Ft.push({key:"FunctionType",value:"0"}),Ft.push({key:"Domain",value:"[0.0 1.0]"}),Ft.push({key:"Size",value:"["+B+"]"}),Ft.push({key:"BitsPerSample",value:"8"}),Ft.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Ft.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),vs({data:Nt,additionalKeyValues:Ft,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:mt}),ft("endobj"),A.objectNumber=Gn(),ft("<< /ShadingType "+A.type),ft("/ColorSpace /DeviceRGB");var ie="/Coords ["+xt(parseFloat(A.coords[0]))+" "+xt(parseFloat(A.coords[1]))+" ";A.type===2?ie+=xt(parseFloat(A.coords[2]))+" "+xt(parseFloat(A.coords[3])):ie+=xt(parseFloat(A.coords[2]))+" "+xt(parseFloat(A.coords[3]))+" "+xt(parseFloat(A.coords[4]))+" "+xt(parseFloat(A.coords[5])),ft(ie+="]"),A.matrix&&ft("/Matrix ["+A.matrix.toString()+"]"),ft("/Function "+mt+" 0 R"),ft("/Extend [true true]"),ft(">>"),ft("endobj")},ws=function(A,B){var mt=ui(),Nt=Gn();B.push({resourcesOid:mt,objectOid:Nt}),A.objectNumber=Nt;var Ft=[];Ft.push({key:"Type",value:"/Pattern"}),Ft.push({key:"PatternType",value:"1"}),Ft.push({key:"PaintType",value:"1"}),Ft.push({key:"TilingType",value:"1"}),Ft.push({key:"BBox",value:"["+A.boundingBox.map(xt).join(" ")+"]"}),Ft.push({key:"XStep",value:xt(A.xStep)}),Ft.push({key:"YStep",value:xt(A.yStep)}),Ft.push({key:"Resources",value:mt+" 0 R"}),A.matrix&&Ft.push({key:"Matrix",value:"["+A.matrix.toString()+"]"}),vs({data:A.stream,additionalKeyValues:Ft,objectId:A.objectNumber}),ft("endobj")},nl=function(A){for(var B in A.objectNumber=Gn(),ft("<<"),A)switch(B){case"opacity":ft("/ca "+J(A[B]));break;case"stroke-opacity":ft("/CA "+J(A[B]))}ft(">>"),ft("endobj")},Ko=function(A){Ti(A.resourcesOid,!0),ft("<<"),ft("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var B in ft("/Font <<"),an)an.hasOwnProperty(B)&&(y===!1||y===!0&&b.hasOwnProperty(B))&&ft("/"+B+" "+an[B].objectNumber+" 0 R");ft(">>")})(),(function(){if(Object.keys(tn).length>0){for(var B in ft("/Shading <<"),tn)tn.hasOwnProperty(B)&&tn[B]instanceof Rf&&tn[B].objectNumber>=0&&ft("/"+B+" "+tn[B].objectNumber+" 0 R");Wn.publish("putShadingPatternDict"),ft(">>")}})(),(function(B){if(Object.keys(tn).length>0){for(var mt in ft("/Pattern <<"),tn)tn.hasOwnProperty(mt)&&tn[mt]instanceof g.TilingPattern&&tn[mt].objectNumber>=0&&tn[mt].objectNumber<B&&ft("/"+mt+" "+tn[mt].objectNumber+" 0 R");Wn.publish("putTilingPatternDict"),ft(">>")}})(A.objectOid),(function(){if(Object.keys(we).length>0){var B;for(B in ft("/ExtGState <<"),we)we.hasOwnProperty(B)&&we[B].objectNumber>=0&&ft("/"+B+" "+we[B].objectNumber+" 0 R");Wn.publish("putGStateDict"),ft(">>")}})(),(function(){for(var B in ft("/XObject <<"),ci)ci.hasOwnProperty(B)&&ci[B].objectNumber>=0&&ft("/"+B+" "+ci[B].objectNumber+" 0 R");Wn.publish("putXobjectDict"),ft(">>")})(),ft(">>"),ft("endobj")},fi=function(A){dn[A.fontName]=dn[A.fontName]||{},dn[A.fontName][A.fontStyle]=A.id},rl=function(A,B,mt,Nt,Ft){var ie={id:"F"+(Object.keys(an).length+1).toString(10),postScriptName:A,fontName:B,fontStyle:mt,encoding:Nt,isStandardFont:Ft||!1,metadata:{}};return Wn.publish("addFont",{font:ie,instance:this}),an[ie.id]=ie,fi(ie),ie.id},Pi=g.__private__.pdfEscape=g.pdfEscape=function(A,B){return(function(mt,Nt){var Ft,ie,ve,nn,ln,Rn,zn,sr,Li;if(ve=(Nt=Nt||{}).sourceEncoding||"Unicode",ln=Nt.outputEncoding,(Nt.autoencode||ln)&&an[ze].metadata&&an[ze].metadata[ve]&&an[ze].metadata[ve].encoding&&(nn=an[ze].metadata[ve].encoding,!ln&&an[ze].encoding&&(ln=an[ze].encoding),!ln&&nn.codePages&&(ln=nn.codePages[0]),typeof ln=="string"&&(ln=nn[ln]),ln)){for(zn=!1,Rn=[],Ft=0,ie=mt.length;Ft<ie;Ft++)(sr=ln[mt.charCodeAt(Ft)])?Rn.push(String.fromCharCode(sr)):Rn.push(mt[Ft]),Rn[Ft].charCodeAt(0)>>8&&(zn=!0);mt=Rn.join("")}for(Ft=mt.length;zn===void 0&&Ft!==0;)mt.charCodeAt(Ft-1)>>8&&(zn=!0),Ft--;if(!zn)return mt;for(Rn=Nt.noBOM?[]:[254,255],Ft=0,ie=mt.length;Ft<ie;Ft++){if((Li=(sr=mt.charCodeAt(Ft))>>8)>>8)throw new Error("Character at position "+Ft+" of string '"+mt+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Rn.push(Li),Rn.push(sr-(Li<<8))}return String.fromCharCode.apply(void 0,Rn)})(A,B).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Yr=g.__private__.beginPage=function(A){Me[++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])}},oc(He),Ue(Me[Y])},Ss=function(A,B){var mt,Nt,Ft;switch(n=B||n,typeof A=="string"&&(mt=D(A.toLowerCase()),Array.isArray(mt)&&(Nt=mt[0],Ft=mt[1])),Array.isArray(A)&&(Nt=A[0]*Qe,Ft=A[1]*Qe),isNaN(Nt)&&(Nt=i[0],Ft=i[1]),(Nt>14400||Ft>14400)&&(si.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Nt=Math.min(14400,Nt),Ft=Math.min(14400,Ft)),i=[Nt,Ft],n.substr(0,1)){case"l":Ft>Nt&&(i=[Ft,Nt]);break;case"p":Nt>Ft&&(i=[Ft,Nt])}Yr(i),Sn(ol),ft(qi),Ia!==0&&ft(Ia+" J"),gi!==0&&ft(gi+" j"),Wn.publish("addPage",{pageNumber:He})},Dl=function(A){A>0&&A<=He&&(Me.splice(A,1),Pe.splice(A,1),He--,Y>He&&(Y=He),this.setPage(Y))},oc=function(A){A>0&&A<=He&&(Y=A)},jc=g.__private__.getNumberOfPages=g.getNumberOfPages=function(){return Me.length-1},zc=function(A,B,mt){var Nt,Ft=void 0;return mt=mt||{},A=A!==void 0?A:an[ze].fontName,B=B!==void 0?B:an[ze].fontStyle,Nt=A.toLowerCase(),dn[Nt]!==void 0&&dn[Nt][B]!==void 0?Ft=dn[Nt][B]:dn[A]!==void 0&&dn[A][B]!==void 0?Ft=dn[A][B]:mt.disableWarning===!1&&si.warn("Unable to look up font label for font '"+A+"', '"+B+"'. Refer to getFontList() for available fonts."),Ft||mt.noFallback||(Ft=dn.times[B])==null&&(Ft=dn.times.normal),Ft},Qi=g.__private__.putInfo=function(){var A=Gn(),B=function(Nt){return Nt};for(var mt in p!==null&&(B=Pn.encryptor(A,0)),ft("<<"),ft("/Producer ("+Pi(B("jsPDF "+gn.version))+")"),xn)xn.hasOwnProperty(mt)&&xn[mt]&&ft("/"+mt.substr(0,1).toUpperCase()+mt.substr(1)+" ("+Pi(B(xn[mt]))+")");ft("/CreationDate ("+Pi(B(Lt))+")"),ft(">>"),ft("endobj")},mi=g.__private__.putCatalog=function(A){var B=(A=A||{}).rootDictionaryObjId||pi;switch(Gn(),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 mt=""+_e;mt.substr(mt.length-1)==="%"&&(_e=parseInt(_e)/100),typeof _e=="number"&&ft("/OpenAction [3 0 R /XYZ null null "+J(_e)+"]")}switch(In||(In="continuous"),In){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")}$e&&ft("/PageMode /"+$e),Wn.publish("putCatalog"),ft(">>"),ft("endobj")},Ni=g.__private__.putTrailer=function(){ft("trailer"),ft("<<"),ft("/Size "+(wt+1)),ft("/Root "+wt+" 0 R"),ft("/Info "+(wt-1)+" 0 R"),p!==null&&ft("/Encrypt "+Pn.oid+" 0 R"),ft("/ID [ <"+dt+"> <"+dt+"> ]"),ft(">>")},Fn=g.__private__.putHeader=function(){ft("%PDF-"+C),ft("%ºß¬à")},Oo=g.__private__.putXRef=function(){var A="0000000000";ft("xref"),ft("0 "+(wt+1)),ft("0000000000 65535 f ");for(var B=1;B<=wt;B++)typeof At[B]=="function"?ft((A+At[B]()).slice(-10)+" 00000 n "):At[B]!==void 0?ft((A+At[B]).slice(-10)+" 00000 n "):ft("0000000000 00000 n ")},hr=g.__private__.buildDocument=function(){var A;wt=0,Rt=0,qt=[],At=[],Zt=[],pi=ui(),Ar=ui(),Ue(qt),Wn.publish("buildDocument"),Fn(),Go(),(function(){Wn.publish("putAdditionalObjects");for(var mt=0;mt<Zt.length;mt++){var Nt=Zt[mt];Ti(Nt.objId,!0),ft(Nt.content),ft("endobj")}Wn.publish("postPutAdditionalObjects")})(),A=[],(function(){for(var mt in an)an.hasOwnProperty(mt)&&(y===!1||y===!0&&b.hasOwnProperty(mt))&&Ao(an[mt])})(),(function(){var mt;for(mt in we)we.hasOwnProperty(mt)&&nl(we[mt])})(),(function(){for(var mt in ci)ci.hasOwnProperty(mt)&&Ll(ci[mt])})(),(function(mt){var Nt;for(Nt in tn)tn.hasOwnProperty(Nt)&&(tn[Nt]instanceof Rf?aa(tn[Nt]):tn[Nt]instanceof Id&&ws(tn[Nt],mt))})(A),Wn.publish("putResources"),A.forEach(Ko),Ko({resourcesOid:Ar,objectOid:Number.MAX_SAFE_INTEGER}),Wn.publish("postPutResources"),p!==null&&(Pn.oid=Gn(),ft("<<"),ft("/Filter /Standard"),ft("/V "+Pn.v),ft("/R "+Pn.r),ft("/U <"+Pn.toHexString(Pn.U)+">"),ft("/O <"+Pn.toHexString(Pn.O)+">"),ft("/P "+Pn.P),ft(">>"),ft("endobj")),Qi(),mi();var B=Rt;return Oo(),Ni(),ft("startxref"),ft(""+B),ft("%%EOF"),Ue(Me[Y]),qt.join(`
15
+ `)},uo=g.__private__.getBlob=function(A){return new Blob([rn(A)],{type:"application/pdf"})},to=g.output=g.__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 hr();case"save":g.save(B.filename);break;case"arraybuffer":return rn(hr());case"blob":return uo(hr());case"bloburi":case"bloburl":if(Xn.URL!==void 0&&typeof Xn.URL.createObjectURL=="function")return Xn.URL&&Xn.URL.createObjectURL(uo(hr()))||void 0;si.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var mt="",Nt=hr();try{mt=fw(Nt)}catch{mt=fw(unescape(encodeURIComponent(Nt)))}return"data:application/pdf;filename="+B.filename+";base64,"+mt;case"pdfobjectnewwindow":case"pdfjsnewwindow":throw new Error("jsPDF viewer output modes are disabled in this build.");case"dataurlnewwindow":if(Object.prototype.toString.call(Xn)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var Ft='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe src="'+this.output("datauristring",B)+'"></iframe></body></html>',ie=Xn.open();if(ie!==null&&(ie.document.write(Ft),ie.document.title=B.filename),ie||typeof safari>"u")return ie;break;case"datauri":case"dataurl":return Xn.document.location.href=this.output("datauristring",B);default:return null}},Ei.foo=function(){try{return Ei.apply(this,arguments)}catch(mt){var A=mt.stack||"";~A.indexOf(" at ")&&(A=A.split(" at ")[1]);var B="Error in function "+A.split(`
16
+ `)[0].split("<")[0]+": "+mt.message;if(!Xn.console)throw new Error(B);Xn.console.error(B,mt),Xn.alert&&alert(B)}},Ei.foo.bar=Ei,Ei.foo),Ir=function(A){return Array.isArray(Yo)===!0&&Yo.indexOf(A)>-1};switch(r){case"pt":Qe=1;break;case"mm":Qe=72/25.4;break;case"cm":Qe=72/2.54;break;case"in":Qe=72;break;case"px":Qe=Ir("px_scaling")==1?.75:96/72;break;case"pc":case"em":Qe=12;break;case"ex":Qe=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);Qe=r}var Pn=null;K(),lt();var jr=g.__private__.getPageInfo=g.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]}},Ra=g.__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 jr(B)},la=g.__private__.getCurrentPageInfo=g.getCurrentPageInfo=function(){return{objId:Pe[Y].objId,pageNumber:Y,pageContext:Pe[Y]}};g.addPage=function(){return Ss.apply(this,arguments),this},g.setPage=function(){return oc.apply(this,arguments),Ue.call(this,Me[Y]),this},g.insertPage=function(A){return this.addPage(),this.movePage(Y,A),this},g.movePage=function(A,B){var mt,Nt;if(A>B){mt=Me[A],Nt=Pe[A];for(var Ft=A;Ft>B;Ft--)Me[Ft]=Me[Ft-1],Pe[Ft]=Pe[Ft-1];Me[B]=mt,Pe[B]=Nt,this.setPage(B)}else if(A<B){mt=Me[A],Nt=Pe[A];for(var ie=A;ie<B;ie++)Me[ie]=Me[ie+1],Pe[ie]=Pe[ie+1];Me[B]=mt,Pe[B]=Nt,this.setPage(B)}return this},g.deletePage=function(){return Dl.apply(this,arguments),this},g.__private__.text=g.text=function(A,B,mt,Nt,Ft){var ie,ve,nn,ln,Rn,zn,sr,Li,Zr,Tr=(Nt=Nt||{}).scope||this;if(typeof A=="number"&&typeof B=="number"&&(typeof mt=="string"||Array.isArray(mt))){var ue=mt;mt=B,B=A,A=ue}if(arguments[3]instanceof Ke==0?(nn=arguments[4],ln=arguments[5],$r(sr=arguments[3])==="object"&&sr!==null||(typeof nn=="string"&&(ln=nn,nn=null),typeof sr=="string"&&(ln=sr,sr=null),typeof sr=="number"&&(nn=sr,sr=null),Nt={flags:sr,angle:nn,align:ln})):(rt("The transform parameter of text() with a Matrix value"),Zr=Ft),isNaN(B)||isNaN(mt)||A==null)throw new Error("Invalid arguments passed to jsPDF.text");if(A.length===0)return Tr;var Qr,di="",An=typeof Nt.lineHeightFactor=="number"?Nt.lineHeightFactor:ks,vn=Tr.internal.scaleFactor;function za(br){return br=br.split(" ").join(Array(Nt.TabLen||9).join(" ")),Pi(br,sr)}function jl(br){for(var ar,Dr=br.concat(),bi=[],Ks=Dr.length;Ks--;)typeof(ar=Dr.shift())=="string"?bi.push(ar):Array.isArray(br)&&(ar.length===1||ar[1]===void 0&&ar[2]===void 0)?bi.push(ar[0]):bi.push([ar[0],ar[1],ar[2]]);return bi}function uc(br,ar){var Dr;if(typeof br=="string")Dr=ar(br)[0];else if(Array.isArray(br)){for(var bi,Ks,Ds=br.concat(),ga=[],pc=Ds.length;pc--;)typeof(bi=Ds.shift())=="string"?ga.push(ar(bi)[0]):Array.isArray(bi)&&typeof bi[0]=="string"&&(Ks=ar(bi[0],bi[1],bi[2]),ga.push([Ks[0],Ks[1],Ks[2]]));Dr=ga}return Dr}var pr=!1,mo=!0;if(typeof A=="string")pr=!0;else if(Array.isArray(A)){var zl=A.concat();ve=[];for(var _s,$i=zl.length;$i--;)(typeof(_s=zl.shift())!="string"||Array.isArray(_s)&&typeof _s[0]!="string")&&(mo=!1);pr=mo}if(pr===!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 ha=xe/Tr.internal.scaleFactor,Ba=ha*(An-1);switch(Nt.baseline){case"bottom":mt-=Ba;break;case"top":mt+=ha-Ba;break;case"hanging":mt+=ha-2*Ba;break;case"middle":mt+=ha/2-Ba}if((zn=Nt.maxWidth||0)>0&&(typeof A=="string"?A=Tr.splitTextToSize(A,zn):Object.prototype.toString.call(A)==="[object Array]"&&(A=A.reduce(function(br,ar){return br.concat(Tr.splitTextToSize(ar,zn))},[]))),ie={text:A,x:B,y:mt,options:Nt,mutex:{pdfEscape:Pi,activeFontKey:ze,fonts:an,activeFontSize:xe}},Wn.publish("preProcessText",ie),A=ie.text,nn=(Nt=ie.options).angle,Zr instanceof Ke==0&&nn&&typeof nn=="number"){nn*=Math.PI/180,Nt.rotationDirection===0&&(nn=-nn),W===V&&(nn=-nn);var Fa=Math.cos(nn),Ys=Math.sin(nn);Zr=new Ke(Fa,Ys,-Ys,Fa,0,0)}else nn&&nn instanceof Ke&&(Zr=nn);W!==V||Zr||(Zr=Zi),(Rn=Nt.charSpace||po)!==void 0&&(di+=xt(X(Rn))+` Tc
17
+ `,this.setCharSpace(this.getCharSpace()||0)),(Li=Nt.horizontalScale)!==void 0&&(di+=xt(100*Li)+` Tz
18
+ `),Nt.lang;var go=-1,pa=Nt.renderingMode!==void 0?Nt.renderingMode:Nt.stroke,Bl=Tr.internal.getCurrentPageInfo().pageContext;switch(pa){case 0:case!1:case"fill":go=0;break;case 1:case!0:case"stroke":go=1;break;case 2:case"fillThenStroke":go=2;break;case 3:case"invisible":go=3;break;case 4:case"fillAndAddForClipping":go=4;break;case 5:case"strokeAndAddPathForClipping":go=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":go=6;break;case 7:case"addToPathForClipping":go=7}var fc=Bl.usedRenderingMode!==void 0?Bl.usedRenderingMode:-1;go!==-1?di+=go+` Tr
19
+ `:fc!==-1&&(di+=`0 Tr
20
+ `),go!==-1&&(Bl.usedRenderingMode=go),ln=Nt.align||"left";var Io,jo=xe*An,Eo=Tr.internal.pageSize.getWidth(),dc=an[ze];Rn=Nt.charSpace||po,zn=Nt.maxWidth||0,sr=Object.assign({autoencode:!0,noBOM:!0},Nt.flags);var ts=[],Ua=function(br){return Tr.getStringUnitWidth(br,{font:dc,charSpace:Rn,fontSize:xe,doKerning:!1})*xe/vn};if(Object.prototype.toString.call(A)==="[object Array]"){var hi;ve=jl(A),ln!=="left"&&(Io=ve.map(Ua));var Nr,es=0;if(ln==="right"){B-=Io[0],A=[],$i=ve.length;for(var Yi=0;Yi<$i;Yi++)Yi===0?(Nr=ho(B),hi=_i(mt)):(Nr=X(es-Io[Yi]),hi=-jo),A.push([ve[Yi],Nr,hi]),es=Io[Yi]}else if(ln==="center"){B-=Io[0]/2,A=[],$i=ve.length;for(var Vs=0;Vs<$i;Vs++)Vs===0?(Nr=ho(B),hi=_i(mt)):(Nr=X((es-Io[Vs])/2),hi=-jo),A.push([ve[Vs],Nr,hi]),es=Io[Vs]}else if(ln==="left"){A=[],$i=ve.length;for(var Fl=0;Fl<$i;Fl++)A.push(ve[Fl])}else if(ln==="justify"&&dc.encoding==="Identity-H"){A=[],$i=ve.length,zn=zn!==0?zn:Eo;for(var ll=0,pe=0;pe<$i;pe++)if(hi=pe===0?_i(mt):-jo,Nr=pe===0?ho(B):ll,pe<$i-1){var To=X((zn-Io[pe])/(ve[pe].split(" ").length-1)),Ws=ve[pe].split(" ");A.push([Ws[0]+" ",Nr,hi]),ll=0;for(var Ls=1;Ls<Ws.length;Ls++){var no=(Ua(Ws[Ls-1]+" "+Ws[Ls])-Ua(Ws[Ls]))*vn+To;Ls==Ws.length-1?A.push([Ws[Ls],no,0]):A.push([Ws[Ls]+" ",no,0]),ll-=no}}else A.push([ve[pe],Nr,hi]);A.push(["",ll,0])}else{if(ln!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(A=[],$i=ve.length,zn=zn!==0?zn:Eo,pe=0;pe<$i;pe++){hi=pe===0?_i(mt):-jo,Nr=pe===0?ho(B):0;var Xs=ve[pe].split(" ").length-1,hc=Xs>0?(zn-Io[pe])/Xs:0;pe<$i-1?ts.push(xt(X(hc))):ts.push(0),A.push([ve[pe],Nr,hi])}}}(typeof Nt.R2L=="boolean"?Nt.R2L:De)===!0&&(A=uc(A,function(br,ar,Dr){return[br.split("").reverse().join(""),ar,Dr]})),ie={text:A,x:B,y:mt,options:Nt,mutex:{pdfEscape:Pi,activeFontKey:ze,fonts:an,activeFontSize:xe}},Wn.publish("postProcessText",ie),A=ie.text,Qr=ie.mutex.isHex||!1;var Ul=an[ze].encoding;Ul!=="WinAnsiEncoding"&&Ul!=="StandardEncoding"||(A=uc(A,function(br,ar,Dr){return[za(br),ar,Dr]})),ve=jl(A),A=[];for(var Ha,qa,Gs,cl=Array.isArray(ve[0])?1:0,ns="",ma=function(br,ar,Dr){var bi="";return Dr instanceof Ke?(Dr=typeof Nt.angle=="number"?xs(Dr,new Ke(1,0,0,1,br,ar)):xs(new Ke(1,0,0,1,br,ar),Dr),W===V&&(Dr=xs(new Ke(1,0,0,-1,0,0),Dr)),bi=Dr.join(" ")+` Tm
21
+ `):bi=xt(br)+" "+xt(ar)+` Td
22
+ `,bi},yi=0;yi<ve.length;yi++){switch(ns="",cl){case 1:Gs=(Qr?"<":"(")+ve[yi][0]+(Qr?">":")"),Ha=parseFloat(ve[yi][1]),qa=parseFloat(ve[yi][2]);break;case 0:Gs=(Qr?"<":"(")+ve[yi]+(Qr?">":")"),Ha=ho(B),qa=_i(mt)}ts!==void 0&&ts[yi]!==void 0&&(ns=ts[yi]+` Tw
23
+ `),yi===0?A.push(ns+ma(Ha,qa,Zr)+Gs):cl===0?A.push(ns+Gs):cl===1&&A.push(ns+ma(Ha,qa,Zr)+Gs)}A=cl===0?A.join(` Tj
24
+ T* `):A.join(` Tj
25
+ `),A+=` Tj
26
+ `;var No=`BT
27
+ /`;return No+=ze+" "+xe+` Tf
28
+ `,No+=xt(xe*An)+` TL
29
+ `,No+=Zo+`
30
+ `,No+=di,No+=A,ft(No+="ET"),b[ze]=!0,Tr};var te=g.__private__.clip=g.clip=function(A){return ft(A==="evenodd"?"W*":"W"),this};g.clipEvenOdd=function(){return te("evenodd")},g.__private__.discardPath=g.discardPath=function(){return ft("n"),this};var Mo=g.__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};g.__private__.setDefaultPathOperation=g.setDefaultPathOperation=function(A){return Mo(A)&&(d=A),this};var ca=g.__private__.getStyle=g.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},Bc=g.close=function(){return ft("h"),this};g.stroke=function(){return ft("S"),this},g.fill=function(A){return fo("f",A),this},g.fillEvenOdd=function(A){return fo("f*",A),this},g.fillStroke=function(A){return fo("B",A),this},g.fillStrokeEvenOdd=function(A){return fo("B*",A),this};var fo=function(A,B){$r(B)==="object"?Mu(B,A):ft(A)},il=function(A){A===null||W===V&&A===void 0||(A=ca(A),ft(A))};function Au(A,B,mt,Nt,Ft){var ie=new Id(B||this.boundingBox,mt||this.xStep,Nt||this.yStep,this.gState,Ft||this.matrix);ie.stream=this.stream;var ve=A+"$$"+this.cloneIndex+++"$$";return Xt(ve,ie),ie}var Mu=function(A,B){var mt=Qt[A.key],Nt=tn[mt];if(Nt instanceof Rf)ft("q"),ft(sc(B)),Nt.gState&&g.setGState(Nt.gState),ft(A.matrix.toString()+" cm"),ft("/"+mt+" sh"),ft("Q");else if(Nt instanceof Id){var Ft=new Ke(1,0,0,-1,0,Ns());A.matrix&&(Ft=Ft.multiply(A.matrix||Zi),mt=Au.call(Nt,A.key,A.boundingBox,A.xStep,A.yStep,Ft).id),ft("q"),ft("/Pattern cs"),ft("/"+mt+" scn"),Nt.gState&&g.setGState(Nt.gState),ft(B),ft("Q")}},sc=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"}},ac=g.moveTo=function(A,B){return ft(xt(X(A))+" "+xt(bt(B))+" m"),this},Rl=g.lineTo=function(A,B){return ft(xt(X(A))+" "+xt(bt(B))+" l"),this},eo=g.curveTo=function(A,B,mt,Nt,Ft,ie){return ft([xt(X(A)),xt(bt(B)),xt(X(mt)),xt(bt(Nt)),xt(X(Ft)),xt(bt(ie)),"c"].join(" ")),this};g.__private__.line=g.line=function(A,B,mt,Nt,Ft){if(isNaN(A)||isNaN(B)||isNaN(mt)||isNaN(Nt)||!Mo(Ft))throw new Error("Invalid arguments passed to jsPDF.line");return W===H?this.lines([[mt-A,Nt-B]],A,B,[1,1],Ft||"S"):this.lines([[mt-A,Nt-B]],A,B,[1,1]).stroke()},g.__private__.lines=g.lines=function(A,B,mt,Nt,Ft,ie){var ve,nn,ln,Rn,zn,sr,Li,Zr,Tr,ue,Qr,di;if(typeof A=="number"&&(di=mt,mt=B,B=A,A=di),Nt=Nt||[1,1],ie=ie||!1,isNaN(B)||isNaN(mt)||!Array.isArray(A)||!Array.isArray(Nt)||!Mo(Ft)||typeof ie!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(ac(B,mt),ve=Nt[0],nn=Nt[1],Rn=A.length,ue=B,Qr=mt,ln=0;ln<Rn;ln++)(zn=A[ln]).length===2?(ue=zn[0]*ve+ue,Qr=zn[1]*nn+Qr,Rl(ue,Qr)):(sr=zn[0]*ve+ue,Li=zn[1]*nn+Qr,Zr=zn[2]*ve+ue,Tr=zn[3]*nn+Qr,ue=zn[4]*ve+ue,Qr=zn[5]*nn+Qr,eo(sr,Li,Zr,Tr,ue,Qr));return ie&&Bc(),il(Ft),this},g.path=function(A){for(var B=0;B<A.length;B++){var mt=A[B],Nt=mt.c;switch(mt.op){case"m":ac(Nt[0],Nt[1]);break;case"l":Rl(Nt[0],Nt[1]);break;case"c":eo.apply(this,Nt);break;case"h":Bc()}}return this},g.__private__.rect=g.rect=function(A,B,mt,Nt,Ft){if(isNaN(A)||isNaN(B)||isNaN(mt)||isNaN(Nt)||!Mo(Ft))throw new Error("Invalid arguments passed to jsPDF.rect");return W===H&&(Nt=-Nt),ft([xt(X(A)),xt(bt(B)),xt(X(mt)),xt(X(Nt)),"re"].join(" ")),il(Ft),this},g.__private__.triangle=g.triangle=function(A,B,mt,Nt,Ft,ie,ve){if(isNaN(A)||isNaN(B)||isNaN(mt)||isNaN(Nt)||isNaN(Ft)||isNaN(ie)||!Mo(ve))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[mt-A,Nt-B],[Ft-mt,ie-Nt],[A-Ft,B-ie]],A,B,[1,1],ve,!0),this},g.__private__.roundedRect=g.roundedRect=function(A,B,mt,Nt,Ft,ie,ve){if(isNaN(A)||isNaN(B)||isNaN(mt)||isNaN(Nt)||isNaN(Ft)||isNaN(ie)||!Mo(ve))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var nn=4/3*(Math.SQRT2-1);return Ft=Math.min(Ft,.5*mt),ie=Math.min(ie,.5*Nt),this.lines([[mt-2*Ft,0],[Ft*nn,0,Ft,ie-ie*nn,Ft,ie],[0,Nt-2*ie],[0,ie*nn,-Ft*nn,ie,-Ft,ie],[2*Ft-mt,0],[-Ft*nn,0,-Ft,-ie*nn,-Ft,-ie],[0,2*ie-Nt],[0,-ie*nn,Ft*nn,-ie,Ft,-ie]],A+Ft,B,[1,1],ve,!0),this},g.__private__.ellipse=g.ellipse=function(A,B,mt,Nt,Ft){if(isNaN(A)||isNaN(B)||isNaN(mt)||isNaN(Nt)||!Mo(Ft))throw new Error("Invalid arguments passed to jsPDF.ellipse");var ie=4/3*(Math.SQRT2-1)*mt,ve=4/3*(Math.SQRT2-1)*Nt;return ac(A+mt,B),eo(A+mt,B-ve,A+ie,B-Nt,A,B-Nt),eo(A-ie,B-Nt,A-mt,B-ve,A-mt,B),eo(A-mt,B+ve,A-ie,B+Nt,A,B+Nt),eo(A+ie,B+Nt,A+mt,B+ve,A+mt,B),il(Ft),this},g.__private__.circle=g.circle=function(A,B,mt,Nt){if(isNaN(A)||isNaN(B)||isNaN(mt)||!Mo(Nt))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(A,B,mt,mt,Nt)},g.setFont=function(A,B,mt){return mt&&(B=kt(B,mt)),ze=zc(A,B,{disableWarning:!1}),this};var Jo=g.__private__.getFont=g.getFont=function(){return an[zc.apply(g,arguments)]};g.__private__.getFontList=g.getFontList=function(){var A,B,mt={};for(A in dn)if(dn.hasOwnProperty(A))for(B in mt[A]=[],dn[A])dn[A].hasOwnProperty(B)&&mt[A].push(B);return mt},g.addFont=function(A,B,mt,Nt,Ft){var ie=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&ie.indexOf(arguments[3])!==-1?Ft=arguments[3]:arguments[3]&&ie.indexOf(arguments[3])==-1&&(mt=kt(mt,Nt)),rl.call(this,A,B,mt,Ft=Ft||"Identity-H")};var ks,ol=e.lineWidth||.200025,Oa=g.__private__.getLineWidth=g.getLineWidth=function(){return ol},Sn=g.__private__.setLineWidth=g.setLineWidth=function(A){return ol=A,ft(xt(X(A))+" w"),this};g.__private__.setLineDash=gn.API.setLineDash=gn.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(mt){return xt(X(mt))}).join(" "),B=xt(X(B)),ft("["+A+"] "+B+" d"),this};var lc=g.__private__.getLineHeight=g.getLineHeight=function(){return xe*ks};g.__private__.getLineHeight=g.getLineHeight=function(){return xe*ks};var vr=g.__private__.setLineHeightFactor=g.setLineHeightFactor=function(A){return typeof(A=A||1.15)=="number"&&(ks=A),this},cc=g.__private__.getLineHeightFactor=g.getLineHeightFactor=function(){return ks};vr(e.lineHeight);var ho=g.__private__.getHorizontalCoordinate=function(A){return X(A)},_i=g.__private__.getVerticalCoordinate=function(A){return W===V?A:Pe[Y].mediaBox.topRightY-Pe[Y].mediaBox.bottomLeftY-X(A)},sl=g.__private__.getHorizontalCoordinateString=g.getHorizontalCoordinateString=function(A){return xt(ho(A))},As=g.__private__.getVerticalCoordinateString=g.getVerticalCoordinateString=function(A){return xt(_i(A))},qi=e.strokeColor||"0 G";g.__private__.getStrokeColor=g.getDrawColor=function(){return or(qi)},g.__private__.setStrokeColor=g.setDrawColor=function(A,B,mt,Nt){return qi=Kn({ch1:A,ch2:B,ch3:mt,ch4:Nt,pdfColorType:"draw",precision:2}),ft(qi),this};var ua=e.fillColor||"0 g";g.__private__.getFillColor=g.getFillColor=function(){return or(ua)},g.__private__.setFillColor=g.setFillColor=function(A,B,mt,Nt){return ua=Kn({ch1:A,ch2:B,ch3:mt,ch4:Nt,pdfColorType:"fill",precision:2}),ft(ua),this};var Zo=e.textColor||"0 g",Ol=g.__private__.getTextColor=g.getTextColor=function(){return or(Zo)};g.__private__.setTextColor=g.setTextColor=function(A,B,mt,Nt){return Zo=Kn({ch1:A,ch2:B,ch3:mt,ch4:Nt,pdfColorType:"text",precision:3}),this};var po=e.charSpace,Pa=g.__private__.getCharSpace=g.getCharSpace=function(){return parseFloat(po||0)};g.__private__.setCharSpace=g.setCharSpace=function(A){if(isNaN(A))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return po=A,this};var Ia=0;g.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},g.__private__.setLineCap=g.setLineCap=function(A){var B=g.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 Ia=B,ft(B+" J"),this};var gi=0;g.__private__.setLineJoin=g.setLineJoin=function(A){var B=g.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 gi=B,ft(B+" j"),this},g.__private__.setLineMiterLimit=g.__private__.setMiterLimit=g.setLineMiterLimit=g.setMiterLimit=function(A){if(A=A||0,isNaN(A))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return ft(xt(X(A))+" M"),this},g.GState=ig,g.setGState=function(A){(A=typeof A=="string"?we[ge[A]]:Po(null,A)).equals(We)||(ft("/"+A.id+" gs"),We=A)};var Po=function(A,B){if(!A||!ge[A]){var mt=!1;for(var Nt in we)if(we.hasOwnProperty(Nt)&&we[Nt].equals(B)){mt=!0;break}if(mt)B=we[Nt];else{var Ft="GS"+(Object.keys(we).length+1).toString(10);we[Ft]=B,B.id=Ft}return A&&(ge[A]=B.id),Wn.publish("addGState",B),B}};g.addGState=function(A,B){return Po(A,B),this},g.saveGraphicsState=function(){return ft("q"),Vn.push({key:ze,size:xe,color:Zo}),this},g.restoreGraphicsState=function(){ft("Q");var A=Vn.pop();return ze=A.key,xe=A.size,Zo=A.color,We=null,this},g.setCurrentTransformationMatrix=function(A){return ft(A.toString()+" cm"),this},g.comment=function(A){return ft("#"+A),this};var Co=function(A,B){var mt=A||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return mt},set:function(ie){isNaN(ie)||(mt=parseFloat(ie))}});var Nt=B||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return Nt},set:function(ie){isNaN(ie)||(Nt=parseFloat(ie))}});var Ft="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Ft},set:function(ie){Ft=ie.toString()}}),this},Ms=function(A,B,mt,Nt){Co.call(this,A,B),this.type="rect";var Ft=mt||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Ft},set:function(ve){isNaN(ve)||(Ft=parseFloat(ve))}});var ie=Nt||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return ie},set:function(ve){isNaN(ve)||(ie=parseFloat(ve))}}),this},ja=function(){this.page=He,this.currentPage=Y,this.pages=Me.slice(0),this.pagesContext=Pe.slice(0),this.x=je,this.y=dr,this.matrix=mn,this.width=Es(Y),this.height=al(Y),this.outputDestination=Ie,this.id="",this.objectNumber=-1};ja.prototype.restore=function(){He=this.page,Y=this.currentPage,Pe=this.pagesContext,Me=this.pages,je=this.x,dr=this.y,mn=this.matrix,da(Y,this.width),Qo(Y,this.height),Ie=this.outputDestination};var fa=function(A,B,mt,Nt,Ft){Vo.push(new ja),He=Y=0,Me=[],je=A,dr=B,mn=Ft,Yr([mt,Nt])};for(var Cs in g.beginFormObject=function(A,B,mt,Nt,Ft){return fa(A,B,mt,Nt,Ft),this},g.endFormObject=function(A){return(function(B){if(Hi[B])Vo.pop().restore();else{var mt=new ja,Nt="Xo"+(Object.keys(ci).length+1).toString(10);mt.id=Nt,Hi[B]=Nt,ci[Nt]=mt,Wn.publish("addFormObject",mt),Vo.pop().restore()}})(A),this},g.doFormObject=function(A,B){var mt=ci[Hi[A]];return ft("q"),ft(B.toString()+" cm"),ft("/"+mt.id+" Do"),ft("Q"),this},g.getFormObject=function(A){var B=ci[Hi[A]];return{x:B.x,y:B.y,width:B.width,height:B.height,matrix:B.matrix}},g.save=function(A,B){return A=A||"generated.pdf",(B=B||{}).returnPromise=B.returnPromise||!1,B.returnPromise===!1?(Df(uo(hr()),A),typeof Df.unload=="function"&&Xn.setTimeout&&setTimeout(Df.unload,911),this):new Promise(function(mt,Nt){try{var Ft=Df(uo(hr()),A);typeof Df.unload=="function"&&Xn.setTimeout&&setTimeout(Df.unload,911),mt(Ft)}catch(ie){Nt(ie.message)}})},gn.API)gn.API.hasOwnProperty(Cs)&&(Cs==="events"&&gn.API.events.length?(function(A,B){var mt,Nt,Ft;for(Ft=B.length-1;Ft!==-1;Ft--)mt=B[Ft][0],Nt=B[Ft][1],A.subscribe.apply(A,[mt].concat(typeof Nt=="function"?[Nt]:Nt))})(Wn,gn.API.events):g[Cs]=gn.API[Cs]);function Es(A){return Pe[A].mediaBox.topRightX-Pe[A].mediaBox.bottomLeftX}function da(A,B){Pe[A].mediaBox.topRightX=B+Pe[A].mediaBox.bottomLeftX}function al(A){return Pe[A].mediaBox.topRightY-Pe[A].mediaBox.bottomLeftY}function Qo(A,B){Pe[A].mediaBox.topRightY=B+Pe[A].mediaBox.bottomLeftY}var Ts=g.getPageWidth=function(A){return Es(A=A||Y)/Qe},Pl=g.setPageWidth=function(A,B){da(A,B*Qe)},Ns=g.getPageHeight=function(A){return al(A=A||Y)/Qe},Il=g.setPageHeight=function(A,B){Qo(A,B*Qe)};return g.internal={pdfEscape:Pi,getStyle:ca,getFont:Jo,getFontSize:Te,getCharSpace:Pa,getTextColor:Ol,getLineHeight:lc,getLineHeightFactor:cc,getLineWidth:Oa,write:Re,getHorizontalCoordinate:ho,getVerticalCoordinate:_i,getCoordinateString:sl,getVerticalCoordinateString:As,collections:{},newObject:Gn,newAdditionalObject:Wo,newObjectDeferred:ui,newObjectDeferredBegin:Ti,getFilters:Xo,putStream:vs,events:Wn,scaleFactor:Qe,pageSize:{getWidth:function(){return Ts(Y)},setWidth:function(A){Pl(Y,A)},getHeight:function(){return Ns(Y)},setHeight:function(A){Il(Y,A)}},encryptionOptions:p,encryption:Pn,getEncryptor:function(A){return p!==null?Pn.encryptor(A,0):function(B){return B}},output:to,getNumberOfPages:jc,get pages(){return Me},out:ft,f2:J,f3:ct,getPageInfo:jr,getPageInfoByObjId:Ra,getCurrentPageInfo:la,getPDFVersion:M,Point:Co,Rectangle:Ms,Matrix:Ke,hasHotfix:Ir},Object.defineProperty(g.internal.pageSize,"width",{get:function(){return Ts(Y)},set:function(A){Pl(Y,A)},enumerable:!0,configurable:!0}),Object.defineProperty(g.internal.pageSize,"height",{get:function(){return Ns(Y)},set:function(A){Il(Y,A)},enumerable:!0,configurable:!0}),(function(A){for(var B=0,mt=on.length;B<mt;B++){var Nt=rl.call(this,A[B][0],A[B][1],A[B][2],on[B][3],!0);y===!1&&(b[Nt]=!0);var Ft=A[B][0].split("-");fi({id:Nt,fontName:Ft[0],fontStyle:Ft[1]||""})}Wn.publish("addFonts",{fonts:an,dictionary:dn})}).call(g,on),ze="F1",Ss(i,n),Wn.publish("initialized"),g}_d.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},_d.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},_d.prototype.hexToBytes=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(String.fromCharCode(parseInt(e.substr(n,2),16)));return t.join("")},_d.prototype.processOwnerPassword=function(e,t){return i2(r2(t).substr(0,5),e)},_d.prototype.encryptor=function(e,t){var n=r2(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(r){return i2(n,r)}},ig.prototype.equals=function(e){var t,n="id,objectNumber,equals";if(!e||$r(e)!==$r(this))return!1;var r=0;for(t in this)if(!(n.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;r++}for(t in e)e.hasOwnProperty(t)&&n.indexOf(t)<0&&r--;return r===0},gn.API={events:[]},gn.version="4.2.0";var Ki=gn.API,i5=1,id=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},kd=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Gf=function(e){return e.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var n=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(n.length===1?"0"+n:n)})},Yn=function(e){return e.toFixed(2)},Yu=function(e){return e.toFixed(5)};Ki.__acroform__={};var La=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},mw=function(e){return e*i5},Tc=function(e){var t=new Qk,n=un.internal.getHeight(e)||0,r=un.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Yn(r)),Number(Yn(n))],t},sN=Ki.__acroform__.setBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return e|1<<t},aN=Ki.__acroform__.clearBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return e&~(1<<t)},lN=Ki.__acroform__.getBit=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return e&1<<t?1:0},so=Ki.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return lN(e,t-1)},ao=Ki.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return sN(e,t-1)},lo=Ki.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return aN(e,t-1)},cN=Ki.__acroform__.calculateCoordinates=function(e,t){var n=t.internal.getHorizontalCoordinate,r=t.internal.getVerticalCoordinate,i=e[0],s=e[1],l=e[2],c=e[3],f={};return f.lowerLeft_X=n(i)||0,f.lowerLeft_Y=r(s+c)||0,f.upperRight_X=n(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))]},uN=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],n=e._V||e.DV,r=o2(e,n),i=e.scope.internal.getFont(e.fontName,e.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(e.scope.__private__.encodeColorString(e.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=Tc(e);return s.scope=e.scope,s.stream=t.join(`
31
+ `),s}},o2=function(e,t){var n=e.fontSize===0?e.maxFontSize:e.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=e.multiline?i.map(function(J){return J.split(`
32
+ `)}):i.map(function(J){return[J]});var s=n,l=un.internal.getHeight(e)||0;l=l<0?-l:l;var c=un.internal.getWidth(e)||0;c=c<0?-c:c;var f=function(J,ct,X){if(J+1<i.length){var bt=ct+" "+i[J+1][0];return gm(bt,e,X).width<=c-4}return!1};s++;t:for(;s>0;){t="",s--;var d,p,y=gm("3",e,s).height,b=e.multiline?l-s:(l-y)/2,g=b+=2,C=0,M=0,L=0;if(s<=0){t=`(...) Tj
33
+ `,t+="% Width of Text: "+gm(t,e,s=12).width+", FieldWidth:"+c+`
34
+ `;break}for(var D="",H=0,V=0;V<i.length;V++)if(i.hasOwnProperty(V)){var W=!1;if(i[V].length!==1&&L!==i[V].length-1){if((y+2)*(H+2)+2>l)continue t;D+=i[V][L],W=!0,M=V,V--}else{D=(D+=i[V][L]+" ").substr(D.length-1)==" "?D.substr(0,D.length-1):D;var gt=parseInt(V),_t=f(gt,D,s),kt=V>=i.length-1;if(_t&&!kt){D+=" ",L=0;continue}if(_t||kt){if(kt)M=gt;else if(e.multiline&&(y+2)*(H+2)+2>l)continue t}else{if(!e.multiline||(y+2)*(H+2)+2>l)continue t;M=gt}}for(var xt="",rt=C;rt<=M;rt++){var jt=i[rt];if(e.multiline){if(rt===M){xt+=jt[L]+" ",L=(L+1)%jt.length;continue}if(rt===C){xt+=jt[jt.length-1]+" ";continue}}xt+=jt[0]+" "}switch(xt=xt.substr(xt.length-1)==" "?xt.substr(0,xt.length-1):xt,p=gm(xt,e,s).width,e.textAlign){case"right":d=c-p-2;break;case"center":d=(c-p)/2;break;default:d=2}t+=Yn(d)+" "+Yn(g)+` Td
35
+ `,t+="("+id(xt)+`) Tj
36
+ `,t+=-Yn(d)+` 0 Td
37
+ `,g=-(s+2),p=0,C=W?M:M+1,H++,D=""}break}return r.text=t,r.fontSize=s,r},gm=function(e,t,n){var r=t.scope.internal.getFont(t.fontName,t.fontStyle),i=t.scope.getStringUnitWidth(e,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:t.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:i}},fN={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},dN=function(e,t){var n={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(r){return r.type===n.type&&r.object===n.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(n)},hN=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(rc.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(fN)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");i5=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new t4,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(n){n.internal.events.unsubscribe(n.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete n.internal.acroformPlugin.acroFormDictionaryRoot._eventID,n.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(n){n.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var r=n.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];s.objId=void 0,s.hasAnnotation&&dN(s,n)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(n){if(n.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");n.internal.write("/AcroForm "+n.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(n){(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=cN(c.Rect,i)),i.internal.newObjectDeferredBegin(c.objId,!0),c.DA=un.createDefaultAppearanceStream(c),$r(c)==="object"&&typeof c.getKeyValueListForStream=="function"&&(f=c.getKeyValueListForStream()),c.Rect=d,c.hasAppearanceStream&&!c.appearanceStreamContent){var p=uN(c);f.push({key:"AP",value:"<</N "+p+">>"}),i.internal.acroformPlugin.xForms.push(p)}if(c.appearanceStreamContent){var y="";for(var b in c.appearanceStreamContent)if(c.appearanceStreamContent.hasOwnProperty(b)){var g=c.appearanceStreamContent[b];if(y+="/"+b+" ",y+="<<",Object.keys(g).length>=1||Array.isArray(g)){for(var l in g)if(g.hasOwnProperty(l)){var C=g[l];typeof C=="function"&&(C=C.call(i,c)),y+="/"+l+" "+C+" ",i.internal.acroformPlugin.xForms.indexOf(C)>=0||i.internal.acroformPlugin.xForms.push(C)}}else typeof(C=g)=="function"&&(C=C.call(i,c)),y+="/"+l+" "+C,i.internal.acroformPlugin.xForms.indexOf(C)>=0||i.internal.acroformPlugin.xForms.push(C);y+=">>"}f.push({key:"AP",value:`<<
38
+ `+y+">>"})}i.internal.putStream({additionalKeyValues:f,objectId:c.objId}),i.internal.out("endobj")}s&&(function(M,L){for(var D in M)if(M.hasOwnProperty(D)){var H=D,V=M[D];L.internal.newObjectDeferredBegin(V.objId,!0),$r(V)==="object"&&typeof V.putStream=="function"&&V.putStream(),delete M[H]}})(i.internal.acroformPlugin.xForms,i)})(n,e)}),e.internal.acroformPlugin.isInitialized=!0}},Zk=Ki.__acroform__.arrayToPdfArray=function(e,t,n){var r=function(l){return l};if(Array.isArray(e)){for(var i="[",s=0;s<e.length;s++)switch(s!==0&&(i+=" "),$r(e[s])){case"boolean":case"number":case"object":i+=e[s].toString();break;case"string":e[s].substr(0,1)==="/"?i+="/"+Gf(e[s].substr(1)):(t!==void 0&&n&&(r=n.internal.getEncryptor(t)),i+="("+id(r(e[s].toString()))+")")}return i+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},J1=function(e,t,n){var r=function(i){return i};return t!==void 0&&n&&(r=n.internal.getEncryptor(t)),(e=e||"").toString(),"("+id(r(e))+")"},Dc=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(e){this._objId=e}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};Dc.prototype.toString=function(){return this.objId+" 0 R"},Dc.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},Dc.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var n in t)if(Object.getOwnPropertyDescriptor(this,t[n]).configurable===!1){var r=t[n],i=this[r];i&&(Array.isArray(i)?e.push({key:r,value:Zk(i,this.objId,this.scope)}):i instanceof Dc?(i.scope=this.scope,e.push({key:r,value:i.objId+" 0 R"})):typeof i!="function"&&e.push({key:r,value:i}))}return e};var Qk=function(){Dc.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 e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(n){t=n}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(n){e=n.trim()},get:function(){return e||null}})};La(Qk,Dc);var t4=function(){Dc.call(this);var e,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(e){var n=function(r){return r};return this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),"("+id(n(e))+")"}},set:function(n){e=n}})};La(t4,Dc);var rc=function e(){Dc.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(D){if(isNaN(D))throw new Error('Invalid value "'+D+'" for attribute F supplied.');t=D}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!so(t,3)},set:function(D){D?this.F=ao(t,3):this.F=lo(t,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(D){if(isNaN(D))throw new Error('Invalid value "'+D+'" for attribute Ff supplied.');n=D}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(D){r=D!==void 0?D:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(D){r[0]=D}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(D){r[1]=D}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(D){r[2]=D}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(D){r[3]=D}});var i="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(D){switch(D){case"/Btn":case"/Tx":case"/Ch":case"/Sig":i=D;break;default:throw new Error('Invalid value "'+D+'" 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 og)return;s="FieldObject"+e.FieldNum++}var D=function(H){return H};return this.scope&&(D=this.scope.internal.getEncryptor(this.objId)),"("+id(D(s))+")"},set:function(D){s=D.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(D){s=D}});var l="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return l},set:function(D){l=D}});var c="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return c},set:function(D){c=D}});var f=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return f},set:function(D){f=D}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/i5:d},set:function(D){d=D}});var p="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return p},set:function(D){p=D}});var y="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!y||this instanceof og||this instanceof Ff))return J1(y,this.objId,this.scope)},set:function(D){D=D.toString(),y=D}});var b=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(b)return this instanceof Uo==0?J1(b,this.objId,this.scope):b},set:function(D){D=D.toString(),b=this instanceof Uo==0?D.substr(0,1)==="("?kd(D.substr(1,D.length-2)):kd(D):D}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof Uo==1?kd(b.substr(1,b.length-1)):b},set:function(D){D=D.toString(),b=this instanceof Uo==1?"/"+Gf(D):D}});var g=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(g)return g},set:function(D){this.V=D}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(g)return this instanceof Uo==0?J1(g,this.objId,this.scope):g},set:function(D){D=D.toString(),g=this instanceof Uo==0?D.substr(0,1)==="("?kd(D.substr(1,D.length-2)):kd(D):D}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof Uo==1?kd(g.substr(1,g.length-1)):g},set:function(D){D=D.toString(),g=this instanceof Uo==1?"/"+Gf(D):D}}),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 C,M=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return M},set:function(D){D=!!D,M=D}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(C)return C},set:function(D){C=D}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,1)},set:function(D){D?this.Ff=ao(this.Ff,1):this.Ff=lo(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,2)},set:function(D){D?this.Ff=ao(this.Ff,2):this.Ff=lo(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,3)},set:function(D){D?this.Ff=ao(this.Ff,3):this.Ff=lo(this.Ff,3)}});var L=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(L!==null)return L},set:function(D){if([0,1,2].indexOf(D)===-1)throw new Error('Invalid value "'+D+'" for attribute Q supplied.');L=D}}),Object.defineProperty(this,"textAlign",{get:function(){var D;switch(L){case 0:default:D="left";break;case 1:D="center";break;case 2:D="right"}return D},configurable:!0,enumerable:!0,set:function(D){switch(D){case"right":case 2:L=2;break;case"center":case 1:L=1;break;default:L=0}}})};La(rc,Dc);var Fd=function(){rc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(n){e=n}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(n){e=n}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return Zk(t,this.objId,this.scope)},set:function(n){var r,i;i=[],typeof(r=n)=="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(n){t=n,this.sort&&t.sort()},this.addOption=function(n){n=(n=n||"").toString(),t.push(n),this.sort&&t.sort()},this.removeOption=function(n,r){for(r=r||!1,n=(n=n||"").toString();t.indexOf(n)!==-1&&(t.splice(t.indexOf(n),1),r!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,18)},set:function(n){n?this.Ff=ao(this.Ff,18):this.Ff=lo(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,19)},set:function(n){this.combo===!0&&(n?this.Ff=ao(this.Ff,19):this.Ff=lo(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,20)},set:function(n){n?(this.Ff=ao(this.Ff,20),t.sort()):this.Ff=lo(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,22)},set:function(n){n?this.Ff=ao(this.Ff,22):this.Ff=lo(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,23)},set:function(n){n?this.Ff=ao(this.Ff,23):this.Ff=lo(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,27)},set:function(n){n?this.Ff=ao(this.Ff,27):this.Ff=lo(this.Ff,27)}}),this.hasAppearanceStream=!1};La(Fd,rc);var Ud=function(){Fd.call(this),this.fontName="helvetica",this.combo=!1};La(Ud,Fd);var Hd=function(){Ud.call(this),this.combo=!0};La(Hd,Ud);var $m=function(){Hd.call(this),this.edit=!0};La($m,Hd);var Uo=function(){rc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,15)},set:function(n){n?this.Ff=ao(this.Ff,15):this.Ff=lo(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,16)},set:function(n){n?this.Ff=ao(this.Ff,16):this.Ff=lo(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,17)},set:function(n){n?this.Ff=ao(this.Ff,17):this.Ff=lo(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,26)},set:function(n){n?this.Ff=ao(this.Ff,26):this.Ff=lo(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var n=function(s){return s};if(this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var r,i=[];for(r in i.push("<<"),t)i.push("/"+r+" ("+id(n(t[r]))+")");return i.push(">>"),i.join(`
39
+ `)}},set:function(n){$r(n)==="object"&&(t=n)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(n){typeof n=="string"&&(t.CA=n)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(n){var r=n==null?"":n.toString();r.substr(0,1)==="/"&&(r=r.substr(1)),e="/"+Gf(r)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(n){e="/"+Gf(n)}})};La(Uo,rc);var Ym=function(){Uo.call(this),this.pushButton=!0};La(Ym,Uo);var qd=function(){Uo.call(this),this.radio=!0,this.pushButton=!1;var e=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t!==void 0?t:[]}})};La(qd,Uo);var og=function(){var e,t;rc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(i){e=i}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(i){t=i}});var n,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+" ("+id(i(r[s]))+")");return l.push(">>"),l.join(`
40
+ `)},set:function(i){$r(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 n},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+Gf(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+Gf(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=un.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};La(og,rc),qd.prototype.setAppearance=function(e){if(!("createAppearanceStream"in e)||!("getCA"in e))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var n=this.Kids[t];n.appearanceStreamContent=e.createAppearanceStream(n.optionName),n.caption=e.getCA()}},qd.prototype.createOption=function(e){var t=new og;return t.Parent=this,t.optionName=e,this.Kids.push(t),pN.call(this.scope,t),t};var Vm=function(){Uo.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=un.CheckBox.createAppearanceStream()};La(Vm,Uo);var Ff=function(){rc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,13)},set:function(t){t?this.Ff=ao(this.Ff,13):this.Ff=lo(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,21)},set:function(t){t?this.Ff=ao(this.Ff,21):this.Ff=lo(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,23)},set:function(t){t?this.Ff=ao(this.Ff,23):this.Ff=lo(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,24)},set:function(t){t?this.Ff=ao(this.Ff,24):this.Ff=lo(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,25)},set:function(t){t?this.Ff=ao(this.Ff,25):this.Ff=lo(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,26)},set:function(t){t?this.Ff=ao(this.Ff,26):this.Ff=lo(this.Ff,26)}});var e=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){Number.isInteger(t)&&(e=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};La(Ff,rc);var Wm=function(){Ff.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!so(this.Ff,14)},set:function(e){e?this.Ff=ao(this.Ff,14):this.Ff=lo(this.Ff,14)}}),this.password=!0};La(Wm,Ff);var un={CheckBox:{createAppearanceStream:function(){return{N:{On:un.CheckBox.YesNormal},D:{On:un.CheckBox.YesPushDown,Off:un.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Tc(e);t.scope=e.scope;var n=[],r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,i=e.scope.__private__.encodeColorString(e.color),s=o2(e,e.caption);return n.push("0.749023 g"),n.push("0 0 "+Yn(un.internal.getWidth(e))+" "+Yn(un.internal.getHeight(e))+" re"),n.push("f"),n.push("BMC"),n.push("q"),n.push("0 0 1 rg"),n.push("/"+r+" "+Yn(s.fontSize)+" Tf "+i),n.push("BT"),n.push(s.text),n.push("ET"),n.push("Q"),n.push("EMC"),t.stream=n.join(`
41
+ `),t},YesNormal:function(e){var t=Tc(e);t.scope=e.scope;var n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color),i=[],s=un.internal.getHeight(e),l=un.internal.getWidth(e),c=o2(e,e.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("/"+n+" "+Yn(c.fontSize)+" Tf "+r),i.push(c.text),i.push("ET"),i.push("Q"),t.stream=i.join(`
42
+ `),t},OffPushDown:function(e){var t=Tc(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+Yn(un.internal.getWidth(e))+" "+Yn(un.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(`
43
+ `),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:un.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=un.RadioButton.Circle.YesNormal,t.D[e]=un.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Tc(e);t.scope=e.scope;var n=[],r=un.internal.getWidth(e)<=un.internal.getHeight(e)?un.internal.getWidth(e)/4:un.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=un.internal.Bezier_C,s=Number((r*i).toFixed(5));return n.push("q"),n.push("1 0 0 1 "+Yu(un.internal.getWidth(e)/2)+" "+Yu(un.internal.getHeight(e)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),n.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),n.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),n.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
44
+ `),t},YesPushDown:function(e){var t=Tc(e);t.scope=e.scope;var n=[],r=un.internal.getWidth(e)<=un.internal.getHeight(e)?un.internal.getWidth(e)/4:un.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*un.internal.Bezier_C).toFixed(5)),l=Number((r*un.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Yu(un.internal.getWidth(e)/2)+" "+Yu(un.internal.getHeight(e)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),n.push("0 g"),n.push("q"),n.push("1 0 0 1 "+Yu(un.internal.getWidth(e)/2)+" "+Yu(un.internal.getHeight(e)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+l+" "+l+" "+r+" 0 "+r+" c"),n.push("-"+l+" "+r+" -"+r+" "+l+" -"+r+" 0 c"),n.push("-"+r+" -"+l+" -"+l+" -"+r+" 0 -"+r+" c"),n.push(l+" -"+r+" "+r+" -"+l+" "+r+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
45
+ `),t},OffPushDown:function(e){var t=Tc(e);t.scope=e.scope;var n=[],r=un.internal.getWidth(e)<=un.internal.getHeight(e)?un.internal.getWidth(e)/4:un.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*un.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Yu(un.internal.getWidth(e)/2)+" "+Yu(un.internal.getHeight(e)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
46
+ `),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:un.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=un.RadioButton.Cross.YesNormal,t.D[e]=un.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Tc(e);t.scope=e.scope;var n=[],r=un.internal.calculateCross(e);return n.push("q"),n.push("1 1 "+Yn(un.internal.getWidth(e)-2)+" "+Yn(un.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(Yn(r.x1.x)+" "+Yn(r.x1.y)+" m"),n.push(Yn(r.x2.x)+" "+Yn(r.x2.y)+" l"),n.push(Yn(r.x4.x)+" "+Yn(r.x4.y)+" m"),n.push(Yn(r.x3.x)+" "+Yn(r.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(`
47
+ `),t},YesPushDown:function(e){var t=Tc(e);t.scope=e.scope;var n=un.internal.calculateCross(e),r=[];return r.push("0.749023 g"),r.push("0 0 "+Yn(un.internal.getWidth(e))+" "+Yn(un.internal.getHeight(e))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+Yn(un.internal.getWidth(e)-2)+" "+Yn(un.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(Yn(n.x1.x)+" "+Yn(n.x1.y)+" m"),r.push(Yn(n.x2.x)+" "+Yn(n.x2.y)+" l"),r.push(Yn(n.x4.x)+" "+Yn(n.x4.y)+" m"),r.push(Yn(n.x3.x)+" "+Yn(n.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
48
+ `),t},OffPushDown:function(e){var t=Tc(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+Yn(un.internal.getWidth(e))+" "+Yn(un.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(`
49
+ `),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+n}};un.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=un.internal.getWidth(e),n=un.internal.getHeight(e),r=Math.min(t,n);return{x1:{x:(t-r)/2,y:(n-r)/2+r},x2:{x:(t-r)/2+r,y:(n-r)/2},x3:{x:(t-r)/2,y:(n-r)/2},x4:{x:(t-r)/2+r,y:(n-r)/2+r}}}},un.internal.getWidth=function(e){var t=0;return $r(e)==="object"&&(t=mw(e.Rect[2])),t},un.internal.getHeight=function(e){var t=0;return $r(e)==="object"&&(t=mw(e.Rect[3])),t};var pN=Ki.addField=function(e){if(hN(this,e),!(e instanceof rc))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};Ki.AcroFormChoiceField=Fd,Ki.AcroFormListBox=Ud,Ki.AcroFormComboBox=Hd,Ki.AcroFormEditBox=$m,Ki.AcroFormButton=Uo,Ki.AcroFormPushButton=Ym,Ki.AcroFormRadioButton=qd,Ki.AcroFormCheckBox=Vm,Ki.AcroFormTextField=Ff,Ki.AcroFormPasswordField=Wm,Ki.AcroFormAppearance=un,Ki.AcroForm={ChoiceField:Fd,ListBox:Ud,ComboBox:Hd,EditBox:$m,Button:Uo,PushButton:Ym,RadioButton:qd,CheckBox:Vm,TextField:Ff,PasswordField:Wm,Appearance:un},gn.AcroForm={ChoiceField:Fd,ListBox:Ud,ComboBox:Hd,EditBox:$m,Button:Uo,PushButton:Ym,RadioButton:qd,CheckBox:Vm,TextField:Ff,PasswordField:Wm,Appearance:un};gn.AcroForm;function e4(e){return e.reduce(function(t,n,r){return t[n]=r,t},{})}(function(e){var t="addImage_";e.__addimage__={};var n="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=e.__addimage__.getImageFileTypeByImageData=function(J,ct){var X,bt,Lt,dt,st,lt=n;if((ct=ct||n)==="RGBA"||J.data!==void 0&&J.data instanceof Uint8ClampedArray&&"height"in J&&"width"in J)return"RGBA";if(_t(J))for(st in r)for(Lt=r[st],X=0;X<Lt.length;X+=1){for(dt=!0,bt=0;bt<Lt[X].length;bt+=1)if(Lt[X][bt]!==void 0&&Lt[X][bt]!==J[bt]){dt=!1;break}if(dt===!0){lt=st;break}}else for(st in r)for(Lt=r[st],X=0;X<Lt.length;X+=1){for(dt=!0,bt=0;bt<Lt[X].length;bt+=1)if(Lt[X][bt]!==void 0&&Lt[X][bt]!==J.charCodeAt(bt)){dt=!1;break}if(dt===!0){lt=st;break}}return lt===n&&ct!==n&&(lt=ct),lt},s=function J(ct){for(var X=this.internal.write,bt=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===D.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===D.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 Mt=ct.filter!==void 0?["/"+ct.filter]:void 0;if(bt({data:ct.data,additionalKeyValues:dt,alreadyAppliedFilters:Mt,objectId:ct.objectId}),X("endobj"),"sMask"in ct&&ct.sMask!==void 0){var K,P=(K=ct.sMaskBitsPerComponent)!==null&&K!==void 0?K:ct.bitsPerComponent,Y={width:ct.width,height:ct.height,colorSpace:"DeviceGray",bitsPerComponent:P,data:ct.sMask};"filter"in ct&&(Y.decodeParameters="/Predictor ".concat(ct.predictor," /Colors 1 /BitsPerComponent ").concat(P," /Columns ").concat(ct.width),Y.filter=ct.filter),J.call(this,Y)}if(ct.colorSpace===D.INDEXED){var tt=this.internal.newObject();bt({data:xt(new Uint8Array(ct.palette)),objectId:tt}),X("endobj")}},l=function(){var J=this.internal.collections[t+"images"];for(var ct in J)s.call(this,J[ct])},c=function(){var J,ct=this.internal.collections[t+"images"],X=this.internal.write;for(var bt in ct)X("/I"+(J=ct[bt]).index,J.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 J=this.internal.collections[t+"images"];return f.call(this),J},p=function(){return Object.keys(this.internal.collections[t+"images"]).length},y=function(J){return typeof e["process"+J.toUpperCase()]=="function"},b=function(J){return $r(J)==="object"&&J.nodeType===1},g=function(J,ct){if(J.nodeName==="IMG"&&J.hasAttribute("src")){var X=""+J.getAttribute("src");if(X.indexOf("data:image/")===0)return qm(unescape(X).split("base64,").pop());var bt=e.loadFile(X,!0);if(bt!==void 0)return bt}if(J.nodeName==="CANVAS"){if(J.width===0||J.height===0)throw new Error("Given canvas must have data. Canvas width: "+J.width+", height: "+J.height);var Lt;switch(ct){case"PNG":Lt="image/png";break;case"WEBP":Lt="image/webp";break;default:Lt="image/jpeg"}return qm(J.toDataURL(Lt,1).split("base64,").pop())}},C=function(J){var ct=this.internal.collections[t+"images"];if(ct){for(var X in ct)if(J===ct[X].alias)return ct[X]}},M=function(J,ct,X){return J||ct||(J=-96,ct=-96),J<0&&(J=-1*X.width*72/J/this.internal.scaleFactor),ct<0&&(ct=-1*X.height*72/ct/this.internal.scaleFactor),J===0&&(J=ct*X.width/X.height),ct===0&&(ct=J*X.height/X.width),[J,ct]},L=function(J,ct,X,bt,Lt,dt){var st=M.call(this,X,bt,Lt),lt=this.internal.getCoordinateString,zt=this.internal.getVerticalCoordinateString,Mt=d.call(this);if(X=st[0],bt=st[1],Mt[Lt.index]=Lt,dt){dt*=Math.PI/180;var K=Math.cos(dt),P=Math.sin(dt),Y=function(yt){return yt.toFixed(4)},tt=[Y(K),Y(P),Y(-1*P),Y(K),0,0,"cm"]}this.internal.write("q"),dt?(this.internal.write([1,"0","0",1,lt(J),zt(ct+bt),"cm"].join(" ")),this.internal.write(tt.join(" ")),this.internal.write([lt(X),"0","0",lt(bt),"0","0","cm"].join(" "))):this.internal.write([lt(X),"0","0",lt(bt),lt(J),zt(ct+bt),"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")},D=e.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"};e.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=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},V=e.__addimage__.sHashCode=function(J){var ct,X,bt=0;if(typeof J=="string")for(X=J.length,ct=0;ct<X;ct++)bt=(bt<<5)-bt+J.charCodeAt(ct),bt|=0;else if(_t(J))for(X=J.byteLength/2,ct=0;ct<X;ct++)bt=(bt<<5)-bt+J[ct],bt|=0;return bt},W=e.__addimage__.validateStringAsBase64=function(J){(J=J||"").toString().trim();var ct=!0;return J.length===0&&(ct=!1),J.length%4!=0&&(ct=!1),/^[A-Za-z0-9+/]+$/.test(J.substr(0,J.length-2))===!1&&(ct=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(J.substr(-2))===!1&&(ct=!1),ct},gt=e.__addimage__.extractImageFromDataUrl=function(J){if(J==null||!(J=J.trim()).startsWith("data:"))return null;var ct=J.indexOf(",");return ct<0?null:J.substring(0,ct).trim().endsWith("base64")?J.substring(ct+1):null};e.__addimage__.isArrayBuffer=function(J){return J instanceof ArrayBuffer};var _t=e.__addimage__.isArrayBufferView=function(J){return J instanceof Int8Array||J instanceof Uint8Array||J instanceof Uint8ClampedArray||J instanceof Int16Array||J instanceof Uint16Array||J instanceof Int32Array||J instanceof Uint32Array||J instanceof Float32Array||J instanceof Float64Array},kt=e.__addimage__.binaryStringToUint8Array=function(J){for(var ct=J.length,X=new Uint8Array(ct),bt=0;bt<ct;bt++)X[bt]=J.charCodeAt(bt);return X},xt=e.__addimage__.arrayBufferToBinaryString=function(J){for(var ct="",X=_t(J)?J:new Uint8Array(J),bt=0;bt<X.length;bt+=8192)ct+=String.fromCharCode.apply(null,X.subarray(bt,bt+8192));return ct};e.addImage=function(){var J,ct,X,bt,Lt,dt,st,lt,zt;if(typeof arguments[1]=="number"?(ct=n,X=arguments[1],bt=arguments[2],Lt=arguments[3],dt=arguments[4],st=arguments[5],lt=arguments[6],zt=arguments[7]):(ct=arguments[1],X=arguments[2],bt=arguments[3],Lt=arguments[4],dt=arguments[5],st=arguments[6],lt=arguments[7],zt=arguments[8]),$r(J=arguments[0])==="object"&&!b(J)&&"imageData"in J){var Mt=J;J=Mt.imageData,ct=Mt.format||ct||n,X=Mt.x||X||0,bt=Mt.y||bt||0,Lt=Mt.w||Mt.width||Lt,dt=Mt.h||Mt.height||dt,st=Mt.alias||st,lt=Mt.compression||lt,zt=Mt.rotation||Mt.angle||zt}var K=this.internal.getFilters();if(lt===void 0&&K.indexOf("FlateEncode")!==-1&&(lt="SLOW"),isNaN(X)||isNaN(bt))throw new Error("Invalid coordinates passed to jsPDF.addImage");f.call(this);var P=rt.call(this,J,ct,st,lt);return L.call(this,X,bt,Lt,dt,P,zt),this};var rt=function(J,ct,X,bt){var Lt,dt,st;if(typeof J=="string"&&i(J)===n){J=unescape(J);var lt=jt(J,!1);(lt!==""||(lt=e.loadFile(J,!0))!==void 0)&&(J=lt)}if(b(J)&&(J=g(J,ct)),ct=i(J,ct),!y(ct))throw new Error("addImage does not support files of type '"+ct+"', please ensure that a plugin for '"+ct+"' support is added.");if(((st=X)==null||st.length===0)&&(X=(function(zt){return typeof zt=="string"||_t(zt)?V(zt):_t(zt.data)?V(zt.data):null})(J)),(Lt=C.call(this,X))||(J instanceof Uint8Array||ct==="RGBA"||(dt=J,J=kt(J)),Lt=this["process"+ct.toUpperCase()](J,p.call(this),X,(function(zt){return zt&&typeof zt=="string"&&(zt=zt.toUpperCase()),zt in e.image_compression?zt:H.NONE})(bt),dt)),!Lt)throw new Error("An unknown error occurred whilst processing the image.");return Lt},jt=e.__addimage__.convertBase64ToBinaryString=function(J,ct){ct=typeof ct!="boolean"||ct;var X,bt="";if(typeof J=="string"){var Lt;X=(Lt=gt(J))!==null&&Lt!==void 0?Lt:J;try{bt=qm(X)}catch(dt){if(ct)throw W(X)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+dt.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return bt};e.getImageProperties=function(J){var ct,X,bt="";if(b(J)&&(J=g(J)),typeof J=="string"&&i(J)===n&&((bt=jt(J,!1))===""&&(bt=e.loadFile(J)||""),J=bt),X=i(J),!y(X))throw new Error("addImage does not support files of type '"+X+"', please ensure that a plugin for '"+X+"' support is added.");if(J instanceof Uint8Array||(J=kt(J)),!(ct=this["process"+X.toUpperCase()](J)))throw new Error("An unknown error occurred whilst processing the image");return ct.fileType=X,ct}})(gn.API),(function(e){var t=function(n){if(n!==void 0&&n!="")return!0};gn.API.events.push(["addPage",function(n){this.internal.getPageInfo(n.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(n){for(var r,i,s,l=this.internal.getCoordinateString,c=this.internal.getVerticalCoordinateString,f=this.internal.getPageInfoByObjId(n.objId),d=n.pageContext.annotations,p=!1,y=0;y<d.length&&!p;y++)switch((r=d[y]).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 g=this.internal.pdfEscape,C=this.internal.getEncryptor(n.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var M=this.internal.newAdditionalObject(),L=this.internal.newAdditionalObject(),D=this.internal.getEncryptor(M.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 ("+g(D(r.contents))+")",s+=" /Popup "+L.objId+" 0 R",s+=" /P "+f.objId+" 0 R",s+=" /T ("+g(D(H))+") >>",M.content=s;var V=M.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 "+V,r.open&&(s+=" /Open true"),s+=" >>",L.content=s,this.internal.write(M.objId,"0 R",L.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=r.color||"#000000";s="<</Type /Annot /Subtype /FreeText "+i+"/Contents ("+g(C(r.contents))+")",s+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+W+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(r.options.name){var gt=this.annotations._nameMap[r.options.name];r.options.pageNumber=gt.page,r.options.top=gt.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 ("+g(C(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("]")}}]),e.createAnnotation=function(n){var r=this.internal.getCurrentPageInfo();switch(n.type){case"link":this.link(n.bounds.x,n.bounds.y,n.bounds.w,n.bounds.h,n);break;case"text":case"freetext":r.pageContext.annotations.push(n)}},e.link=function(n,r,i,s,l){var c=this.internal.getCurrentPageInfo(),f=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;c.pageContext.annotations.push({finalBounds:{x:f(n),y:d(r),w:f(n+i),h:d(r+s)},options:l,type:"link"})},e.textWithLink=function(n,r,i,s){var l,c,f=this.getTextWidth(n),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){c=s.maxWidth;var p=this.splitTextToSize(n,c).length;l=Math.ceil(d*p)}else c=f,l=d;return this.text(n,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},e.getTextWidth=function(n){var r=this.internal.getFontSize();return this.getStringUnitWidth(n)*r/this.internal.scaleFactor}})(gn.API),(function(e){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]},n={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];e.__arabicParser__={};var s=e.__arabicParser__.isInArabicSubstitutionA=function(M){return t[M.charCodeAt(0)]!==void 0},l=e.__arabicParser__.isArabicLetter=function(M){return typeof M=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(M)},c=e.__arabicParser__.isArabicEndLetter=function(M){return l(M)&&s(M)&&t[M.charCodeAt(0)].length<=2},f=e.__arabicParser__.isArabicAlfLetter=function(M){return l(M)&&i.indexOf(M.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(M){return l(M)&&s(M)&&t[M.charCodeAt(0)].length>=1};var d=e.__arabicParser__.arabicLetterHasFinalForm=function(M){return l(M)&&s(M)&&t[M.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(M){return l(M)&&s(M)&&t[M.charCodeAt(0)].length>=3};var p=e.__arabicParser__.arabicLetterHasMedialForm=function(M){return l(M)&&s(M)&&t[M.charCodeAt(0)].length==4},y=e.__arabicParser__.resolveLigatures=function(M){var L=0,D=n,H="",V=0;for(L=0;L<M.length;L+=1)D[M.charCodeAt(L)]!==void 0?(V++,typeof(D=D[M.charCodeAt(L)])=="number"&&(H+=String.fromCharCode(D),D=n,V=0),L===M.length-1&&(D=n,H+=M.charAt(L-(V-1)),L-=V-1,V=0)):(D=n,H+=M.charAt(L-V),L-=V,V=0);return H};e.__arabicParser__.isArabicDiacritic=function(M){return M!==void 0&&r[M.charCodeAt(0)]!==void 0};var b=e.__arabicParser__.getCorrectForm=function(M,L,D){return l(M)?s(M)===!1?-1:!d(M)||!l(L)&&!l(D)||!l(D)&&c(L)||c(M)&&!l(L)||c(M)&&f(L)||c(M)&&c(L)?0:p(M)&&l(L)&&!c(L)&&l(D)&&d(D)?3:c(M)||!l(D)?1:2:-1},g=function(M){var L=0,D=0,H=0,V="",W="",gt="",_t=(M=M||"").split("\\s+"),kt=[];for(L=0;L<_t.length;L+=1){for(kt.push(""),D=0;D<_t[L].length;D+=1)V=_t[L][D],W=_t[L][D-1],gt=_t[L][D+1],l(V)?(H=b(V,W,gt),kt[L]+=H!==-1?String.fromCharCode(t[V.charCodeAt(0)][H]):V):kt[L]+=V;kt[L]=y(kt[L])}return kt.join(" ")},C=e.__arabicParser__.processArabic=e.processArabic=function(){var M,L=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,D=[];if(Array.isArray(L)){var H=0;for(D=[],H=0;H<L.length;H+=1)Array.isArray(L[H])?D.push([g(L[H][0]),L[H][1],L[H][2]]):D.push([g(L[H])]);M=D}else M=g(L);return typeof arguments[0]=="string"?M:(arguments[0].text=M,arguments[0])};e.events.push(["preProcessText",C])})(gn.API),gn.API.autoPrint=function(e){var t;return(e=e||{}).variant=e.variant||"non-conform",e.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(e){var t=function(){var n=void 0;Object.defineProperty(this,"pdf",{get:function(){return n},set:function(c){n=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(n,r){var i;if((n=n||"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.")},e.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])})(gn.API),(function(e){var t={left:0,top:0,bottom:0,right:0},n=!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(M){f=M}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(M){d=M}});var p=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return p},set:function(M){p=M}});var y=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return y},set:function(M){y=M}});var b=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return b},set:function(M){b=M}});var g=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return g},set:function(M){g=M}});var C=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return C},set:function(M){C=M}}),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]},e.setHeaderFunction=function(f){return r.call(this),this.internal.__cell__.headerFunction=typeof f=="function"?f:void 0,this},e.getTextDimensions=function(f,d){r.call(this);var p=(d=d||{}).fontSize||this.getFontSize(),y=d.font||this.getFont(),b=d.scaleFactor||this.internal.scaleFactor,g=0,C=0,M=0,L=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 D=d.maxWidth;D>0?typeof f=="string"?f=this.splitTextToSize(f,D):Object.prototype.toString.call(f)==="[object Array]"&&(f=f.reduce(function(V,W){return V.concat(L.splitTextToSize(W,D))},[])):f=Array.isArray(f)?f:[f];for(var H=0;H<f.length;H++)g<(M=this.getStringUnitWidth(f[H],{font:y})*p)&&(g=M);return g!==0&&(C=f.length),{w:g/=b,h:Math.max((C*p*this.getLineHeightFactor()-p*(this.getLineHeightFactor()-1))/b,0)}},e.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=e.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,y=this.internal.__cell__.margins||t,b=this.internal.__cell__.tableHeaderRow,g=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+y.bottom>this.getPageHeight()?(this.cellAddPage(),f.y=y.top,g&&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,n===!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};e.table=function(f,d,p,y,b){if(r.call(this),!p)throw new Error("No data for PDF table.");var g,C,M,L,D=[],H=[],V=[],W={},gt={},_t=[],kt=[],xt=(b=b||{}).autoSize||!1,rt=b.printHeaders!==!1,jt=b.css&&b.css["font-size"]!==void 0?16*b.css["font-size"]:b.fontSize||12,J=b.margins||Object.assign({width:this.getPageWidth()},t),ct=typeof b.padding=="number"?b.padding:3,X=b.headerBackgroundColor||"#c8c8c8",bt=b.headerTextColor||"#000";if(i.call(this),this.internal.__cell__.printHeaders=rt,this.internal.__cell__.margins=J,this.internal.__cell__.table_font_size=jt,this.internal.__cell__.padding=ct,this.internal.__cell__.headerBackgroundColor=X,this.internal.__cell__.headerTextColor=bt,this.setFontSize(jt),y==null)H=D=Object.keys(p[0]),V=D.map(function(){return"left"});else if(Array.isArray(y)&&$r(y[0])==="object")for(D=y.map(function(Mt){return Mt.name}),H=y.map(function(Mt){return Mt.prompt||Mt.name||""}),V=y.map(function(Mt){return Mt.align||"left"}),g=0;g<y.length;g+=1)gt[y[g].name]=.7499990551181103*y[g].width;else Array.isArray(y)&&typeof y[0]=="string"&&(H=D=y,V=D.map(function(){return"left"}));if(xt||Array.isArray(y)&&typeof y[0]=="string")for(g=0;g<D.length;g+=1){for(W[L=D[g]]=p.map(function(Mt){return Mt[L]}),this.setFont(void 0,"bold"),_t.push(this.getTextDimensions(H[g],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),C=W[L],this.setFont(void 0,"normal"),M=0;M<C.length;M+=1)_t.push(this.getTextDimensions(C[M],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);gt[L]=Math.max.apply(null,_t)+ct+ct,_t=[]}if(rt){var Lt={};for(g=0;g<D.length;g+=1)Lt[D[g]]={},Lt[D[g]].text=H[g],Lt[D[g]].align=V[g];var dt=c.call(this,Lt,gt);kt=D.map(function(Mt){return new s(f,d,gt[Mt],dt,Lt[Mt].text,void 0,Lt[Mt].align)}),this.setTableHeaderRow(kt),this.printHeaderRow(1,!1)}var st=y.reduce(function(Mt,K){return Mt[K.name]=K.align,Mt},{});for(g=0;g<p.length;g+=1){"rowStart"in b&&b.rowStart instanceof Function&&b.rowStart({row:g,data:p[g]},this);var lt=c.call(this,p[g],gt);for(M=0;M<D.length;M+=1){var zt=p[g][D[M]];"cellStart"in b&&b.cellStart instanceof Function&&b.cellStart({row:g,col:M,data:zt},this),l.call(this,new s(f,d,gt[D[M]],lt,zt,g+2,st[D[M]]))}}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,y=this.internal.__cell__.table_font_size,b=this.internal.scaleFactor;return Object.keys(f).map(function(g){var C=f[g];return this.splitTextToSize(C.hasOwnProperty("text")?C.text:C,d[g]-p-p)},this).map(function(g){return this.getLineHeightFactor()*g.length*y/b+p+p},this).reduce(function(g,C){return Math.max(g,C)},0)};e.setTableHeaderRow=function(f){r.call(this),this.internal.__cell__.tableHeaderRow=f},e.printHeaderRow=function(f,d){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var p;if(n=!0,typeof this.internal.__cell__.headerFunction=="function"){var y=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(y[0],y[1],y[2],y[3],void 0,-1)}this.setFont(void 0,"bold");for(var b=[],g=0;g<this.internal.__cell__.tableHeaderRow.length;g+=1){p=this.internal.__cell__.tableHeaderRow[g].clone(),d&&(p.y=this.internal.__cell__.margins.top||0,b.push(p)),p.lineNumber=f;var C=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),l.call(this,p),this.setTextColor(C)}b.length>0&&this.setTableHeaderRow(b),this.setFont(void 0,"normal"),n=!1}})(gn.API);var n4={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},r4=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],s2=e4(r4),i4=[100,200,300,400,500,600,700,800,900],mN=e4(i4);function Z1(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),n=(function(s){return n4[s=s||"normal"]?s:"normal"})(e.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})(e.weight),i=(function(s){return typeof s2[s=s||"normal"]=="number"?s:"normal"})(e.stretch);return{family:t,style:n,weight:r,stretch:i,src:e.src||[],ref:e.ref||{name:t,style:[i,n,r].join(" ")}}}function gw(e,t,n,r){var i;for(i=n;i>=0&&i<t.length;i+=r)if(e[t[i]])return e[t[i]];for(i=n;i>=0&&i<t.length;i-=r)if(e[t[i]])return e[t[i]]}var gN={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},yw={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function bw(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function xw(e){return e.trimLeft()}function yN(e,t){for(var n=0;n<e.length;){if(e.charAt(n)===t)return[e.substring(0,n),e.substring(n+1)];n+=1}return null}function bN(e){var t=e.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],e.substring(t[0].length)]}var Ad,ym,vw,ww,Sw,Q1=["times"];function kw(e,t,n,r,i){var s=4,l=Mw;switch(i){case gn.API.image_compression.FAST:s=1,l=Aw;break;case gn.API.image_compression.MEDIUM:s=6,l=Cw;break;case gn.API.image_compression.SLOW:s=9,l=Ew}e=(function(f,d,p,y){for(var b,g=f.length/d,C=new Uint8Array(f.length+g),M=[xN,Aw,Mw,Cw,Ew],L=0;L<g;L+=1){var D=L*d,H=f.subarray(D,D+d);if(y)C.set(y(H,p,b),D+L);else{for(var V=M.length,W=[],gt=0;gt<V;gt+=1)W[gt]=M[gt](H,p,b);var _t=wN(W.concat());C.set(W[_t],D+L)}b=H}return C})(e,t,Math.ceil(n*r/8),l);var c=Qy(e,{level:s});return gn.API.__addimage__.arrayBufferToBinaryString(c)}function xN(e){var t=Array.apply([],e);return t.unshift(0),t}function Aw(e,t){var n=e.length,r=[];r[0]=1;for(var i=0;i<n;i+=1){var s=e[i-t]||0;r[i+1]=e[i]-s+256&255}return r}function Mw(e,t,n){var r=e.length,i=[];i[0]=2;for(var s=0;s<r;s+=1){var l=n&&n[s]||0;i[s+1]=e[s]-l+256&255}return i}function Cw(e,t,n){var r=e.length,i=[];i[0]=3;for(var s=0;s<r;s+=1){var l=e[s-t]||0,c=n&&n[s]||0;i[s+1]=e[s]+256-(l+c>>>1)&255}return i}function Ew(e,t,n){var r=e.length,i=[];i[0]=4;for(var s=0;s<r;s+=1){var l=vN(e[s-t]||0,n&&n[s]||0,n&&n[s-t]||0);i[s+1]=e[s]-l+256&255}return i}function vN(e,t,n){if(e===t&&t===n)return e;var r=Math.abs(t-n),i=Math.abs(e-n),s=Math.abs(e+t-n-n);return r<=i&&r<=s?e:i<=s?t:n}function wN(e){var t=e.map(function(n){return n.reduce(function(r,i){return r+Math.abs(i)},0)});return t.indexOf(Math.min.apply(null,t))}function ty(e,t,n){var r=t*n,i=Math.floor(r/8),s=16-(r-8*i+n),l=(1<<n)-1;return o4(e,i)>>s&l}function Tw(e,t,n,r){var i=n*r,s=Math.floor(i/8),l=16-(i-8*s+r),c=(1<<r)-1,f=(t&c)<<l;(function(d,p,y){if(p+1<d.byteLength)d.setUint16(p,y,!1);else{var b=y>>8&255;d.setUint8(p,b)}})(e,s,o4(e,s)&~(c<<l)&65535|f)}function o4(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function SN(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=e[t++]|e[t++]<<8,r=e[t++]|e[t++]<<8,i=e[t++],s=i>>7,l=1<<1+(7&i);e[t++],e[t++];var c=null,f=null;s&&(c=t,f=l,t+=3*l);var d=!0,p=[],y=0,b=null,g=0,C=null;for(this.width=n,this.height=r;d&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,C=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((J=e[t++])>=0))throw Error("Invalid block size");if(J===0)break;t+=J}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var M=e[t++];y=e[t++]|e[t++]<<8,b=e[t++],1&M||(b=null),g=M>>2&7,t++;break;case 254:for(;;){if(!((J=e[t++])>=0))throw Error("Invalid block size");if(J===0)break;t+=J}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var L=e[t++]|e[t++]<<8,D=e[t++]|e[t++]<<8,H=e[t++]|e[t++]<<8,V=e[t++]|e[t++]<<8,W=e[t++],gt=W>>6&1,_t=1<<1+(7&W),kt=c,xt=f,rt=!1;W>>7&&(rt=!0,kt=t,xt=_t,t+=3*_t);var jt=t;for(t++;;){var J;if(!((J=e[t++])>=0))throw Error("Invalid block size");if(J===0)break;t+=J}p.push({x:L,y:D,width:H,height:V,has_local_palette:rt,palette_offset:kt,palette_size:xt,data_offset:jt,data_length:t-jt,transparent_index:b,interlaced:!!gt,delay:y,disposal:g});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return p.length},this.loopCount=function(){return C},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,X){var bt=this.frameInfo(ct),Lt=bt.width*bt.height;if(Lt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var dt=new Uint8Array(Lt);Nw(e,bt.data_offset,dt,Lt);var st=bt.palette_offset,lt=bt.transparent_index;lt===null&&(lt=256);var zt=bt.width,Mt=n-zt,K=zt,P=4*(bt.y*n+bt.x),Y=4*((bt.y+bt.height)*n+bt.x),tt=P,yt=4*Mt;bt.interlaced===!0&&(yt+=4*n*7);for(var wt=8,At=0,qt=dt.length;At<qt;++At){var Rt=dt[At];if(K===0&&(K=zt,(tt+=yt)>=Y&&(yt=4*Mt+4*n*(wt-1),tt=P+(zt+Mt)*(wt<<1),wt>>=1)),Rt===lt)tt+=4;else{var Zt=e[st+3*Rt],Me=e[st+3*Rt+1],le=e[st+3*Rt+2];X[tt++]=le,X[tt++]=Me,X[tt++]=Zt,X[tt++]=255}--K}},this.decodeAndBlitFrameRGBA=function(ct,X){var bt=this.frameInfo(ct),Lt=bt.width*bt.height;if(Lt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var dt=new Uint8Array(Lt);Nw(e,bt.data_offset,dt,Lt);var st=bt.palette_offset,lt=bt.transparent_index;lt===null&&(lt=256);var zt=bt.width,Mt=n-zt,K=zt,P=4*(bt.y*n+bt.x),Y=4*((bt.y+bt.height)*n+bt.x),tt=P,yt=4*Mt;bt.interlaced===!0&&(yt+=4*n*7);for(var wt=8,At=0,qt=dt.length;At<qt;++At){var Rt=dt[At];if(K===0&&(K=zt,(tt+=yt)>=Y&&(yt=4*Mt+4*n*(wt-1),tt=P+(zt+Mt)*(wt<<1),wt>>=1)),Rt===lt)tt+=4;else{var Zt=e[st+3*Rt],Me=e[st+3*Rt+1],le=e[st+3*Rt+2];X[tt++]=Zt,X[tt++]=Me,X[tt++]=le,X[tt++]=255}--K}}}function Nw(e,t,n,r){for(var i=e[t++],s=1<<i,l=s+1,c=l+1,f=i+1,d=(1<<f)-1,p=0,y=0,b=0,g=e[t++],C=new Int32Array(4096),M=null;;){for(;p<16&&g!==0;)y|=e[t++]<<p,p+=8,g===1?g=e[t++]:--g;if(p<f)break;var L=y&d;if(y>>=f,p-=f,L!==s){if(L===l)break;for(var D=L<c?L:M,H=0,V=D;V>s;)V=C[V]>>8,++H;var W=V;if(b+H+(D!==L?1:0)>r)return void si.log("Warning, gif stream longer than expected.");n[b++]=W;var gt=b+=H;for(D!==L&&(n[b++]=W),V=D;H--;)V=C[V],n[--gt]=255&V,V>>=8;M!==null&&c<4096&&(C[c++]=M<<8|W,c>=d+1&&f<12&&(++f,d=d<<1|1)),M=L}else c=l+1,d=(1<<(f=i+1))-1,M=null}return b!==r&&si.log("Warning, gif stream shorter than expected."),n}function ey(e){var t,n,r,i,s,l=Math.floor,c=new Array(64),f=new Array(64),d=new Array(64),p=new Array(64),y=new Array(65535),b=new Array(65535),g=new Array(64),C=new Array(64),M=[],L=0,D=7,H=new Array(64),V=new Array(64),W=new Array(64),gt=new Array(256),_t=new Array(2048),kt=[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],xt=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],rt=[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],J=[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],X=[0,1,2,3,4,5,6,7,8,9,10,11],bt=[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,Y){for(var tt=0,yt=0,wt=new Array,At=1;At<=16;At++){for(var qt=1;qt<=P[At];qt++)wt[Y[yt]]=[],wt[Y[yt]][0]=tt,wt[Y[yt]][1]=At,yt++,tt++;tt*=2}return wt}function st(P){for(var Y=P[0],tt=P[1]-1;tt>=0;)Y&1<<tt&&(L|=1<<D),tt--,--D<0&&(L==255?(lt(255),lt(0)):lt(L),D=7,L=0)}function lt(P){M.push(P)}function zt(P){lt(P>>8&255),lt(255&P)}function Mt(P,Y,tt,yt,wt){for(var At,qt=wt[0],Rt=wt[240],Zt=(function(xe,_e){var Te,De,$e,fn,In,bn,Nn,xn,ze,Qe,je=0;for(ze=0;ze<8;++ze){Te=xe[je],De=xe[je+1],$e=xe[je+2],fn=xe[je+3],In=xe[je+4],bn=xe[je+5],Nn=xe[je+6];var dr=Te+(xn=xe[je+7]),mn=Te-xn,an=De+Nn,dn=De-Nn,Vn=$e+bn,tn=$e-bn,Qt=fn+In,we=fn-In,ge=dr+Qt,We=dr-Qt,He=an+Vn,Pe=an-Vn;xe[je]=ge+He,xe[je+4]=ge-He;var Wn=.707106781*(Pe+We);xe[je+2]=We+Wn,xe[je+6]=We-Wn;var Yo=.382683433*((ge=we+tn)-(Pe=dn+mn)),ci=.5411961*ge+Yo,Hi=1.306562965*Pe+Yo,Vo=.707106781*(He=tn+dn),Ke=mn+Vo,xs=mn-Vo;xe[je+5]=xs+ci,xe[je+3]=xs-ci,xe[je+1]=Ke+Hi,xe[je+7]=Ke-Hi,je+=8}for(je=0,ze=0;ze<8;++ze){Te=xe[je],De=xe[je+8],$e=xe[je+16],fn=xe[je+24],In=xe[je+32],bn=xe[je+40],Nn=xe[je+48];var Zi=Te+(xn=xe[je+56]),Xt=Te-xn,Ei=De+Nn,Gn=De-Nn,ui=$e+bn,Ti=$e-bn,Wo=fn+In,pi=fn-In,Ar=Zi+Wo,or=Zi-Wo,Kn=Ei+ui,Xo=Ei-ui;xe[je]=Ar+Kn,xe[je+32]=Ar-Kn;var vs=.707106781*(Xo+or);xe[je+16]=or+vs,xe[je+48]=or-vs;var Da=.382683433*((Ar=pi+Ti)-(Xo=Gn+Xt)),Go=.5411961*Ar+Da,Ao=1.306562965*Xo+Da,Ll=.707106781*(Kn=Ti+Gn),aa=Xt+Ll,ws=Xt-Ll;xe[je+40]=ws+Go,xe[je+24]=ws-Go,xe[je+8]=aa+Ao,xe[je+56]=aa-Ao,je++}for(ze=0;ze<64;++ze)Qe=xe[ze]*_e[ze],g[ze]=Qe>0?Qe+.5|0:Qe-.5|0;return g})(P,Y),Me=0;Me<64;++Me)C[kt[Me]]=Zt[Me];var le=C[0]-tt;tt=C[0],le==0?st(yt[0]):(st(yt[b[At=32767+le]]),st(y[At]));for(var Ie=63;Ie>0&&C[Ie]==0;)Ie--;if(Ie==0)return st(qt),tt;for(var Ue,ft=1;ft<=Ie;){for(var Re=ft;C[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}At=32767+C[ft],st(wt[(rn<<4)+b[At]]),st(y[At]),ft++}return Ie!=63&&st(qt),tt}function K(P){P=Math.min(Math.max(P,1),100),s!=P&&((function(Y){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],yt=0;yt<64;yt++){var wt=l((tt[yt]*Y+50)/100);wt=Math.min(Math.max(wt,1),255),c[kt[yt]]=wt}for(var At=[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((At[qt]*Y+50)/100);Rt=Math.min(Math.max(Rt,1),255),f[kt[qt]]=Rt}for(var Zt=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],Me=0,le=0;le<8;le++)for(var Ie=0;Ie<8;Ie++)d[Me]=1/(c[kt[Me]]*Zt[le]*Zt[Ie]*8),p[Me]=1/(f[kt[Me]]*Zt[le]*Zt[Ie]*8),Me++})(P<50?Math.floor(5e3/P):Math.floor(200-2*P)),s=P)}this.encode=function(P,Y){Y&&K(Y),M=new Array,L=0,D=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 De=0;De<64;De++)lt(c[De]);lt(1);for(var $e=0;$e<64;$e++)lt(f[$e])})(),(function(De,$e){zt(65472),zt(17),lt(8),zt($e),zt(De),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 De=0;De<16;De++)lt(xt[De+1]);for(var $e=0;$e<=11;$e++)lt(rt[$e]);lt(16);for(var fn=0;fn<16;fn++)lt(jt[fn+1]);for(var In=0;In<=161;In++)lt(J[In]);lt(1);for(var bn=0;bn<16;bn++)lt(ct[bn+1]);for(var Nn=0;Nn<=11;Nn++)lt(X[Nn]);lt(17);for(var xn=0;xn<16;xn++)lt(bt[xn+1]);for(var ze=0;ze<=161;ze++)lt(Lt[ze])})(),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,yt=0,wt=0;L=0,D=7,this.encode.displayName="_encode_";for(var At,qt,Rt,Zt,Me,le,Ie,Ue,ft,Re=P.data,rn=P.width,on=P.height,xe=4*rn,_e=0;_e<on;){for(At=0;At<xe;){for(Me=xe*_e+At,Ie=-1,Ue=0,ft=0;ft<64;ft++)le=Me+(Ue=ft>>3)*xe+(Ie=4*(7&ft)),_e+Ue>=on&&(le-=xe*(_e+1+Ue-on)),At+Ie>=xe&&(le-=At+Ie-xe+4),qt=Re[le++],Rt=Re[le++],Zt=Re[le++],H[ft]=(_t[qt]+_t[Rt+256|0]+_t[Zt+512|0]>>16)-128,V[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=Mt(H,d,tt,t,r),yt=Mt(V,p,yt,n,i),wt=Mt(W,p,wt,n,i),At+=32}_e+=8}if(D>=0){var Te=[];Te[1]=D+1,Te[0]=(1<<D+1)-1,st(Te)}return zt(65497),new Uint8Array(M)},e=e||50,(function(){for(var P=String.fromCharCode,Y=0;Y<256;Y++)gt[Y]=P(Y)})(),t=dt(xt,rt),n=dt(ct,X),r=dt(jt,J),i=dt(bt,Lt),(function(){for(var P=1,Y=2,tt=1;tt<=15;tt++){for(var yt=P;yt<Y;yt++)b[32767+yt]=tt,y[32767+yt]=[],y[32767+yt][1]=tt,y[32767+yt][0]=yt;for(var wt=-(Y-1);wt<=-P;wt++)b[32767+wt]=tt,y[32767+wt]=[],y[32767+wt][1]=tt,y[32767+wt][0]=Y-1+wt;P<<=1,Y<<=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(e)}function Jl(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.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 _w(e){function t(rt){if(!rt)throw Error("assert :P")}function n(rt,jt,J){for(var ct=0;4>ct;ct++)if(rt[jt+ct]!=J.charCodeAt(ct))return!0;return!1}function r(rt,jt,J,ct,X){for(var bt=0;bt<X;bt++)rt[jt+bt]=J[ct+bt]}function i(rt,jt,J,ct){for(var X=0;X<ct;X++)rt[jt+X]=J}function s(rt){return new Int32Array(rt)}function l(rt,jt){for(var J=[],ct=0;ct<rt;ct++)J.push(new jt);return J}function c(rt,jt){var J=[];return(function ct(X,bt,Lt){for(var dt=Lt[bt],st=0;st<dt&&(X.push(Lt.length>bt+1?[]:new jt),!(Lt.length<bt+1));st++)ct(X[st],bt+1,Lt)})(J,0,rt),J}var f=function(){var rt=this;function jt(m,v){for(var E=1<<v-1>>>0;m&E;)E>>>=1;return E?(m&E-1)+E:m}function J(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,pt,Dt,Wt){var ht,Ot,Ht=Q,re=1<<at,Yt=s(16),ne=s(16);for(t(Dt!=0),t(pt!=null),t($!=null),t(0<at),Ot=0;Ot<Dt;++Ot){if(15<pt[Ot])return 0;++Yt[pt[Ot]]}if(Yt[0]==Dt)return 0;for(ne[1]=0,ht=1;15>ht;++ht){if(Yt[ht]>1<<ht)return 0;ne[ht+1]=ne[ht]+Yt[ht]}for(Ot=0;Ot<Dt;++Ot)ht=pt[Ot],0<pt[Ot]&&(Wt[ne[ht]++]=Ot);if(ne[15]==1)return(pt=new X).g=0,pt.value=Wt[0],J($,Ht,1,re,pt),re;var ce,ke=-1,ye=re-1,Je=0,Ye=1,Ln=1,en=1<<at;for(Ot=0,ht=1,Dt=2;ht<=at;++ht,Dt<<=1){if(Ye+=Ln<<=1,0>(Ln-=Yt[ht]))return 0;for(;0<Yt[ht];--Yt[ht])(pt=new X).g=ht,pt.value=Wt[Ot++],J($,Ht+Je,Dt,en,pt),Je=jt(Je,ht)}for(ht=at+1,Dt=2;15>=ht;++ht,Dt<<=1){if(Ye+=Ln<<=1,0>(Ln-=Yt[ht]))return 0;for(;0<Yt[ht];--Yt[ht]){if(pt=new X,(Je&ye)!=ke){for(Ht+=en,ce=1<<(ke=ht)-at;15>ke&&!(0>=(ce-=Yt[ke]));)++ke,ce<<=1;re+=en=1<<(ce=ke-at),$[Q+(ke=Je&ye)].g=ce+at,$[Q+ke].value=Ht-Q-ke}pt.g=ht-at,pt.value=Wt[Ot++],J($,Ht+(Je>>at),Dt,en,pt),Je=jt(Je,ht)}}return Ye!=2*ne[15]-1?0:re})(m,v,E,R,F,q)}function X(){this.value=this.g=0}function bt(){this.value=this.g=0}function Lt(){this.G=l(5,X),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=l(Ua,bt)}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 Mt(m){for(;8<=m.u&&m.bb<m.Sb;)m.Ra>>>=8,m.Ra+=m.oa[m.pa+m.bb]<<es-8>>>0,++m.bb,m.u-=8;yt(m)&&(m.h=1,m.u=0)}function K(m,v){if(t(0<=v),!m.h&&v<=Nr){var E=tt(m)&hi[v];return m.u+=v,Mt(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 Y(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function tt(m){return m.Ra>>>(m.u&es-1)>>>0}function yt(m){return t(m.bb<=m.Sb),m.h||m.bb==m.Sb&&m.u>es}function wt(m,v){m.u=v,m.h=yt(m)}function At(m){m.u>=Yi&&(t(m.u>=Yi),Mt(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+Vs[R],m.b-=R,m.Ca=(E<<R)-1,q}function Me(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 xe(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){rt[v]=function(E,R,F,q,$,Q,at){var pt;for(pt=0;pt<$;++pt){var Dt=rt[m](Q[at+pt-1],F,q+pt);Q[at+pt]=_e(E[R+pt],Dt)}}}function De(){this.ud=this.hd=this.jd=0}function $e(m,v){return((4278124286&(m^v))>>>1)+(m&v)>>>0}function fn(m){return 0<=m&&256>m?m:0>m?0:255<m?255:void 0}function In(m,v){return fn(m+(m-v+.5>>1))}function bn(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 xn(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 ze(m,v){v.jd=255&m,v.hd=m>>8&255,v.ud=m>>16&255}function Qe(m,v,E,R,F,q){var $;for($=0;$<R;++$){var Q=v[E+$],at=Q>>>8,pt=Q,Dt=255&(Dt=(Dt=Q>>>16)+((m.jd<<24>>24)*(at<<24>>24)>>>5));pt=255&(pt=(pt+=(m.hd<<24>>24)*(at<<24>>24)>>>5)+((m.ud<<24>>24)*(Dt<<24>>24)>>>5)),F[q+$]=(4278255360&Q)+(Dt<<16)+pt}}function je(m,v,E,R,F){rt[v]=function(q,$,Q,at,pt,Dt,Wt,ht,Ot){for(at=Wt;at<ht;++at)for(Wt=0;Wt<Ot;++Wt)pt[Dt++]=F(Q[R(q[$++])])},rt[m]=function(q,$,Q,at,pt,Dt,Wt){var ht=8>>q.b,Ot=q.Ea,Ht=q.K[0],re=q.w;if(8>ht)for(q=(1<<q.b)-1,re=(1<<ht)-1;$<Q;++$){var Yt,ne=0;for(Yt=0;Yt<Ot;++Yt)Yt&q||(ne=R(at[pt++])),Dt[Wt++]=F(Ht[ne&re]),ne>>=ht}else rt["VP8LMapColor"+E](at,pt,Ht,re,Dt,Wt,$,Q,Ot)}}function dr(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 mn(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 an(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 dn(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 Vn(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 tn(m,v,E,R,F,q){if(q==0)for(E=v+E;v<E;)Me(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){rt[v][0]=rt[m+"0"],rt[v][1]=rt[m+"1"],rt[v][2]=rt[m+"2"],rt[v][3]=rt[m+"3"],rt[v][4]=rt[m+"4"],rt[v][5]=rt[m+"5"],rt[v][6]=rt[m+"6"],rt[v][7]=rt[m+"7"],rt[v][8]=rt[m+"8"],rt[v][9]=rt[m+"9"],rt[v][10]=rt[m+"10"],rt[v][11]=rt[m+"11"],rt[v][12]=rt[m+"12"],rt[v][13]=rt[m+"13"],rt[v][14]=rt[m+"0"],rt[v][15]=rt[m+"0"]}function we(m){return m==vc||m==$c||m==Hl||m==ql}function ge(){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 ge,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 Wn(){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 Yo(m){return alert("todo:WebPSamplerProcessPlane"),m.T}function ci(m,v){var E=m.T,R=v.ba.f.RGBA,F=R.eb,q=R.fb+m.ka*R.A,$=Ii[v.ba.S],Q=m.y,at=m.O,pt=m.f,Dt=m.N,Wt=m.ea,ht=m.W,Ot=v.cc,Ht=v.dc,re=v.Mc,Yt=v.Nc,ne=m.ka,ce=m.ka+m.T,ke=m.U,ye=ke+1>>1;for(ne==0?$(Q,at,null,null,pt,Dt,Wt,ht,pt,Dt,Wt,ht,F,q,null,null,ke):($(v.ec,v.fc,Q,at,Ot,Ht,re,Yt,pt,Dt,Wt,ht,F,q-R.A,F,q,ke),++E);ne+2<ce;ne+=2)Ot=pt,Ht=Dt,re=Wt,Yt=ht,Dt+=m.Rc,ht+=m.Rc,q+=2*R.A,$(Q,(at+=2*m.fa)-m.fa,Q,at,Ot,Ht,re,Yt,pt,Dt,Wt,ht,F,q-R.A,F,q,ke);return at+=m.fa,m.j+ce<m.o?(r(v.ec,v.fc,Q,at,ke),r(v.cc,v.dc,pt,Dt,ye),r(v.Mc,v.Nc,Wt,ht,ye),E--):1&ce||$(Q,at,null,null,pt,Dt,Wt,ht,pt,Dt,Wt,ht,F,q+R.A,null,null,ke),E}function Hi(m,v,E){var R=m.F,F=[m.J];if(R!=null){var q=m.U,$=v.ba.S,Q=$==xc||$==Hl;v=v.ba.f.RGBA;var at=[0],pt=m.ka;at[0]=m.T,m.Kb&&(pt==0?--at[0]:(--pt,F[0]-=m.width),m.j+m.ka+m.T==m.o&&(at[0]=m.o-m.j-pt));var Dt=v.eb;pt=v.fb+pt*v.A,m=mc(R,F[0],m.width,q,at,Dt,pt+(Q?0:3),v.A),t(E==at),m&&we($)&&ul(Dt,pt,Q,q,at,v.A)}return 0}function Vo(m){var v=m.ma,E=v.ba.S,R=11>E,F=E==yo||E==is||E==xc||E==Js||E==12||we(E);if(v.memory=null,v.Ib=null,v.Jb=null,v.Nd=null,!Eo(v.Oa,m,F?11:12))return 0;if(F&&we(E)&&jl(),m.da)alert("todo:use_scaling");else{if(R){if(v.Ib=Yo,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=ci,jl()}}else alert("todo:EmitYUV");F&&(v.Jb=Hi,R&&vn())}if(R&&!hl){for(m=0;256>m;++m)Di[m]=89858*(m-128)+Vl>>Os,rh[m]=-22014*(m-128)+Vl,Tu[m]=-45773*(m-128),kc[m]=113618*(m-128)+Vl>>Os;for(m=Wi;m<va;++m)v=76283*(m-16)+Vl>>Os,Ac[m-Wi]=Qi(v,255),cd[m-Wi]=Qi(v+8>>4,15);hl=1}return 1}function Ke(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 xs(m){m.ma.memory=null}function Zi(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=ss[v-1])>>4)*m+(8-(15&E)))?E:1;var E}function Gn(m,v,E){var R=tt(E),F=m[v+=255&R].g-8;return 0<F&&(wt(E,E.u+8),R=tt(E),v+=m[v].value,v+=R&(1<<F)-1),wt(E,E.u+m[v].g),m[v].value}function ui(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 Wo(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 pt=m.gc[F],Dt=$,Wt=v,ht=Q,Ot=at,Ht=(at=R,Q=E,pt.Ea);switch(t(Dt<Wt),t(Wt<=pt.nc),pt.hc){case 2:pe(ht,Ot,(Wt-Dt)*Ht,at,Q);break;case 0:var re=Dt,Yt=Wt,ne=at,ce=Q,ke=(en=pt).Ea;re==0&&(Fl(ht,Ot,null,null,1,ne,ce),Nn(ht,Ot+1,0,0,ke-1,ne,ce+1),Ot+=ke,ce+=ke,++re);for(var ye=1<<en.b,Je=ye-1,Ye=xe(ke,en.b),Ln=en.K,en=en.w+(re>>en.b)*Ye;re<Yt;){var Zn=Ln,zr=en,Bn=1;for(ll(ht,Ot,ne,ce-ke,1,ne,ce);Bn<ke;){var Ve=(Bn&~Je)+ye;Ve>ke&&(Ve=ke),(0,Xs[Zn[zr++]>>8&15])(ht,Ot+ +Bn,ne,ce+Bn-ke,Ve-Bn,ne,ce+Bn),Bn=Ve}Ot+=ke,ce+=ke,++re&Je||(en+=Ye)}Wt!=pt.nc&&r(at,Q-Ht,at,Q+(Wt-Dt-1)*Ht,Ht);break;case 1:for(Ht=ht,Yt=Ot,ke=(ht=pt.Ea)-(ce=ht&~(ne=(Ot=1<<pt.b)-1)),re=xe(ht,pt.b),ye=pt.K,pt=pt.w+(Dt>>pt.b)*re;Dt<Wt;){for(Je=ye,Ye=pt,Ln=new De,en=Yt+ce,Zn=Yt+ht;Yt<en;)ze(Je[Ye++],Ln),hc(Ln,Ht,Yt,Ot,at,Q),Yt+=Ot,Q+=Ot;Yt<Zn&&(ze(Je[Ye++],Ln),hc(Ln,Ht,Yt,ke,at,Q),Yt+=ke,Q+=ke),++Dt&ne||(pt+=re)}break;case 3:if(ht==at&&Ot==Q&&0<pt.b){for(Yt=at,ht=Ht=Q+(Wt-Dt)*Ht-(ce=(Wt-Dt)*xe(pt.Ea,pt.b)),Ot=at,ne=Q,re=[],ce=(ke=ce)-1;0<=ce;--ce)re[ce]=Ot[ne+ce];for(ce=ke-1;0<=ce;--ce)Yt[ht+ce]=re[ce];To(pt,Dt,Wt,at,Ht,at,Q)}else To(pt,Dt,Wt,ht,Ot,at,Q)}Q=R,at=E}at!=E&&r(R,E,Q,at,q)}function pi(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(Wo(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 pt=q.j-E;E=q.j,F[0]+=pt*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,pt=Dt.eb,Dt.A),ht=q;for(Dt=Dt.fb+m.Ma*Dt.A;0<ht--;){var Ot=$,Ht=Q,re=F,Yt=pt,ne=Dt;switch(R){case Hc:Ul(Ot,Ht,re,Yt,ne);break;case yo:Ha(Ot,Ht,re,Yt,ne);break;case vc:Ha(Ot,Ht,re,Yt,ne),ul(Yt,ne,0,re,1,0);break;case qc:cl(Ot,Ht,re,Yt,ne);break;case is:tn(Ot,Ht,re,Yt,ne,1);break;case $c:tn(Ot,Ht,re,Yt,ne,1),ul(Yt,ne,0,re,1,0);break;case xc:tn(Ot,Ht,re,Yt,ne,0);break;case Hl:tn(Ot,Ht,re,Yt,ne,0),ul(Yt,ne,1,re,1,0);break;case Js:qa(Ot,Ht,re,Yt,ne);break;case ql:qa(Ot,Ht,re,Yt,ne),rs(Yt,ne,re,1,0);break;case $a:Gs(Ot,Ht,re,Yt,ne);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 or(m,v,E,R,F,q){if(m.Z!=0){var $=m.qd,Q=m.rd;for(t(ea[m.Z]!=null);v<E;++v)ea[m.Z]($,Q,R,F,R,F,q),$=R,Q=F,F+=q;m.qd=$,m.rd=Q}}function Kn(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,pt=m.gc;t(m.ab==1),t(pt[0].hc==3),Ls(pt[0],R,v,Q,at,q,$),or(E,R,v,q,$,F)}m.C=m.Ma=v}function Xo(m,v,E,R,F,q,$){var Q=m.$/R,at=m.$%R,pt=m.m,Dt=m.s,Wt=E+m.$,ht=Wt;F=E+R*F;var Ot=E+R*q,Ht=280+Dt.ua,re=m.Pb?Q:16777216,Yt=0<Dt.ua?Dt.Wa:null,ne=Dt.wc,ce=Wt<Ot?Ti(Dt,at,Q):null;t(m.C<q),t(Ot<=F);var ke=!1;t:for(;;){for(;ke||Wt<Ot;){var ye=0;if(Q>=re){var Je=Wt-E;t((re=m).Pb),re.wd=re.m,re.xd=Je,0<re.s.ua&&Re(re.s.Wa,re.s.vb),re=Q+Ya}if(at&ne||(ce=Ti(Dt,at,Q)),t(ce!=null),ce.Qb&&(v[Wt]=ce.qb,ke=!0),!ke)if(At(pt),ce.jc){ye=pt,Je=v;var Ye=Wt,Ln=ce.pd[tt(ye)&Ua-1];t(ce.jc),256>Ln.g?(wt(ye,ye.u+Ln.g),Je[Ye]=Ln.value,ye=0):(wt(ye,ye.u+Ln.g-256),t(256<=Ln.value),ye=Ln.value),ye==0&&(ke=!0)}else ye=Gn(ce.G[0],ce.H[0],pt);if(pt.h)break;if(ke||256>ye){if(!ke)if(ce.nd)v[Wt]=(ce.qb|ye<<8)>>>0;else{if(At(pt),ke=Gn(ce.G[1],ce.H[1],pt),At(pt),Je=Gn(ce.G[2],ce.H[2],pt),Ye=Gn(ce.G[3],ce.H[3],pt),pt.h)break;v[Wt]=(Ye<<24|ke<<16|ye<<8|Je)>>>0}if(ke=!1,++Wt,++at>=R&&(at=0,++Q,$!=null&&Q<=q&&!(Q%16)&&$(m,Q),Yt!=null))for(;ht<Wt;)ye=v[ht++],Yt.X[(506832829*ye&4294967295)>>>Yt.Mb]=ye}else if(280>ye){if(ye=Xt(ye-256,pt),Je=Gn(ce.G[4],ce.H[4],pt),At(pt),Je=Ei(R,Je=Xt(Je,pt)),pt.h)break;if(Wt-E<Je||F-Wt<ye)break t;for(Ye=0;Ye<ye;++Ye)v[Wt+Ye]=v[Wt+Ye-Je];for(Wt+=ye,at+=ye;at>=R;)at-=R,++Q,$!=null&&Q<=q&&!(Q%16)&&$(m,Q);if(t(Wt<=F),at&ne&&(ce=Ti(Dt,at,Q)),Yt!=null)for(;ht<Wt;)ye=v[ht++],Yt.X[(506832829*ye&4294967295)>>>Yt.Mb]=ye}else{if(!(ye<Ht))break t;for(ke=ye-280,t(Yt!=null);ht<Wt;)ye=v[ht++],Yt.X[(506832829*ye&4294967295)>>>Yt.Mb]=ye;ye=Wt,t(!(ke>>>(Je=Yt).Xa)),v[ye]=Je.X[ke],ke=!0}ke||t(pt.h==yt(pt))}if(m.Pb&&pt.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(pt.h)break t;$?.(m,Q>q?q:Q),m.a=0,m.$=Wt-E}return 1}return m.a=3,0}function vs(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 Da(){var m=new Rn;return m==null?null:(m.a=0,m.xb=dl,Qt("Predictor","VP8LPredictors"),Qt("Predictor","VP8LPredictors_C"),Qt("PredictorAdd","VP8LPredictorsAdd"),Qt("PredictorAdd","VP8LPredictorsAdd_C"),pe=xn,hc=Qe,Ul=dr,Ha=mn,qa=an,Gs=dn,cl=Vn,rt.VP8LMapColor32b=Ws,rt.VP8LMapColor8b=no,m)}function Go(m,v,E,R,F){var q=1,$=[m],Q=[v],at=R.m,pt=R.s,Dt=null,Wt=0;t:for(;;){if(E)for(;q&&K(at,1);){var ht=$,Ot=Q,Ht=R,re=1,Yt=Ht.m,ne=Ht.gc[Ht.ab],ce=K(Yt,2);if(Ht.Oc&1<<ce)q=0;else{switch(Ht.Oc|=1<<ce,ne.hc=ce,ne.Ea=ht[0],ne.nc=Ot[0],ne.K=[null],++Ht.ab,t(4>=Ht.ab),ce){case 0:case 1:ne.b=K(Yt,3)+2,re=Go(xe(ne.Ea,ne.b),xe(ne.nc,ne.b),0,Ht,ne.K),ne.K=ne.K[0];break;case 3:var ke,ye=K(Yt,8)+1,Je=16<ye?0:4<ye?1:2<ye?2:3;if(ht[0]=xe(ne.Ea,Je),ne.b=Je,ke=re=Go(ye,1,0,Ht,ne.K)){var Ye,Ln=ye,en=ne,Zn=1<<(8>>en.b),zr=s(Zn);if(zr==null)ke=0;else{var Bn=en.K[0],Ve=en.w;for(zr[0]=en.K[0][0],Ye=1;Ye<1*Ln;++Ye)zr[Ye]=_e(Bn[Ve+Ye],zr[Ye-1]);for(;Ye<4*Zn;++Ye)zr[Ye]=0;en.K[0]=null,en.K[0]=zr,ke=1}}re=ke;break;case 2:break;default:t(0)}q=re}}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 ei,Mn,jn,kr=R,ji=$,zi=Q,Or=Wt,ni=E,Bi=kr.m,ri=kr.s,Un=[null],wn=1,_r=0,nr=as[Or];n:for(;;){if(ni&&K(Bi,1)){var w=K(Bi,3)+2,k=xe(ji,w),_=xe(zi,w),N=k*_;if(!Go(k,_,0,kr,Un))break n;for(Un=Un[0],ri.xc=w,ei=0;ei<N;++ei){var j=Un[ei]>>8&65535;Un[ei]=j,j>=wn&&(wn=j+1)}}if(Bi.h)break n;for(Mn=0;5>Mn;++Mn){var G=Rs[Mn];!Mn&&0<Or&&(G+=1<<Or),_r<G&&(_r=G)}var nt=l(wn*nr,X),z=wn,Z=l(z,Lt);if(Z==null)var ut=null;else t(65536>=z),ut=Z;var ot=s(_r);if(ut==null||ot==null||nt==null){kr.a=1;break n}var it=nt;for(ei=jn=0;ei<wn;++ei){var I=ut[ei],Ct=I.G,It=I.H,St=0,Et=1,vt=0;for(Mn=0;5>Mn;++Mn){G=Rs[Mn],Ct[Mn]=it,It[Mn]=jn,!Mn&&0<Or&&(G+=1<<Or);i:{var Bt,Vt=G,me=kr,se=ot,Ee=it,Ze=jn,En=0,fe=me.m,Xe=K(fe,1);if(i(se,0,0,Vt),Xe){var Se=K(fe,1)+1,Tn=K(fe,1),$t=K(fe,Tn==0?1:8);se[$t]=1,Se==2&&(se[$t=K(fe,8)]=1);var Le=1}else{var Be=s(19),Fe=K(fe,4)+4;if(19<Fe){me.a=3;var Ae=0;break i}for(Bt=0;Bt<Fe;++Bt)Be[wc[Bt]]=K(fe,3);var _n=void 0,qe=void 0,rr=me,lr=Be,xr=Vt,ii=se,Wr=0,mr=rr.m,Mr=8,vi=l(128,X);r:for(;ct(vi,0,7,lr,19);){if(K(mr,1)){var xo=2+2*K(mr,3);if((_n=2+K(mr,xo))>xr)break r}else _n=xr;for(qe=0;qe<xr&&_n--;){At(mr);var Kc=vi[0+(127&tt(mr))];wt(mr,mr.u+Kc.g);var na=Kc.value;if(16>na)ii[qe++]=na,na!=0&&(Mr=na);else{var Af=na==16,Nu=na-16,Xl=$l[Nu],Jc=K(mr,bo[Nu])+Xl;if(qe+Jc>xr)break r;for(var _u=Af?Mr:0;0<Jc--;)ii[qe++]=_u}}Wr=1;break r}Wr||(rr.a=3),Le=Wr}(Le=Le&&!fe.h)&&(En=ct(Ee,Ze,8,se,Vt)),Le&&En!=0?Ae=En:(me.a=3,Ae=0)}if(Ae==0)break n;if(Et&&Yc[Mn]==1&&(Et=it[jn].g==0),St+=it[jn].g,jn+=Ae,3>=Mn){var ml,Zc=ot[0];for(ml=1;ml<G;++ml)ot[ml]>Zc&&(Zc=ot[ml]);vt+=Zc}}if(I.nd=Et,I.Qb=0,Et&&(I.qb=(Ct[3][It[3]+0].value<<24|Ct[1][It[1]+0].value<<16|Ct[2][It[2]+0].value)>>>0,St==0&&256>Ct[0][It[0]+0].value&&(I.Qb=1,I.qb+=Ct[0][It[0]+0].value<<8)),I.jc=!I.Qb&&6>vt,I.jc){var Qc,Xr=I;for(Qc=0;Qc<Ua;++Qc){var Bo=Qc,Br=Xr.pd[Bo],Lo=Xr.G[0][Xr.H[0]+Bo];256<=Lo.value?(Br.g=Lo.g+256,Br.value=Lo.value):(Br.g=0,Br.value=0,Bo>>=ui(Lo,8,Br),Bo>>=ui(Xr.G[1][Xr.H[1]+Bo],16,Br),Bo>>=ui(Xr.G[2][Xr.H[2]+Bo],0,Br),ui(Xr.G[3][Xr.H[3]+Bo],24,Br))}}}ri.vc=Un,ri.Wb=wn,ri.Ya=ut,ri.yc=nt,Oe=1;break e}Oe=0}if(!(q=Oe)){R.a=3;break t}if(0<Wt){if(pt.ua=1<<Wt,!ft(pt.Wa,Wt)){R.a=1,q=0;break t}}else pt.ua=0;var Ps=R,oo=$,Pr=Q,Fr=Ps.s,Sa=Fr.xc;if(Ps.c=oo,Ps.i=Pr,Fr.md=xe(oo,Sa),Fr.wc=Sa==0?-1:(1<<Sa)-1,E){R.xb=ta;break t}if((Dt=s($*Q))==null){R.a=1,q=0;break t}q=(q=Xo(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||vs(pt)):vs(pt),q}function Ao(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,pt=at*$,Dt=Q.ca,Wt=Q.tb+at*E,ht=m.Ta,Ot=m.Ua;Wo(m,$,F,q),zo(ht,Ot,Dt,Wt,pt),or(Q,E,E+$,Dt,Wt,at),R-=$,F+=$*m.c,E+=$}t(E==v),m.C=m.Ma=v}function aa(){this.ub=this.yd=this.td=this.Rb=0}function ws(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function nl(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function Ko(){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 fi(){this.jb=s(3),this.Wc=c([4,8],Ko),this.Xc=c([4,17],Ko)}function rl(){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 Yr(){this.Na=this.la=0}function Ss(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Dl(){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 oc(){this.uc=this.M=this.Nb=0,this.wa=Array(new Pi),this.Y=0,this.ya=Array(new Dl),this.aa=0,this.l=new mi}function jc(){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 aa,this.Kc=new ws,this.ed=new rl,this.Qa=new nl,this.Ic=this.$c=this.Aa=0,this.D=new oc,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,Ss),this.Pa=new fi,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new jc),this.Hd=0,this.rb=Array(new Yr),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 Dl),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 Qi(m,v){return 0>m?0:m>v?v:m}function mi(){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=uo)),m}function Fn(m,v,E){return m.a==0&&(m.a=v,m.sc=E,m.cb=0),0}function Oo(m,v,E){return 3<=E&&m[v+0]==157&&m[v+1]==1&&m[v+2]==42}function hr(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(!Oo(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,pt=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)pt.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(pt=0;4>pt;++pt)Rt(q)&&(Q.vd[pt]=lt(q,6));for(pt=0;4>pt;++pt)Rt(q)&&(Q.od[pt]=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*(pt=m.Xb))E=7;else{for(at+=3*pt,Q-=3*pt,Dt=0;Dt<pt;++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[+pt],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,pt=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 ht=Dt.Zb[Wt];Dt.Fb||(ht+=E)}else{if(0<Wt){m.pb[Wt]=m.pb[0];continue}ht=E}var Ot=m.pb[Wt];Ot.Sc[0]=ls[Qi(ht+F,127)],Ot.Sc[1]=cs[Qi(ht+0,127)],Ot.Eb[0]=2*ls[Qi(ht+R,127)],Ot.Eb[1]=101581*cs[Qi(ht+Q,127)]>>16,8>Ot.Eb[1]&&(Ot.Eb[1]=8),Ot.Qc[0]=ls[Qi(ht+pt,117)],Ot.Qc[1]=cs[Qi(ht+at,127)],Ot.lc=ht+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)pt=Zt(q,Rr[E][F][R][Q])?st(q,8):ld[E][F][R][Q],$.Wc[E][F].Yb[R][Q]=pt;for(F=0;17>F;++F)$.Xc[E][F]=$.Wc[E][er[F]]}return m.kc=Rt(q),m.kc&&(m.Bd=st(q,8)),m.cb=1}function uo(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 pt=m,Dt=0;if(Zt(pt,(ht=Q)[(Wt=E)+3]))if(Zt(pt,ht[Wt+6])){for(Q=0,Wt=2*(Dt=Zt(pt,ht[Wt+8]))+(ht=Zt(pt,ht[Wt+9+Dt])),Dt=0,ht=Vc[Wt];ht[Q];++Q)Dt+=Dt+Zt(pt,ht[Q]);Dt+=3+(8<<Wt)}else Zt(pt,ht[Wt+7])?(Dt=7+2*Zt(pt,165),Dt+=Zt(pt,145)):Dt=5+Zt(pt,159);else Dt=Zt(pt,ht[Wt+4])?3+Zt(pt,ht[Wt+5]):2;Q=at[2]}else Dt=1,Q=at[1];at=$+Zs[F],0>(pt=m).b&&qt(pt);var Wt,ht=pt.b,Ot=(Wt=pt.Ca>>1)-(pt.I>>ht)>>31;--pt.b,pt.Ca+=Ot,pt.Ca|=1,pt.I-=(Wt+1&Ot)<<ht,q[at]=((Dt^Ot)-Ot)*R[(0<F)+0]}return 16}function to(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 Ir(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 Pn(m,v,E,R,F,q){Ir(m,v,0,E,R+F),Ir(m,v,1,E,R+q),Ir(m,v,2,E,R-q),Ir(m,v,3,E,R-F)}function jr(m){return(20091*m>>16)+m}function Ra(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],pt=(35468*m[v+4]>>16)-jr(m[v+12]),Dt=jr(m[v+4])+(35468*m[v+12]>>16);$[q+0]=Q+Dt,$[q+1]=at+pt,$[q+2]=at-pt,$[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],pt=(35468*$[q+4]>>16)-jr($[q+12]),Ir(E,R,0,0,Q+(Dt=jr($[q+4])+(35468*$[q+12]>>16))),Ir(E,R,1,0,at+pt),Ir(E,R,2,0,at-pt),Ir(E,R,3,0,Q-Dt),q++,R+=32}function la(m,v,E,R){var F=m[v+0]+4,q=35468*m[v+4]>>16,$=jr(m[v+4]),Q=35468*m[v+1]>>16;Pn(E,R,0,F+$,m=jr(m[v+1]),Q),Pn(E,R,1,F+q,m,Q),Pn(E,R,2,F-q,m,Q),Pn(E,R,3,F-$,m,Q)}function te(m,v,E,R,F){Ra(m,v,E,R),F&&Ra(m,v+16,E,R+4)}function Mo(m,v,E,R){ma(m,v+0,E,R,1),ma(m,v+32,E,R+128,1)}function ca(m,v,E,R){var F;for(m=m[v+0]+4,F=0;4>F;++F)for(v=0;4>v;++v)Ir(E,R,v,F,m)}function Bc(m,v,E,R){m[v+0]&&br(m,v+0,E,R),m[v+16]&&br(m,v+16,E,R+4),m[v+32]&&br(m,v+32,E,R+128),m[v+48]&&br(m,v+48,E,R+128+4)}function fo(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],pt=m[v+0+F]-m[v+12+F];q[0+F]=$+Q,q[8+F]=$-Q,q[4+F]=pt+at,q[12+F]=pt-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],pt=m-q[3+4*F],E[R+0]=$+Q>>3,E[R+16]=pt+at>>3,E[R+32]=$-Q>>3,E[R+48]=pt-at>>3,R+=64}function il(m,v,E){var R,F=v-32,q=ro,$=255-m[F-1];for(R=0;R<E;++R){var Q,at=q,pt=$+m[v-1];for(Q=0;Q<E;++Q)m[v+Q]=at[pt+m[F+Q]];v+=32}}function Au(m,v){il(m,v,4)}function Mu(m,v){il(m,v,8)}function sc(m,v){il(m,v,16)}function ac(m,v){var E;for(E=0;16>E;++E)r(m,v+32*E,m,v-32,16)}function Rl(m,v){var E;for(E=16;0<E;--E)i(m,v,m[v-1],16),v+=32}function eo(m,v,E){var R;for(R=0;16>R;++R)i(v,E+32*R,m,16)}function Jo(m,v){var E,R=16;for(E=0;16>E;++E)R+=m[v-1+32*E]+m[v+E-32];eo(R>>5,m,v)}function ks(m,v){var E,R=8;for(E=0;16>E;++E)R+=m[v-1+32*E];eo(R>>4,m,v)}function ol(m,v){var E,R=8;for(E=0;16>E;++E)R+=m[v+E-32];eo(R>>4,m,v)}function Oa(m,v){eo(128,m,v)}function Sn(m,v,E){return m+2*v+E+2>>2}function lc(m,v){var E,R=v-32;for(R=new Uint8Array([Sn(m[R-1],m[R+0],m[R+1]),Sn(m[R+0],m[R+1],m[R+2]),Sn(m[R+1],m[R+2],m[R+3]),Sn(m[R+2],m[R+3],m[R+4])]),E=0;4>E;++E)r(m,v+32*E,R,0,R.length)}function vr(m,v){var E=m[v-1],R=m[v-1+32],F=m[v-1+64],q=m[v-1+96];Me(m,v+0,16843009*Sn(m[v-1-32],E,R)),Me(m,v+32,16843009*Sn(E,R,F)),Me(m,v+64,16843009*Sn(R,F,q)),Me(m,v+96,16843009*Sn(F,q,q))}function cc(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 ho(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],pt=m[v+3-32];m[v+0+96]=Sn(R,F,m[v-1+96]),m[v+1+96]=m[v+0+64]=Sn(E,R,F),m[v+2+96]=m[v+1+64]=m[v+0+32]=Sn(q,E,R),m[v+3+96]=m[v+2+64]=m[v+1+32]=m[v+0+0]=Sn($,q,E),m[v+3+64]=m[v+2+32]=m[v+1+0]=Sn(Q,$,q),m[v+3+32]=m[v+2+0]=Sn(at,Q,$),m[v+3+0]=Sn(pt,at,Q)}function _i(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]=Sn(m[v+0-32],E,R),m[v+1+0]=m[v+0+32]=Sn(E,R,F),m[v+2+0]=m[v+1+32]=m[v+0+64]=Sn(R,F,q),m[v+3+0]=m[v+2+32]=m[v+1+64]=m[v+0+96]=Sn(F,q,$),m[v+3+32]=m[v+2+64]=m[v+1+96]=Sn(q,$,Q),m[v+3+64]=m[v+2+96]=Sn($,Q,at),m[v+3+96]=Sn(Q,at,at)}function sl(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],pt=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+pt+1>>1,m[v+0+96]=Sn(F,R,E),m[v+0+64]=Sn(R,E,q),m[v+0+32]=m[v+1+96]=Sn(E,q,$),m[v+1+32]=m[v+2+96]=Sn(q,$,Q),m[v+2+32]=m[v+3+96]=Sn($,Q,at),m[v+3+32]=Sn(Q,at,pt)}function As(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],pt=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]=Sn(E,R,F),m[v+1+32]=m[v+0+96]=Sn(R,F,q),m[v+2+32]=m[v+1+96]=Sn(F,q,$),m[v+3+32]=m[v+2+96]=Sn(q,$,Q),m[v+3+64]=Sn($,Q,at),m[v+3+96]=Sn(Q,at,pt)}function qi(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]=Sn(E,R,F),m[v+3+0]=m[v+1+32]=Sn(R,F,q),m[v+3+32]=m[v+1+64]=Sn(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 ua(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],pt=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]=Sn(Q,at,pt),m[v+2+0]=Sn($,Q,at),m[v+1+0]=m[v+3+32]=Sn(E,$,Q),m[v+1+32]=m[v+3+64]=Sn(R,E,$),m[v+1+64]=m[v+3+96]=Sn(F,R,E),m[v+1+96]=Sn(q,F,R)}function Zo(m,v){var E;for(E=0;8>E;++E)r(m,v+32*E,m,v-32,8)}function Ol(m,v){var E;for(E=0;8>E;++E)i(m,v,m[v-1],8),v+=32}function po(m,v,E){var R;for(R=0;8>R;++R)i(v,E+32*R,m,8)}function Pa(m,v){var E,R=8;for(E=0;8>E;++E)R+=m[v+E-32]+m[v-1+32*E];po(R>>4,m,v)}function Ia(m,v){var E,R=4;for(E=0;8>E;++E)R+=m[v+E-32];po(R>>3,m,v)}function gi(m,v){var E,R=4;for(E=0;8>E;++E)R+=m[v-1+32*E];po(R>>3,m,v)}function Po(m,v){po(128,m,v)}function Co(m,v,E){var R=m[v-E],F=m[v+0],q=3*(F-R)+ya[1020+m[v-2*E]-m[v+E]],$=bc[112+(q+4>>3)];m[v-E]=ro[255+R+bc[112+(q+3>>3)]],m[v+0]=ro[255+F-$]}function Ms(m,v,E,R){var F=m[v+0],q=m[v+E];return Vi[255+m[v-2*E]-m[v-E]]>R||Vi[255+q-F]>R}function ja(m,v,E,R){return 4*Vi[255+m[v-E]-m[v+0]]+Vi[255+m[v-2*E]-m[v+E]]<=R}function fa(m,v,E,R,F){var q=m[v-3*E],$=m[v-2*E],Q=m[v-E],at=m[v+0],pt=m[v+E],Dt=m[v+2*E],Wt=m[v+3*E];return 4*Vi[255+Q-at]+Vi[255+$-pt]>R?0:Vi[255+m[v-4*E]-q]<=F&&Vi[255+q-$]<=F&&Vi[255+$-Q]<=F&&Vi[255+Wt-Dt]<=F&&Vi[255+Dt-pt]<=F&&Vi[255+pt-at]<=F}function Cs(m,v,E,R){var F=2*R+1;for(R=0;16>R;++R)ja(m,v+R,E,F)&&Co(m,v+R,E)}function Es(m,v,E,R){var F=2*R+1;for(R=0;16>R;++R)ja(m,v+R*E,1,F)&&Co(m,v+R*E,1)}function da(m,v,E,R){var F;for(F=3;0<F;--F)Cs(m,v+=4*E,E,R)}function al(m,v,E,R){var F;for(F=3;0<F;--F)Es(m,v+=4,E,R)}function Qo(m,v,E,R,F,q,$,Q){for(q=2*q+1;0<F--;){if(fa(m,v,E,q,$))if(Ms(m,v,E,Q))Co(m,v,E);else{var at=m,pt=v,Dt=E,Wt=at[pt-2*Dt],ht=at[pt-Dt],Ot=at[pt+0],Ht=at[pt+Dt],re=at[pt+2*Dt],Yt=27*(ce=ya[1020+3*(Ot-ht)+ya[1020+Wt-Ht]])+63>>7,ne=18*ce+63>>7,ce=9*ce+63>>7;at[pt-3*Dt]=ro[255+at[pt-3*Dt]+ce],at[pt-2*Dt]=ro[255+Wt+ne],at[pt-Dt]=ro[255+ht+Yt],at[pt+0]=ro[255+Ot-Yt],at[pt+Dt]=ro[255+Ht-ne],at[pt+2*Dt]=ro[255+re-ce]}v+=R}}function Ts(m,v,E,R,F,q,$,Q){for(q=2*q+1;0<F--;){if(fa(m,v,E,q,$))if(Ms(m,v,E,Q))Co(m,v,E);else{var at=m,pt=v,Dt=E,Wt=at[pt-Dt],ht=at[pt+0],Ot=at[pt+Dt],Ht=bc[112+(4+(re=3*(ht-Wt))>>3)],re=bc[112+(re+3>>3)],Yt=Ht+1>>1;at[pt-2*Dt]=ro[255+at[pt-2*Dt]+Yt],at[pt-Dt]=ro[255+Wt+re],at[pt+0]=ro[255+ht-Ht],at[pt+Dt]=ro[255+Ot-Yt]}v+=R}}function Pl(m,v,E,R,F,q){Qo(m,v,E,1,16,R,F,q)}function Ns(m,v,E,R,F,q){Qo(m,v,1,E,16,R,F,q)}function Il(m,v,E,R,F,q){var $;for($=3;0<$;--$)Ts(m,v+=4*E,E,1,16,R,F,q)}function A(m,v,E,R,F,q){var $;for($=3;0<$;--$)Ts(m,v+=4,1,E,16,R,F,q)}function B(m,v,E,R,F,q,$,Q){Qo(m,v,F,1,8,q,$,Q),Qo(E,R,F,1,8,q,$,Q)}function mt(m,v,E,R,F,q,$,Q){Qo(m,v,1,F,8,q,$,Q),Qo(E,R,1,F,8,q,$,Q)}function Nt(m,v,E,R,F,q,$,Q){Ts(m,v+4*F,F,1,8,q,$,Q),Ts(E,R+4*F,F,1,8,q,$,Q)}function Ft(m,v,E,R,F,q,$,Q){Ts(m,v+4,1,F,8,q,$,Q),Ts(E,R+4,1,F,8,q,$,Q)}function ie(){this.ba=new He,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Wn,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function ve(){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 nn(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function ln(){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 X}function Rn(){this.xb=this.a=0,this.l=new mi,this.ca=new He,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new Y,this.Pb=0,this.wd=new Y,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new ln,this.ab=0,this.gc=l(4,nn),this.Oc=0}function zn(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new mi,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function sr(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 Li(m,v,E,R,F,q,$){var Q;if(m==null)sr(null,null,E,R,F,q,$);else for(Q=0;Q<$;++Q)F[q+Q]=m[v+Q]+E[R+Q]&255}function Zr(m,v,E,R,F,q,$){if(m==null)sr(null,null,E,R,F,q,$);else{var Q,at=m[v+0],pt=at,Dt=at;for(Q=0;Q<$;++Q)pt=Dt+(at=m[v+Q])-pt,Dt=E[R+Q]+(-256&pt?0>pt?0:255:pt)&255,pt=at,F[q+Q]=Dt}}function Tr(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 zn,($=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,pt=m.qc,Dt=m.mb,Wt=m.nb,ht=at+1,Ot=pt-1,Ht=$.l;if(t(Q!=null&&Dt!=null&&v!=null),ea[0]=null,ea[1]=sr,ea[2]=Li,ea[3]=Zr,$.ca=Dt,$.tb=Wt,$.c=v.width,$.i=v.height,t(0<$.c&&0<$.i),1>=pt)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=Ke,Ht.ac=Vo,Ht.bc=xs,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=Da();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,ht,Ot),!Go($.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=Ao(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(ht=m.rc,Ot=m.Vc,Ht=m.Fa,at=m.P+1+E*v,pt=m.mb,Dt=m.nb+E*v,t(at<=m.P+m.qc),Q.Z!=0)for(t(ea[Q.Z]!=null),$=0;$<R;++$)ea[Q.Z](ht,Ot,Ht,at,pt,Dt,v),ht=pt,Ot=Dt,Dt+=v,at+=v;else for($=0;$<R;++$)r(pt,Dt,Ht,at,v),ht=pt,Ot=Dt,Dt+=v,at+=v;m.rc=ht,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||vn(),Q.ic){Q=$.V,ht=$.Ba,Ot=$.c;var re=$.i,Yt=(Ht=1,at=$.$/Ot,pt=$.$%Ot,Dt=$.m,Wt=$.s,$.$),ne=Ot*re,ce=Ot*v,ke=Wt.wc,ye=Yt<ce?Ti(Wt,pt,at):null;t(Yt<=ne),t(v<=re),t(Ar(Wt));e:for(;;){for(;!Dt.h&&Yt<ce;){if(pt&ke||(ye=Ti(Wt,pt,at)),t(ye!=null),At(Dt),256>(re=Gn(ye.G[0],ye.H[0],Dt)))Q[ht+Yt]=re,++Yt,++pt>=Ot&&(pt=0,++at<=v&&!(at%16)&&Kn($,at));else{if(!(280>re)){Ht=0;break e}re=Xt(re-256,Dt);var Je,Ye=Gn(ye.G[4],ye.H[4],Dt);if(At(Dt),!(Yt>=(Ye=Ei(Ot,Ye=Xt(Ye,Dt)))&&ne-Yt>=re)){Ht=0;break e}for(Je=0;Je<re;++Je)Q[ht+Yt+Je]=Q[ht+Yt+Je-Ye];for(Yt+=re,pt+=re;pt>=Ot;)pt-=Ot,++at<=v&&!(at%16)&&Kn($,at);Yt<ce&&pt&ke&&(ye=Ti(Wt,pt,at))}t(Dt.h==yt(Dt))}Kn($,at>v?v:at);break e}!Ht||Dt.h&&Yt<ne?(Ht=0,$.a=Dt.h?5:3):$.$=Yt,v=Ht}else v=Xo($,$.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),pt=m,Dt=v+(E?0:3);for($=0;$<R;++$){var Wt=pt[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 Qr(m,v,E,R,F){for(;0<R--;){var q;for(q=0;q<E;++q){var $=m[v+2*q+0],Q=15&(pt=m[v+2*q+1]),at=4369*Q,pt=(240&pt|pt>>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&pt|Q}v+=F}}function di(m,v,E,R,F,q,$,Q){var at,pt,Dt=255;for(pt=0;pt<F;++pt){for(at=0;at<R;++at){var Wt=m[v+at];q[$+4*at]=Wt,Dt&=Wt}v+=E,$+=Q}return Dt!=255}function An(m,v,E,R,F){var q;for(q=0;q<F;++q)E[R+q]=m[v+q]>>8}function vn(){ul=ue,rs=Qr,mc=di,zo=An}function za(m,v,E){rt[m]=function(R,F,q,$,Q,at,pt,Dt,Wt,ht,Ot,Ht,re,Yt,ne,ce,ke){var ye,Je=ke-1>>1,Ye=Q[at+0]|pt[Dt+0]<<16,Ln=Wt[ht+0]|Ot[Ht+0]<<16;t(R!=null);var en=3*Ye+Ln+131074>>2;for(v(R[F+0],255&en,en>>16,re,Yt),q!=null&&(en=3*Ln+Ye+131074>>2,v(q[$+0],255&en,en>>16,ne,ce)),ye=1;ye<=Je;++ye){var Zn=Q[at+ye]|pt[Dt+ye]<<16,zr=Wt[ht+ye]|Ot[Ht+ye]<<16,Bn=Ye+Zn+Ln+zr+524296,Ve=Bn+2*(Zn+Ln)>>3;en=Ve+Ye>>1,Ye=(Bn=Bn+2*(Ye+zr)>>3)+Zn>>1,v(R[F+2*ye-1],255&en,en>>16,re,Yt+(2*ye-1)*E),v(R[F+2*ye-0],255&Ye,Ye>>16,re,Yt+(2*ye-0)*E),q!=null&&(en=Bn+Ln>>1,Ye=Ve+zr>>1,v(q[$+2*ye-1],255&en,en>>16,ne,ce+(2*ye-1)*E),v(q[$+2*ye+0],255&Ye,Ye>>16,ne,ce+(2*ye+0)*E)),Ye=Zn,Ln=zr}1&ke||(en=3*Ye+Ln+131074>>2,v(R[F+ke-1],255&en,en>>16,re,Yt+(ke-1)*E),q!=null&&(en=3*Ln+Ye+131074>>2,v(q[$+ke-1],255&en,en>>16,ne,ce+(ke-1)*E)))}}function jl(){Ii[Hc]=ba,Ii[yo]=Sc,Ii[qc]=kf,Ii[is]=Wc,Ii[xc]=Va,Ii[Js]=xa,Ii[$a]=us,Ii[vc]=Sc,Ii[$c]=Wc,Ii[Hl]=Va,Ii[ql]=xa}function uc(m){return m&-16384?0>m?0:255:m>>Xc}function pr(m,v){return uc((19077*m>>8)+(26149*v>>8)-14234)}function mo(m,v,E){return uc((19077*m>>8)-(6419*v>>8)-(13320*E>>8)+8708)}function zl(m,v){return uc((19077*m>>8)+(33050*v>>8)-17685)}function _s(m,v,E,R,F){R[F+0]=pr(m,E),R[F+1]=mo(m,v,E),R[F+2]=zl(m,v)}function $i(m,v,E,R,F){R[F+0]=zl(m,v),R[F+1]=mo(m,v,E),R[F+2]=pr(m,E)}function ha(m,v,E,R,F){var q=mo(m,v,E);v=q<<3&224|zl(m,v)>>3,R[F+0]=248&pr(m,E)|q>>5,R[F+1]=v}function Ba(m,v,E,R,F){var q=240&zl(m,v)|15;R[F+0]=240&pr(m,E)|mo(m,v,E)>>4,R[F+1]=q}function Fa(m,v,E,R,F){R[F+0]=255,_s(m,v,E,R,F+1)}function Ys(m,v,E,R,F){$i(m,v,E,R,F),R[F+3]=255}function go(m,v,E,R,F){_s(m,v,E,R,F),R[F+3]=255}function pa(m,v,E){rt[m]=function(R,F,q,$,Q,at,pt,Dt,Wt){for(var ht=Dt+(-2&Wt)*E;Dt!=ht;)v(R[F+0],q[$+0],Q[at+0],pt,Dt),v(R[F+1],q[$+0],Q[at+0],pt,Dt+E),F+=2,++$,++at,Dt+=2*E;1&Wt&&v(R[F+0],q[$+0],Q[at+0],pt,Dt)}}function Bl(m,v,E){return E==0?m==0?v==0?6:5:v==0?4:0:E}function fc(m,v,E,R,F){switch(m>>>30){case 3:ma(v,E,R,F,0);break;case 2:yi(v,E,R,F);break;case 1:br(v,E,R,F)}}function Io(m,v){var E,R,F=v.M,q=v.Nb,$=m.oc,Q=m.pc+40,at=m.oc,pt=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[pt+32*E-1]=129,Dt[Wt+32*E-1]=129;for(0<F?$[Q-1-32]=at[pt-1-32]=Dt[Wt-1-32]=129:(i($,Q-32-1,127,21),i(at,pt-32-1,127,9),i(Dt,Wt-32-1,127,9)),R=0;R<m.za;++R){var ht=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,pt+32*E-4,at,pt+32*E+4,4),r(Dt,Wt+32*E-4,Dt,Wt+32*E+4,4)}var Ot=m.Gd,Ht=m.Hd+R,re=ht.ad,Yt=ht.Hc;if(0<F&&(r($,Q-32,Ot[Ht].y,0,16),r(at,pt-32,Ot[Ht].f,0,8),r(Dt,Wt-32,Ot[Ht].ea,0,8)),ht.Za){var ne=$,ce=Q-32+16;for(0<F&&(R>=m.za-1?i(ne,ce,Ot[Ht].y[15],4):r(ne,ce,Ot[Ht+1].y,0,4)),E=0;4>E;E++)ne[ce+128+E]=ne[ce+256+E]=ne[ce+384+E]=ne[ce+0+E];for(E=0;16>E;++E,Yt<<=2)ne=$,ce=Q+Vr[E],ti[ht.Ob[E]](ne,ce),fc(Yt,re,16*+E,ne,ce)}else if(ne=Bl(R,F,ht.Ob[0]),_o[ne]($,Q),Yt!=0)for(E=0;16>E;++E,Yt<<=2)fc(Yt,re,16*+E,$,Q+Vr[E]);for(E=ht.Gc,ne=Bl(R,F,ht.Dd),Qs[ne](at,pt),Qs[ne](Dt,Wt),Yt=re,ne=at,ce=pt,255&(ht=0|E)&&(170&ht?No(Yt,256,ne,ce):ar(Yt,256,ne,ce)),ht=Dt,Yt=Wt,255&(E>>=8)&&(170&E?No(re,320,ht,Yt):ar(re,320,ht,Yt)),F<m.Ub-1&&(r(Ot[Ht].y,0,$,Q+480,16),r(Ot[Ht].f,0,at,pt+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,re=m.qa,ht=m.ra+8*R+E,Yt=m.Ha,ne=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(re,ht+E*m.B,at,pt+32*E,8),r(Yt,ne+E*m.B,Dt,Wt+32*E,8)}}function jo(m,v,E,R,F,q,$,Q,at){var pt=[0],Dt=[0],Wt=0,ht=at!=null?at.kd:0,Ot=at??new ve;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,re=E,Yt=Ot.gb;if(t(m!=null),t(re!=null),t(Yt!=null),Yt[0]=0,12<=re[0]&&!n(m,Ht[0],"RIFF")){if(n(m,Ht[0]+8,"WEBP")){Yt=3;break t}var ne=Ue(m,Ht[0]+4);if(12>ne||4294967286<ne){Yt=3;break t}if(ht&&ne>re[0]-8){Yt=7;break t}Yt[0]=ne,Ht[0]+=12,re[0]-=12}Yt=0}if(Yt!=0)return Yt;for(ne=0<Ot.gb[0],E=E[0];;){t:{var ce=m;re=v,Yt=E;var ke=pt,ye=Dt,Je=Ht=[0];if((en=Wt=[Wt])[0]=0,8>Yt[0])Yt=7;else{if(!n(ce,re[0],"VP8X")){if(Ue(ce,re[0]+4)!=10){Yt=3;break t}if(18>Yt[0]){Yt=7;break t}var Ye=Ue(ce,re[0]+8),Ln=1+Ie(ce,re[0]+12);if(2147483648<=Ln*(ce=1+Ie(ce,re[0]+15))){Yt=3;break t}Je!=null&&(Je[0]=Ye),ke!=null&&(ke[0]=Ln),ye!=null&&(ye[0]=ce),re[0]+=18,Yt[0]-=18,en[0]=1}Yt=0}}if(Wt=Wt[0],Ht=Ht[0],Yt!=0)return Yt;if(re=!!(2&Ht),!ne&&Wt)return 3;if(q!=null&&(q[0]=!!(16&Ht)),$!=null&&($[0]=re),Q!=null&&(Q[0]=0),$=pt[0],Ht=Dt[0],Wt&&re&&at==null){Yt=0;break}if(4>E){Yt=7;break}if(ne&&Wt||!ne&&!Wt&&!n(m,v[0],"ALPH")){E=[E],Ot.na=[Ot.na],Ot.P=[Ot.P],Ot.Sa=[Ot.Sa];t:{Ye=m,Yt=v,ne=E;var en=Ot.gb;ke=Ot.na,ye=Ot.P,Je=Ot.Sa,Ln=22,t(Ye!=null),t(ne!=null),ce=Yt[0];var Zn=ne[0];for(t(ke!=null),t(Je!=null),ke[0]=null,ye[0]=null,Je[0]=0;;){if(Yt[0]=ce,ne[0]=Zn,8>Zn){Yt=7;break t}var zr=Ue(Ye,ce+4);if(4294967286<zr){Yt=3;break t}var Bn=8+zr+1&-2;if(Ln+=Bn,0<en&&Ln>en){Yt=3;break t}if(!n(Ye,ce,"VP8 ")||!n(Ye,ce,"VP8L")){Yt=0;break t}if(Zn[0]<Bn){Yt=7;break t}n(Ye,ce,"ALPH")||(ke[0]=Ye,ye[0]=ce+8,Je[0]=zr),ce+=Bn,Zn-=Bn}}if(E=E[0],Ot.na=Ot.na[0],Ot.P=Ot.P[0],Ot.Sa=Ot.Sa[0],Yt!=0)break}E=[E],Ot.Ja=[Ot.Ja],Ot.xa=[Ot.xa];t:if(en=m,Yt=v,ne=E,ke=Ot.gb[0],ye=Ot.Ja,Je=Ot.xa,Ye=Yt[0],ce=!n(en,Ye,"VP8 "),Ln=!n(en,Ye,"VP8L"),t(en!=null),t(ne!=null),t(ye!=null),t(Je!=null),8>ne[0])Yt=7;else{if(ce||Ln){if(en=Ue(en,Ye+4),12<=ke&&en>ke-12){Yt=3;break t}if(ht&&en>ne[0]-8){Yt=7;break t}ye[0]=en,Yt[0]+=8,ne[0]-=8,Je[0]=Ln}else Je[0]=5<=ne[0]&&en[Ye+0]==47&&!(en[Ye+4]>>5),ye[0]=ne[0];Yt=0}if(E=E[0],Ot.Ja=Ot.Ja[0],Ot.xa=Ot.xa[0],v=v[0],Yt!=0)break;if(4294967286<Ot.Ja)return 3;if(Q==null||re||(Q[0]=Ot.xa?2:1),$=[$],Ht=[Ht],Ot.xa){if(5>E){Yt=7;break}Q=$,ht=Ht,re=q,m==null||5>E?m=0:5<=E&&m[v+0]==47&&!(m[v+4]>>5)?(ne=[0],en=[0],ke=[0],zt(ye=new Y,m,v,E),Zi(ye,ne,en,ke)?(Q!=null&&(Q[0]=ne[0]),ht!=null&&(ht[0]=en[0]),re!=null&&(re[0]=ke[0]),m=1):m=0):m=0}else{if(10>E){Yt=7;break}Q=Ht,m==null||10>E||!Oo(m,v+3,E-3)?m=0:(ht=m[v+0]|m[v+1]<<8|m[v+2]<<16,re=16383&(m[v+7]<<8|m[v+6]),m=16383&(m[v+9]<<8|m[v+8]),1&ht||3<(ht>>1&7)||!(ht>>4&1)||ht>>5>=Ot.Ja||!re||!m?m=0:($&&($[0]=re),Q&&(Q[0]=m),m=1))}if(!m||($=$[0],Ht=Ht[0],Wt&&(pt[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 Yt==0||Yt==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):Yt}function Eo(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 dc(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 ts(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,pt=R.height;if(m=R.S,0>=at||0>=pt||!(m>=Hc&&13>m))m=2;else{if(0>=R.Rd&&R.sd==null){$=q=F=v=0;var Dt=(Q=at*Gc[m])*pt;if(11>m||(q=(pt+1)/2*(v=(at+1)/2),m==12&&($=(F=at)*pt)),(pt=s(Dt+2*q+$))==null){m=1;break t}R.sd=pt,11>m?((at=R.f.RGBA).eb=pt,at.fb=0,at.A=Q,at.size=Dt):((at=R.f.kb).y=pt,at.O=0,at.fa=Q,at.Fd=Dt,at.f=pt,at.N=0+Dt,at.Ab=v,at.Cd=q,at.ea=pt,at.W=0+Dt+q,at.Db=v,at.Ed=q,m==12&&(at.F=pt,at.J=0+Dt+2*q),at.Tc=$,at.lb=F)}if(v=1,F=R.S,q=R.width,$=R.height,F>=Hc&&13>F)if(11>F)m=R.f.RGBA,v&=(Q=Math.abs(m.A))*($-1)+q<=m.size,v&=Q>=q*Gc[F],v&=m.eb!=null;else{m=R.f.kb,Q=(q+1)/2,Dt=($+1)/2,at=Math.abs(m.fa),pt=Math.abs(m.Ab);var Wt=Math.abs(m.Db),ht=Math.abs(m.lb),Ot=ht*($-1)+q;v&=at*($-1)+q<=m.Fd,v&=pt*(Dt-1)+Q<=m.Cd,v=(v&=Wt*(Dt-1)+Q<=m.Ed)&at>=q&pt>=Q&Wt>=Q,v&=m.y!=null,v&=m.f!=null,v&=m.ea!=null,F==12&&(v&=ht>=q,v&=Ot<=m.Tc,v&=m.F!=null)}else v=0;m=v?0:2}}return m!=0||E!=null&&E.fd&&(m=dc(R)),m}var Ua=64,hi=[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],Nr=24,es=32,Yi=8,Vs=[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"),rt.Predictor0=function(){return 4278190080},rt.Predictor1=function(m){return m},rt.Predictor2=function(m,v,E){return v[E+0]},rt.Predictor3=function(m,v,E){return v[E+1]},rt.Predictor4=function(m,v,E){return v[E-1]},rt.Predictor5=function(m,v,E){return $e($e(m,v[E+1]),v[E+0])},rt.Predictor6=function(m,v,E){return $e(m,v[E-1])},rt.Predictor7=function(m,v,E){return $e(m,v[E+0])},rt.Predictor8=function(m,v,E){return $e(v[E-1],v[E+0])},rt.Predictor9=function(m,v,E){return $e(v[E+0],v[E+1])},rt.Predictor10=function(m,v,E){return $e($e(m,v[E-1]),$e(v[E+0],v[E+1]))},rt.Predictor11=function(m,v,E){var R=v[E+0];return 0>=bn(R>>24&255,m>>24&255,(v=v[E-1])>>24&255)+bn(R>>16&255,m>>16&255,v>>16&255)+bn(R>>8&255,m>>8&255,v>>8&255)+bn(255&R,255&m,255&v)?R:m},rt.Predictor12=function(m,v,E){var R=v[E+0];return(fn((m>>24&255)+(R>>24&255)-((v=v[E-1])>>24&255))<<24|fn((m>>16&255)+(R>>16&255)-(v>>16&255))<<16|fn((m>>8&255)+(R>>8&255)-(v>>8&255))<<8|fn((255&m)+(255&R)-(255&v)))>>>0},rt.Predictor13=function(m,v,E){var R=v[E-1];return(In((m=$e(m,v[E+0]))>>24&255,R>>24&255)<<24|In(m>>16&255,R>>16&255)<<16|In(m>>8&255,R>>8&255)<<8|In(255&m,255&R))>>>0};var Fl=rt.PredictorAdd0;rt.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 ll=rt.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 pe,To=rt.ColorIndexInverseTransform,Ws=rt.MapARGB,Ls=rt.VP8LColorIndexInverseTransformAlpha,no=rt.MapAlpha,Xs=rt.VP8LPredictorsAdd=[];Xs.length=16,(rt.VP8LPredictors=[]).length=16,(rt.VP8LPredictorsAdd_C=[]).length=16,(rt.VP8LPredictors_C=[]).length=16;var hc,Ul,Ha,qa,Gs,cl,ns,ma,yi,No,br,ar,Dr,bi,Ks,Ds,ga,pc,Cu,vf,wf,ad,Eu,Sf,ul,rs,mc,zo,fl=s(511),Fc=s(2041),gc=s(225),yc=s(767),Uc=0,ya=Fc,bc=gc,ro=yc,Vi=fl,Hc=0,yo=1,qc=2,is=3,xc=4,Js=5,$a=6,vc=7,$c=8,Hl=9,ql=10,bo=[2,3,7],$l=[3,3,11],Rs=[280,256,256,256,40],Yc=[0,1,1,1,0],wc=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],ss=[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],as=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Ya=8,ls=[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],cs=[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,Vc=[[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]],Zs=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],Yl=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],ld=[[[[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]]]],io=[[[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]]],Rr=[[[[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]]]],er=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],_o=[],ti=[],Qs=[],ta=1,dl=2,ea=[],Ii=[];za("UpsampleRgbLinePair",_s,3),za("UpsampleBgrLinePair",$i,3),za("UpsampleRgbaLinePair",go,4),za("UpsampleBgraLinePair",Ys,4),za("UpsampleArgbLinePair",Fa,4),za("UpsampleRgba4444LinePair",Ba,2),za("UpsampleRgb565LinePair",ha,2);var ba=rt.UpsampleRgbLinePair,kf=rt.UpsampleBgrLinePair,Sc=rt.UpsampleRgbaLinePair,Wc=rt.UpsampleBgraLinePair,Va=rt.UpsampleArgbLinePair,xa=rt.UpsampleRgba4444LinePair,us=rt.UpsampleRgb565LinePair,Os=16,Vl=1<<Os-1,Wi=-227,va=482,Xc=6,hl=0,Di=s(256),kc=s(256),Tu=s(256),rh=s(256),Ac=s(va-Wi),cd=s(va-Wi);pa("YuvToRgbRow",_s,3),pa("YuvToBgrRow",$i,3),pa("YuvToRgbaRow",go,4),pa("YuvToBgraRow",Ys,4),pa("YuvToArgbRow",Fa,4),pa("YuvToRgba4444Row",Ba,2),pa("YuvToRgb565Row",ha,2);var Vr=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],wa=[0,2,8],pl=[8,7,6,4,4,2,2,2,1,1,1,1],Wl=1;this.WebPDecodeRGBA=function(m,v,E,R,F){var q=yo,$=new ie,Q=new He;$.ba=Q,Q.S=q,Q.width=[Q.width],Q.height=[Q.height];var at=Q.width,pt=Q.height,Dt=new Pe;if(Dt==null||m==null)var Wt=2;else t(Dt!=null),Wt=jo(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]),pt!=null&&(pt[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 mi,(F=new ve).data=m,F.w=v,F.ha=E,F.kd=1,v=[0],t(F!=null),((m=jo(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=Ke,R.ac=Vo,R.bc=xs,R.ma=$,F.xa){if((m=Da())==null){$=1;break t}if((function(ht,Ot){var Ht=[0],re=[0],Yt=[0];e:for(;;){if(ht==null)return 0;if(Ot==null)return ht.a=2,0;if(ht.l=Ot,ht.a=0,zt(ht.m,Ot.data,Ot.w,Ot.ha),!Zi(ht.m,Ht,re,Yt)){ht.a=3;break e}if(ht.xb=dl,Ot.width=Ht[0],Ot.height=re[0],!Go(Ht[0],re[0],1,ht,null))break e;return 1}return t(ht.a!=0),0})(m,R)){if(R=(v=ts(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),!Eo(F.Oa,E,is)){R.a=2;break n}if(!Ao(R,E.width)||E.da)break n;if((E.da||we(R.ca.S))&&vn(),11>R.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),R.ca.f.kb.F!=null&&vn()),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(!Xo(R,R.V,R.Ba,R.c,R.i,E.o,pi))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,hr(m,R)){if((v=ts(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(pt=Dt=0;4>pt;++pt)12>(Wt=F.pb[pt]).lc&&(Wt.ia=at*pl[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(ht,Ot){if(ht==null)return 0;if(Ot==null)return Fn(ht,2,"NULL VP8Io parameter in VP8Decode().");if(!ht.cb&&!hr(ht,Ot))return 0;if(t(ht.cb),Ot.ac==null||Ot.ac(Ot)){Ot.ob&&(ht.L=0);var Ht=wa[ht.L];if(ht.L==2?(ht.yb=0,ht.zb=0):(ht.yb=Ot.v-Ht>>4,ht.zb=Ot.j-Ht>>4,0>ht.yb&&(ht.yb=0),0>ht.zb&&(ht.zb=0)),ht.Va=Ot.o+15+Ht>>4,ht.Hb=Ot.va+15+Ht>>4,ht.Hb>ht.za&&(ht.Hb=ht.za),ht.Va>ht.Ub&&(ht.Va=ht.Ub),0<ht.L){var re=ht.ed;for(Ht=0;4>Ht;++Ht){var Yt;if(ht.Qa.Cb){var ne=ht.Qa.Lb[Ht];ht.Qa.Fb||(ne+=re.Tb)}else ne=re.Tb;for(Yt=0;1>=Yt;++Yt){var ce=ht.gd[Ht][Yt],ke=ne;if(re.Pc&&(ke+=re.vd[0],Yt&&(ke+=re.od[0])),0<(ke=0>ke?0:63<ke?63:ke)){var ye=ke;0<re.wb&&(ye=4<re.wb?ye>>2:ye>>1)>9-re.wb&&(ye=9-re.wb),1>ye&&(ye=1),ce.dd=ye,ce.tc=2*ke+ye,ce.ld=40<=ke?2:15<=ke?1:0}else ce.tc=0;ce.La=Yt}}}Ht=0}else Fn(ht,6,"Frame setup failed"),Ht=ht.a;if(Ht=Ht==0){if(Ht){ht.$c=0,0<ht.Aa||(ht.Ic=Wl);e:{Ht=ht.Ic,re=4*(ye=ht.za);var Je=32*ye,Ye=ye+1,Ln=0<ht.L?ye*(0<ht.Aa?2:1):0,en=(ht.Aa==2?2:1)*ye;if((ce=re+832+(Yt=3*(16*Ht+wa[ht.L])/2*Je)+(ne=ht.Fa!=null&&0<ht.Fa.length?ht.Kc.c*ht.Kc.i:0))!=ce)Ht=0;else{if(ce>ht.Vb){if(ht.Vb=0,ht.Ec=s(ce),ht.Fc=0,ht.Ec==null){Ht=Fn(ht,1,"no memory during frame initialization.");break e}ht.Vb=ce}ce=ht.Ec,ke=ht.Fc,ht.Ac=ce,ht.Bc=ke,ke+=re,ht.Gd=l(Je,jc),ht.Hd=0,ht.rb=l(Ye+1,Yr),ht.sb=1,ht.wa=Ln?l(Ln,Pi):null,ht.Y=0,ht.D.Nb=0,ht.D.wa=ht.wa,ht.D.Y=ht.Y,0<ht.Aa&&(ht.D.Y+=ye),t(!0),ht.oc=ce,ht.pc=ke,ke+=832,ht.ya=l(en,Dl),ht.aa=0,ht.D.ya=ht.ya,ht.D.aa=ht.aa,ht.Aa==2&&(ht.D.aa+=ye),ht.R=16*ye,ht.B=8*ye,ye=(Je=wa[ht.L])*ht.R,Je=Je/2*ht.B,ht.sa=ce,ht.ta=ke+ye,ht.qa=ht.sa,ht.ra=ht.ta+16*Ht*ht.R+Je,ht.Ha=ht.qa,ht.Ia=ht.ra+8*Ht*ht.B+Je,ht.$c=0,ke+=Yt,ht.mb=ne?ce:null,ht.nb=ne?ke:null,t(ke+ne<=ht.Fc+ht.Vb),to(ht),i(ht.Ac,ht.Bc,0,re),Ht=1}}if(Ht){if(Ot.ka=0,Ot.y=ht.sa,Ot.O=ht.ta,Ot.f=ht.qa,Ot.N=ht.ra,Ot.ea=ht.Ha,Ot.Vd=ht.Ia,Ot.fa=ht.R,Ot.Rc=ht.B,Ot.F=null,Ot.J=0,!Uc){for(Ht=-255;255>=Ht;++Ht)fl[255+Ht]=0>Ht?-Ht:Ht;for(Ht=-1020;1020>=Ht;++Ht)Fc[1020+Ht]=-128>Ht?-128:127<Ht?127:Ht;for(Ht=-112;112>=Ht;++Ht)gc[112+Ht]=-16>Ht?-16:15<Ht?15:Ht;for(Ht=-255;510>=Ht;++Ht)yc[255+Ht]=0>Ht?0:255<Ht?255:Ht;Uc=1}ns=fo,ma=te,No=Mo,br=ca,ar=Bc,yi=la,Dr=Pl,bi=Ns,Ks=B,Ds=mt,ga=Il,pc=A,Cu=Nt,vf=Ft,wf=Cs,ad=Es,Eu=da,Sf=al,ti[0]=cc,ti[1]=Au,ti[2]=lc,ti[3]=vr,ti[4]=ho,ti[5]=sl,ti[6]=_i,ti[7]=As,ti[8]=ua,ti[9]=qi,_o[0]=Jo,_o[1]=sc,_o[2]=ac,_o[3]=Rl,_o[4]=ks,_o[5]=ol,_o[6]=Oa,Qs[0]=Pa,Qs[1]=Mu,Qs[2]=Zo,Qs[3]=Ol,Qs[4]=gi,Qs[5]=Ia,Qs[6]=Po,Ht=1}else Ht=0}Ht&&(Ht=(function(Zn,zr){for(Zn.M=0;Zn.M<Zn.Va;++Zn.M){var Bn,Ve=Zn.Jc[Zn.M&Zn.Xb],Oe=Zn.m,ei=Zn;for(Bn=0;Bn<ei.za;++Bn){var Mn=Oe,jn=ei,kr=jn.Ac,ji=jn.Bc+4*Bn,zi=jn.zc,Or=jn.ya[jn.aa+Bn];if(jn.Qa.Bb?Or.$b=Zt(Mn,jn.Pa.jb[0])?2+Zt(Mn,jn.Pa.jb[2]):Zt(Mn,jn.Pa.jb[1]):Or.$b=0,jn.kc&&(Or.Ad=Zt(Mn,jn.Bd)),Or.Za=!Zt(Mn,145)+0,Or.Za){var ni=Or.Ob,Bi=0;for(jn=0;4>jn;++jn){var ri,Un=zi[0+jn];for(ri=0;4>ri;++ri){Un=io[kr[ji+ri]][Un];for(var wn=Yl[Zt(Mn,Un[0])];0<wn;)wn=Yl[2*wn+Zt(Mn,Un[wn])];Un=-wn,kr[ji+ri]=Un}r(ni,Bi,kr,ji,4),Bi+=4,zi[0+jn]=Un}}else Un=Zt(Mn,156)?Zt(Mn,128)?1:3:Zt(Mn,163)?2:0,Or.Ob[0]=Un,i(kr,ji,Un,4),i(zi,0,Un,4);Or.Dd=Zt(Mn,142)?Zt(Mn,114)?Zt(Mn,183)?1:3:2:0}if(ei.m.Ka)return Fn(Zn,7,"Premature end-of-partition0 encountered.");for(;Zn.ja<Zn.za;++Zn.ja){if(ei=Ve,Mn=(Oe=Zn).rb[Oe.sb-1],kr=Oe.rb[Oe.sb+Oe.ja],Bn=Oe.ya[Oe.aa+Oe.ja],ji=Oe.kc?Bn.Ad:0)Mn.la=kr.la=0,Bn.Za||(Mn.Na=kr.Na=0),Bn.Hc=0,Bn.Gc=0,Bn.ia=0;else{var _r,nr;if(Mn=kr,kr=ei,ji=Oe.Pa.Xc,zi=Oe.ya[Oe.aa+Oe.ja],Or=Oe.pb[zi.$b],jn=zi.ad,ni=0,Bi=Oe.rb[Oe.sb-1],Un=ri=0,i(jn,ni,0,384),zi.Za)var w=0,k=ji[3];else{wn=s(16);var _=Mn.Na+Bi.Na;if(_=xi(kr,ji[1],_,Or.Eb,0,wn,0),Mn.Na=Bi.Na=(0<_)+0,1<_)ns(wn,0,jn,ni);else{var N=wn[0]+3>>3;for(wn=0;256>wn;wn+=16)jn[ni+wn]=N}w=1,k=ji[0]}var j=15&Mn.la,G=15&Bi.la;for(wn=0;4>wn;++wn){var nt=1&G;for(N=nr=0;4>N;++N)j=j>>1|(nt=(_=xi(kr,k,_=nt+(1&j),Or.Sc,w,jn,ni))>w)<<7,nr=nr<<2|(3<_?3:1<_?2:jn[ni+0]!=0),ni+=16;j>>=4,G=G>>1|nt<<7,ri=(ri<<8|nr)>>>0}for(k=j,w=G>>4,_r=0;4>_r;_r+=2){for(nr=0,j=Mn.la>>4+_r,G=Bi.la>>4+_r,wn=0;2>wn;++wn){for(nt=1&G,N=0;2>N;++N)_=nt+(1&j),j=j>>1|(nt=0<(_=xi(kr,ji[2],_,Or.Qc,0,jn,ni)))<<3,nr=nr<<2|(3<_?3:1<_?2:jn[ni+0]!=0),ni+=16;j>>=2,G=G>>1|nt<<5}Un|=nr<<4*_r,k|=j<<4<<_r,w|=(240&G)<<_r}Mn.la=k,Bi.la=w,zi.Hc=ri,zi.Gc=Un,zi.ia=43690&Un?0:Or.ia,ji=!(ri|Un)}if(0<Oe.L&&(Oe.wa[Oe.Y+Oe.ja]=Oe.gd[Bn.$b][Bn.Za],Oe.wa[Oe.Y+Oe.ja].La|=!ji),ei.Ka)return Fn(Zn,7,"Premature end-of-file encountered.")}if(to(Zn),Oe=zr,ei=1,Bn=(Ve=Zn).D,Mn=0<Ve.L&&Ve.M>=Ve.zb&&Ve.M<=Ve.Va,Ve.Aa==0)e:{if(Bn.M=Ve.M,Bn.uc=Mn,Io(Ve,Bn),ei=1,Bn=(nr=Ve.D).Nb,Mn=(Un=wa[Ve.L])*Ve.R,kr=Un/2*Ve.B,wn=16*Bn*Ve.R,N=8*Bn*Ve.B,ji=Ve.sa,zi=Ve.ta-Mn+wn,Or=Ve.qa,jn=Ve.ra-kr+N,ni=Ve.Ha,Bi=Ve.Ia-kr+N,G=(j=nr.M)==0,ri=j>=Ve.Va-1,Ve.Aa==2&&Io(Ve,nr),nr.uc)for(nt=(_=Ve).D.M,t(_.D.uc),nr=_.yb;nr<_.Hb;++nr){w=nr,k=nt;var z=(Z=(vt=_).D).Nb;_r=vt.R;var Z=Z.wa[Z.Y+w],ut=vt.sa,ot=vt.ta+16*z*_r+16*w,it=Z.dd,I=Z.tc;if(I!=0)if(t(3<=I),vt.L==1)0<w&&ad(ut,ot,_r,I+4),Z.La&&Sf(ut,ot,_r,I),0<k&&wf(ut,ot,_r,I+4),Z.La&&Eu(ut,ot,_r,I);else{var Ct=vt.B,It=vt.qa,St=vt.ra+8*z*Ct+8*w,Et=vt.Ha,vt=vt.Ia+8*z*Ct+8*w;z=Z.ld,0<w&&(bi(ut,ot,_r,I+4,it,z),Ds(It,St,Et,vt,Ct,I+4,it,z)),Z.La&&(pc(ut,ot,_r,I,it,z),vf(It,St,Et,vt,Ct,I,it,z)),0<k&&(Dr(ut,ot,_r,I+4,it,z),Ks(It,St,Et,vt,Ct,I+4,it,z)),Z.La&&(ga(ut,ot,_r,I,it,z),Cu(It,St,Et,vt,Ct,I,it,z))}}if(Ve.ia&&alert("todo:DitherRow"),Oe.put!=null){if(nr=16*j,j=16*(j+1),G?(Oe.y=Ve.sa,Oe.O=Ve.ta+wn,Oe.f=Ve.qa,Oe.N=Ve.ra+N,Oe.ea=Ve.Ha,Oe.W=Ve.Ia+N):(nr-=Un,Oe.y=ji,Oe.O=zi,Oe.f=Or,Oe.N=jn,Oe.ea=ni,Oe.W=Bi),ri||(j-=Un),j>Oe.o&&(j=Oe.o),Oe.F=null,Oe.J=null,Ve.Fa!=null&&0<Ve.Fa.length&&nr<j&&(Oe.J=Tr(Ve,Oe,nr,j-nr),Oe.F=Ve.mb,Oe.F==null&&Oe.F.length==0)){ei=Fn(Ve,3,"Could not decode alpha data.");break e}nr<Oe.j&&(Un=Oe.j-nr,nr=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)),nr<j&&(Oe.O+=Oe.v,Oe.N+=Oe.v>>1,Oe.W+=Oe.v>>1,Oe.F!=null&&(Oe.J+=Oe.v),Oe.ka=nr-Oe.j,Oe.U=Oe.va-Oe.v,Oe.T=j-nr,ei=Oe.put(Oe))}Bn+1!=Ve.Ic||ri||(r(Ve.sa,Ve.ta-Mn,ji,zi+16*Ve.R,Mn),r(Ve.qa,Ve.ra-kr,Or,jn+8*Ve.B,kr),r(Ve.Ha,Ve.Ia-kr,ni,Bi+8*Ve.B,kr))}if(!ei)return Fn(Zn,6,"Output aborted.")}return 1})(ht,Ot)),Ot.bc!=null&&Ot.bc(Ot),Ht&=1}return Ht?(ht.cb=0,Ht):0})(m,R)||(v=m.a)}}else v=m.a}v==0&&$.Oa!=null&&$.Oa.fd&&(v=dc($.ba))}$=v}q=$!=0?null:11>q?Q.f.RGBA.eb:Q.f.kb.y}else q=null;return q};var Gc=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(rt,jt){for(var J="",ct=0;ct<4;ct++)J+=String.fromCharCode(rt[jt++]);return J}function p(rt,jt){return rt[jt+0]|rt[jt+1]<<8}function y(rt,jt){return(rt[jt+0]|rt[jt+1]<<8|rt[jt+2]<<16)>>>0}function b(rt,jt){return(rt[jt+0]|rt[jt+1]<<8|rt[jt+2]<<16|rt[jt+3]<<24)>>>0}new f;var g=[0],C=[0],M=[],L=new f,D=e,H=(function(rt,jt){var J={},ct=0,X=!1,bt=0,Lt=0;if(J.frames=[],!(function(P,Y){for(var tt=0;tt<4;tt++)if(P[Y+tt]!="RIFF".charCodeAt(tt))return!0;return!1})(rt,jt)){for(b(rt,jt+=4),jt+=8;jt<rt.length;){var dt=d(rt,jt),st=b(rt,jt+=4);jt+=4;var lt=st+(1&st);switch(dt){case"VP8 ":case"VP8L":J.frames[ct]===void 0&&(J.frames[ct]={}),(K=J.frames[ct]).src_off=X?Lt:jt-8,K.src_size=bt+st+8,ct++,X&&(X=!1,bt=0,Lt=0);break;case"VP8X":(K=J.header={}).feature_flags=rt[jt];var zt=jt+4;K.canvas_width=1+y(rt,zt),zt+=3,K.canvas_height=1+y(rt,zt),zt+=3;break;case"ALPH":X=!0,bt=lt+8,Lt=jt-8;break;case"ANIM":(K=J.header).bgcolor=b(rt,jt),zt=jt+4,K.loop_count=p(rt,zt),zt+=2;break;case"ANMF":var Mt,K;(K=J.frames[ct]={}).offset_x=2*y(rt,jt),jt+=3,K.offset_y=2*y(rt,jt),jt+=3,K.width=1+y(rt,jt),jt+=3,K.height=1+y(rt,jt),jt+=3,K.duration=y(rt,jt),jt+=3,Mt=rt[jt++],K.dispose=1&Mt,K.blend=Mt>>1&1}dt!="ANMF"&&(jt+=lt)}return J}})(D,0);H.response=D,H.rgbaoutput=!0,H.dataurl=!1;var V=H.header?H.header:null,W=H.frames?H.frames:null;if(V){V.loop_counter=V.loop_count,g=[V.canvas_height],C=[V.canvas_width];for(var gt=0;gt<W.length&&W[gt].blend!=0;gt++);}var _t=W[0],kt=L.WebPDecodeRGBA(D,_t.src_off,_t.src_size,C,g);_t.rgba=kt,_t.imgwidth=C[0],_t.imgheight=g[0];for(var xt=0;xt<C[0]*g[0]*4;xt++)M[xt]=kt[xt];return this.width=C,this.height=g,this.data=M,this}function kN(){var e,t=this.internal.__metadata__.metadata,n=unescape(encodeURIComponent(t));e=this.internal.__metadata__.rawXml?n:'<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>'+n.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 "+e.length+" >>"),this.internal.write("stream"),this.internal.write(e),this.internal.write("endstream"),this.internal.write("endobj")}function AN(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(e){var t,n,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};e.events.push(["initialized",function(){this.context2d=new y(this),t=this.internal.f2,n=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 y=function(P){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var Y=P;Object.defineProperty(this,"pdf",{get:function(){return Y}});var tt=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return tt},set:function(ft){tt=!!ft}});var yt=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return yt},set:function(ft){yt=!!ft}});var wt=0;Object.defineProperty(this,"posX",{get:function(){return wt},set:function(ft){isNaN(ft)||(wt=ft)}});var At=0;Object.defineProperty(this,"posY",{get:function(){return At},set:function(ft){isNaN(ft)||(At=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 Me=[];Object.defineProperty(this,"ctxStack",{get:function(){return Me},set:function(ft){Me=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],xe=Re[4];Re[5];var _e=Re[6],Te=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(xe)[2];xe=Math.floor(Te==="px"?parseFloat(xe)*this.pdf.internal.scaleFactor:Te==="em"?parseFloat(xe)*this.pdf.getFontSize():parseFloat(xe)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(xe);var De=(function(je){var dr,mn,an=[],dn=je.trim();if(dn==="")return Q1;if(dn in yw)return[yw[dn]];for(;dn!=="";){switch(mn=null,dr=(dn=xw(dn)).charAt(0)){case'"':case"'":mn=yN(dn.substring(1),dr);break;default:mn=bN(dn)}if(mn===null||(an.push(mn[0]),(dn=xw(mn[1]))!==""&&dn.charAt(0)!==","))return Q1;dn=dn.replace(/^,/,"")}return an})(_e);if(this.fontFaces){var $e=(function(je,dr){var mn=je.getFontList(),an=JSON.stringify(mn);if(le===null||Ie!==an){var dn=(function(Vn){var tn=[];return Object.keys(Vn).forEach(function(Qt){Vn[Qt].forEach(function(we){var ge=null;switch(we){case"bold":ge={family:Qt,weight:"bold"};break;case"italic":ge={family:Qt,style:"italic"};break;case"bolditalic":ge={family:Qt,weight:"bold",style:"italic"};break;case"":case"normal":ge={family:Qt}}ge!==null&&(ge.ref={name:Qt,style:we},tn.push(ge))})}),tn})(mn);le=(function(Vn){for(var tn={},Qt=0;Qt<Vn.length;++Qt){var we=Z1(Vn[Qt]),ge=we.family,We=we.stretch,He=we.style,Pe=we.weight;tn[ge]=tn[ge]||{},tn[ge][We]=tn[ge][We]||{},tn[ge][We][He]=tn[ge][We][He]||{},tn[ge][We][He][Pe]=we}return tn})(dn.concat(dr)),Ie=an}return le})(this.pdf,this.fontFaces),fn=De.map(function(je){return{family:je,stretch:"normal",weight:on,style:rn}}),In=(function(je,dr,mn){for(var an=(mn=mn||{}).defaultFontFamily||"times",dn=Object.assign({},gN,mn.genericFontFamilies||{}),Vn=null,tn=null,Qt=0;Qt<dr.length;++Qt)if(dn[(Vn=Z1(dr[Qt])).family]&&(Vn.family=dn[Vn.family]),je.hasOwnProperty(Vn.family)){tn=je[Vn.family];break}if(!(tn=tn||je[an]))throw new Error("Could not find a font-family for the rule '"+bw(Vn)+"' and default family '"+an+"'.");if(tn=(function(we,ge){if(ge[we])return ge[we];var We=s2[we],He=We<=s2.normal?-1:1,Pe=gw(ge,r4,We,He);if(!Pe)throw new Error("Could not find a matching font-stretch value for "+we);return Pe})(Vn.stretch,tn),tn=(function(we,ge){if(ge[we])return ge[we];for(var We=n4[we],He=0;He<We.length;++He)if(ge[We[He]])return ge[We[He]];throw new Error("Could not find a matching font-style for "+we)})(Vn.style,tn),!(tn=(function(we,ge){if(ge[we])return ge[we];if(we===400&&ge[500])return ge[500];if(we===500&&ge[400])return ge[400];var We=mN[we],He=gw(ge,i4,We,we<400?-1:1);if(!He)throw new Error("Could not find a matching font-weight for value "+we);return He})(Vn.weight,tn)))throw new Error("Failed to resolve a font for the rule '"+bw(Vn)+"'.");return tn})($e,fn);this.pdf.setFont(In.ref.name,In.ref.style)}else{var bn="";(on==="bold"||parseInt(on,10)>=700||rn==="bold")&&(bn="bold"),rn==="italic"&&(bn+="italic"),bn.length===0&&(bn="normal");for(var Nn="",xn={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"},ze=0;ze<De.length;ze++){if(this.pdf.internal.getFont(De[ze],bn,{noFallback:!0,disableWarning:!0})!==void 0){Nn=De[ze];break}if(bn==="bolditalic"&&this.pdf.internal.getFont(De[ze],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Nn=De[ze],bn="bold";else if(this.pdf.internal.getFont(De[ze],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Nn=De[ze],bn="normal";break}}if(Nn===""){for(var Qe=0;Qe<De.length;Qe++)if(xn[De[Qe]]){Nn=xn[De[Qe]];break}}Nn=Nn===""?"Times":Nn,this.pdf.setFont(Nn,bn)}}}}),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}})};y.prototype.setLineDash=function(P){this.lineDash=P},y.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},y.prototype.fill=function(){W.call(this,"fill",!1)},y.prototype.stroke=function(){W.call(this,"stroke",!1)},y.prototype.beginPath=function(){this.path=[{type:"begin"}]},y.prototype.moveTo=function(P,Y){if(isNaN(P)||isNaN(Y))throw si.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,Y));this.path.push({type:"mt",x:tt.x,y:tt.y}),this.ctx.lastPoint=new l(P,Y)},y.prototype.closePath=function(){var P=new l(0,0),Y=0;for(Y=this.path.length-1;Y!==-1;Y--)if(this.path[Y].type==="begin"&&$r(this.path[Y+1])==="object"&&typeof this.path[Y+1].x=="number"){P=new l(this.path[Y+1].x,this.path[Y+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new l(P.x,P.y)},y.prototype.lineTo=function(P,Y){if(isNaN(P)||isNaN(Y))throw si.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,Y));this.path.push({type:"lt",x:tt.x,y:tt.y}),this.ctx.lastPoint=new l(tt.x,tt.y)},y.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),W.call(this,null,!0)},y.prototype.quadraticCurveTo=function(P,Y,tt,yt){if(isNaN(tt)||isNaN(yt)||isNaN(P)||isNaN(Y))throw si.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var wt=this.ctx.transform.applyToPoint(new l(tt,yt)),At=this.ctx.transform.applyToPoint(new l(P,Y));this.path.push({type:"qct",x1:At.x,y1:At.y,x:wt.x,y:wt.y}),this.ctx.lastPoint=new l(wt.x,wt.y)},y.prototype.bezierCurveTo=function(P,Y,tt,yt,wt,At){if(isNaN(wt)||isNaN(At)||isNaN(P)||isNaN(Y)||isNaN(tt)||isNaN(yt))throw si.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var qt=this.ctx.transform.applyToPoint(new l(wt,At)),Rt=this.ctx.transform.applyToPoint(new l(P,Y)),Zt=this.ctx.transform.applyToPoint(new l(tt,yt));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)},y.prototype.arc=function(P,Y,tt,yt,wt,At){if(isNaN(P)||isNaN(Y)||isNaN(tt)||isNaN(yt)||isNaN(wt))throw si.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(At=!!At,!this.ctx.transform.isIdentity){var qt=this.ctx.transform.applyToPoint(new l(P,Y));P=qt.x,Y=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(wt-yt)>=2*Math.PI&&(yt=0,wt=2*Math.PI),this.path.push({type:"arc",x:P,y:Y,radius:tt,startAngle:yt,endAngle:wt,counterclockwise:At})},y.prototype.arcTo=function(P,Y,tt,yt,wt){throw new Error("arcTo not implemented.")},y.prototype.rect=function(P,Y,tt,yt){if(isNaN(P)||isNaN(Y)||isNaN(tt)||isNaN(yt))throw si.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(P,Y),this.lineTo(P+tt,Y),this.lineTo(P+tt,Y+yt),this.lineTo(P,Y+yt),this.lineTo(P,Y),this.lineTo(P+tt,Y),this.lineTo(P,Y)},y.prototype.fillRect=function(P,Y,tt,yt){if(isNaN(P)||isNaN(Y)||isNaN(tt)||isNaN(yt))throw si.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!g.call(this)){var wt={};this.lineCap!=="butt"&&(wt.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(wt.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(P,Y,tt,yt),this.fill(),wt.hasOwnProperty("lineCap")&&(this.lineCap=wt.lineCap),wt.hasOwnProperty("lineJoin")&&(this.lineJoin=wt.lineJoin)}},y.prototype.strokeRect=function(P,Y,tt,yt){if(isNaN(P)||isNaN(Y)||isNaN(tt)||isNaN(yt))throw si.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");C.call(this)||(this.beginPath(),this.rect(P,Y,tt,yt),this.stroke())},y.prototype.clearRect=function(P,Y,tt,yt){if(isNaN(P)||isNaN(Y)||isNaN(tt)||isNaN(yt))throw si.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(P,Y,tt,yt))},y.prototype.save=function(P){P=typeof P!="boolean"||P;for(var Y=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(Y),P){this.ctx.fontSize=this.pdf.internal.getFontSize();var yt=new p(this.ctx);this.ctxStack.push(this.ctx),this.ctx=yt}},y.prototype.restore=function(P){P=typeof P!="boolean"||P;for(var Y=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(Y),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)},y.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var b=function(P){var Y,tt,yt,wt;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))Y=0,tt=0,yt=0,wt=0;else{var At=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(P);if(At!==null)Y=parseInt(At[1]),tt=parseInt(At[2]),yt=parseInt(At[3]),wt=1;else if((At=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(P))!==null)Y=parseInt(At[1]),tt=parseInt(At[2]),yt=parseInt(At[3]),wt=parseFloat(At[4]);else{if(wt=1,typeof P=="string"&&P.charAt(0)!=="#"){var qt=new Gk(P);P=qt.ok?qt.toHex():"#000000"}P.length===4?(Y=P.substring(1,2),Y+=Y,tt=P.substring(2,3),tt+=tt,yt=P.substring(3,4),yt+=yt):(Y=P.substring(1,3),tt=P.substring(3,5),yt=P.substring(5,7)),Y=parseInt(Y,16),tt=parseInt(tt,16),yt=parseInt(yt,16)}}return{r:Y,g:tt,b:yt,a:wt,style:P}},g=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},C=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};y.prototype.fillText=function(P,Y,tt,yt){if(isNaN(Y)||isNaN(tt)||typeof P!="string")throw si.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(yt=isNaN(yt)?void 0:yt,!g.call(this)){var wt=lt(this.ctx.transform.rotation),At=this.ctx.transform.scaleX;ct.call(this,{text:P,x:Y,y:tt,scale:At,angle:wt,align:this.textAlign,maxWidth:yt})}},y.prototype.strokeText=function(P,Y,tt,yt){if(isNaN(Y)||isNaN(tt)||typeof P!="string")throw si.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!C.call(this)){yt=isNaN(yt)?void 0:yt;var wt=lt(this.ctx.transform.rotation),At=this.ctx.transform.scaleX;ct.call(this,{text:P,x:Y,y:tt,scale:At,renderingMode:"stroke",angle:wt,align:this.textAlign,maxWidth:yt})}},y.prototype.measureText=function(P){if(typeof P!="string")throw si.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var Y=this.pdf,tt=this.pdf.internal.scaleFactor,yt=Y.internal.getFontSize(),wt=Y.getStringUnitWidth(P)*yt/Y.internal.scaleFactor;return new function(At){var qt=(At=At||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return qt}}),this}({width:wt*=Math.round(96*tt/72*1e4)/1e4})},y.prototype.scale=function(P,Y){if(isNaN(P)||isNaN(Y))throw si.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var tt=new f(P,0,0,Y,0,0);this.ctx.transform=this.ctx.transform.multiply(tt)},y.prototype.rotate=function(P){if(isNaN(P))throw si.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var Y=new f(Math.cos(P),Math.sin(P),-Math.sin(P),Math.cos(P),0,0);this.ctx.transform=this.ctx.transform.multiply(Y)},y.prototype.translate=function(P,Y){if(isNaN(P)||isNaN(Y))throw si.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,Y);this.ctx.transform=this.ctx.transform.multiply(tt)},y.prototype.transform=function(P,Y,tt,yt,wt,At){if(isNaN(P)||isNaN(Y)||isNaN(tt)||isNaN(yt)||isNaN(wt)||isNaN(At))throw si.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var qt=new f(P,Y,tt,yt,wt,At);this.ctx.transform=this.ctx.transform.multiply(qt)},y.prototype.setTransform=function(P,Y,tt,yt,wt,At){P=isNaN(P)?1:P,Y=isNaN(Y)?0:Y,tt=isNaN(tt)?0:tt,yt=isNaN(yt)?1:yt,wt=isNaN(wt)?0:wt,At=isNaN(At)?0:At,this.ctx.transform=new f(P,Y,tt,yt,wt,At)};var M=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};y.prototype.drawImage=function(P,Y,tt,yt,wt,At,qt,Rt,Zt){var Me=this.pdf.getImageProperties(P),le=1,Ie=1,Ue=1,ft=1;yt!==void 0&&Rt!==void 0&&(Ue=Rt/yt,ft=Zt/wt,le=Me.width/yt*Rt/yt,Ie=Me.height/wt*Zt/wt),At===void 0&&(At=Y,qt=tt,Y=0,tt=0),yt!==void 0&&Rt===void 0&&(Rt=yt,Zt=wt),yt===void 0&&Rt===void 0&&(Rt=Me.width,Zt=Me.height);var Re=this.ctx.transform.decompose(),rn=lt(Re.rotate.shx),on=new f,xe=(on=(on=(on=on.multiply(Re.translate)).multiply(Re.skew)).multiply(Re.scale)).applyToRectangle(new c(At-Y*Ue,qt-tt*ft,yt*le,wt*Ie));if(this.autoPaging){for(var _e,Te=L.call(this,xe),De=[],$e=0;$e<Te.length;$e+=1)De.indexOf(Te[$e])===-1&&De.push(Te[$e]);V(De);for(var fn=De[0],In=De[De.length-1],bn=fn;bn<In+1;bn++){this.pdf.setPage(bn);var Nn=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],xn=bn===1?this.posY+this.margin[0]:this.margin[0],ze=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Qe=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],je=bn===1?0:ze+(bn-2)*Qe;if(this.ctx.clip_path.length!==0){var dr=this.path;_e=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=H(_e,this.posX+this.margin[3],-je+xn+this.ctx.prevPageLastElemOffset),gt.call(this,"fill",!0),this.path=dr}var mn=JSON.parse(JSON.stringify(xe));mn=H([mn],this.posX+this.margin[3],-je+xn+this.ctx.prevPageLastElemOffset)[0];var an=(bn>fn||bn<In)&&M.call(this);an&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Nn,Qe,null).clip().discardPath()),this.pdf.addImage(P,"JPEG",mn.x,mn.y,mn.w,mn.h,null,null,rn),an&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(P,"JPEG",xe.x,xe.y,xe.w,xe.h,null,null,rn)};var L=function(P,Y,tt){var yt=[];Y=Y||this.pdf.internal.pageSize.width,tt=tt||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var wt=this.posY+this.ctx.prevPageLastElemOffset;switch(P.type){default:case"mt":case"lt":yt.push(Math.floor((P.y+wt)/tt)+1);break;case"arc":yt.push(Math.floor((P.y+wt-P.radius)/tt)+1),yt.push(Math.floor((P.y+wt+P.radius)/tt)+1);break;case"qct":var At=zt(this.ctx.lastPoint.x,this.ctx.lastPoint.y,P.x1,P.y1,P.x,P.y);yt.push(Math.floor((At.y+wt)/tt)+1),yt.push(Math.floor((At.y+At.h+wt)/tt)+1);break;case"bct":var qt=Mt(this.ctx.lastPoint.x,this.ctx.lastPoint.y,P.x1,P.y1,P.x2,P.y2,P.x,P.y);yt.push(Math.floor((qt.y+wt)/tt)+1),yt.push(Math.floor((qt.y+qt.h+wt)/tt)+1);break;case"rect":yt.push(Math.floor((P.y+wt)/tt)+1),yt.push(Math.floor((P.y+P.h+wt)/tt)+1)}for(var Rt=0;Rt<yt.length;Rt+=1)for(;this.pdf.internal.getNumberOfPages()<yt[Rt];)D.call(this);return yt},D=function(){var P=this.fillStyle,Y=this.strokeStyle,tt=this.font,yt=this.lineCap,wt=this.lineWidth,At=this.lineJoin;this.pdf.addPage(),this.fillStyle=P,this.strokeStyle=Y,this.font=tt,this.lineCap=yt,this.lineWidth=wt,this.lineJoin=At},H=function(P,Y,tt){for(var yt=0;yt<P.length;yt++)switch(P[yt].type){case"bct":P[yt].x2+=Y,P[yt].y2+=tt;case"qct":P[yt].x1+=Y,P[yt].y1+=tt;default:P[yt].x+=Y,P[yt].y+=tt}return P},V=function(P){return P.sort(function(Y,tt){return Y-tt})},W=function(P,Y){var tt=this.fillStyle,yt=this.strokeStyle,wt=this.lineCap,At=this.lineWidth,qt=Math.abs(At*this.ctx.transform.scaleX),Rt=this.lineJoin;if(this.autoPaging){for(var Zt,Me,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=L.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];)D.call(this);V(Ue);for(var xe=Ue[0],_e=Ue[Ue.length-1],Te=xe;Te<_e+1;Te++){this.pdf.setPage(Te),this.fillStyle=tt,this.strokeStyle=yt,this.lineCap=wt,this.lineWidth=qt,this.lineJoin=Rt;var De=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],$e=Te===1?this.posY+this.margin[0]:this.margin[0],fn=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],In=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],bn=Te===1?0:fn+(Te-2)*In;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],-bn+$e+this.ctx.prevPageLastElemOffset),gt.call(this,P,!0),this.path=Nn}if(Me=JSON.parse(JSON.stringify(le)),this.path=H(Me,this.posX+this.margin[3],-bn+$e+this.ctx.prevPageLastElemOffset),Y===!1||Te===0){var xn=(Te>xe||Te<_e)&&M.call(this);xn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],De,In,null).clip().discardPath()),gt.call(this,P,Y),xn&&this.pdf.restoreGraphicsState()}this.lineWidth=At}this.path=le}else this.lineWidth=qt,gt.call(this,P,Y),this.lineWidth=At},gt=function(P,Y){if((P!=="stroke"||Y||!C.call(this))&&(P==="stroke"||Y||!g.call(this))){for(var tt,yt,wt=[],At=this.path,qt=0;qt<At.length;qt++){var Rt=At[qt];switch(Rt.type){case"begin":wt.push({begin:!0});break;case"close":wt.push({close:!0});break;case"mt":wt.push({start:Rt,deltas:[],abs:[]});break;case"lt":var Zt=wt.length;if(At[qt-1]&&!isNaN(At[qt-1].x)&&(tt=[Rt.x-At[qt-1].x,Rt.y-At[qt-1].y],Zt>0)){for(;Zt>=0;Zt--)if(wt[Zt-1].close!==!0&&wt[Zt-1].begin!==!0){wt[Zt-1].deltas.push(tt),wt[Zt-1].abs.push(Rt);break}}break;case"bct":tt=[Rt.x1-At[qt-1].x,Rt.y1-At[qt-1].y,Rt.x2-At[qt-1].x,Rt.y2-At[qt-1].y,Rt.x-At[qt-1].x,Rt.y-At[qt-1].y],wt[wt.length-1].deltas.push(tt);break;case"qct":var Me=At[qt-1].x+2/3*(Rt.x1-At[qt-1].x),le=At[qt-1].y+2/3*(Rt.y1-At[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=[Me-At[qt-1].x,le-At[qt-1].y,Ie-At[qt-1].x,Ue-At[qt-1].y,ft-At[qt-1].x,Re-At[qt-1].y],wt[wt.length-1].deltas.push(tt);break;case"arc":wt.push({deltas:[],abs:[],arc:!0}),Array.isArray(wt[wt.length-1].abs)&&wt[wt.length-1].abs.push(Rt)}}yt=Y?null:P==="stroke"?"stroke":"fill";for(var rn=!1,on=0;on<wt.length;on++)if(wt[on].arc)for(var xe=wt[on].abs,_e=0;_e<xe.length;_e++){var Te=xe[_e];Te.type==="arc"?xt.call(this,Te.x,Te.y,Te.radius,Te.startAngle,Te.endAngle,Te.counterclockwise,void 0,Y,!rn):X.call(this,Te.x,Te.y),rn=!0}else if(wt[on].close===!0)this.pdf.internal.out("h"),rn=!1;else if(wt[on].begin!==!0){var De=wt[on].start.x,$e=wt[on].start.y;bt.call(this,wt[on].deltas,De,$e),rn=!0}yt&&rt.call(this,yt),Y&&jt.call(this)}},_t=function(P){var Y=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,tt=Y*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return P-tt;case"top":return P+Y-tt;case"hanging":return P+Y-2*tt;case"middle":return P+Y/2-tt;default:return P}},kt=function(P){return P+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};y.prototype.createLinearGradient=function(){var P=function(){};return P.colorStops=[],P.addColorStop=function(Y,tt){this.colorStops.push([Y,tt])},P.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},P.isCanvasGradient=!0,P},y.prototype.createPattern=function(){return this.createLinearGradient()},y.prototype.createRadialGradient=function(){return this.createLinearGradient()};var xt=function(P,Y,tt,yt,wt,At,qt,Rt,Zt){for(var Me=dt.call(this,tt,yt,wt,At),le=0;le<Me.length;le++){var Ie=Me[le];le===0&&(Zt?J.call(this,Ie.x1+P,Ie.y1+Y):X.call(this,Ie.x1+P,Ie.y1+Y)),Lt.call(this,P,Y,Ie.x2,Ie.y2,Ie.x3,Ie.y3,Ie.x4,Ie.y4)}Rt?jt.call(this):rt.call(this,qt)},rt=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()},J=function(P,Y){this.pdf.internal.out(n(P)+" "+r(Y)+" m")},ct=function(P){var Y;switch(P.align){case"right":case"end":Y="right";break;case"center":Y="center";break;default:Y="left"}var tt,yt,wt,At=this.pdf.getTextDimensions(P.text),qt=_t.call(this,P.y),Rt=kt.call(this,qt)-At.h,Zt=this.ctx.transform.applyToPoint(new l(P.x,qt));if(this.autoPaging){var Me=this.ctx.transform.decompose(),le=new f;le=(le=(le=le.multiply(Me.translate)).multiply(Me.skew)).multiply(Me.scale);for(var Ie=this.ctx.transform.applyToRectangle(new c(P.x,qt,At.w,At.h)),Ue=le.applyToRectangle(new c(P.x,Rt,At.w,At.h)),ft=L.call(this,Ue),Re=[],rn=0;rn<ft.length;rn+=1)Re.indexOf(ft[rn])===-1&&Re.push(ft[rn]);V(Re);for(var on=Re[0],xe=Re[Re.length-1],_e=on;_e<xe+1;_e++){this.pdf.setPage(_e);var Te=_e===1?this.posY+this.margin[0]:this.margin[0],De=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],$e=this.pdf.internal.pageSize.height-this.margin[2],fn=$e-this.margin[0],In=this.pdf.internal.pageSize.width-this.margin[1],bn=In-this.margin[3],Nn=_e===1?0:De+(_e-2)*fn;if(this.ctx.clip_path.length!==0){var xn=this.path;tt=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=H(tt,this.posX+this.margin[3],-1*Nn+Te),gt.call(this,"fill",!0),this.path=xn}var ze=H([JSON.parse(JSON.stringify(Ue))],this.posX+this.margin[3],-Nn+Te+this.ctx.prevPageLastElemOffset)[0];P.scale>=.01&&(yt=this.pdf.internal.getFontSize(),this.pdf.setFontSize(yt*P.scale),wt=this.lineWidth,this.lineWidth=wt*P.scale);var Qe=this.autoPaging!=="text";if(Qe||ze.y+ze.h<=$e){if(Qe||ze.y>=Te&&ze.x<=In){var je=Qe?P.text:this.pdf.splitTextToSize(P.text,P.maxWidth||In-ze.x)[0],dr=H([JSON.parse(JSON.stringify(Ie))],this.posX+this.margin[3],-Nn+Te+this.ctx.prevPageLastElemOffset)[0],mn=Qe&&(_e>on||_e<xe)&&M.call(this);mn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],bn,fn,null).clip().discardPath()),this.pdf.text(je,dr.x,dr.y,{angle:P.angle,align:Y,renderingMode:P.renderingMode}),mn&&this.pdf.restoreGraphicsState()}}else ze.y<$e&&(this.ctx.prevPageLastElemOffset+=$e-ze.y);P.scale>=.01&&(this.pdf.setFontSize(yt),this.lineWidth=wt)}}else P.scale>=.01&&(yt=this.pdf.internal.getFontSize(),this.pdf.setFontSize(yt*P.scale),wt=this.lineWidth,this.lineWidth=wt*P.scale),this.pdf.text(P.text,Zt.x+this.posX,Zt.y+this.posY,{angle:P.angle,align:Y,renderingMode:P.renderingMode,maxWidth:P.maxWidth}),P.scale>=.01&&(this.pdf.setFontSize(yt),this.lineWidth=wt)},X=function(P,Y,tt,yt){tt=tt||0,yt=yt||0,this.pdf.internal.out(n(P+tt)+" "+r(Y+yt)+" l")},bt=function(P,Y,tt){return this.pdf.lines(P,Y,tt,null,null)},Lt=function(P,Y,tt,yt,wt,At,qt,Rt){this.pdf.internal.out([t(i(tt+P)),t(s(yt+Y)),t(i(wt+P)),t(s(At+Y)),t(i(qt+P)),t(s(Rt+Y)),"c"].join(" "))},dt=function(P,Y,tt,yt){for(var wt=2*Math.PI,At=Math.PI/2;Y>tt;)Y-=wt;var qt=Math.abs(tt-Y);qt<wt&&yt&&(qt=wt-qt);for(var Rt=[],Zt=yt?-1:1,Me=Y;qt>1e-5;){var le=Me+Zt*Math.min(qt,At);Rt.push(st.call(this,P,Me,le)),qt-=Math.abs(le-Me),Me=le}return Rt},st=function(P,Y,tt){var yt=(tt-Y)/2,wt=P*Math.cos(yt),At=P*Math.sin(yt),qt=wt,Rt=-At,Zt=qt*qt+Rt*Rt,Me=Zt+qt*wt+Rt*At,le=4/3*(Math.sqrt(2*Zt*Me)-Me)/(qt*At-Rt*wt),Ie=qt-le*Rt,Ue=Rt+le*qt,ft=Ie,Re=-Ue,rn=yt+Y,on=Math.cos(rn),xe=Math.sin(rn);return{x1:P*Math.cos(Y),y1:P*Math.sin(Y),x2:Ie*on-Ue*xe,y2:Ie*xe+Ue*on,x3:ft*on-Re*xe,y3:ft*xe+Re*on,x4:P*Math.cos(tt),y4:P*Math.sin(tt)}},lt=function(P){return 180*P/Math.PI},zt=function(P,Y,tt,yt,wt,At){var qt=P+.5*(tt-P),Rt=Y+.5*(yt-Y),Zt=wt+.5*(tt-wt),Me=At+.5*(yt-At),le=Math.min(P,wt,qt,Zt),Ie=Math.max(P,wt,qt,Zt),Ue=Math.min(Y,At,Rt,Me),ft=Math.max(Y,At,Rt,Me);return new c(le,Ue,Ie-le,ft-Ue)},Mt=function(P,Y,tt,yt,wt,At,qt,Rt){var Zt,Me,le,Ie,Ue,ft,Re,rn,on,xe,_e,Te,De,$e,fn=tt-P,In=yt-Y,bn=wt-tt,Nn=At-yt,xn=qt-wt,ze=Rt-At;for(Me=0;Me<41;Me++)on=(Re=(le=P+(Zt=Me/40)*fn)+Zt*((Ue=tt+Zt*bn)-le))+Zt*(Ue+Zt*(wt+Zt*xn-Ue)-Re),xe=(rn=(Ie=Y+Zt*In)+Zt*((ft=yt+Zt*Nn)-Ie))+Zt*(ft+Zt*(At+Zt*ze-ft)-rn),Me==0?(_e=on,Te=xe,De=on,$e=xe):(_e=Math.min(_e,on),Te=Math.min(Te,xe),De=Math.max(De,on),$e=Math.max($e,xe));return new c(Math.round(_e),Math.round(Te),Math.round(De-_e),Math.round($e-Te))},K=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var P,Y,tt=(P=this.ctx.lineDash,Y=this.ctx.lineDashOffset,JSON.stringify({lineDash:P,lineDashOffset:Y}));this.prevLineDash!==tt&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=tt)}}})(gn.API),(function(e){var t=function(l){var c,f,d,p,y,b,g,C,M,L;for(f=[],d=0,p=(l+=c="\0\0\0\0".slice(l.length%4||4)).length;p>d;d+=4)(y=(l.charCodeAt(d)<<24)+(l.charCodeAt(d+1)<<16)+(l.charCodeAt(d+2)<<8)+l.charCodeAt(d+3))!==0?(b=(y=((y=((y=((y=(y-(L=y%85))/85)-(M=y%85))/85)-(C=y%85))/85)-(g=y%85))/85)%85,f.push(b+33,g+33,C+33,M+33,L+33)):f.push(122);return(function(D,H){for(var V=H;V>0;V--)D.pop()})(f,c.length),String.fromCharCode.apply(String,f)+"~>"},n=function(l){var c,f,d,p,y,b=String,g="length",C=255,M="charCodeAt",L="slice",D="replace";for(l[L](-2),l=l[L](0,-2)[D](/\s/g,"")[D]("z","!!!!!"),d=[],p=0,y=(l+=c="uuuuu"[L](l[g]%5||5))[g];y>p;p+=5)f=52200625*(l[M](p)-33)+614125*(l[M](p+1)-33)+7225*(l[M](p+2)-33)+85*(l[M](p+3)-33)+(l[M](p+4)-33),d.push(C&f>>24,C&f>>16,C&f>>8,C&f);return(function(H,V){for(var W=V;W>0;W--)H.pop()})(d,c[g]),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=Qy(c)).reduce(function(d,p){return d+String.fromCharCode(p)},"")};e.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=n(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(" ")}}})(gn.API),(function(e){e.loadFile=function(t,n,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 y=new XMLHttpRequest,b=0,g=function(C){var M=C.length,L=[],D=String.fromCharCode;for(b=0;b<M;b+=1)L.push(D(255&C.charCodeAt(b)));return L.join("")};if(y.open("GET",f,!d),y.overrideMimeType("text/plain; charset=x-user-defined"),d===!1&&(y.onload=function(){y.status===200?p(g(this.responseText)):p(void 0)}),y.send(null),d&&y.status===200)return g(y.responseText)})(i,s,l)}catch{}return c})(t,n,r)},e.allowFsRead=void 0,e.loadImageFile=e.loadFile})(gn.API),(function(e){function t(){return(Xn.html2canvas?Promise.resolve(Xn.html2canvas):O1(()=>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 n(){return(Xn.DOMPurify?Promise.resolve(Xn.DOMPurify):O1(()=>import("./purify.es-C0_7NiBM.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=$r(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),y=f.firstChild;y;y=y.nextSibling)d!==!0&&y.nodeType===1&&y.nodeName==="SCRIPT"||p.appendChild(c(y,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(n).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,y=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:y,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 g=0;g<p.length;++g){var C=p[g],M=C.src.find(function(L){return L.format==="truetype"});M&&d.addFont(M.url,C.ref.name,C.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||gn.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,y){return d.updateProgress(null,null,1,[p]),Promise.prototype.then.call(this,function(b){return d.updateProgress(null,p),b}).then(p,y).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 y=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?p:l.convert(Object.assign({},p),Promise.prototype),b=d.call(y,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,gn.getPageSize=function(c,f,d){if($r(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 y,b=(""+d).toLowerCase(),g={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":y=1;break;case"mm":y=72/25.4;break;case"cm":y=72/2.54;break;case"in":y=72;break;case"px":y=.75;break;case"pc":case"em":y=12;break;case"ex":y=6;break;default:throw"Invalid unit: "+f}var C,M=0,L=0;if(g.hasOwnProperty(b))M=g[b][1]/y,L=g[b][0]/y;else try{M=d[1],L=d[0]}catch{throw new Error("Invalid format: "+d)}if(c==="p"||c==="portrait")c="p",L>M&&(C=L,L=M,M=C);else{if(c!=="l"&&c!=="landscape")throw"Invalid orientation: "+c;c="l",M>L&&(C=L,L=M,M=C)}return{width:L,height:M,unit:f,k:y,orientation:c}},e.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(Z1):null;var d=new l(f);return f.worker?d:d.from(c).doCallback()}})(gn.API),gn.API.addJS=function(e){var t,n,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})(e);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"),n=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&&n!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},(function(e){var t;e.events.push(["postPutResources",function(){var n=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=n.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];n.internal.newObjectDeferredBegin(f,!1)}n.internal.write(l)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,p=[];for(s=0;s<d;s++){var y=n.internal.newObject();p.push(y);var b=n.internal.getPageInfo(s+1);n.internal.write("<< /D["+b.objId+" 0 R /XYZ null null null]>> endobj")}var g=n.internal.newObject();for(n.internal.write("<< /Names [ "),s=0;s<p.length;s++)n.internal.write("(page_"+(s+1)+")"+p[s]+" 0 R");n.internal.write(" ] >>","endobj"),t=n.internal.newObject(),n.internal.write("<< /Dests "+g+" 0 R"),n.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var n=this;n.outline.root.children.length>0&&(n.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&n.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var n=this;n.outline={createNamedDestinations:!1,root:{children:[]}},n.outline.add=function(r,i,s){var l={title:i,options:s,children:[]};return r==null&&(r=this.root),r.children.push(l),l},n.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=n,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},n.outline.genIds_r=function(r){r.id=n.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},n.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()},n.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=n.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])},n.outline.line=function(r){this.ctx.val+=r+`\r
50
+ `},n.outline.makeRef=function(r){return r.id+" 0 R"},n.outline.makeString=function(r){return"("+n.internal.pdfEscape(r)+")"},n.outline.objStart=function(r){this.ctx.val+=`\r
51
+ `+r.id+` 0 obj\r
52
+ <<\r
53
+ `},n.outline.objEnd=function(){this.ctx.val+=`>> \r
54
+ endobj\r
55
+ `},n.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}}])})(gn.API),(function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(n,r,i,s,l,c){var f,d=this.decode.DCT_DECODE,p=null;if(typeof n=="string"||this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n)){switch(n=l||n,n=this.__addimage__.isArrayBuffer(n)?new Uint8Array(n):n,f=(function(y){for(var b,g=256*y.charCodeAt(4)+y.charCodeAt(5),C=y.length,M={width:0,height:0,numcomponents:1},L=4;L<C;L+=2){if(L+=g,t.indexOf(y.charCodeAt(L+1))!==-1){b=256*y.charCodeAt(L+5)+y.charCodeAt(L+6),M={width:256*y.charCodeAt(L+7)+y.charCodeAt(L+8),height:b,numcomponents:y.charCodeAt(L+9)};break}g=256*y.charCodeAt(L+2)+y.charCodeAt(L+3)}return M})(n=this.__addimage__.isArrayBufferView(n)?this.__addimage__.arrayBufferToBinaryString(n):n),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:n,width:f.width,height:f.height,colorSpace:c,bitsPerComponent:8,filter:d,index:r,alias:i}}return p}})(gn.API),gn.API.processPNG=function(e,t,n,r){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var i,s=eN(e,{checkCrc:!0}),l=s.width,c=s.height,f=s.channels,d=s.palette,p=s.depth;i=d&&f===1?(function(xt){for(var rt=xt.width,jt=xt.height,J=xt.data,ct=xt.palette,X=xt.depth,bt=!1,Lt=[],dt=[],st=void 0,lt=!1,zt=0,Mt=0;Mt<ct.length;Mt++){var K=Mv(ct[Mt],4),P=K[0],Y=K[1],tt=K[2],yt=K[3];Lt.push(P,Y,tt),yt!=null&&(yt===0?(zt++,dt.length<1&&dt.push(Mt)):yt<255&&(lt=!0))}if(lt||zt>1){bt=!0,dt=void 0;var wt=rt*jt;st=new Uint8Array(wt);for(var At=new DataView(J.buffer),qt=0;qt<wt;qt++){var Rt=ty(At,qt,X),Zt=Mv(ct[Rt],4)[3];st[qt]=Zt}}else zt===0&&(dt=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:bt?8:void 0,colorBytes:J,alphaBytes:st,needSMask:bt,palette:Lt,mask:dt}})(s):f===2||f===4?(function(xt){for(var rt=xt.data,jt=xt.width,J=xt.height,ct=xt.channels,X=xt.depth,bt=ct===2?"DeviceGray":"DeviceRGB",Lt=ct-1,dt=jt*J,st=Lt,lt=dt*st,zt=1*dt,Mt=Math.ceil(lt*X/8),K=Math.ceil(zt*X/8),P=new Uint8Array(Mt),Y=new Uint8Array(K),tt=new DataView(rt.buffer),yt=new DataView(P.buffer),wt=new DataView(Y.buffer),At=!1,qt=0;qt<dt;qt++){for(var Rt=qt*ct,Zt=0;Zt<st;Zt++)Tw(yt,ty(tt,Rt+Zt,X),qt*st+Zt,X);var Me=ty(tt,Rt+st,X);Me<(1<<X)-1&&(At=!0),Tw(wt,Me,1*qt,X)}return{colorSpace:bt,colorsPerPixel:Lt,sMaskBitsPerComponent:At?X:void 0,colorBytes:P,alphaBytes:Y,needSMask:At}})(s):(function(xt){var rt=xt.data,jt=xt.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:jt,colorsPerPixel:jt==="DeviceGray"?1:3,colorBytes:rt instanceof Uint16Array?(function(J){for(var ct=J.length,X=new Uint8Array(2*ct),bt=new DataView(X.buffer,X.byteOffset,X.byteLength),Lt=0;Lt<ct;Lt++)bt.setUint16(2*Lt,J[Lt],!1);return X})(rt):rt,needSMask:!1}})(s);var y,b,g,C=i,M=C.colorSpace,L=C.colorsPerPixel,D=C.sMaskBitsPerComponent,H=C.colorBytes,V=C.alphaBytes,W=C.needSMask,gt=C.palette,_t=C.mask,kt=null;return r!==gn.API.image_compression.NONE&&typeof Qy=="function"?(kt=(function(xt){var rt;switch(xt){case gn.API.image_compression.FAST:rt=11;break;case gn.API.image_compression.MEDIUM:rt=13;break;case gn.API.image_compression.SLOW:rt=14;break;default:rt=12}return rt})(r),y=this.decode.FLATE_DECODE,b="/Predictor ".concat(kt," /Colors ").concat(L," /BitsPerComponent ").concat(p," /Columns ").concat(l),e=kw(H,Math.ceil(l*L*p/8),L,p,r),W&&(g=kw(V,Math.ceil(l*D/8),1,D,r))):(y=void 0,b=void 0,e=H,W&&(g=V)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(g&&this.__addimage__.isArrayBuffer(g)||this.__addimage__.isArrayBufferView(g))&&(g=this.__addimage__.arrayBufferToBinaryString(g)),{alias:n,data:e,index:t,filter:y,decodeParameters:b,transparency:_t,palette:gt,sMask:g,predictor:kt,width:l,height:c,bitsPerComponent:p,sMaskBitsPerComponent:D,colorSpace:M}}},(function(e){e.processGIF89A=function(t,n,r,i){var s=new SN(t),l=s.width,c=s.height,f=[];s.decodeAndBlitFrameRGBA(0,f);var d={data:f,width:l,height:c},p=new ey(100).encode(d,100);return e.processJPEG.call(this,p,n,r,i)},e.processGIF87A=e.processGIF89A})(gn.API),Jl.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 e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var n=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:n,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},Jl.prototype.parseBGR=function(){this.pos=this.offset;var e="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[e]()}catch(n){si.log("bit decode error:"+n)}},Jl.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),n=t%4;for(e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,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}n!==0&&(this.pos+=4-n)}},Jl.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<e;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)}},Jl.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),s=n*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}e!==0&&(this.pos+=4-e)}},Jl.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,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+=e}},Jl.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),n=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&n)/n*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+=e}},Jl.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){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*n;this.data[l]=s,this.data[l+1]=i,this.data[l+2]=r,this.data[l+3]=255}this.pos+=this.width%4}},Jl.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){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*n;this.data[c]=s,this.data[c+1]=i,this.data[c+2]=r,this.data[c+3]=l}},Jl.prototype.getData=function(){return this.data},(function(e){e.processBMP=function(t,n,r,i){var s=new Jl(t,!1),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new ey(100).encode(f,100);return e.processJPEG.call(this,d,n,r,i)}})(gn.API),_w.prototype.getData=function(){return this.data},(function(e){e.processWEBP=function(t,n,r,i){var s=new _w(t),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new ey(100).encode(f,100);return e.processJPEG.call(this,d,n,r,i)}})(gn.API),gn.API.processRGBA=function(e,t,n){for(var r=e.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],y=r[d+1],b=r[d+2],g=r[d+3];s[c++]=p,s[c++]=y,s[c++]=b,l[f++]=g}var C=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(l),data:C,index:t,alias:n,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},gn.API.setLanguage=function(e){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"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,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},Ad=gn.API,ym=Ad.getCharWidthsArray=function(e,t){var n,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,y=t.doKerning!==!1,b=0,g=e.length,C=0,M=c[0]||f,L=[];for(n=0;n<g;n++)r=e.charCodeAt(n),typeof i.metadata.widthOfString=="function"?L.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(r))+l*(1e3/s)||0)/1e3):(b=y&&$r(d[r])==="object"&&!isNaN(parseInt(d[r][C],10))?d[r][C]/p:0,L.push((c[r]||M)/f+b)),C=r;return L},vw=Ad.getStringUnitWidth=function(e,t){var n=(t=t||{}).fontSize||this.internal.getFontSize(),r=t.font||this.internal.getFont(),i=t.charSpace||this.internal.getCharSpace();return Ad.processArabic&&(e=Ad.processArabic(e)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(e,n,i)/n:ym.apply(this,arguments).reduce(function(s,l){return s+l},0)},ww=function(e,t,n,r){for(var i=[],s=0,l=e.length,c=0;s!==l&&c+t[s]<n;)c+=t[s],s++;i.push(e.slice(0,s));var f=s;for(c=0;s!==l;)c+t[s]>r&&(i.push(e.slice(f,s)),c=0,f=s),c+=t[s],s++;return f!==s&&i.push(e.slice(f,s)),i},Sw=function(e,t,n){n||(n={});var r,i,s,l,c,f,d,p=[],y=[p],b=n.textIndent||0,g=0,C=0,M=e.split(" "),L=ym.apply(this,[" ",n])[0];if(f=n.lineIndent===-1?M[0].length+2:n.lineIndent||0){var D=Array(f).join(" "),H=[];M.map(function(W){(W=W.split(/\s*\n/)).length>1?H=H.concat(W.map(function(gt,_t){return(_t&&gt.length?`
56
+ `:"")+gt})):H.push(W[0])}),M=H,f=vw.apply(this,[D,n])}for(s=0,l=M.length;s<l;s++){var V=0;if(r=M[s],f&&r[0]==`
57
+ `&&(r=r.substr(1),V=1),b+g+(C=(i=ym.apply(this,[r,n])).reduce(function(W,gt){return W+gt},0))>t||V){if(C>t){for(c=ww.apply(this,[r,i,t-(b+g),t]),p.push(c.shift()),p=[c.pop()];c.length;)y.push([c.shift()]);C=i.slice(r.length-(p[0]?p[0].length:0)).reduce(function(W,gt){return W+gt},0)}else p=[r];y.push(p),b=C+f,g=L}else p.push(r),b+=g+C,g=L}return d=f?function(W,gt){return(gt?D:"")+W.join(" ")}:function(W){return W.join(" ")},y.map(d)},Ad.splitTextToSize=function(e,t,n){var r,i=(n=n||{}).fontSize||this.internal.getFontSize(),s=(function(p){if(p.widths&&p.kerning)return{widths:p.widths,kerning:p.kerning};var y=this.internal.getFont(p.fontName,p.fontStyle),b="Unicode";return y.metadata[b]?{widths:y.metadata[b].widths||{0:1},kerning:y.metadata[b].kerning||{}}:{font:y.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(e)?e:String(e).split(/\r?\n/);var l=1*this.internal.scaleFactor*t/i;s.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/i:0,s.lineIndent=n.lineIndent;var c,f,d=[];for(c=0,f=r.length;c<f;c++)d=d.concat(Sw.apply(this,[r[c],l,s]));return d},(function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",n="klmnopqrstuvwxyz",r={},i={},s=0;s<16;s++)r[n[s]]=t[s],i[t[s]]=n[s];var l=function(b){return"0x"+parseInt(b,10).toString(16)},c=e.__fontmetrics__.compress=function(b){var g,C,M,L,D=["{"];for(var H in b){if(g=b[H],isNaN(parseInt(H,10))?C="'"+H+"'":(H=parseInt(H,10),C=(C=l(H).slice(2)).slice(0,-1)+i[C.slice(-1)]),typeof g=="number")g<0?(M=l(g).slice(3),L="-"):(M=l(g).slice(2),L=""),M=L+M.slice(0,-1)+i[M.slice(-1)];else{if($r(g)!=="object")throw new Error("Don't know what to do with value type "+$r(g)+".");M=c(g)}D.push(C+M)}return D.push("}"),D.join("")},f=e.__fontmetrics__.uncompress=function(b){if(typeof b!="string")throw new Error("Invalid argument passed to uncompress.");for(var g,C,M,L,D={},H=1,V=D,W=[],gt="",_t="",kt=b.length-1,xt=1;xt<kt;xt+=1)(L=b[xt])=="'"?g?(M=g.join(""),g=void 0):g=[]:g?g.push(L):L=="{"?(W.push([V,M]),V={},M=void 0):L=="}"?((C=W.pop())[0][C[1]]=V,M=void 0,V=C[0]):L=="-"?H=-1:M===void 0?r.hasOwnProperty(L)?(gt+=r[L],M=parseInt(gt,16)*H,H=1,gt=""):gt+=L:r.hasOwnProperty(L)?(_t+=r[L],V[M]=parseInt(_t,16)*H,H=1,M=void 0,_t=""):_t+=L;return D},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}},y={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}}}")}};e.events.push(["addFont",function(b){var g=b.font,C=y.Unicode[g.postScriptName];C&&(g.metadata.Unicode={},g.metadata.Unicode.widths=C.widths,g.metadata.Unicode.kerning=C.kerning);var M=p.Unicode[g.postScriptName];M&&(g.metadata.Unicode.encoding=M,g.encoding=M.codePages[0])}])})(gn.API),(function(e){var t=function(n){for(var r=n.length,i=new Uint8Array(r),s=0;s<r;s++)i[s]=n.charCodeAt(s);return i};e.API.events.push(["addFont",function(n){var r=void 0,i=n.font,s=n.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(qm(c)),l.metadata=e.API.TTFFont.open(c),l.metadata.Unicode=l.metadata.Unicode||{encoding:{},kerning:{},widths:[]},l.metadata.glyIdsUsed=[0]})(i,r)}}])})(gn),gn.API.addSvgAsImage=function(e,t,n,r,i,s,l,c){if(isNaN(t)||isNaN(n))throw si.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(i))throw si.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},y=this;return(Xn.canvg?Promise.resolve(Xn.canvg):O1(()=>import("./index.es-COZX40-D.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,e,p)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(b){return b.render(p)}).then(function(){y.addImage(f.toDataURL("image/jpeg",1),t,n,r,i,l,c)})},gn.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),n=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,n);return this},gn.API.viewerPreferences=function(e,t){var n;e=e||{},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,y=0;function b(C,M){var L,D=!1;for(L=0;L<C.length;L+=1)C[L]===M&&(D=!0);return D}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(l)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var g=c.length;for(y=0;y<g;y+=1)n[c[y]].value=n[c[y]].defaultValue,n[c[y]].explicitSet=!1}if($r(e)==="object"){for(i in e)if(s=e[i],b(c,i)&&s!==void 0){if(n[i].type==="boolean"&&typeof s=="boolean")n[i].value=s;else if(n[i].type==="name"&&b(n[i].valueSet,s))n[i].value=s;else if(n[i].type==="integer"&&Number.isInteger(s))n[i].value=s;else if(n[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(" "))}n[i].value="["+f.join(" ")+"]"}else n[i].value=n[i].defaultValue;n[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var C,M=[];for(C in n)n[C].explicitSet===!0&&(n[C].type==="name"?M.push("/"+C+" /"+n[C].value):M.push("/"+C+" "+n[C].value));M.length!==0&&this.internal.write(`/ViewerPreferences
58
+ <<
59
+ `+M.join(`
60
+ `)+`
61
+ >>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},gn.API.addMetadata=function(e,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:e,namespaceUri:t??"http://jspdf.default.namespaceuri/",rawXml:typeof t=="boolean"&&t},this.internal.events.subscribe("putCatalog",AN),this.internal.events.subscribe("postPutResources",kN)),this},(function(e){var t=e.API,n=t.pdfEscape16=function(s,l){for(var c,f=l.metadata.Unicode.widths,d=["","0","00","000","0000"],p=[""],y=0,b=s.length;y<b;++y){if(c=l.metadata.characterToGlyph(s.charCodeAt(y)),l.metadata.glyIdsUsed.push(c),l.metadata.toUnicode[c]=s.charCodeAt(y),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,y,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=[],y=0,b=(c=Object.keys(s).sort(function(g,C){return g-C})).length;y<b;y++)l=c[y],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 e.API.TTFFont&&c.encoding==="Identity-H"){for(var y=c.metadata.Unicode.widths,b=c.metadata.subset.encode(c.metadata.glyIdsUsed,1),g="",C=0;C<b.length;C++)g+=String.fromCharCode(b[C]);var M=d();p({data:g,addLength1:!0,objectId:M}),f("endobj");var L=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:L}),f("endobj");var D=d();f("<<"),f("/Type /FontDescriptor"),f("/FontName /"+Ld(c.fontName)),f("/FontFile2 "+M+" 0 R"),f("/FontBBox "+e.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 /"+Ld(c.fontName)),f("/FontDescriptor "+D+" 0 R"),f("/W "+e.API.PDFObject.convert(y)),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 "+L+" 0 R"),f("/BaseFont /"+Ld(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 e.API.TTFFont&&c.encoding==="WinAnsiEncoding"){for(var y=c.metadata.rawData,b="",g=0;g<y.length;g++)b+=String.fromCharCode(y[g]);var C=d();p({data:b,addLength1:!0,objectId:C}),f("endobj");var M=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:M}),f("endobj");var L=d();f("<<"),f("/Descent "+c.metadata.decender),f("/CapHeight "+c.metadata.capHeight),f("/StemV "+c.metadata.stemV),f("/Type /FontDescriptor"),f("/FontFile2 "+C+" 0 R"),f("/Flags 96"),f("/FontBBox "+e.API.PDFObject.convert(c.metadata.bbox)),f("/FontName /"+Ld(c.fontName)),f("/ItalicAngle "+c.metadata.italicAngle),f("/Ascent "+c.metadata.ascender),f(">>"),f("endobj"),c.objectNumber=d();for(var D=0;D<c.metadata.hmtx.widths.length;D++)c.metadata.hmtx.widths[D]=parseInt(c.metadata.hmtx.widths[D]*(1e3/c.metadata.head.unitsPerEm));f("<</Subtype/TrueType/Type/Font/ToUnicode "+M+" 0 R/BaseFont/"+Ld(c.fontName)+"/FontDescriptor "+L+" 0 R/Encoding/"+c.encoding+" /FirstChar 29 /LastChar 255 /Widths "+e.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||{},y=s.mutex||{},b=y.pdfEscape,g=y.activeFontKey,C=y.fonts,M=g,L="",D=0,H="",V=C[M].encoding;if(C[M].encoding!=="Identity-H")return{text:c,x:f,y:d,options:p,mutex:y};for(H=c,M=g,Array.isArray(c)&&(H=c[0]),D=0;D<H.length;D+=1)C[M].metadata.hasOwnProperty("cmap")&&(l=C[M].metadata.cmap.unicode.codeMap[H[D].charCodeAt(0)]),l||H[D].charCodeAt(0)<256&&C[M].metadata.hasOwnProperty("Unicode")?L+=H[D]:L+="";var W="";return parseInt(M.slice(1))<14||V==="WinAnsiEncoding"?W=b(L,M).split("").map(function(gt){return gt.charCodeAt(0).toString(16)}).join(""):V==="Identity-H"&&(W=n(L,C[M])),y.isHex=!0,{text:W,x:f,y:d,options:p,mutex:y}};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}])})(gn),(function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0},e.addFileToVFS=function(n,r){return t.call(this),this.internal.vFS[n]=r,this},e.getFileFromVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0?this.internal.vFS[n]:null}})(gn.API),(function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(r){var i,s,l,c,f,d,p,y=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]],g=[[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]],C={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},M={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},L=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],D=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,V=0;this.__bidiEngine__={};var W=function(J){var ct=J.charCodeAt(),X=ct>>8,bt=M[X];return bt!==void 0?y[256*bt+(255&ct)]:X===252||X===253?"AL":D.test(X)?"L":X===8?"R":"N"},gt=function(J){for(var ct,X=0;X<J.length;X++){if((ct=W(J.charAt(X)))==="L")return!1;if(ct==="R")return!0}return!1},_t=function(J,ct,X,bt){var Lt,dt,st,lt,zt=ct[bt];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":bt<1||bt+1>=ct.length||(Lt=X[bt-1])!=="EN"&&Lt!=="AN"||(dt=ct[bt+1])!=="EN"&&dt!=="AN"?zt="N":H&&(dt="AN"),zt=dt===Lt?dt:"N";break;case"ES":zt=(Lt=bt>0?X[bt-1]:"B")==="EN"&&bt+1<ct.length&&ct[bt+1]==="EN"?"EN":"N";break;case"ET":if(bt>0&&X[bt-1]==="EN"){zt="EN";break}if(H){zt="N";break}for(st=bt+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=bt+1;st<lt&&ct[st]==="NSM";)st++;if(st<lt){var Mt=J[bt],K=Mt>=1425&&Mt<=2303||Mt===64286;if(Lt=ct[st],K&&(Lt==="R"||Lt==="AL")){zt="R";break}}}zt=bt<1||(Lt=ct[bt-1])==="B"?"N":X[bt-1];break;case"B":H=!1,i=!0,zt=V;break;case"S":s=!0,zt="N"}return zt},kt=function(J,ct,X){var bt=J.split("");return X&&xt(bt,X,{hiLevel:V}),bt.reverse(),ct&&ct.reverse(),bt.join("")},xt=function(J,ct,X){var bt,Lt,dt,st,lt,zt=-1,Mt=J.length,K=0,P=[],Y=V?g:b,tt=[];for(H=!1,i=!1,s=!1,Lt=0;Lt<Mt;Lt++)tt[Lt]=W(J[Lt]);for(dt=0;dt<Mt;dt++){if(lt=K,P[dt]=_t(J,tt,P,dt),bt=240&(K=Y[lt][C[P[dt]]]),K&=15,ct[dt]=st=Y[K][5],bt>0)if(bt===16){for(Lt=zt;Lt<dt;Lt++)ct[Lt]=1;zt=-1}else zt=-1;if(Y[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),X.hiLevel|=st}s&&(function(yt,wt,At){for(var qt=0;qt<At;qt++)if(yt[qt]==="S"){wt[qt]=V;for(var Rt=qt-1;Rt>=0&&yt[Rt]==="WS";Rt--)wt[Rt]=V}})(tt,ct,Mt)},rt=function(J,ct,X,bt,Lt){if(!(Lt.hiLevel<J)){if(J===1&&V===1&&!i)return ct.reverse(),void(X&&X.reverse());for(var dt,st,lt,zt,Mt=ct.length,K=0;K<Mt;){if(bt[K]>=J){for(lt=K+1;lt<Mt&&bt[lt]>=J;)lt++;for(zt=K,st=lt-1;zt<st;zt++,st--)dt=ct[zt],ct[zt]=ct[st],ct[st]=dt,X&&(dt=X[zt],X[zt]=X[st],X[st]=dt);K=lt}K++}}},jt=function(J,ct,X){var bt=J.split(""),Lt={hiLevel:V};return X||(X=[]),xt(bt,X,Lt),(function(dt,st,lt){if(lt.hiLevel!==0&&p)for(var zt,Mt=0;Mt<dt.length;Mt++)st[Mt]===1&&(zt=L.indexOf(dt[Mt]))>=0&&(dt[Mt]=L[zt+1])})(bt,X,Lt),rt(2,bt,ct,X,Lt),rt(1,bt,ct,X,Lt),bt.join("")};return this.__bidiEngine__.doBidiReorder=function(J,ct,X){if((function(Lt,dt){if(dt)for(var st=0;st<Lt.length;st++)dt[st]=st;c===void 0&&(c=gt(Lt)),d===void 0&&(d=gt(Lt))})(J,ct),l||!f||d)if(l&&f&&c^d)V=c?1:0,J=kt(J,ct,X);else if(!l&&f&&d)V=c?1:0,J=jt(J,ct,X),J=kt(J,ct);else if(!l||c||f||d){if(l&&!f&&c^d)J=kt(J,ct),c?(V=0,J=jt(J,ct,X)):(V=1,J=jt(J,ct,X),J=kt(J,ct));else if(l&&c&&!f&&d)V=1,J=jt(J,ct,X),J=kt(J,ct);else if(!l&&!f&&c^d){var bt=p;c?(V=1,J=jt(J,ct,X),V=0,p=!1,J=jt(J,ct,X),p=bt):(V=0,J=jt(J,ct,X),J=kt(J,ct),V=1,p=!1,J=jt(J,ct,X),p=bt,J=kt(J,ct))}}else V=0,J=jt(J,ct,X);else V=c?1:0,J=jt(J,ct,X);return J},this.__bidiEngine__.setOptions=function(J){J&&(l=J.isInputVisual,f=J.isOutputVisual,c=J.isInputRtl,d=J.isOutputRtl,p=J.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"],n=new e.__bidiEngine__({isInputVisual:!0});e.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,n.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([n.doBidiReorder(i[c][0]),i[c][1],i[c][2]]):l.push([n.doBidiReorder(i[c])]);r.text=l}else r.text=n.doBidiReorder(i);n.setOptions({isInputVisual:!0})}])})(gn),gn.API.TTFFont=(function(){function e(t){var n;if(this.rawData=t,n=this.contents=new hf(t),this.contents.pos=4,n.readString(4)==="ttcf")throw new Error("TTCF not supported.");n.pos=0,this.parse(),this.subset=new BN(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new MN(this.contents),this.head=new EN(this),this.name=new DN(this),this.cmap=new s4(this),this.toUnicode={},this.hhea=new TN(this),this.maxp=new RN(this),this.hmtx=new ON(this),this.post=new _N(this),this.os2=new NN(this),this.loca=new zN(this),this.glyf=new PN(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]},e.prototype.registerTTF=function(){var t,n,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&(n=i>>16)&&(n=-(1+(65535^n))),this.italicAngle=+(n+"."+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")},e.prototype.characterToGlyph=function(t){var n;return((n=this.cmap.unicode)!=null?n.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var n;return n=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*n},e.prototype.widthOfString=function(t,n,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/n)||0;return l*(n/1e3)},e.prototype.lineHeight=function(t,n){var r;return n==null&&(n=!1),r=n?this.lineGap:0,(this.ascender+r-this.decender)/1e3*t},e})();var ic,hf=(function(){function e(t){this.data=t??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(t){return this.data[this.pos++]=t},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},e.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},e.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},e.prototype.readString=function(t){var n,r;for(r=[],n=0;0<=t?n<t:n>t;n=0<=t?++n:--n)r[n]=String.fromCharCode(this.readByte());return r.join("")},e.prototype.writeString=function(t){var n,r,i;for(i=[],n=0,r=t.length;0<=r?n<r:n>r;n=0<=r?++n:--n)i.push(this.writeByte(t.charCodeAt(n)));return i},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,n,r,i,s,l,c,f;return t=this.readByte(),n=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^n)+1099511627776*(255^r)+4294967296*(255^i)+16777216*(255^s)+65536*(255^l)+256*(255^c)+(255^f)+1):72057594037927940*t+281474976710656*n+1099511627776*r+4294967296*i+16777216*s+65536*l+256*c+f},e.prototype.writeLongLong=function(t){var n,r;return n=Math.floor(t/4294967296),r=4294967295&t,this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var n,r;for(n=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)n.push(this.readByte());return n},e.prototype.write=function(t){var n,r,i,s;for(s=[],r=0,i=t.length;r<i;r++)n=t[r],s.push(this.writeByte(n));return s},e})(),MN=(function(){var e;function t(n){var r,i,s;for(this.scalarType=n.readInt(),this.tableCount=n.readShort(),this.searchRange=n.readShort(),this.entrySelector=n.readShort(),this.rangeShift=n.readShort(),this.tables={},i=0,s=this.tableCount;0<=s?i<s:i>s;i=0<=s?++i:--i)r={tag:n.readString(4),checksum:n.readInt(),offset:n.readInt(),length:n.readInt()},this.tables[r.tag]=r}return t.prototype.encode=function(n){var r,i,s,l,c,f,d,p,y,b,g,C,M;for(M in g=Object.keys(n).length,f=Math.log(2),y=16*Math.floor(Math.log(g)/f),l=Math.floor(y/f),p=16*g-y,(i=new hf).writeInt(this.scalarType),i.writeShort(g),i.writeShort(y),i.writeShort(l),i.writeShort(p),s=16*g,d=i.pos+s,c=null,C=[],n)for(b=n[M],i.writeString(M),i.writeInt(e(b)),i.writeInt(d),i.writeInt(b.length),C=C.concat(b),M==="head"&&(c=d),d+=b.length;d%4;)C.push(0),d++;return i.write(C),r=2981146554-e(i.data),i.pos=c+8,i.writeUInt32(r),i.data},e=function(n){var r,i,s,l;for(n=a4.call(n);n.length%4;)n.push(0);for(s=new hf(n),i=0,r=0,l=n.length;r<l;r=r+=4)i+=s.readUInt32();return 4294967295&i},t})(),CN={}.hasOwnProperty,Ic=function(e,t){for(var n in t)CN.call(t,n)&&(e[n]=t[n]);function r(){this.constructor=e}return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};ic=(function(){function e(t){var n;this.file=t,n=this.file.directory.tables[this.tag],this.exists=!!n,n&&(this.offset=n.offset,this.length=n.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e})();var EN=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="head",e.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()},e.prototype.encode=function(t){var n;return(n=new hf).writeInt(this.version),n.writeInt(this.revision),n.writeInt(this.checkSumAdjustment),n.writeInt(this.magicNumber),n.writeShort(this.flags),n.writeShort(this.unitsPerEm),n.writeLongLong(this.created),n.writeLongLong(this.modified),n.writeShort(this.xMin),n.writeShort(this.yMin),n.writeShort(this.xMax),n.writeShort(this.yMax),n.writeShort(this.macStyle),n.writeShort(this.lowestRecPPEM),n.writeShort(this.fontDirectionHint),n.writeShort(t),n.writeShort(this.glyphDataFormat),n.data},e})(),Lw=(function(){function e(t,n){var r,i,s,l,c,f,d,p,y,b,g,C,M,L,D,H,V;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=n+t.readInt(),y=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(g=t.readUInt16(),b=g/2,t.pos+=6,s=(function(){var W,gt;for(gt=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)gt.push(t.readUInt16());return gt})(),t.pos+=2,M=(function(){var W,gt;for(gt=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)gt.push(t.readUInt16());return gt})(),d=(function(){var W,gt;for(gt=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)gt.push(t.readUInt16());return gt})(),p=(function(){var W,gt;for(gt=[],f=W=0;0<=b?W<b:W>b;f=0<=b?++W:--W)gt.push(t.readUInt16());return gt})(),i=(this.length-t.pos+this.offset)/2,c=(function(){var W,gt;for(gt=[],f=W=0;0<=i?W<i:W>i;f=0<=i?++W:--W)gt.push(t.readUInt16());return gt})(),f=D=0,V=s.length;D<V;f=++D)for(L=s[f],r=H=C=M[f];C<=L?H<=L:H>=L;r=C<=L?++H:--H)p[f]===0?l=r+d[f]:(l=c[p[f]/2+(r-C)-(b-f)]||0)!==0&&(l+=d[f]),this.codeMap[r]=65535&l}t.pos=y}return e.encode=function(t,n){var r,i,s,l,c,f,d,p,y,b,g,C,M,L,D,H,V,W,gt,_t,kt,xt,rt,jt,J,ct,X,bt,Lt,dt,st,lt,zt,Mt,K,P,Y,tt,yt,wt,At,qt,Rt,Zt,Me,le;switch(bt=new hf,l=Object.keys(t).sort(function(Ie,Ue){return Ie-Ue}),n){case"macroman":for(M=0,L=(function(){var Ie=[];for(C=0;C<256;++C)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]=++M),s[i]={old:t[i],new:H[t[i]]},L[i]=H[t[i]];return bt.writeUInt16(1),bt.writeUInt16(0),bt.writeUInt32(12),bt.writeUInt16(0),bt.writeUInt16(262),bt.writeUInt16(0),bt.write(L),{charMap:s,subtable:bt.data,maxGlyphID:M+1};case"unicode":for(ct=[],y=[],V=0,H={},r={},D=d=null,dt=0,Mt=l.length;dt<Mt;dt++)H[gt=t[i=l[dt]]]==null&&(H[gt]=++V),r[i]={old:gt,new:H[gt]},c=H[gt]-i,D!=null&&c===d||(D&&y.push(D),ct.push(i),d=c),D=i;for(D&&y.push(D),y.push(65535),ct.push(65535),jt=2*(rt=ct.length),xt=2*Math.pow(Math.log(rt)/Math.LN2,2),b=Math.log(xt/2)/Math.LN2,kt=2*rt-xt,f=[],_t=[],g=[],C=st=0,K=ct.length;st<K;C=++st){if(J=ct[C],p=y[C],J===65535){f.push(0),_t.push(0);break}if(J-(X=r[J].new)>=32768)for(f.push(0),_t.push(2*(g.length+rt-C)),i=lt=J;J<=p?lt<=p:lt>=p;i=J<=p?++lt:--lt)g.push(r[i].new);else f.push(X-J),_t.push(0)}for(bt.writeUInt16(3),bt.writeUInt16(1),bt.writeUInt32(12),bt.writeUInt16(4),bt.writeUInt16(16+8*rt+2*g.length),bt.writeUInt16(0),bt.writeUInt16(jt),bt.writeUInt16(xt),bt.writeUInt16(b),bt.writeUInt16(kt),At=0,P=y.length;At<P;At++)i=y[At],bt.writeUInt16(i);for(bt.writeUInt16(0),qt=0,Y=ct.length;qt<Y;qt++)i=ct[qt],bt.writeUInt16(i);for(Zt=0,tt=f.length;Zt<tt;Zt++)c=f[Zt],bt.writeUInt16(c);for(Me=0,yt=_t.length;Me<yt;Me++)W=_t[Me],bt.writeUInt16(W);for(le=0,wt=g.length;le<wt;le++)M=g[le],bt.writeUInt16(M);return{charMap:r,subtable:bt.data,maxGlyphID:V+1}}},e})(),s4=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="cmap",e.prototype.parse=function(t){var n,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)n=new Lw(t,this.offset),this.tables.push(n),n.isUnicode&&this.unicode==null&&(this.unicode=n);return!0},e.encode=function(t,n){var r,i;return n==null&&(n="macroman"),r=Lw.encode(t,n),(i=new hf).writeUInt16(0),i.writeUInt16(1),r.table=i.data.concat(r.subtable),r},e})(),TN=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="hhea",e.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()},e})(),NN=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="OS/2",e.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 n,r;for(r=[],n=0;n<10;++n)r.push(t.readByte());return r})(),this.charRange=(function(){var n,r;for(r=[],n=0;n<4;++n)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 n,r;for(r=[],n=0;n<2;n=++n)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()},e})(),_N=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="post",e.prototype.parse=function(t){var n,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;)n=t.readByte(),i.push(this.names.push(t.readString(n)));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)}},e})(),LN=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},DN=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="name",e.prototype.parse=function(t){var n,r,i,s,l,c,f,d,p,y,b;for(t.pos=this.offset,t.readShort(),n=t.readShort(),c=t.readShort(),r=[],s=0;0<=n?s<n:s>n;s=0<=n?++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,y=r.length;p<y;s=++p)i=r[s],t.pos=i.offset,d=t.readString(i.length),l=new LN(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]},e})(),RN=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="maxp",e.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()},e})(),ON=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="hmtx",e.prototype.parse=function(t){var n,r,i,s,l,c,f;for(t.pos=this.offset,this.metrics=[],n=0,c=this.file.hhea.numberOfMetrics;0<=c?n<c:n>c;n=0<=c?++n:--n)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=[],n=d=0;0<=i?d<i:d>i;n=0<=i?++d:--d)p.push(t.readInt16());return p})(),this.widths=(function(){var d,p,y,b;for(b=[],d=0,p=(y=this.metrics).length;d<p;d++)s=y[d],b.push(s.advance);return b}).call(this),r=this.widths[this.widths.length-1],f=[],n=l=0;0<=i?l<i:l>i;n=0<=i?++l:--l)f.push(this.widths.push(r));return f},e.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]}},e})(),a4=[].slice,PN=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var n,r,i,s,l,c,f,d,p,y;return t in this.cache?this.cache[t]:(s=this.file.loca,n=this.file.contents,r=s.indexOf(t),(i=s.lengthOf(t))===0?this.cache[t]=null:(n.pos=this.offset+r,l=(c=new hf(n.read(i))).readShort(),d=c.readShort(),y=c.readShort(),f=c.readShort(),p=c.readShort(),this.cache[t]=l===-1?new jN(c,d,y,f,p):new IN(c,l,d,y,f,p),this.cache[t]))},e.prototype.encode=function(t,n,r){var i,s,l,c,f;for(l=[],s=[],c=0,f=n.length;c<f;c++)i=t[n[c]],s.push(l.length),i&&(l=l.concat(i.encode(r)));return s.push(l.length),{table:l,offsets:s}},e})(),IN=(function(){function e(t,n,r,i,s,l){this.raw=t,this.numberOfContours=n,this.xMin=r,this.yMin=i,this.xMax=s,this.yMax=l,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e})(),jN=(function(){function e(t,n,r,i,s){var l,c;for(this.raw=t,this.xMin=n,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 e.prototype.encode=function(){var t,n,r;for(n=new hf(a4.call(this.raw.data)),t=0,r=this.glyphIDs.length;t<r;++t)n.pos=this.glyphOffsets[t];return n.data},e})(),zN=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ic(e,ic),e.prototype.tag="loca",e.prototype.parse=function(t){var n,r;return t.pos=this.offset,n=this.file.head.indexToLocFormat,this.offsets=n===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)},e.prototype.indexOf=function(t){return this.offsets[t]},e.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},e.prototype.encode=function(t,n){for(var r=new Uint32Array(this.offsets.length),i=0,s=0,l=0;l<r.length;++l)if(r[l]=i,s<n.length&&n[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},e})(),BN=(function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,n,r,i,s;for(n in i=this.font.cmap.tables[0].codeMap,t={},s=this.subset)r=s[n],t[n]=i[r];return t},e.prototype.glyphsFor=function(t){var n,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 n=[],i)(r=i[s])!=null&&r.compound&&n.push.apply(n,r.glyphIDs);if(n.length>0)for(s in f=this.glyphsFor(n))r=f[s],i[s]=r;return i},e.prototype.encode=function(t,n){var r,i,s,l,c,f,d,p,y,b,g,C,M,L,D;for(i in r=s4.encode(this.generateCmap(),"unicode"),l=this.glyphsFor(t),g={0:0},D=r.charMap)g[(f=D[i]).old]=f.new;for(C in b=r.maxGlyphID,l)C in g||(g[C]=b++);return p=(function(H){var V,W;for(V in W={},H)W[H[V]]=V;return W})(g),y=Object.keys(p).sort(function(H,V){return H-V}),M=(function(){var H,V,W;for(W=[],H=0,V=y.length;H<V;H++)c=y[H],W.push(p[c]);return W})(),s=this.font.glyf.encode(l,M,g),d=this.font.loca.encode(s.offsets,M),L={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(n)},this.font.os2.exists&&(L["OS/2"]=this.font.os2.raw()),this.font.directory.encode(L)},e})();gn.API.PDFObject=(function(){var e;function t(){}return e=function(n,r){return(Array(r+1).join("0")+n).slice(-r)},t.convert=function(n){var r,i,s,l;if(Array.isArray(n))return"["+(function(){var c,f,d;for(d=[],c=0,f=n.length;c<f;c++)r=n[c],d.push(t.convert(r));return d})().join(" ")+"]";if(typeof n=="string")return"/"+n;if(n?.isString)return"("+n+")";if(n instanceof Date)return"(D:"+e(n.getUTCFullYear(),4)+e(n.getUTCMonth(),2)+e(n.getUTCDate(),2)+e(n.getUTCHours(),2)+e(n.getUTCMinutes(),2)+e(n.getUTCSeconds(),2)+"Z)";if({}.toString.call(n)==="[object Object]"){for(i in s=["<<"],n)l=n[i],s.push("/"+i+" "+t.convert(l));return s.push(">>"),s.join(`
86
+ `)}return""+n},t})();const FN=new Set(["point","polygon","polyline","rectangle","ellipse","arrow","compass","numbering","image"]);function Dw(e){return FN.has(e.anchor.type)}function ny(e,t){if(e.anchor.type!=="linked")return e.anchor;const{pinId:n}=e.anchor,r=t.find(i=>i.id===n);return!r||r.anchor.type==="linked"?null:r.anchor}function a2(e,t){if(e.anchor.type!=="linked")return e;const{pinId:n}=e.anchor,r=t.find(i=>i.id===n);return r&&r.anchor.type!=="linked"?r:null}function o5(e,t){return t.filter(n=>n.anchor.type==="linked"&&n.anchor.pinId===e).map(n=>n.id)}function UN(e,t){return new Set([e,...o5(e,t)])}const HN="1.14.0",Ml=["#FBD710","#F0462F","#FF8D28","#4FD553","#00C0E8","#0088FF","#E246A1","#FFFFFF","#A0522D","#888888","#000000"],qN="small",$N={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}},eh=$N[qN],l2=eh.maxLogicalImageSize,bm=eh.minZoom,xm=eh.maxZoom,Rw=eh.zoomWheelFactor,vm=eh.zoomPrecision,Jr=eh.contourScale,s5=1/1.25,l4=Jr*s5,c4=280*Jr,c2=100*Jr,Ow=12*Jr,Pw=12*Jr,Fh=3*Jr,Xm=1*Jr,Iw=1*Jr,jw=2*Jr,zw=1*Jr,Bw="rgba(0,0,0,0.45)",u4=2.5*Jr,Nf=2.5*Jr,Rc=.25,Kf=4,a5=.25,l5=1,YN=.5,VN=.6,Xh="solid",sg="filled",WN="44",jd=[5*Jr,3*Jr],u2=4*Jr,f4=60*Jr,Us=20,f2="iso";function wm(e){return e.toString().padStart(2,"0")}function Dd(e=new Date,t=f2){const n=e.getFullYear(),r=wm(e.getMonth()+1),i=wm(e.getDate()),s=wm(e.getHours()),l=wm(e.getMinutes());return t==="ua_full"?`${i}.${r}.${n} ${s}:${l}`:`${n}-${r}-${i} ${s}:${l}`}const Ju="#E63946",d4=3*Jr,d2=2*Jr,h2=7*Jr,h4=0,Gh=1.4,XN="image/png,image/jpeg,image/svg+xml,image/webp,image/gif,image/avif,image/bmp",GN=["PNG","JPG","SVG","WebP","GIF","AVIF","BMP"],KN=2,JN=40,ZN=4,QN=48,t_="blur",e_=.5,n_=.05,Sm=12,ry=200*Jr,km=16,p4=10*Jr,r_=.1,i_="#ffffff",o_="#000000",iy="<p>Текст</p>",p2=6,s_=5,ag=1,Fw=4,a_=18;function zd(){return typeof navigator>"u"?"Ctrl+V":/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"⌘+V":"Ctrl+V"}function Jf(e){return typeof e!="number"||!Number.isFinite(e)?l5:Math.min(Kf,Math.max(Rc,e))}function Uw(e,t){return Jf(e.strokeWidthScale??Jf(t))}function c5(e){return Jf(e).toFixed(2).replace(/\.?0+$/,"")}function m4(e){const t=1+(Jf(e)-1)*YN;return Math.max(VN,t)}function l_(e){return e.type!=="text"}const g4=!1,y4="tyts-app-settings",m2={fontId:"road-ui",strokeWidthScale:l5},c_="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif";function u_(e){return`${e==="uaf-sans"&&g4?"'UAF Sans'":"'Road UI'"}, ${c_}`}function f_(e){return e==="road-ui"?e:m2.fontId}function d_(){try{const e=localStorage.getItem(y4);if(!e)return{...m2};const t=JSON.parse(e);return{fontId:f_(t.fontId),strokeWidthScale:Jf(t.strokeWidthScale)}}catch{}return{...m2}}function Hw(e){localStorage.setItem(y4,JSON.stringify(e))}function h_(){const[e,t]=U.useState(()=>d_()),n=U.useMemo(()=>u_(e.fontId),[e.fontId]);U.useEffect(()=>{document.documentElement.style.setProperty("--tyts-font-family",n),document.body.style.fontFamily=n},[n]);const r=U.useCallback(s=>{t(l=>{const c={...l,fontId:s};return Hw(c),c})},[]),i=U.useCallback(s=>{t(l=>{const c={...l,strokeWidthScale:Jf(s)};return Hw(c),c})},[]);return{settings:e,fontFamily:n,setFontId:r,setStrokeWidthScale:i}}const p_=[{id:"road-ui",label:"Road UI"}];function m_({open:e,fontId:t,fontFamily:n,strokeWidthScale:r,onClose:i,onFontIdChange:s,onStrokeWidthScaleChange:l}){if(!e)return null;const c=(r-Rc)/(Kf-Rc)*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:n},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:p_.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:Rc,max:Kf,step:a5,value:r,"aria-label":"Товщина ліній",onChange:f=>l(Number(f.target.value)),className:"tyts-range",style:{flex:1,"--tyts-range-accent":Ju,"--tyts-range-fill":`${c}%`}}),T.jsxs("span",{style:{minWidth:42,textAlign:"right",fontVariantNumeric:"tabular-nums",fontSize:13},children:["×",c5(r)]}),T.jsx("button",{type:"button",onClick:()=>l(l5),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 b4=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],g_=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"];function y_(e){return(e.getDay()+6)%7}function Of(e){return new Date(e.getFullYear(),e.getMonth(),1)}function g2(e,t){const n=e.getFullYear(),r=e.getMonth()+t,i=e.getDate(),s=new Date(n,r+1,0).getDate();return new Date(n,r,Math.min(i,s),e.getHours(),e.getMinutes(),0,0)}function qw(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function y2(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.trunc(e))):t}function b_(e,t){const n=new Date(e,t,1),r=new Date(e,t+1,0).getDate(),i=y_(n),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(e,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 x_(e){const t=Of(e);return[g2(t,-1),t,g2(t,1)]}function v_(e){const t=e.getMonth(),n=b4[t];return t===0||t===11?`${n} ${e.getFullYear()}`:n}function b2(e,t,n){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),y2(t,0,23),y2(n,0,59),0,0)}function w_(e,t){return b2(t,e.getHours(),e.getMinutes())}function S_({monthDate:e,value:t,today:n,onSelectDay:r}){const i=e.getFullYear(),s=e.getMonth(),l=U.useMemo(()=>b_(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:v_(e)}),T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:g_.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=qw(c.date,t),p=qw(c.date,n);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:e,label:t,value:n,min:r,max:i,onChange:s}){const[l,c]=U.useState(null),f=l!==null,d=f?l:Oh(n),p=b=>{const g=b.replace(/\D/g,"");if(g===""){c(null);return}const C=y2(Number(g),r,i);s(C),c(null)},y=b=>{const g=i-r+1,C=((n-r+b)%g+g)%g+r;s(C),f&&c(Oh(C))};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:e,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:t}),T.jsx("input",{id:e,className:"tyts-time-input",type:"text",inputMode:"numeric",autoComplete:"off",spellCheck:!1,value:d,onFocus:()=>c(Oh(n)),onBlur:()=>p(l??Oh(n)),onChange:b=>{const g=b.target.value.replace(/\D/g,"").slice(0,2);c(g)},onKeyDown:b=>{b.key==="ArrowUp"?(b.preventDefault(),y(1)):b.key==="ArrowDown"?(b.preventDefault(),y(-1)):b.key==="Enter"&&(b.preventDefault(),p(l??Oh(n)),b.target.blur())},onWheel:b=>{document.activeElement===b.currentTarget&&(b.preventDefault(),y(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:()=>y(1),style:Ww,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:()=>y(-1),style:{...Ww,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 k_({year:e,selected:t,today:n,onSelectMonth:r}){return T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(120px, 1fr))",gap:8,minWidth:400,marginBottom:12},children:b4.map((i,s)=>{const l=t.getFullYear()===e&&t.getMonth()===s,c=n.getFullYear()===e&&n.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 A_({value:e,viewMonth:t,format:n,locked:r,onChange:i,onViewMonthChange:s,onFormatChange:l,onLockedChange:c,onInsert:f,onNow:d,onClose:p}){const y=U.useId(),b=U.useId(),g=U.useMemo(()=>new Date,[]),C=U.useMemo(()=>x_(t),[t]),M=Dd(e,n),[L,D]=U.useState(!1),[H,V]=U.useState(()=>t.getFullYear()),W=L?H:t.getFullYear();U.useEffect(()=>{const xt=rt=>{if(rt.key==="Escape"){if(rt.preventDefault(),rt.stopPropagation(),L){D(!1);return}p()}};return window.addEventListener("keydown",xt,!0),()=>window.removeEventListener("keydown",xt,!0)},[p,L]);const gt=()=>{V(t.getFullYear()),D(!0)},_t=xt=>{if(L){V(rt=>rt+xt);return}s(g2(t,xt))},kt=xt=>{s(Of(new Date(H,xt,1))),D(!1)};return T.jsxs("div",{role:"dialog","aria-label":"Вибір дати та часу",onClick:xt=>xt.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:L?"Попередній рік":"Попередній місяць",onClick:()=>_t(-1),style:Vw,children:T.jsx("i",{className:"bi bi-chevron-left","aria-hidden":!0})}),T.jsx("button",{type:"button",title:L?"Закрити вибір місяця":"Показати всі місяці року",onClick:()=>{L?D(!1):gt()},style:{border:"none",background:"transparent",color:"#e8eaed",fontSize:15,fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"4px 10px",borderRadius:6,textDecoration:L?"underline":"none",textUnderlineOffset:3},children:W}),T.jsx("button",{type:"button",title:L?"Наступний рік":"Наступний місяць",onClick:()=>_t(1),style:Vw,children:T.jsx("i",{className:"bi bi-chevron-right","aria-hidden":!0})})]}),L?T.jsx(k_,{year:H,selected:t,today:g,onSelectMonth:kt}):T.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap",marginBottom:12},children:C.map(xt=>T.jsx(S_,{monthDate:xt,value:e,today:g,onSelectDay:rt=>i(w_(e,rt))},`${xt.getFullYear()}-${xt.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:y,label:"Години",value:e.getHours(),min:0,max:23,onChange:xt=>i(b2(e,xt,e.getMinutes()))}),T.jsx("span",{style:{opacity:.6,fontWeight:600},children:":"}),T.jsx($w,{id:b,label:"Хвилини",value:e.getMinutes(),min:0,max:59,onChange:xt=>i(b2(e,e.getHours(),xt))})]}),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(Yw,{active:n==="iso",label:"ISO",onClick:()=>l("iso")}),T.jsx(Yw,{active:n==="ua_full",label:"UA",onClick:()=>l("ua_full")})]}),T.jsx(M_,{locked:r,onToggle:()=>c(!r)}),T.jsx("button",{type:"button",onClick:d,style:{...C_,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:M}),T.jsx("button",{type:"button",onClick:f,style:E_,children:"Вставити"})]})]})}function Yw({active:e,label:t,onClick:n}){return T.jsx("button",{type:"button",onClick:n,style:{border:e?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:e?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:e?"#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 M_({locked:e,onToggle:t}){const[n,r]=U.useState(!1),i=e?"Дата й час зафіксовані — основна кнопка «Дата/час» вставляє їх. Натисніть, щоб зняти фіксацію":"Зафіксувати дату й час: основна кнопка «Дата/час» вставлятиме їх замість поточного моменту";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":e,"aria-label":e?"Зняти фіксацію дати й часу":"Зафіксувати дату й час",style:{width:30,height:30,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:e?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:e?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:e?"#ffc2c8":"#ccc",cursor:"pointer",padding:0},children:T.jsx("i",{className:`bi ${e?"bi-lock-fill":"bi-unlock"}`,style:{fontSize:14},"aria-hidden":!0})}),n&&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 Oh(e){return e.toString().padStart(2,"0")}const Vw={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"},Ww={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},C_={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"},E_={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"},T_=20,oy=12,N_=12;function __(e,t,n){if(e.length===0)return{};const i=c4,s=c2,l=T_,c=Math.max(0,n-2*l),f=Math.max(1,Math.floor((c+oy)/(s+oy))),d={};return e.forEach((p,y)=>{const b=Math.floor(y/f),g=y%f;let C=t-l-i-b*(i+N_),M=l+g*(s+oy);C=Math.max(l,Math.min(C,t-i-l)),M=Math.max(l,Math.min(M,n-s-l)),d[p]={x:C,y:M,width:i,height:s}}),d}function L_(e,t){const n=Math.min(l2/e,l2/t,Number.POSITIVE_INFINITY);return{w:Math.round(e*n),h:Math.round(t*n)}}function u5(e,t,n,r){const i=Math.max(1,n.width),s=Math.max(1,n.height);return{x:(e-n.x)*(r.w/i),y:(t-n.y)*(r.h/s)}}function Xw(e,t,n){const r=(i,s)=>u5(i,s,t,n);switch(e.type){case"linked":return e;case"point":case"standalone":return{...e,...r(e.x,e.y)};case"text":{const i=r(e.x,e.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...e,x:i.x,y:i.y,width:e.width*(n.w/s),height:e.height*(n.h/l),...e.point?{point:r(e.point.x,e.point.y)}:{}}}case"image":case"redact":case"rectangle":{const i=r(e.x,e.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...e,x:i.x,y:i.y,width:e.width*(n.w/s),height:e.height*(n.h/l)}}case"ellipse":{const i=r(e.cx,e.cy),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...e,cx:i.x,cy:i.y,rx:e.rx*(n.w/s),ry:e.ry*(n.h/l)}}case"compass":{const i=r(e.cx,e.cy),s=Math.max(1,t.width),l=Math.max(1,t.height),c=Math.min(n.w/s,n.h/l);return{...e,cx:i.x,cy:i.y,radius:e.radius*c}}case"polygon":case"polyline":return{...e,points:e.points.map(i=>r(i.x,i.y))};case"numbering":case"arrow":{const i=r(e.start.x,e.start.y),s=r(e.end.x,e.end.y);if(e.type==="numbering")return{...e,start:i,end:s};const l=r(e.control.x,e.control.y);return{...e,start:i,end:s,control:l}}default:return e}}function Gw(e){switch(e.type){case"linked":return{x:0,y:0,w:0,h:0};case"point":case"standalone":return{x:e.x,y:e.y,w:0,h:0};case"text":case"image":case"redact":case"rectangle":return{x:e.x,y:e.y,w:e.width,h:e.height};case"ellipse":return{x:e.cx-e.rx,y:e.cy-e.ry,w:e.rx*2,h:e.ry*2};case"compass":return{x:e.cx-e.radius,y:e.cy-e.radius,w:e.radius*2,h:e.radius*2};case"polygon":case"polyline":{if(e.points.length===0)return{x:0,y:0,w:0,h:0};const t=e.points.map(s=>s.x),n=e.points.map(s=>s.y),r=Math.min(...t),i=Math.min(...n);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...n)-i}}case"numbering":case"arrow":{const t=[e.start.x,e.end.x],n=[e.start.y,e.end.y];e.type==="arrow"&&(t.push(e.control.x),n.push(e.control.y));const r=Math.min(...t),i=Math.min(...n);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...n)-i}}default:return e}}function D_(e,t){const n=e.x+e.w,r=e.y+e.h,i=t.x+t.w,s=t.y+t.h;return e.x<=i&&n>=t.x&&e.y<=s&&r>=t.y}function Am(e,t){return D_(e,{x:0,y:0,w:t.w,h:t.h})}function Kw(e,t,n){const r=u5(e.x,e.y,t,n),i=Math.max(1,t.width),s=Math.max(1,t.height);return{x:r.x,y:r.y,width:e.width*(n.w/i),height:e.height*(n.h/s)}}function R_(e,t,n,r){const i=[],s={},l=new Set;for(const c of e){if(c.anchor.type==="linked")continue;const f=Xw(c.anchor,n,r),d=t[c.id],p=d?Kw(d,n,r):null;(Am(Gw(f),r)||p!==null&&Am({x:p.x,y:p.y,w:p.width,h:p.height},r))&&l.add(c.id)}for(const c of e){if(c.anchor.type==="linked"&&!l.has(c.anchor.pinId))continue;const f=Xw(c.anchor,n,r),d=Gw(f),p=c.anchor.type==="linked"?!0:Am(d,r),y=t[c.id],b=y?Kw(y,n,r):null,g=b?Am({x:b.x,y:b.y,w:b.width,h:b.height},r):!1;if(!p&&!g)continue;const C=c.leaderPoints?.map(M=>u5(M.x,M.y,n,r));i.push(C?{...c,anchor:f,leaderPoints:C}:{...c,anchor:f}),b&&(s[c.id]=b)}return{pins:i,cardPositions:s}}function x4(e){const n=(e||"").replace(/<br\s*\/?>/gi,`
87
+ `).replace(/<\/p>/gi,`
88
+ `).replace(/<\/div>/gi,`
89
+ `).replace(/<[^>]+>/g,"").split(`
90
+ `);for(;n.length>1&&n[n.length-1].trim()==="";)n.pop();return n}function v4(e,t){const n=t*Gh;return Math.ceil(e*n+ag*2)}function O_(e,t,n){const r=x4(e),i=n?.fontSize??Us,s=p2*2+ag*2,l=Math.max(1,...r.map(d=>Math.ceil(t(d||" ")))),c=Math.max(24,l+s),f=Math.max(a_,v4(r.length,i));return{width:c,height:f}}function P_(e,t,n){const r=e.width/2,i=e.height/2,s=Math.abs(Math.cos(t)),l=Math.abs(Math.sin(t));if(s>1e-9){const d=(r+n)/s;if(d*l<=i)return d}if(l>1e-9){const d=(i+n)/l;if(d*s<=r)return d}const c=s*r+l*i,f=r*r+i*i-n*n;return c+Math.sqrt(Math.max(0,c*c-f))}function w4(e,t,n,r=p4){const i=P_(n,t,r);return{x:e.x+Math.cos(t)*i-n.width/2,y:e.y+Math.sin(t)*i-n.height/2}}function I_(e,t,n,r=p4){const i=Math.atan2(t.y-e.y,t.x-e.x);return w4(e,i,n,r)}function j_(e,t,n){const r=n.x+n.width/2,i=n.y+n.height/2,s=e-r,l=t-i,c=n.width/2/Math.abs(s||.001),f=n.height/2/Math.abs(l||.001),d=Math.min(c,f);return{x:r+s*d,y:i+l*d}}function r0(e,t,n,r,i,s){const l=i-n,c=s-r,f=l*l+c*c;if(f===0)return{x:n,y:r,dist2:(e-n)**2+(t-r)**2};let d=((e-n)*l+(t-r)*c)/f;d=Math.max(0,Math.min(1,d));const p=n+d*l,y=r+d*c;return{x:p,y,dist2:(e-p)**2+(t-y)**2}}function z_(e,t,n){if(e.length===0)return{x:t,y:n};if(e.length===1)return{x:e[0].x,y:e[0].y};let r={x:e[0].x,y:e[0].y,dist2:1/0};for(let i=0;i<e.length;i++){const s=e[i],l=e[(i+1)%e.length],c=r0(t,n,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function B_(e,t,n){if(e.length===0)return{x:t,y:n};if(e.length===1)return{x:e[0].x,y:e[0].y};let r={x:e[0].x,y:e[0].y,dist2:1/0};for(let i=0;i<e.length-1;i++){const s=e[i],l=e[i+1],c=r0(t,n,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function F_(e,t,n,r,i){let l={x:e.x,y:e.y,dist2:1/0},c=e;for(let f=1;f<=24;f+=1){const d=f/24,p=1-d,y={x:p*p*e.x+2*p*d*t.x+d*d*n.x,y:p*p*e.y+2*p*d*t.y+d*d*n.y},b=r0(r,i,c.x,c.y,y.x,y.y);b.dist2<l.dist2&&(l=b),c=y}return{x:l.x,y:l.y}}function S4(e,t,n){const r=Math.cos(-n),i=Math.sin(-n);return{x:e*r-t*i,y:e*i+t*r}}function k4(e,t,n){const r=Math.cos(n),i=Math.sin(n);return{x:e*r-t*i,y:e*i+t*r}}function sy(e,t,n,r=0){const{x:i,y:s,width:l,height:c}=e,f=i+l/2,d=s+c/2,p=r*Math.PI/180,y=S4(t-f,n-d,p),b=l/2,g=c/2,C=[[[-b,-g],[b,-g]],[[b,-g],[b,g]],[[b,g],[-b,g]],[[-b,g],[-b,-g]]];let M={x:0,y:0,dist2:1/0};for(const[D,H]of C){const V=r0(y.x,y.y,D[0],D[1],H[0],H[1]);V.dist2<M.dist2&&(M=V)}const L=k4(M.x,M.y,p);return{x:f+L.x,y:d+L.y}}function Jw(e,t,n,r=0){const{cx:i,cy:s,rx:l,ry:c}=e;if(l<=0||c<=0)return{x:i,y:s};const f=r*Math.PI/180,d=S4(t-i,n-s,f),p=Math.atan2(d.y*l,d.x*c),y=l*Math.cos(p),b=c*Math.sin(p),g=k4(y,b,f);return{x:i+g.x,y:s+g.y}}function U_(e,t){const n=t.x+t.width/2,r=t.y+t.height/2;return e.type==="point"?{x:e.x,y:e.y}:e.type==="standalone"?{x:e.x,y:e.y}:e.type==="polygon"?z_(e.points,n,r):e.type==="polyline"?B_(e.points,n,r):e.type==="arrow"?F_(e.start,e.control,e.end,n,r):e.type==="rectangle"?sy(e,n,r,e.rotation??0):e.type==="image"||e.type==="redact"?sy(e,n,r):e.type==="ellipse"?Jw(e,n,r,e.rotation??0):e.type==="compass"?Jw({cx:e.cx,cy:e.cy,rx:e.radius,ry:e.radius},n,r,e.rotation??0):{x:n,y:r}}function x2(e,t,n=[]){const r=(Array.isArray(n)?n:[]).filter(f=>!!f&&Number.isFinite(f.x)&&Number.isFinite(f.y)),i=r[0],s=U_(e,i?{x:i.x,y:i.y,width:0,height:0}:t),l=r.length>0?r[r.length-1]:s,c=j_(l.x,l.y,t);return[s,...r,c]}function H_(e){return e.map((t,n)=>`${n===0?"M":"L"} ${t.x} ${t.y}`).join(" ")}function q_(e){const t=[];for(let n=0;n<e.length-1;n+=1)t.push({x:(e[n].x+e[n+1].x)/2,y:(e[n].y+e[n+1].y)/2});return t}function Zw(e){return e.z??Number.POSITIVE_INFINITY}function lg(e){return e.map((t,n)=>({pin:t,index:n})).sort((t,n)=>Zw(t.pin)-Zw(n.pin)||t.index-n.index).map(t=>t.pin)}function $_(e,t,n){switch(e){case"front":return n;case"back":return 0;case"up":return Math.min(n,t+1);case"down":return Math.max(0,t-1);default:return e}}function A4(e,t){const n=e.find(i=>i.id===t);if(!n)return new Set;const r=a2(n,e)??n;return new Set([r.id,...o5(r.id,e)])}function Y_(e,t,n){if(!e.some(b=>b.id===t))return[...e];const r=A4(e,t),i=lg(e),s=i.filter(b=>r.has(b.id)),l=i.filter(b=>!r.has(b.id));if(s.length===0)return[...e];const c=i.findIndex(b=>r.has(b.id)),f=i.slice(0,c).filter(b=>!r.has(b.id)).length,d=$_(n,f,l.length),p=[...l.slice(0,d),...s,...l.slice(d)],y=new Map(p.map((b,g)=>[b.id,g]));return e.every(b=>!y.has(b.id)||b.z===y.get(b.id))?[...e]:e.map(b=>y.has(b.id)?{...b,z:y.get(b.id)}:b)}function V_(e,t,n){if(!e.some(f=>f.id===t))return!1;const r=A4(e,t),i=lg(e),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 n==="front"||n==="up"?c<l:c>0}function W_(e){if(e.type==="linked")return{x:0,y:0};if(e.type==="point")return{x:e.x,y:e.y};if(e.type==="numbering")return{x:e.end.x,y:e.end.y};if(e.type==="standalone")return{x:e.x,y:e.y};if(e.type==="rectangle")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="text")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="image")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="redact")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="ellipse")return{x:e.cx,y:e.cy};if(e.type==="compass")return{x:e.cx,y:e.cy};if(e.type==="arrow")return{x:(e.start.x+e.end.x+e.control.x)/3,y:(e.start.y+e.end.y+e.control.y)/3};if(e.type==="polygon"||e.type==="polyline"){const t=e.points;if(t.length===0)return{x:0,y:0};const n=t.reduce((i,s)=>i+s.x,0),r=t.reduce((i,s)=>i+s.y,0);return{x:n/t.length,y:r/t.length}}return{x:0,y:0}}function X_(e,t,n){const r=i=>({x:i.x+t,y:i.y+n});switch(e.type){case"linked":return e;case"point":case"standalone":return{...e,...r(e)};case"text":return{...e,...r(e),...e.point?{point:r(e.point)}:{}};case"image":case"redact":case"rectangle":return{...e,...r(e)};case"ellipse":case"compass":{const i=r({x:e.cx,y:e.cy});return{...e,cx:i.x,cy:i.y}}case"polygon":case"polyline":return{...e,points:e.points.map(r)};case"numbering":return{...e,start:r(e.start),end:r(e.end)};case"arrow":return{...e,start:r(e.start),end:r(e.end),control:r(e.control)};default:return e}}function Qw(e,t){return{pin:{...e},card:t?{...t}:null}}function G_(e,t,n){const r=W_(e.pin.anchor),i=t.x-r.x,s=t.y-r.y;return M4(e,i,s,n)}function M4(e,t,n,r){return{pin:{...e.pin,id:r,anchor:X_(e.pin.anchor,t,n)},card:e.card?{...e.card,x:e.card.x+t,y:e.card.y+n}:null}}function f5(e){switch(e.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 e}}function C4(e){switch(e.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 e}}function Vu(e){return f5(e.anchor)&&(e.strokeStyle??Xh)==="dashed"}function Gm(e,t){return(t??sg)==="none"?null:`${e}${WN}`}function ay(e,t){return Gm(e,t)??"transparent"}const E4=24*Jr,K_=12,J_=12*Jr,Km=1.25*Jr;function Z_(e,t,n,r=E4,i=J_){const s=i+r;switch(e){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,n-s)};case"sw":return{cx:s,cy:Math.max(s,n-s)};default:return e}}function d5(e){const t=Math.max(1,e),n=-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:n},{x:i,y:r},{x:-i,y:r}],letterY:-t,fontSize:s,arcGapHalfRad:l,arcStartRad:c+l,arcEndRad:c-l+Math.PI*2}}function Q_(e,t,n){const{arcStartRad:r,arcEndRad:i}=d5(n),s=e+n*Math.cos(r),l=t+n*Math.sin(r),c=e+n*Math.cos(i),f=t+n*Math.sin(i);return`M ${s} ${l} A ${n} ${n} 0 1 1 ${c} ${f}`}function t8(e,t){const{cx:n,cy:r,radius:i,rotation:s=0,color:l,strokeWidth:c=Km}=t,f=s*Math.PI/180,d=d5(i);e.save(),e.translate(n,r),e.rotate(f),e.beginPath(),e.arc(0,0,i,d.arcStartRad,d.arcEndRad,!1),e.strokeStyle=l,e.lineWidth=c,e.lineCap="round",e.stroke();const[p,y,b]=d.arrowPoints;e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(y.x,y.y),e.lineTo(b.x,b.y),e.closePath(),e.fillStyle=l,e.fill(),e.fillStyle=l,e.font=`700 ${d.fontSize}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillText("N",0,d.letterY),e.restore()}const e8=Su.memo(function({x:t,y:n,color:r,widthScale:i=1,onClick:s,onMouseDown:l,onPointerDown:c}){const f=Fh*i;return T.jsx("g",{transform:`translate(${t}, ${n})`,onClick:s,onPointerDown:c,onMouseDown:l,style:{cursor:l?"grab":"pointer"},children:T.jsx("circle",{r:f,fill:r,stroke:"white",strokeWidth:Xm*i})})},(e,t)=>e.x===t.x&&e.y===t.y&&e.color===t.color&&e.label===t.label&&e.active===t.active&&e.widthScale===t.widthScale),T4=(e,t,n)=>e+(t-e)*Math.min(1,Math.max(0,n));function n8(e){return T4(KN,JN,e)}function r8(e){return T4(ZN,QN,e)}function i8(e,t,n){const r=n.w/Math.max(1,t.w),i=n.h/Math.max(1,t.h);return{sx:e.x*r,sy:e.y*i,sw:Math.max(1,e.width*r),sh:Math.max(1,e.height*i)}}function o8(e,t){let n=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;n+=e[f],r+=e[f+1],i+=e[f+2],s+=1}return s?{r:Math.round(n/s),g:Math.round(r/s),b:Math.round(i/s)}:null}const s8=24;function a8(e,t,n,r){const{sx:i,sy:s,sw:l,sh:c}=i8(t,n,r),f=s8,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(e,i,s,l,c,0,0,f,f);const y=o8(p.getImageData(0,0,f,f).data,f);return y?`rgb(${y.r}, ${y.g}, ${y.b})`:null}catch{return null}}function tS(e,t,n,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(e,t,n,r,i,0,0,s,l)}catch{return null}return c}function N4(e,t,n){const{rect:r,mode:i,strength:s,imageSize:l,sourceSize:c}=n;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 L=a8(t,r,l,c);e.save(),e.fillStyle=L??"#808080",e.fillRect(r.x,r.y,r.width,r.height),e.restore();return}if(i==="blur"){const L=n8(s),D=L*2,H=tS(t,(r.x-D)*f,(r.y-D)*d,(r.width+D*2)*f,(r.height+D*2)*d);if(!H)return;e.save(),e.beginPath(),e.rect(r.x,r.y,r.width,r.height),e.clip(),e.filter=`blur(${L}px)`,e.drawImage(H,r.x-D,r.y-D,r.width+D*2,r.height+D*2),e.filter="none",e.restore();return}const p=tS(t,r.x*f,r.y*d,r.width*f,r.height*d);if(!p)return;const y=r8(s),b=Math.max(1,Math.round(r.width/y)),g=Math.max(1,Math.round(r.height/y)),C=document.createElement("canvas");C.width=b,C.height=g;const M=C.getContext("2d");M&&(M.imageSmoothingEnabled=!0,M.drawImage(p,0,0,b,g),e.save(),e.beginPath(),e.rect(r.x,r.y,r.width,r.height),e.clip(),e.imageSmoothingEnabled=!1,e.drawImage(C,0,0,b,g,r.x,r.y,r.width,r.height),e.imageSmoothingEnabled=!0,e.restore())}const l8=U.memo(function({x:t,y:n,width:r,height:i,mode:s,strength:l,source:c,imageSize:f,resolution:d=2}){const p=U.useRef(null);return U.useEffect(()=>{const y=p.current;if(!y||!c||r<=0||i<=0)return;const b={w:c.naturalWidth,h:c.naturalHeight};if(!b.w||!b.h)return;y.width=Math.max(1,Math.round(r*d)),y.height=Math.max(1,Math.round(i*d));const g=y.getContext("2d");g&&(g.setTransform(d,0,0,d,-t*d,-n*d),g.clearRect(t,n,r,i),N4(g,c,{rect:{x:t,y:n,width:r,height:i},mode:s,strength:l,imageSize:f,sourceSize:b}))},[t,n,r,i,s,l,c,f,d]),T.jsx("foreignObject",{x:t,y:n,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 _4=gk();const c8=mk(_4);var ly={exports:{}},cy={};var eS;function u8(){if(eS)return cy;eS=1;var e=wp();function t(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,s=e.useLayoutEffect,l=e.useDebugValue;function c(y,b){var g=b(),C=r({inst:{value:g,getSnapshot:b}}),M=C[0].inst,L=C[1];return s(function(){M.value=g,M.getSnapshot=b,f(M)&&L({inst:M})},[y,g,b]),i(function(){return f(M)&&L({inst:M}),y(function(){f(M)&&L({inst:M})})},[y]),l(g),g}function f(y){var b=y.getSnapshot;y=y.value;try{var g=b();return!n(y,g)}catch{return!0}}function d(y,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return cy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,cy}var nS;function L4(){return nS||(nS=1,ly.exports=u8()),ly.exports}var D4=L4();function ms(e){this.content=e}ms.prototype={constructor:ms,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),s=r.content.slice();return i==-1?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new ms(s)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new ms(n)},addToStart:function(e,t){return new ms([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ms(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),s=r.find(e);return i.splice(s==-1?i.length:s,0,t,n),new ms(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=ms.from(e),e.size?new ms(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ms.from(e),e.size?new ms(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ms.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};ms.from=function(e){if(e instanceof ms)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ms(t)};function R4(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),s=t.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let l=0;i.text[l]==s.text[l];l++)n++;return n}if(i.content.size||s.content.size){let l=R4(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function O4(e,t,n,r){for(let i=e.childCount,s=t.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let l=e.child(--i),c=t.child(--s),f=l.nodeSize;if(l==c){n-=f,r-=f;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let d=0,p=Math.min(l.text.length,c.text.length);for(;d<p&&l.text[l.text.length-d-1]==c.text[c.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let d=O4(l.content,c.content,n-1,r-1);if(d)return d}n-=f,r-=f}}class Ce{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,i=0,s){for(let l=0,c=0;c<n;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,n-p),r,i+p)}c=d}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let s="",l=!0;return this.nodesBetween(t,n,(c,f)=>{let d=c.isText?c.text.slice(Math.max(t,f)-f,n-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 n=this.lastChild,r=t.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.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,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let s=0,l=0;l<n;s++){let c=this.content[s],f=l+c.nodeSize;f>t&&((l<t||f>n)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=f}return new Ce(r,i)}cutByIndex(t,n){return t==n?Ce.empty:t==0&&n==this.content.length?this:new Ce(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[t]=n,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 n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))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 n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];t(i,r,n),r+=i.nodeSize}}findDiffStart(t,n=0){return R4(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return O4(this,t,n,r)}findIndex(t){if(t==0)return Mm(0,t);if(t==this.size)return Mm(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=t)return s==t?Mm(n+1,s):Mm(n,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,n){if(!n)return Ce.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ce(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Ce.empty;let n,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)?(n||(n=t.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Ce(n||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 uy={index:0,offset:0};function Mm(e,t){return uy.index=e,uy.offset=t,uy}function cg(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!cg(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!cg(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let ai=class v2{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,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))n||(n=t.slice(0,i));else{if(s.type.excludes(this.type))return t;!r&&s.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&cg(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return v2.none;if(t instanceof v2)return[t];let n=t.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ai.none=[];class ug extends Error{}class Ge{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=I4(this.content,t+this.openStart,n);return r&&new Ge(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Ge(P4(this.content,t+this.openStart,n+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,n){if(!n)return Ge.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ge(Ce.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let s=t.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=t.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new Ge(t,r,i)}}Ge.empty=new Ge(Ce.empty,0,0);function P4(e,t,n){let{index:r,offset:i}=e.findIndex(t),s=e.maybeChild(r),{index:l,offset:c}=e.findIndex(n);if(i==t||s.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(r,s.copy(P4(s.content,t-i-1,n-i-1)))}function I4(e,t,n,r){let{index:i,offset:s}=e.findIndex(t),l=e.maybeChild(i);if(s==t||l.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=I4(l.content,t-s-1,n,l);return c&&e.replaceChild(i,l.copy(c))}function f8(e,t,n){if(n.openStart>e.depth)throw new ug("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ug("Inconsistent open depths");return j4(e,t,n,0)}function j4(e,t,n,r){let i=e.index(r),s=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let l=j4(e,t,n,r+1);return s.copy(s.content.replaceChild(i,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let l=e.parent,c=l.content;return Hf(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=d8(n,e);return Hf(s,B4(e,l,c,t,r))}else return Hf(s,fg(e,t,r))}function z4(e,t){if(!t.type.compatibleContent(e.type))throw new ug("Cannot join "+t.type.name+" onto "+e.type.name)}function w2(e,t,n){let r=e.node(n);return z4(r,t.node(n)),r}function Uf(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Kh(e,t,n,r){let i=(t||e).node(n),s=0,l=t?t.index(n):i.childCount;e&&(s=e.index(n),e.depth>n?s++:e.textOffset&&(Uf(e.nodeAfter,r),s++));for(let c=s;c<l;c++)Uf(i.child(c),r);t&&t.depth==n&&t.textOffset&&Uf(t.nodeBefore,r)}function Hf(e,t){return e.type.checkContent(t),e.copy(t)}function B4(e,t,n,r,i){let s=e.depth>i&&w2(e,t,i+1),l=r.depth>i&&w2(n,r,i+1),c=[];return Kh(null,e,i,c),s&&l&&t.index(i)==n.index(i)?(z4(s,l),Uf(Hf(s,B4(e,t,n,r,i+1)),c)):(s&&Uf(Hf(s,fg(e,t,i+1)),c),Kh(t,n,i,c),l&&Uf(Hf(l,fg(n,r,i+1)),c)),Kh(r,null,i,c),new Ce(c)}function fg(e,t,n){let r=[];if(Kh(null,e,n,r),e.depth>n){let i=w2(e,t,n+1);Uf(Hf(i,fg(e,t,n+1)),r)}return Kh(t,null,n,r),new Ce(r)}function d8(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let s=n-1;s>=0;s--)i=t.node(s).copy(Ce.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}class up{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<t;s++)i+=r.child(s).nodeSize;return i}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return ai.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),i=t.maybeChild(n);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 n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.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 n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){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)&&(!n||n(this.node(r))))return new dg(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 n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;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 up(n,r,s)}static resolveCached(t,n){let r=rS.get(t);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==n)return l}else rS.set(t,r=new h8);let i=r.elts[r.i]=up.resolve(t,n);return r.i=(r.i+1)%p8,i}}class h8{constructor(){this.elts=[],this.i=0}}const p8=12,rS=new WeakMap;class dg{constructor(t,n,r){this.$from=t,this.$to=n,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 m8=Object.create(null);let cf=class S2{constructor(t,n,r,i=ai.none){this.type=t,this.attrs=n,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,n,r,i=0){this.content.nodesBetween(t,n,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,n,r,i){return this.content.textBetween(t,n,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,n,r){return this.type==t&&cg(this.attrs,n||t.defaultAttrs||m8)&&ai.sameSet(this.marks,r||ai.none)}copy(t=null){return t==this.content?this:new S2(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new S2(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Ge.empty;let i=this.resolve(t),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),d=i.node(l).content.cut(i.pos-c,s.pos-c);return new Ge(d,i.depth-l,s.depth-l)}replace(t,n,r){return f8(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(i==t||n.isText)return n;t-=i+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(t){return up.resolveCached(this,t)}resolveNoCache(t){return up.resolve(this,t)}rangeHasMark(t,n,r){let i=!1;return n>t&&this.nodesBetween(t,n,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()+")"),F4(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Ce.empty,i=0,s=r.childCount){let l=this.contentMatchAt(t).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,n);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,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(t).matchType(r),l=s&&s.matchFragment(this.content,n);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=ai.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!ai.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n 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(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=Ce.fromJSON(t,n.content),s=t.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};cf.prototype.text=void 0;class hg extends cf{constructor(t,n,r,i){if(super(t,n,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):F4(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new hg(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new hg(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function F4(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Zf{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new g8(t,n);if(r.next==null)return Zf.empty;let i=U4(r);r.next&&r.err("Unexpected trailing text");let s=k8(S8(i));return A8(s,r),s}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let i=this;for(let s=n;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:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let i=[this];function s(l,c){let f=l.matchFragment(t,r);if(f&&(!n||f.validEnd))return Ce.from(c.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:p,next:y}=l.next[d];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(y)==-1){i.push(y);let b=s(y,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 n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=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 n)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[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 n(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(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
+ `)}}Zf.empty=new Zf(!0);class g8{constructor(t,n){this.string=t,this.nodeTypes=n,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 U4(e){let t=[];do t.push(y8(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function y8(e){let t=[];do t.push(b8(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function b8(e){let t=w8(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=x8(e,t);else break;return t}function iS(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function x8(e,t){let n=iS(e),r=n;return e.eat(",")&&(e.next!="}"?r=iS(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function v8(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let s in n){let l=n[s];l.isInGroup(t)&&i.push(l)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function w8(e){if(e.eat("(")){let t=U4(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=v8(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function S8(e){let t=[[]];return i(s(e,0),n()),t;function n(){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=n())}else if(l.type=="star"){let f=n();return r(c,f),i(s(l.expr,f),f),[r(f)]}else if(l.type=="plus"){let f=n();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=n();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=n();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 H4(e,t){return t-e}function oS(e,t){let n=[];return r(t),n.sort(H4);function r(i){let s=e[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let l=0;l<s.length;l++){let{term:c,to:f}=s[l];!c&&n.indexOf(f)==-1&&r(f)}}}function k8(e){let t=Object.create(null);return n(oS(e,0));function n(r){let i=[];r.forEach(l=>{e[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]);oS(e,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=t[r.join(",")]=new Zf(r.indexOf(e.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(H4);s.next.push({type:i[l][0],next:t[c.join(",")]||n(c)})}return s}}function A8(e,t){for(let n=0,r=[e];n<r.length;n++){let i=r[n],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 q4(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function $4(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let s=e[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Y4(e,t,n,r){for(let i in t)if(!(i in e))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in e){let s=e[i];s.validate&&s.validate(t[i])}}function V4(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new C8(e,r,t[r]);return n}let sS=class W4{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=V4(t,r.attrs),this.defaultAttrs=q4(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==Zf.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:$4(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new cf(this,this.computeAttrs(t),Ce.from(n),ai.setFrom(r))}createChecked(t=null,n,r){return n=Ce.from(n),this.checkContent(n),new cf(this,this.computeAttrs(t),n,ai.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=Ce.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(Ce.empty,!0);return s?new cf(this,t,n.append(s),ai.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.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){Y4(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 n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:ai.none:t}static compile(t,n){let r=Object.create(null);t.forEach((s,l)=>r[s]=new W4(s,n,l));let i=n.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 M8(e,t,n){let r=n.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 ${e}, got ${s}`)}}class C8{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?M8(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class i0{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=V4(t,i.attrs),this.excluded=null;let s=q4(this.attrs);this.instance=s?new ai(this,s):null}create(t=null){return!t&&this.instance?this.instance:new ai(this,$4(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((s,l)=>r[s]=new i0(s,i++,n,l)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){Y4(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class X4{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=ms.from(t.nodes),n.marks=ms.from(t.marks||{}),this.nodes=sS.compile(this.spec.nodes,this),this.marks=i0.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]=Zf.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?aS(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==""?[]:aS(this,l.split(" "))}this.nodeFromJSON=i=>cf.fromJSON(this,i),this.markFromJSON=i=>ai.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof sS){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(n,r,i)}text(t,n){let r=this.nodes.text;return new hg(r,r.defaultAttrs,t,ai.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function aS(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e.marks[i],l=s;if(s)n.push(s);else for(let c in e.marks){let f=e.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=f)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function E8(e){return e.tag!=null}function T8(e){return e.style!=null}let Jh=class k2{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(E8(i))this.tags.push(i);else if(T8(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,n={}){let r=new cS(this,n,!1);return r.addAll(t,ai.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new cS(this,n,!0);return r.addAll(t,ai.none,n.from,n.to),Ge.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(L8(t,s.tag)&&(s.namespace===void 0||t.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(t,n,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)!=n))){if(l.getAttrs){let f=l.getAttrs(n);if(f===!1)continue;l.attrs=f||void 0}return l}}}static schemaRules(t){let n=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,i)}for(let i in t.marks){let s=t.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=uS(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=uS(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new k2(t,k2.schemaRules(t)))}};const G4={address:!0,article:!0,aside:!0,blockquote:!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},N8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},K4={ol:!0,ul:!0},fp=1,A2=2,Zh=4;function lS(e,t,n){return t!=null?(t?fp:0)|(t==="full"?A2:0):e&&e.whitespace=="pre"?fp|A2:n&~Zh}class Cm{constructor(t,n,r,i,s,l){this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=ai.none,this.match=s||(l&Zh?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ce.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);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&fp)){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 n=Ce.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(Ce.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!G4.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class cS{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,l=lS(null,n.preserveWhitespace,0)|(r?Zh:0);i?s=new Cm(i.type,i.attrs,ai.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new Cm(null,null,ai.none,!0,null,l):s=new Cm(t.schema.topNodeType,null,ai.none,!0,null,l),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,i=this.top,s=i.options&A2?"full":this.localPreserveWS||(i.options&fp)>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(),n,!0),c[f]&&this.insertNode(l.text(c[f]),n,!/\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),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,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;K4.hasOwnProperty(l)&&this.parser.normalizeLists&&_8(t);let f=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(c=this.parser.matchTag(t,this,r));t:if(f?f.ignore:N8.hasOwnProperty(l))this.findInside(t),this.ignoreFallback(t,n);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(G4.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,n);break t}let y=f&&f.skip?n:this.readStyles(t,n);y&&this.addAll(t,y),d&&this.sync(s),this.needsBlock=p}else{let d=this.readStyles(t,n);d&&this.addElementByRule(t,f,d,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
93
+ `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){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?n=n.filter(d=>!f.clearMark(d)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return n}addElementByRule(t,n,r,i){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let f=this.enter(l,n.attrs||null,r,n.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[n.mark];r=r.concat(f.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(f=>this.insertNode(f,r,!1));else{let f=t;typeof n.contentElement=="string"?f=t.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(t):n.contentElement&&(f=n.contentElement),this.findAround(t,f,!0),this.addAll(f,r),this.findAround(t,f,!1)}s&&this.sync(c)&&this.open--}addAll(t,n,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,n);this.findAtPoint(t,s)}findPlace(t,n,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++)n=this.enterInner(i[l],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(t,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(t.type));let l=ai.none;for(let c of i.concat(t.marks))(s.type?s.type.allowsMarkType(c.type):fS(c.type,t.type))&&(l=c.addToSet(l));return s.content.push(t.mark(l)),!0}return!1}enter(t,n,r,i){let s=this.findPlace(t.create(n),r,!1);return s&&(s=this.enterInner(t,n,r,!0,i)),s}enterInner(t,n,r,i=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(t);let c=lS(t,s,l.options);l.options&Zh&&l.content.length==0&&(c|=Zh);let f=ai.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):fS(d.type,t))?(f=d.addToSet(f),!1):!0),this.nodes.push(new Cm(t,n,f,i,null,c)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=fp)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&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)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=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=n[c];if(d==""){if(c==n.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(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function _8(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&K4.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function L8(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function uS(e){let t={};for(let n in e)t[n]=e[n];return t}function fS(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))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 od{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=fy(n).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,n);p&&(s.push([d,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:i}=Jm(fy(n),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,n,i)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let i=t.marks.length-1;i>=0;i--){let s=this.serializeMark(t.marks[i],t.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&Jm(fy(r),i(t,n),null,t.attrs)}static renderSpec(t,n,r=null,i){return Jm(t,n,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new od(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=dS(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return dS(t.marks)}}function dS(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function fy(e){return e.document||window.document}const hS=new WeakMap;function D8(e){let t=hS.get(e);return t===void 0&&hS.set(e,t=R8(e)),t}function R8(e){let t=null;function n(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++)n(r[i]);else for(let i in r)n(r[i])}return n(e),t}function Jm(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=D8(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&&(n=i.slice(0,l),i=i.slice(l+1));let c,f=n?e.createElementNS(n,i):e.createElement(i),d=t[1],p=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){p=2;for(let y in d)if(d[y]!=null){let b=y.indexOf(" ");b>0?f.setAttributeNS(y.slice(0,b),y.slice(b+1),d[y]):y=="style"&&f.style?f.style.cssText=d[y]:f.setAttribute(y,d[y])}}for(let y=p;y<t.length;y++){let b=t[y];if(b===0){if(y<t.length-1||y>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:g,contentDOM:C}=Jm(e,b,n,r);if(f.appendChild(g),C){if(c)throw new RangeError("Multiple content holes");c=C}}}return{dom:f,contentDOM:c}}const J4=65535,Z4=Math.pow(2,16);function O8(e,t){return e+t*Z4}function pS(e){return e&J4}function P8(e){return(e-(e&J4))/Z4}const Q4=1,tA=2,Zm=4,eA=8;class M2{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&eA)>0}get deletedBefore(){return(this.delInfo&(Q4|Zm))>0}get deletedAfter(){return(this.delInfo&(tA|Zm))>0}get deletedAcross(){return(this.delInfo&Zm)>0}}class Za{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Za.empty)return Za.empty}recover(t){let n=0,r=pS(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+P8(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,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],y=f+d;if(t<=y){let b=d?t==f?-1:t==y?1:n:n,g=f+i+(b<0?0:p);if(r)return g;let C=t==(n<0?f:y)?null:O8(c/3,t-f),M=t==f?tA:t==y?Q4:Zm;return(n<0?t!=f:t!=y)&&(M|=eA),new M2(g,M,C)}i+=p-d}return r?t+i:new M2(t+i,0,null)}touches(t,n){let r=0,i=pS(n),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 n=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+n],p=this.ranges[i+r];t(c,c+d,f,f+p),s+=p-d}}invert(){return new Za(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Za.empty:new Za(t<0?[0,-t,0]:[0,0,t])}}Za.empty=new Za([]);class dp{constructor(t,n,r=0,i=t?t.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new dp(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let i=t.getMirror(n);this.appendMap(t._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let i=t.getMirror(n);this.appendMap(t._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new dp;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(t,n);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 M2(t,i,null)}}const dy=Object.create(null);class $s{getMap(){return Za.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=dy[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in dy)throw new RangeError("Duplicate use of step JSON ID "+t);return dy[t]=n,n.prototype.jsonID=t,n}}class So{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new So(t,null)}static fail(t){return new So(null,t)}static fromReplace(t,n,r,i){try{return So.ok(t.replace(n,r,i))}catch(s){if(s instanceof ug)return So.fail(s.message);throw s}}}function h5(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(h5(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return Ce.fromArray(r)}class sf extends $s{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new Ge(h5(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return So.fromReplace(t,this.from,this.to,s)}invert(){return new ec(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sf(n.pos,r.pos,this.mark)}merge(t){return t instanceof sf&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new sf(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new sf(n.from,n.to,t.markFromJSON(n.mark))}}$s.jsonID("addMark",sf);class ec extends $s{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new Ge(h5(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return So.fromReplace(t,this.from,this.to,r)}invert(){return new sf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ec(n.pos,r.pos,this.mark)}merge(t){return t instanceof ec&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ec(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ec(n.from,n.to,t.markFromJSON(n.mark))}}$s.jsonID("removeMark",ec);class af extends $s{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return So.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return So.fromReplace(t,this.pos,this.pos+1,new Ge(Ce.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new af(this.pos,n.marks[i]);return new af(this.pos,this.mark)}}return new Qf(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new af(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new af(n.pos,t.markFromJSON(n.mark))}}$s.jsonID("addNodeMark",af);class Qf extends $s{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return So.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return So.fromReplace(t,this.pos,this.pos+1,new Ge(Ce.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new af(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Qf(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Qf(n.pos,t.markFromJSON(n.mark))}}$s.jsonID("removeNodeMark",Qf);class Ho extends $s{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&C2(t,this.from,this.to)?So.fail("Structure replace would overwrite content"):So.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Za([this.from,this.to-this.from,this.slice.size])}invert(t){return new Ho(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ho(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Ho)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Ge.empty:new Ge(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Ho(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Ge.empty:new Ge(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Ho(t.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ho(n.from,n.to,Ge.fromJSON(t,n.slice),!!n.structure)}}$s.jsonID("replace",Ho);class qo extends $s{constructor(t,n,r,i,s,l,c=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=l,this.structure=c}apply(t){if(this.structure&&(C2(t,this.from,this.gapFrom)||C2(t,this.gapTo,this.to)))return So.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return So.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?So.fromReplace(t,this.from,this.to,r):So.fail("Content does not fit in gap")}getMap(){return new Za([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new qo(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new qo(n.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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new qo(n.from,n.to,n.gapFrom,n.gapTo,Ge.fromJSON(t,n.slice),n.insert,!!n.structure)}}$s.jsonID("replaceAround",qo);function C2(e,t,n){let r=e.resolve(t),i=n-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 I8(e,t,n,r){let i=[],s=[],l,c;e.doc.nodesBetween(t,n,(f,d,p)=>{if(!f.isInline)return;let y=f.marks;if(!r.isInSet(y)&&p.type.allowsMarkType(r.type)){let b=Math.max(d,t),g=Math.min(d+f.nodeSize,n),C=r.addToSet(y);for(let M=0;M<y.length;M++)y[M].isInSet(C)||(l&&l.to==b&&l.mark.eq(y[M])?l.to=g:i.push(l=new ec(b,g,y[M])));c&&c.to==b?c.to=g:s.push(c=new sf(b,g,r))}}),i.forEach(f=>e.step(f)),s.forEach(f=>e.step(f))}function j8(e,t,n,r){let i=[],s=0;e.doc.nodesBetween(t,n,(l,c)=>{if(!l.isInline)return;s++;let f=null;if(r instanceof i0){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,n);for(let p=0;p<f.length;p++){let y=f[p],b;for(let g=0;g<i.length;g++){let C=i[g];C.step==s-1&&y.eq(i[g].style)&&(b=C)}b?(b.to=d,b.step=s):i.push({style:y,from:Math.max(c,t),to:d,step:s})}}}),i.forEach(l=>e.step(new ec(l.from,l.to,l.style)))}function p5(e,t,n,r=n.contentMatch,i=!0){let s=e.doc.nodeAt(t),l=[],c=t+1;for(let f=0;f<s.childCount;f++){let d=s.child(f),p=c+d.nodeSize,y=r.matchType(d.type);if(!y)l.push(new Ho(c,p,Ge.empty));else{r=y;for(let b=0;b<d.marks.length;b++)n.allowsMarkType(d.marks[b].type)||e.step(new ec(c,p,d.marks[b]));if(i&&d.isText&&n.whitespace!="pre"){let b,g=/\r?\n|\r/g,C;for(;b=g.exec(d.text);)C||(C=new Ge(Ce.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),l.push(new Ho(c+b.index,c+b.index+b[0].length,C))}}c=p}if(!r.validEnd){let f=r.fillBefore(Ce.empty,!0);e.replace(c,c,new Ge(f,0,0))}for(let f=l.length-1;f>=0;f--)e.step(l[f])}function z8(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function nh(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,i=0,s=0;;--r){let l=e.$from.node(r),c=e.$from.index(r)+i,f=e.$to.indexAfter(r)-s;if(r<e.depth&&l.canReplace(c,f,n))return r;if(r==0||l.type.spec.isolating||!z8(l,c,f))break;c&&(i=1),f<l.childCount&&(s=1)}return null}function B8(e,t,n){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,y=0;for(let C=s,M=!1;C>n;C--)M||r.index(C)>0?(M=!0,p=Ce.from(r.node(C).copy(p)),y++):f--;let b=Ce.empty,g=0;for(let C=s,M=!1;C>n;C--)M||i.after(C+1)<i.end(C)?(M=!0,b=Ce.from(i.node(C).copy(b)),g++):d++;e.step(new qo(f,d,l,c,new Ge(p.append(b),y,g),p.size-y,!0))}function m5(e,t,n=null,r=e){let i=F8(e,t),s=i&&U8(r,t);return s?i.map(mS).concat({type:t,attrs:n}).concat(s.map(mS)):null}function mS(e){return{type:e,attrs:null}}function F8(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.contentMatchAt(r).findWrapping(t);if(!s)return null;let l=s.length?s[0]:t;return n.canReplaceWith(r,i,l)?s:null}function U8(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.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(n.child(d).type);return!f||!f.validEnd?null:l}function H8(e,t,n){let r=Ce.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[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(n[l].type.create(n[l].attrs,r))}let i=t.start,s=t.end;e.step(new qo(i,s,i,s,new Ge(r,0,0),n.length,!0))}function q8(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,(l,c)=>{let f=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,f)&&$8(e.doc,e.mapping.slice(s).map(c),r)){let d=null;if(r.schema.linebreakReplacement){let g=r.whitespace=="pre",C=!!r.contentMatch.matchType(r.schema.linebreakReplacement);g&&!C?d=!1:!g&&C&&(d=!0)}d===!1&&rA(e,l,c,s),p5(e,e.mapping.slice(s).map(c,1),r,void 0,d===null);let p=e.mapping.slice(s),y=p.map(c,1),b=p.map(c+l.nodeSize,1);return e.step(new qo(y,b,y+1,b-1,new Ge(Ce.from(r.create(f,null,l.marks)),0,0),1,!0)),d===!0&&nA(e,l,c,s),!1}})}function nA(e,t,n,r){t.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let f=e.mapping.slice(r).map(n+1+s+l.index);e.replaceWith(f,f+1,t.type.schema.linebreakReplacement.create())}}})}function rA(e,t,n,r){t.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=e.mapping.slice(r).map(n+1+s);e.replaceWith(l,l+1,t.type.schema.text(`
94
+ `))}})}function $8(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Y8(e,t,n,r,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(r,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new qo(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new Ge(Ce.from(l),0,0),1,!0))}function vu(e,t,n=1,r){let i=e.resolve(t),s=i.depth-n,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=n-2;d>s;d--,p--){let y=i.node(d),b=i.index(d);if(y.type.spec.isolating)return!1;let g=y.content.cutByIndex(b,y.childCount),C=r&&r[p+1];C&&(g=g.replaceChild(0,C.type.create(C.attrs)));let M=r&&r[p]||y;if(!y.canReplace(b+1,y.childCount)||!M.type.validContent(g))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 V8(e,t,n=1,r){let i=e.doc.resolve(t),s=Ce.empty,l=Ce.empty;for(let c=i.depth,f=i.depth-n,d=n-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))}e.step(new Ho(t,t,new Ge(s.append(l),n,n),!0))}function gf(e,t){let n=e.resolve(t),r=n.index();return iA(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function W8(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),l=s.type==r?e.type.schema.nodes.text:s.type;if(n=n.matchType(l),!n||!e.type.allowsMarks(s.marks))return!1}return n.validEnd}function iA(e,t){return!!(e&&t&&!e.isLeaf&&W8(e,t))}function o0(e,t,n=-1){let r=e.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):n>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&&iA(s,l)&&r.node(i).canReplace(c,c+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function X8(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,s=e.doc.resolve(t-n),l=s.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",y=!!l.contentMatch.matchType(i);p&&!y?r=!1:!p&&y&&(r=!0)}let c=e.steps.length;if(r===!1){let p=e.doc.resolve(t+n);rA(e,p.node(),p.before(),c)}l.inlineContent&&p5(e,t+n-1,l,s.node().contentMatchAt(s.index()),r==null);let f=e.mapping.slice(c),d=f.map(t-n);if(e.step(new Ho(d,f.map(t+n,-1),Ge.empty,!0)),r===!0){let p=e.doc.resolve(d);nA(e,p.node(),p.before(),e.steps.length)}return e}function G8(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))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,n))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,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function oA(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.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 y=d.contentMatchAt(f).findWrapping(i.firstChild.type);p=y&&d.canReplaceWith(f,f,y[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function s0(e,t,n=t,r=Ge.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return sA(i,s,r)?new Ho(t,n,r):new K8(i,s,r).fit()}function sA(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class K8{constructor(t,n,r){this.$from=t,this.$to=n,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(),n=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 Ge(s,l,c);return t>-1?new qo(r.pos,t,this.$to.pos,this.$to.end(),f,n):f.size||r.pos!=this.$to.pos?new Ho(r.pos,i.pos,f):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){t=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=hy(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,y=null;if(n==1&&(l?d.matchType(l.type)||(y=d.fillBefore(Ce.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:y};if(n==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:n,openEnd:r}=this.unplaced,i=hy(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Ge(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=hy(t,n);if(i.childCount<=1&&n>0){let s=t.size-n<=n+i.size;this.unplaced=new Ge(Uh(t,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Ge(Uh(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let M=0;M<s.length;M++)this.openFrontierNode(s[M]);let l=this.unplaced,c=r?r.content:l.content,f=l.openStart-t,d=0,p=[],{match:y,type:b}=this.frontier[n];if(i){for(let M=0;M<i.childCount;M++)p.push(i.child(M));y=y.matchFragment(i)}let g=c.size+t-(l.content.size-l.openEnd);for(;d<c.childCount;){let M=c.child(d),L=y.matchType(M.type);if(!L)break;d++,(d>1||f==0||M.content.size)&&(y=L,p.push(aA(M.mark(b.allowedMarks(M.marks)),d==1?f:0,d==c.childCount?g:-1)))}let C=d==c.childCount;C||(g=-1),this.placed=Hh(this.placed,n,Ce.from(p)),this.frontier[n].match=y,C&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let M=0,L=c;M<g;M++){let D=L.lastChild;this.frontier.push({type:D.type,match:D.contentMatchAt(D.childCount)}),L=D.content}this.unplaced=C?t==0?Ge.empty:new Ge(Uh(l.content,t-1,1),t-1,g<0?l.openEnd:t-1):new Ge(Uh(l.content,t,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!py(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.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 n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),l=py(t,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=py(t,c,d,f,!0);if(!p||p.childCount)continue t}return{depth:n,fit:l,move:s?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Hh(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.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,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Hh(this.placed,this.depth,Ce.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ce.empty,!0);n.childCount&&(this.placed=Hh(this.placed,this.frontier.length,n))}}function Uh(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Uh(e.firstChild.content,t-1,n)))}function Hh(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Hh(e.lastChild.content,t-1,n)))}function hy(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function aA(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,aA(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Ce.empty,!0)))),e.copy(r)}function py(e,t,n,r,i){let s=e.node(t),l=i?e.indexAfter(t):e.index(t);if(l==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!J8(n,s.content,l)?c:null}function J8(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Z8(e){return e.spec.defining||e.spec.definingForContent}function Q8(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(sA(i,s,r))return e.step(new Ho(t,n,r));let l=cA(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let b=i.depth,g=i.pos-1;b>0;b--,g--){let C=i.node(b).type.spec;if(C.defining||C.definingAsContext||C.isolating)break;l.indexOf(b)>-1?c=b:i.before(b)==g&&l.splice(1,0,-b)}let f=l.indexOf(c),d=[],p=r.openStart;for(let b=r.content,g=0;;g++){let C=b.firstChild;if(d.push(C),g==r.openStart)break;b=C.content}for(let b=p-1;b>=0;b--){let g=d[b],C=Z8(g.type);if(C&&!g.sameMarkup(i.node(Math.abs(c)-1)))p=b;else if(C||!g.type.isTextblock)break}for(let b=r.openStart;b>=0;b--){let g=(b+p+1)%(r.openStart+1),C=d[g];if(C)for(let M=0;M<l.length;M++){let L=l[(M+f)%l.length],D=!0;L<0&&(D=!1,L=-L);let H=i.node(L-1),V=i.index(L-1);if(H.canReplaceWith(V,V,C.type,C.marks))return e.replace(i.before(L),D?s.after(L):n,new Ge(lA(r.content,0,r.openStart,g),g,r.openEnd))}}let y=e.steps.length;for(let b=l.length-1;b>=0&&(e.replace(t,n,r),!(e.steps.length>y));b--){let g=l[b];g<0||(t=i.before(g),n=s.after(g))}}function lA(e,t,n,r,i){if(t<n){let s=e.firstChild;e=e.replaceChild(0,s.copy(lA(s.content,t+1,n,r,s)))}if(t>r){let s=i.contentMatchAt(0),l=s.fillBefore(e).append(e);e=l.append(s.matchFragment(l).fillBefore(Ce.empty,!0))}return e}function tL(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=G8(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new Ge(Ce.from(r),0,0))}function eL(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),s=cA(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 e.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 e.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&&n>r.end(l)&&i.end(l)-n!=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 e.delete(r.before(l),n);e.delete(t,n)}function cA(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let s=e.start(i);if(s<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(s==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==s-1)&&n.push(i)}return n}class $d extends $s{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return So.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return So.fromReplace(t,this.pos,this.pos+1,new Ge(Ce.from(i),0,n.isLeaf?0:1))}getMap(){return Za.empty}invert(t){return new $d(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new $d(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new $d(n.pos,n.attr,n.value)}}$s.jsonID("attr",$d);class hp extends $s{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return So.ok(r)}getMap(){return Za.empty}invert(t){return new hp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new hp(n.attr,n.value)}}$s.jsonID("docAttr",hp);let Vd=class extends Error{};Vd=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Vd.prototype=Object.create(Error.prototype);Vd.prototype.constructor=Vd;Vd.prototype.name="TransformError";class uA{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new dp}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Vd(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(t=i.map(t,1),n=i.map(n,-1)),i.forEach((s,l,c,f)=>{t=Math.min(t,c),n=Math.max(n,f)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=Ge.empty){let i=s0(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new Ge(Ce.from(r),0,0))}delete(t,n){return this.replace(t,n,Ge.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return Q8(this,t,n,r),this}replaceRangeWith(t,n,r){return tL(this,t,n,r),this}deleteRange(t,n){return eL(this,t,n),this}lift(t,n){return B8(this,t,n),this}join(t,n=1){return X8(this,t,n),this}wrap(t,n){return H8(this,t,n),this}setBlockType(t,n=t,r,i=null){return q8(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return Y8(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new $d(t,n,r)),this}setDocAttribute(t,n){return this.step(new hp(t,n)),this}addNodeMark(t,n){return this.step(new af(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof ai)n.isInSet(r.marks)&&this.step(new Qf(t,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new Qf(t,s)),i=s.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(t,n=1,r){return V8(this,t,n,r),this}addMark(t,n,r){return I8(this,t,n,r),this}removeMark(t,n,r){return j8(this,t,n,r),this}clearIncompatible(t,n,r){return p5(this,t,n,r),this}}const my=Object.create(null);class tr{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new nL(t.min(n),t.max(n))]}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 n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=Ge.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.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?Ge.empty:n),c==0&&bS(t,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,n){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,n),bS(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let i=t.parent.inlineContent?new Hn(t):Rd(t.node(0),t.parent,t.pos,t.index(),n,r);if(i)return i;for(let s=t.depth-1;s>=0;s--){let l=n<0?Rd(t.node(0),t.node(s),t.before(s+1),t.index(s),n,r):Rd(t.node(0),t.node(s),t.after(s+1),t.index(s)+1,n,r);if(l)return l}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new tl(t.node(0))}static atStart(t){return Rd(t,t,0,0,1)||new tl(t)}static atEnd(t){return Rd(t,t,t.content.size,t.childCount,-1)||new tl(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=my[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in my)throw new RangeError("Duplicate use of selection JSON ID "+t);return my[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Hn.between(this.$anchor,this.$head).getBookmark()}}tr.prototype.visible=!0;class nL{constructor(t,n){this.$from=t,this.$to=n}}let gS=!1;function yS(e){!gS&&!e.parent.inlineContent&&(gS=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Hn extends tr{constructor(t,n=t){yS(t),yS(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return tr.near(r);let i=t.resolve(n.map(this.anchor));return new Hn(i.parent.inlineContent?i:r,r)}replace(t,n=Ge.empty){if(super.replace(t,n),n==Ge.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Hn&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new a0(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Hn(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=tr.findFrom(n,r,!0)||tr.findFrom(n,-r,!0);if(s)n=s.$head;else return tr.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(tr.findFrom(t,-r,!0)||tr.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new Hn(t,n)}}tr.jsonID("text",Hn);class a0{constructor(t,n){this.anchor=t,this.head=n}map(t){return new a0(t.map(this.anchor),t.map(this.head))}resolve(t){return Hn.between(t.resolve(this.anchor),t.resolve(this.head))}}class Cn extends tr{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=t.resolve(i);return r?tr.near(s):new Cn(s)}content(){return new Ge(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 g5(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Cn(t.resolve(n.anchor))}static create(t,n){return new Cn(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Cn.prototype.visible=!1;tr.jsonID("node",Cn);class g5{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new a0(r,r):new g5(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Cn.isSelectable(r)?new Cn(n):tr.near(n)}}class tl extends tr{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=Ge.empty){if(n==Ge.empty){t.delete(0,t.doc.content.size);let r=tr.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new tl(t)}map(t){return new tl(t)}eq(t){return t instanceof tl}getBookmark(){return rL}}tr.jsonID("all",tl);const rL={map(){return this},resolve(e){return new tl(e)}};function Rd(e,t,n,r,i,s=!1){if(t.inlineContent)return Hn.create(e,n);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(e,n-(i<0?c.nodeSize:0))}else{let f=Rd(e,c,n+i,i<0?c.childCount:0,i,s);if(f)return f}n+=c.nodeSize*i}return null}function bS(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Ho||i instanceof qo))return;let s=e.mapping.maps[r],l;s.forEach((c,f,d,p)=>{l==null&&(l=p)}),e.setSelection(tr.near(e.doc.resolve(l),n))}const xS=1,Em=2,vS=4;class iL extends uA{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|xS)&~Em,this.storedMarks=null,this}get selectionSet(){return(this.updated&xS)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Em,this}ensureMarks(t){return ai.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&Em)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~Em,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ai.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(n);s=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(t,s)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(tr.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,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|=vS,this}get scrolledIntoView(){return(this.updated&vS)>0}}function wS(e,t){return!t||!e?e:e.bind(t)}class qh{constructor(t,n,r){this.name=t,this.init=wS(n.init,r),this.apply=wS(n.apply,r)}}const oL=[new qh("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new qh("selection",{init(e,t){return e.selection||tr.atStart(t.doc)},apply(e){return e.selection}}),new qh("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new qh("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class gy{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=oL.slice(),n&&n.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 qh(r.key,r.spec.state,r))})}}class Bd{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){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 n=[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<n.length&&c.spec.appendTransaction.call(c,f?n.slice(f):n,d,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",t),!i){i=[];for(let y=0;y<this.config.plugins.length;y++)i.push(y<l?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}i&&(i[l]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Bd(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(t,this[s.name],this,n)}return n}get tr(){return new iL(this)}static create(t){let n=new gy(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Bd(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}reconfigure(t){let n=new gy(this.schema,t.plugins),r=n.fields,i=new Bd(n);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 n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.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&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new gy(t.schema,t.plugins),s=new Bd(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=cf.fromJSON(t.schema,n.doc);else if(l.name=="selection")s.selection=tr.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.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(n,c)){s[l.name]=d.fromJSON.call(f,t,n[c],s);return}}s[l.name]=l.init(t,s)}}),s}}function fA(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=fA(i,t,{})),n[r]=i}return n}class Ui{constructor(t){this.spec=t,this.props={},t.props&&fA(t.props,this,this.props),this.key=t.key?t.key.key:dA("plugin")}getState(t){return t[this.key]}}const yy=Object.create(null);function dA(e){return e in yy?e+"$"+ ++yy[e]:(yy[e]=0,e+"$")}class Ro{constructor(t="key"){this.key=dA(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const y5=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function hA(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const pA=(e,t,n)=>{let r=hA(e,n);if(!r)return!1;let i=b5(r);if(!i){let l=r.blockRange(),c=l&&nh(l);return c==null?!1:(t&&t(e.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(kA(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Wd(s,"end")||Cn.isSelectable(s)))for(let l=r.depth;;l--){let c=s0(e.doc,r.before(l),r.after(l),Ge.empty);if(c&&c.slice.size<c.to-c.from){if(t){let f=e.tr.step(c);f.setSelection(Wd(s,"end")?tr.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(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},sL=(e,t,n)=>{let r=hA(e,n);if(!r)return!1;let i=b5(r);return i?mA(e,i,t):!1},aL=(e,t,n)=>{let r=yA(e,n);if(!r)return!1;let i=x5(r);return i?mA(e,i,t):!1};function mA(e,t,n){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=s0(e.doc,s,f,Ge.empty);if(!d||d.from!=s||d instanceof Ho&&d.slice.size>=f-s)return!1;if(n){let p=e.tr.step(d);p.setSelection(Hn.create(p.doc,s)),n(p.scrollIntoView())}return!0}function Wd(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const gA=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=b5(r)}let l=s&&s.nodeBefore;return!l||!Cn.isSelectable(l)?!1:(t&&t(e.tr.setSelection(Cn.create(e.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function b5(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function yA(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const bA=(e,t,n)=>{let r=yA(e,n);if(!r)return!1;let i=x5(r);if(!i)return!1;let s=i.nodeAfter;if(kA(e,i,t,1))return!0;if(r.parent.content.size==0&&(Wd(s,"start")||Cn.isSelectable(s))){let l=s0(e.doc,r.before(),r.after(),Ge.empty);if(l&&l.slice.size<l.to-l.from){if(t){let c=e.tr.step(l);c.setSelection(Wd(s,"start")?tr.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(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},xA=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=x5(r)}let l=s&&s.nodeAfter;return!l||!Cn.isSelectable(l)?!1:(t&&t(e.tr.setSelection(Cn.create(e.doc,s.pos)).scrollIntoView()),!0)};function x5(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const lL=(e,t)=>{let n=e.selection,r=n instanceof Cn,i;if(r){if(n.node.isTextblock||!gf(e.doc,n.from))return!1;i=n.from}else if(i=o0(e.doc,n.from,-1),i==null)return!1;if(t){let s=e.tr.join(i);r&&s.setSelection(Cn.create(s.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(s.scrollIntoView())}return!0},cL=(e,t)=>{let n=e.selection,r;if(n instanceof Cn){if(n.node.isTextblock||!gf(e.doc,n.to))return!1;r=n.to}else if(r=o0(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},uL=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),s=i&&nh(i);return s==null?!1:(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)},vA=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
95
+ `).scrollIntoView()),!0)};function v5(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const fL=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),l=v5(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(t){let c=n.after(),f=e.tr.replaceWith(c,c,l.createAndFill());f.setSelection(tr.near(f.doc.resolve(c),1)),t(f.scrollIntoView())}return!0},wA=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof tl||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=v5(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=e.tr.insert(l,s.createAndFill());c.setSelection(Hn.create(c.doc,l+1)),t(c.scrollIntoView())}return!0},SA=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(vu(e.doc,s))return t&&t(e.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&nh(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function dL(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof Cn&&t.selection.node.isBlock)return!r.parentOffset||!vu(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,f=!1,d=!1;for(let g=r.depth;;g--)if(r.node(g).isBlock){f=r.end(g)==r.pos+(r.depth-g),d=r.start(g)==r.pos-(r.depth-g),c=v5(r.node(g-1).contentMatchAt(r.indexAfter(g-1))),s.unshift(f&&c?{type:c}:null),l=g;break}else{if(g==1)return!1;s.unshift(null)}let p=t.tr;(t.selection instanceof Hn||t.selection instanceof tl)&&p.deleteSelection();let y=p.mapping.map(r.pos),b=vu(p.doc,y,s.length,s);if(b||(s[0]=c?{type:c}:null,b=vu(p.doc,y,s.length,s)),!b)return!1;if(p.split(y,s.length,s),!f&&d&&r.node(l).type!=c){let g=p.mapping.map(r.before(l)),C=p.doc.resolve(g);c&&r.node(l-1).canReplaceWith(C.index(),C.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const hL=dL(),pL=(e,t)=>{let{$from:n,to:r}=e.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),t&&t(e.tr.setSelection(Cn.create(e.doc,i))),!0)};function mL(e,t,n){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)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(s,s+1)||!(i.isTextblock||gf(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function kA(e,t,n,r){let i=t.nodeBefore,s=t.nodeAfter,l,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&mL(e,t,n))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(n){let g=t.pos+s.nodeSize,C=Ce.empty;for(let D=l.length-1;D>=0;D--)C=Ce.from(l[D].create(null,C));C=Ce.from(i.copy(C));let M=e.tr.step(new qo(t.pos-1,g,t.pos,g,new Ge(C,1,0),l.length,!0)),L=M.doc.resolve(g+2*l.length);L.nodeAfter&&L.nodeAfter.type==i.type&&gf(M.doc,L.pos)&&M.join(L.pos),n(M.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:tr.findFrom(t,1),y=p&&p.$from.blockRange(p.$to),b=y&&nh(y);if(b!=null&&b>=t.depth)return n&&n(e.tr.lift(y,b).scrollIntoView()),!0;if(d&&Wd(s,"start",!0)&&Wd(i,"end")){let g=i,C=[];for(;C.push(g),!g.isTextblock;)g=g.lastChild;let M=s,L=1;for(;!M.isTextblock;M=M.firstChild)L++;if(g.canReplace(g.childCount,g.childCount,M.content)){if(n){let D=Ce.empty;for(let V=C.length-1;V>=0;V--)D=Ce.from(C[V].copy(D));let H=e.tr.step(new qo(t.pos-C.length,t.pos+s.nodeSize,t.pos+L,t.pos+s.nodeSize-L,new Ge(D,C.length,0),0,!0));n(H.scrollIntoView())}return!0}}return!1}function AA(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(t.tr.setSelection(Hn.create(t.doc,e<0?i.start(s):i.end(s)))),!0):!1}}const gL=AA(-1),yL=AA(1);function bL(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&m5(l,e,t);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function SS(e,t=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(e,t)))if(f.type==e)i=!0;else{let p=n.doc.resolve(d),y=p.index();i=p.parent.canReplaceWith(y,y+1,e)}})}if(!i)return!1;if(r){let s=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:f}}=n.selection.ranges[l];s.setBlockType(c,f,e,t)}r(s.scrollIntoView())}return!0}}function w5(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}w5(y5,pA,gA);w5(y5,bA,xA);w5(vA,wA,SA,hL);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function xL(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s);if(!l)return!1;let c=r?n.tr:null;return vL(c,l,e,t)?(r&&r(c.scrollIntoView()),!0):!1}}function vL(e,t,n,r=null){let i=!1,s=t,l=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let f=l.resolve(t.start-2);s=new dg(f,f,t.depth),t.endIndex<t.parent.childCount&&(t=new dg(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let c=m5(s,n,r,t);return c?(e&&wL(e,t,c,i,n),!0):!1}function wL(e,t,n,r,i){let s=Ce.empty;for(let p=n.length-1;p>=0;p--)s=Ce.from(n[p].type.create(n[p].attrs,s));e.step(new qo(t.start-(r?2:0),t.end,t.start,t.end,new Ge(s,0,0),n.length,!0));let l=0;for(let p=0;p<n.length;p++)n[p].type==i&&(l=p+1);let c=n.length-l,f=t.start+n.length-(r?2:0),d=t.parent;for(let p=t.startIndex,y=t.endIndex,b=!0;p<y;p++,b=!1)!b&&vu(e.doc,f,c)&&(e.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return e}function SL(e){return function(t,n){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==e);return s?n?r.node(s.depth-1).type==e?kL(t,n,e,s):AL(t,n,s):!0:!1}}function kL(e,t,n,r){let i=e.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new qo(s-1,l,s,l,new Ge(Ce.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new dg(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=nh(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return gf(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),t(i.scrollIntoView()),!0}function AL(e,t,n){let r=e.tr,i=n.parent;for(let g=n.end,C=n.endIndex-1,M=n.startIndex;C>M;C--)g-=i.child(C).nodeSize,r.delete(g-1,g+1);let s=r.doc.resolve(n.start),l=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,f=n.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 y=s.pos,b=y+l.nodeSize;return r.step(new qo(y-(c?1:0),b+(f?1:0),y+1,b-1,new Ge((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 ML(e){return function(t,n){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==e);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!=e)return!1;if(n){let d=f.lastChild&&f.lastChild.type==c.type,p=Ce.from(d?e.create():null),y=new Ge(Ce.from(e.create(null,Ce.from(c.type.create(null,p)))),d?3:1,0),b=s.start,g=s.end;n(t.tr.step(new qo(b-(d?3:1),g,b,g,y,1,!0)).scrollIntoView())}return!0}}const gs=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Xd=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let E2=null;const yu=function(e,t,n){let r=E2||(E2=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},CL=function(){E2=null},td=function(e,t,n,r){return n&&(kS(e,t,n,r,-1)||kS(e,t,n,r,1))},EL=/^(img|br|input|textarea|hr)$/i;function kS(e,t,n,r,i){for(var s;;){if(e==n&&t==r)return!0;if(t==(i<0?0:El(e))){let l=e.parentNode;if(!l||l.nodeType!=1||kp(e)||EL.test(e.nodeName)||e.contentEditable=="false")return!1;t=gs(e)+(i<0?0:1),e=l}else if(e.nodeType==1){let l=e.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 e=l,t=i<0?El(e):0}else return!1}}function El(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function TL(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=El(e)}else if(e.parentNode&&!kp(e))t=gs(e),e=e.parentNode;else return null}}function NL(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!kp(e))t=gs(e)+1,e=e.parentNode;else return null}}function _L(e,t,n){for(let r=t==0,i=t==El(e);r||i;){if(e==n)return!0;let s=gs(e);if(e=e.parentNode,!e)return!1;r=r&&s==0,i=i&&s==El(e)}}function kp(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const l0=function(e){return e.focusNode&&td(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Pf(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function LL(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function DL(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(El(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(El(r.startContainer),r.startOffset)}}}const Oc=typeof navigator<"u"?navigator:null,AS=typeof document<"u"?document:null,yf=Oc&&Oc.userAgent||"",T2=/Edge\/(\d+)/.exec(yf),MA=/MSIE \d/.exec(yf),N2=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yf),_a=!!(MA||N2||T2),uf=MA?document.documentMode:N2?+N2[1]:T2?+T2[1]:0,Tl=!_a&&/gecko\/(\d+)/i.test(yf);Tl&&+(/Firefox\/(\d+)/.exec(yf)||[0,0])[1];const _2=!_a&&/Chrome\/(\d+)/.exec(yf),bs=!!_2,CA=_2?+_2[1]:0,qs=!_a&&!!Oc&&/Apple Computer/.test(Oc.vendor),Gd=qs&&(/Mobile\/\w+/.test(yf)||!!Oc&&Oc.maxTouchPoints>2),Cl=Gd||(Oc?/Mac/.test(Oc.platform):!1),EA=Oc?/Win/.test(Oc.platform):!1,xu=/Android \d/.test(yf),Ap=!!AS&&"webkitFontSmoothing"in AS.documentElement.style,RL=Ap?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function OL(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function du(e,t){return typeof e=="number"?e:e[t]}function PL(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function MS(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(l.nodeType!=1){l=Xd(l);continue}let c=l,f=c==s.body,d=f?OL(s):PL(c),p=0,y=0;if(t.top<d.top+du(r,"top")?y=-(d.top-t.top+du(i,"top")):t.bottom>d.bottom-du(r,"bottom")&&(y=t.bottom-t.top>d.bottom-d.top?t.top+du(i,"top")-d.top:t.bottom-d.bottom+du(i,"bottom")),t.left<d.left+du(r,"left")?p=-(d.left-t.left+du(i,"left")):t.right>d.right-du(r,"right")&&(p=t.right-d.right+du(i,"right")),p||y)if(f)s.defaultView.scrollBy(p,y);else{let g=c.scrollLeft,C=c.scrollTop;y&&(c.scrollTop+=y),p&&(c.scrollLeft+=p);let M=c.scrollLeft-g,L=c.scrollTop-C;t={left:t.left-M,top:t.top-L,right:t.right-M,bottom:t.bottom-L}}let b=f?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(b))break;l=b=="absolute"?l.offsetParent:Xd(l)}}function IL(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let s=(t.left+t.right)/2,l=n+1;l<Math.min(innerHeight,t.bottom);l+=5){let c=e.root.elementFromPoint(s,l);if(!c||c==e.dom||!e.dom.contains(c))continue;let f=c.getBoundingClientRect();if(f.top>=n-20){r=c,i=f.top;break}}return{refDOM:r,refTop:i,stack:TA(e.dom)}}function TA(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Xd(r));return t}function jL({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;NA(n,r==0?0:r-t)}function NA(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:s}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Md=null;function zL(e){if(e.setActive)return e.setActive();if(Md)return e.focus(Md);let t=TA(e);e.focus(Md==null?{get preventScroll(){return Md={preventScroll:!0},!0}}:void 0),Md||(Md=!1,NA(t,0))}function _A(e,t){let n,r=2e8,i,s=0,l=t.top,c=t.top,f,d;for(let p=e.firstChild,y=0;p;p=p.nextSibling,y++){let b;if(p.nodeType==1)b=p.getClientRects();else if(p.nodeType==3)b=yu(p).getClientRects();else continue;for(let g=0;g<b.length;g++){let C=b[g];if(C.top<=l&&C.bottom>=c){l=Math.max(C.bottom,l),c=Math.min(C.top,c);let M=C.left>t.left?C.left-t.left:C.right<t.left?t.left-C.right:0;if(M<r){n=p,r=M,i=M&&n.nodeType==3?{left:C.right<t.left?C.right:C.left,top:t.top}:t,p.nodeType==1&&M&&(s=y+(t.left>=(C.left+C.right)/2?1:0));continue}}else C.top>t.top&&!f&&C.left<=t.left&&C.right>=t.left&&(f=p,d={left:Math.max(C.left,Math.min(C.right,t.left)),top:C.top});!n&&(t.left>=C.right&&t.top>=C.top||t.left>=C.left&&t.top>=C.bottom)&&(s=y+1)}}return!n&&f&&(n=f,i=d,r=0),n&&n.nodeType==3?BL(n,i):!n||r&&n.nodeType==1?{node:e,offset:s}:_A(n,i)}function BL(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(e,s+1),r.setStart(e,s);let l=Zu(r,1);if(l.top!=l.bottom&&S5(t,l)){i={node:e,offset:s+(t.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:e,offset:0}}function S5(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function FL(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function UL(e,t,n){let{node:r,offset:i}=_A(t,n),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return e.docView.posFromDOM(r,i,s)}function HL(e,t,n,r){let i=-1;for(let s=t,l=!1;s!=e.dom;){let c=e.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:e.docView.posFromDOM(t,n,-1)}function LA(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let l=e.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let f=0;f<c.length;f++){let d=c[f];if(S5(t,d))return LA(l,t,d)}}if((s=(s+1)%r)==i)break}return e}function qL(e,t){let n=e.dom.ownerDocument,r,i=0,s=DL(n,t.left,t.top);s&&({node:r,offset:i}=s);let l=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),c;if(!l||!e.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=e.dom.getBoundingClientRect();if(!S5(t,d)||(l=LA(e.dom,t,d),!l))return null}if(qs)for(let d=l;r&&d;d=Xd(d))d.draggable&&(r=void 0);if(l=FL(l,t),r){if(Tl&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],y;p.nodeName=="IMG"&&(y=p.getBoundingClientRect()).right<=t.left&&y.bottom>t.top&&i++}let d;Ap&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=HL(e,r,i,t))}c==null&&(c=UL(e,l,t));let f=e.docView.nearestDesc(l,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function CS(e){return e.top<e.bottom||e.left<e.right}function Zu(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(CS(r))return r}return Array.prototype.find.call(n,CS)||e.getBoundingClientRect()}const $L=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function DA(e,t,n){let{node:r,offset:i,atom:s}=e.docView.domFromPos(t,n<0?-1:1),l=Ap||Tl;if(r.nodeType==3)if(l&&($L.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let f=Zu(yu(r,i,i),n);if(Tl&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Zu(yu(r,i-1,i-1),-1);if(d.top==f.top){let p=Zu(yu(r,i,i+1),-1);if(p.top!=f.top)return Ph(p,p.left<d.left)}}return f}else{let f=i,d=i,p=n<0?1:-1;return n<0&&!i?(d++,p=-1):n>=0&&i==r.nodeValue.length?(f--,p=1):n<0?f--:d++,Ph(Zu(yu(r,f,d),p),p<0)}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==El(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return by(f.getBoundingClientRect(),!1)}if(s==null&&i<El(r)){let f=r.childNodes[i];if(f.nodeType==1)return by(f.getBoundingClientRect(),!0)}return by(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==El(r))){let f=r.childNodes[i-1],d=f.nodeType==3?yu(f,El(f)-(l?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return Ph(Zu(d,1),!1)}if(s==null&&i<El(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?yu(f,0,l?0:1):f.nodeType==1?f:null:null;if(d)return Ph(Zu(d,-1),!0)}return Ph(Zu(r.nodeType==3?yu(r):r,-n),n>=0)}function Ph(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function by(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function RA(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function YL(e,t,n){let r=t.selection,i=n=="up"?r.$from:r.$to;return RA(e,t,()=>{let{node:s}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=e.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=DA(e,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=yu(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&&(n=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const VL=/[\u0590-\u08ac]/;function WL(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,l=i==r.parent.content.size,c=e.domSelection();return c?!VL.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:RA(e,t,()=>{let{focusNode:f,focusOffset:d,anchorNode:p,anchorOffset:y}=e.domSelectionRange(),b=c.caretBidiLevel;c.modify("move",n,"character");let g=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:C,focusOffset:M}=e.domSelectionRange(),L=C&&!g.contains(C.nodeType==1?C:C.parentNode)||f==C&&d==M;try{c.collapse(p,y),f&&(f!=p||d!=y)&&c.extend&&c.extend(f,d)}catch{}return b!=null&&(c.caretBidiLevel=b),L}):r.pos==r.start()||r.pos==r.end()}let ES=null,TS=null,NS=!1;function XL(e,t,n){return ES==t&&TS==n?NS:(ES=t,TS=n,NS=n=="up"||n=="down"?YL(e,t,n):WL(e,t,n))}const Nl=0,_S=1,If=2,Pc=3;class Mp{constructor(t,n,r,i){this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Nl,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].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 n=0,r=this.posAtStart;;n++){let i=this.children[n];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,n,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[n-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[n];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=n>gs(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(n==0)for(let s=t;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==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,n=!1){for(let r=!0,i=t;i;i=i.parentNode){let s=this.getDesc(i),l;if(s&&(!n||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 n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let i=t;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],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,n){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 PA){i=t-s;break}s=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof OA&&s.side>=0;r--);if(n<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&n&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?gs(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,n):{node:this.contentDOM,offset:s?gs(s.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,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&&n<=d-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(t,n,p);t=l;for(let y=c;y>0;y--){let b=this.children[y-1];if(b.size&&b.dom.parentNode==this.contentDOM&&!b.emptyChildAt(1)){i=gs(b.dom)+1;break}t-=b.size}i==-1&&(i=0)}if(i>-1&&(d>n||c==this.children.length-1)){n=d;for(let p=c+1;p<this.children.length;p++){let y=this.children[p];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(-1)){s=gs(y.dom);break}n+=y.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:t,to:n,fromOffset:i,toOffset:s}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,i=!1){let s=Math.min(t,n),l=Math.max(t,n);for(let g=0,C=0;g<this.children.length;g++){let M=this.children[g],L=C+M.size;if(s>C&&l<L)return M.setSelection(t-C-M.border,n-C-M.border,r,i);C=L}let c=this.domFromPos(t,t?-1:1),f=n==t?c:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),p=r.domSelectionRange(),y=!1;if((Tl||qs)&&t==n){let{node:g,offset:C}=c;if(g.nodeType==3){if(y=!!(C&&g.nodeValue[C-1]==`
96
+ `),y&&C==g.nodeValue.length)for(let M=g,L;M;M=M.parentNode){if(L=M.nextSibling){L.nodeName=="BR"&&(c=f={node:L.parentNode,offset:gs(L)+1});break}let D=M.pmViewDesc;if(D&&D.node&&D.node.isBlock)break}}else{let M=g.childNodes[C-1];y=M&&(M.nodeName=="BR"||M.contentEditable=="false")}}if(Tl&&p.focusNode&&p.focusNode!=f.node&&p.focusNode.nodeType==1){let g=p.focusNode.childNodes[p.focusOffset];g&&g.contentEditable=="false"&&(i=!0)}if(!(i||y&&qs)&&td(c.node,c.offset,p.anchorNode,p.anchorOffset)&&td(f.node,f.offset,p.focusNode,p.focusOffset))return;let b=!1;if((d.extend||t==n)&&!(y&&Tl)){d.collapse(c.node,c.offset);try{t!=n&&d.extend(f.node,f.offset),b=!0}catch{}}if(!b){if(t>n){let C=c;c=f,f=C}let g=document.createRange();g.setEnd(f.node,f.offset),g.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(g)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){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&&n>=r:t<l&&n>r){let c=r+s.border,f=l-s.border;if(t>=c&&n<=f){this.dirty=t==r||n==l?If:_S,t==c&&n==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Pc:s.markDirty(t-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?If:Pc}r=l}this.dirty=If}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?If:_S;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class OA extends Mp{constructor(t,n,r,i){let s,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(t,[],l,null),this.widget=n,this.widget=n,s=this}matchesWidget(t){return this.dirty==Nl&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(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 GL extends Mp{constructor(t,n,r,i){super(t,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ed extends Mp{constructor(t,n,r,i,s){super(t,[],r,i),this.mark=n,this.spec=s}static create(t,n,r,i){let s=i.nodeViews[n.type.name],l=s&&s(n,i,r);return(!l||!l.dom)&&(l=od.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ed(t,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Pc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Pc&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Nl){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Nl}}slice(t,n,r){let i=ed.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=D2(s,n,l,r)),t>0&&(s=D2(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 ff extends Mp{constructor(t,n,r,i,s,l,c,f,d){super(t,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(t,n,r,i,s,l){let c=s.nodeViews[n.type.name],f,d=c&&c(n,s,()=>{if(!f)return l;if(f.parent)return f.parent.posBeforeChild(f)},r,i),p=d&&d.dom,y=d&&d.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:y}=od.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!y&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let b=p;return p=zA(p,r,n),d?f=new KL(t,n,r,i,p,y||null,b,d,s,l+1):n.isText?new c0(t,n,r,i,p,b,s):new ff(t,n,r,i,p,y||null,b,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>Ce.empty)}return t}matchesNode(t,n,r){return this.dirty==Nl&&t.eq(this.node)&&pg(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,i=n,s=t.composing?this.localCompositionInfo(t,n):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,f=new ZL(this,l&&l.node,t);eD(this.node,this.innerDeco,(d,p,y)=>{d.spec.marks?f.syncToMarks(d.spec.marks,r,t,p):d.type.side>=0&&!y&&f.syncToMarks(p==this.node.childCount?ai.none:this.node.child(p).marks,r,t,p),f.placeWidget(d,t,i)},(d,p,y,b)=>{f.syncToMarks(d.marks,r,t,b);let g;f.findNodeMatch(d,p,y,b)||c&&t.state.selection.from>i&&t.state.selection.to<i+d.nodeSize&&(g=f.findIndexWithChild(s.node))>-1&&f.updateNodeAt(d,p,y,g,t)||f.updateNextNode(d,p,y,t,b,i)||f.addNode(d,p,y,t,i),i+=d.nodeSize}),f.syncToMarks([],r,t,0),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==If)&&(l&&this.protectLocalComposition(t,l),IA(this.contentDOM,this.children,t),Gd&&nD(this.dom))}localCompositionInfo(t,n){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof Hn)||r<n||i>n+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=rD(this.node.content,l,r-n,i-n);return c<0?null:{node:s,pos:c,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;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 GL(this,s,n,i);t.input.compositionNodes.push(l),this.children=D2(this.children,r,r+i.length,t,l)}update(t,n,r,i){return this.dirty==Pc||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,i),!0)}updateInner(t,n,r,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Nl}updateOuterDeco(t){if(pg(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=jA(this.dom,this.nodeDOM,L2(this.outerDeco,this.node,n),L2(t,this.node,n)),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 LS(e,t,n,r,i){zA(r,t,e);let s=new ff(void 0,e,t,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class c0 extends ff{constructor(t,n,r,i,s,l,c){super(t,n,r,i,s,null,l,c,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,i){return this.dirty==Pc||this.dirty!=Nl&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Nl||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=Nl,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let i=this.node.cut(t,n),s=document.createTextNode(i.text);return new c0(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Pc)}get domAtom(){return!1}isText(t){return this.node.text==t}}class PA extends Mp{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Nl&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class KL extends ff{constructor(t,n,r,i,s,l,c,f,d,p){super(t,n,r,i,s,l,c,d,p),this.spec=f}update(t,n,r,i){if(this.dirty==Pc)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let s=this.spec.update(t,n,r);return s&&this.updateInner(t,n,r,i),s}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,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 IA(e,t,n){let r=e.firstChild,i=!1;for(let s=0;s<t.length;s++){let l=t[s],c=l.dom;if(c.parentNode==e){for(;c!=r;)r=DS(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(c,r);if(l instanceof ed){let f=r?r.previousSibling:e.lastChild;IA(l.contentDOM,l.children,n),r=f?f.nextSibling:e.firstChild}}for(;r;)r=DS(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const Qh=function(e){e&&(this.nodeName=e)};Qh.prototype=Object.create(null);const jf=[new Qh];function L2(e,t,n){if(e.length==0)return jf;let r=n?jf[0]:new Qh,i=[r];for(let s=0;s<e.length;s++){let l=e[s].type.attrs;if(l){l.nodeName&&i.push(r=new Qh(l.nodeName));for(let c in l){let f=l[c];f!=null&&(n&&i.length==1&&i.push(r=new Qh(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 jA(e,t,n,r){if(n==jf&&r==jf)return t;let i=t;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let f;c&&c.nodeName==l.nodeName&&i!=e&&(f=i.parentNode)&&f.nodeName.toLowerCase()==l.nodeName||(f=document.createElement(l.nodeName),f.pmIsDeco=!0,f.appendChild(i),c=jf[0]),i=f}JL(i,c||jf[0],l)}return i}function JL(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&e.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&e.classList.add(i[s]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(t.style);)e.style.removeProperty(i[1])}n.style&&(e.style.cssText+=n.style)}}function zA(e,t,n){return jA(e,e,jf,L2(t,n,e.nodeType!=1))}function pg(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function DS(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class ZL{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=QL(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,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=Nl,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 y=this.top.children[p];if(y.matchesMark(t[l])&&!this.isLocked(y.dom)){f=p;break}}if(f>-1)f>this.index&&(this.changed=!0,this.destroyBetween(this.index,f)),this.top=this.top.children[this.index];else{let p=ed.create(this.top,t[l],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(t,n,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,n,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,n,r)&&!this.preMatch.matched.has(d)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,n,r,i,s){let l=this.top.children[i];return l.dirty==Pc&&l.dom==l.contentDOM&&(l.dirty=If),l.update(t,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==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=n}}updateNextNode(t,n,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let f=this.top.children[c];if(f instanceof ff){let d=this.preMatch.matched.get(f);if(d!=null&&d!=s)return!1;let p=f.dom,y,b=this.isLocked(p)&&!(t.isText&&f.node&&f.node.isText&&f.nodeDOM.nodeValue==t.text&&f.dirty!=Pc&&pg(n,f.outerDeco));if(!b&&f.update(t,n,r,i))return this.destroyBetween(this.index,c),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!b&&(y=this.recreateWrapper(f,t,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=y,y.contentDOM&&(y.dirty=If,y.updateChildren(i,l+1),y.dirty=Nl),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,i,s,l){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!pg(r,t.outerDeco)||!i.eq(t.innerDeco))return null;let c=ff.create(this.top,n,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,n,r,i,s){let l=ff.create(this.top,t,n,r,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(t,n,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 OA(this.top,t,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof ed;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof c0)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((qs||bs)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.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 PA(this.top,[],r,null);n!=this.top?n.children.push(i):n.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 QL(e,t){let n=t,r=n.children.length,i=e.childCount,s=new Map,l=[];t:for(;i>0;){let c;for(;;)if(r){let d=n.children[r-1];if(d instanceof ed)n=d,r=d.children.length;else{c=d,r--;break}}else{if(n==t)break t;r=n.parent.children.indexOf(n),n=n.parent}let f=c.node;if(f){if(f!=e.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function tD(e,t){return e.type.side-t.type.side}function eD(e,t,n,r){let i=t.locals(e),s=0;if(i.length==0){for(let d=0;d<e.childCount;d++){let p=e.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,y;for(;l<i.length&&i[l].to==s;){let L=i[l++];L.widget&&(p?(y||(y=[p])).push(L):p=L)}if(p)if(y){y.sort(tD);for(let L=0;L<y.length;L++)n(y[L],d,!!f)}else n(p,d,!!f);let b,g;if(f)g=-1,b=f,f=null;else if(d<e.childCount)g=d,b=e.child(d++);else break;for(let L=0;L<c.length;L++)c[L].to<=s&&c.splice(L--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)c.push(i[l++]);let C=s+b.nodeSize;if(b.isText){let L=C;l<i.length&&i[l].from<L&&(L=i[l].from);for(let D=0;D<c.length;D++)c[D].to<L&&(L=c[D].to);L<C&&(f=b.cut(L-s),b=b.cut(0,L-s),C=L,g=-1)}else for(;l<i.length&&i[l].to<C;)l++;let M=b.isInline&&!b.isLeaf?c.filter(L=>!L.inline):c.slice();r(b,M,t.forChild(s,b),g),s=C}}function nD(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function rD(e,t,n,r){for(let i=0,s=0;i<e.childCount&&s<=r;){let l=e.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let f=l.text;for(;i<e.childCount;){let d=e.child(i++);if(s+=d.nodeSize,!d.isText)break;f+=d.text}if(s>=n){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>=n)return c+d;if(n==r&&f.length>=r+t.length-c&&f.slice(r-c,r-c+t.length)==t)return r}}return-1}function D2(e,t,n,r,i){let s=[];for(let l=0,c=0;l<e.length;l++){let f=e[l],d=c,p=c+=f.size;d>=n||p<=t?s.push(f):(d<t&&s.push(f.slice(0,t-d,r)),i&&(s.push(i),i=void 0),p>n&&s.push(f.slice(n-d,f.size,r)))}return s}function k5(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),s=i&&i.size==0,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),f,d;if(l0(n)){for(f=l;i&&!i.node;)i=i.parent;let y=i.node;if(i&&y.isAtom&&Cn.isSelectable(y)&&i.parent&&!(y.isInline&&_L(n.focusNode,n.focusOffset,i.dom))){let b=i.posBefore;d=new Cn(l==b?c:r.resolve(b))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let y=l,b=l;for(let g=0;g<n.rangeCount;g++){let C=n.getRangeAt(g);y=Math.min(y,e.docView.posFromDOM(C.startContainer,C.startOffset,1)),b=Math.max(b,e.docView.posFromDOM(C.endContainer,C.endOffset,-1))}if(y<0)return null;[f,l]=b==e.state.selection.anchor?[b,y]:[y,b],c=r.resolve(l)}else f=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(f<0)return null}let p=r.resolve(f);if(!d){let y=t=="pointer"||e.state.selection.head<c.pos&&!s?1:-1;d=A5(e,p,c,y)}return d}function BA(e){return e.editable?e.hasFocus():UA(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function wu(e,t=!1){let n=e.state.selection;if(FA(e,n),!!BA(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&bs){let r=e.domSelectionRange(),i=e.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&td(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)oD(e);else{let{anchor:r,head:i}=n,s,l;RS&&!(n instanceof Hn)&&(n.$from.parent.inlineContent||(s=OS(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=OS(e,n.to))),e.docView.setSelection(r,i,e,t),RS&&(s&&PS(s),l&&PS(l)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&iD(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const RS=qs||bs&&CA<63;function OS(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(qs&&i&&i.contentEditable=="false")return xy(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return xy(i);if(s)return xy(s)}}function xy(e){return e.contentEditable="true",qs&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function PS(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function iD(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!BA(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function oD(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,gs(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&_a&&uf<=11&&(n.disabled=!0,n.disabled=!1)}function FA(e,t){if(t instanceof Cn){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(IS(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else IS(e)}function IS(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function A5(e,t,n,r){return e.someProp("createSelectionBetween",i=>i(e,t,n))||Hn.between(t,n,r)}function jS(e){return e.editable&&!e.hasFocus()?!1:UA(e)}function UA(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function sD(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return td(t.node,t.offset,n.anchorNode,n.anchorOffset)}function R2(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&tr.findFrom(s,t)}function Qu(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function zS(e,t,n){let r=e.state.selection;if(r instanceof Hn)if(n.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=e.state.doc.resolve(i.pos+s.nodeSize*(t<0?-1:1));return Qu(e,new Hn(r.$anchor,l))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=R2(e.state,t);return i&&i instanceof Cn?Qu(e,i):!1}else if(!(Cl&&n.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=e.docView.descAt(c))&&!l.contentDOM?Cn.isSelectable(s)?Qu(e,new Cn(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):Ap?Qu(e,new Hn(e.state.doc.resolve(t<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Cn&&r.node.isInline)return Qu(e,new Hn(t>0?r.$to:r.$from));{let i=R2(e.state,t);return i?Qu(e,i):!1}}}function mg(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function tp(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Cd(e,t){return t<0?aD(e):lD(e)}function aD(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,l=!1;for(Tl&&n.nodeType==1&&r<mg(n)&&tp(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(tp(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(HA(n))break;{let c=n.previousSibling;for(;c&&tp(c,-1);)i=n.parentNode,s=gs(c),c=c.previousSibling;if(c)n=c,r=mg(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}l?O2(e,n,r):i&&O2(e,i,s)}function lD(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=mg(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(tp(c,1))s=n,l=++r;else break}else{if(HA(n))break;{let c=n.nextSibling;for(;c&&tp(c,1);)s=c.parentNode,l=gs(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=mg(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}}s&&O2(e,s,l)}function HA(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function cD(e,t){for(;e&&t==e.childNodes.length&&!kp(e);)t=gs(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function uD(e,t){for(;e&&!t&&!kp(e);)t=gs(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function O2(e,t,n){if(t.nodeType!=3){let s,l;(l=cD(t,n))?(t=l,n=0):(s=uD(t,n))&&(t=s,n=s.nodeValue.length)}let r=e.domSelection();if(!r)return;if(l0(r)){let s=document.createRange();s.setEnd(t,n),s.setStart(t,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&wu(e)},50)}function BS(e,t){let n=e.state.doc.resolve(t);if(!(bs||EA)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let s=e.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<n.end()){let s=e.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(e.dom).direction=="rtl"?"rtl":"ltr"}function FS(e,t,n){let r=e.state.selection;if(r instanceof Hn&&!r.empty||n.indexOf("s")>-1||Cl&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=R2(e.state,t);if(l&&l instanceof Cn)return Qu(e,l)}if(!i.parent.inlineContent){let l=t<0?i:s,c=r instanceof tl?tr.near(l,t):tr.findFrom(l,t);return c?Qu(e,c):!1}return!1}function US(e,t){if(!(e.state.selection instanceof Hn))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let l=e.state.tr;return t<0?l.delete(n.pos-s.nodeSize,n.pos):l.delete(n.pos,n.pos+s.nodeSize),e.dispatch(l),!0}return!1}function HS(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function fD(e){if(!qs||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;HS(e,r,"true"),setTimeout(()=>HS(e,r,"false"),20)}return!1}function dD(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function hD(e,t){let n=t.keyCode,r=dD(t);if(n==8||Cl&&n==72&&r=="c")return US(e,-1)||Cd(e,-1);if(n==46&&!t.shiftKey||Cl&&n==68&&r=="c")return US(e,1)||Cd(e,1);if(n==13||n==27)return!0;if(n==37||Cl&&n==66&&r=="c"){let i=n==37?BS(e,e.state.selection.from)=="ltr"?-1:1:-1;return zS(e,i,r)||Cd(e,i)}else if(n==39||Cl&&n==70&&r=="c"){let i=n==39?BS(e,e.state.selection.from)=="ltr"?1:-1:1;return zS(e,i,r)||Cd(e,i)}else{if(n==38||Cl&&n==80&&r=="c")return FS(e,-1,r)||Cd(e,-1);if(n==40||Cl&&n==78&&r=="c")return fD(e)||FS(e,1,r)||Cd(e,1);if(r==(Cl?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function M5(e,t){e.someProp("transformCopied",g=>{t=g(t,e)});let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let g=r.firstChild;n.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),r=g.content}let l=e.someProp("clipboardSerializer")||od.fromSchema(e.state.schema),c=XA(),f=c.createElement("div");f.appendChild(l.serializeFragment(r,{document:c}));let d=f.firstChild,p,y=0;for(;d&&d.nodeType==1&&(p=WA[d.nodeName.toLowerCase()]);){for(let g=p.length-1;g>=0;g--){let C=c.createElement(p[g]);for(;f.firstChild;)C.appendChild(f.firstChild);f.appendChild(C),y++}d=f.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${s}${y?` -${y}`:""} ${JSON.stringify(n)}`);let b=e.someProp("clipboardTextSerializer",g=>g(t,e))||t.content.textBetween(0,t.content.size,`
97
+
98
+ `);return{dom:f,text:b,slice:t}}function qA(e,t,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!t)return null;let f=!!t&&(r||s||!n);if(f){if(e.someProp("transformPastedText",b=>{t=b(t,s||r,e)}),s)return c=new Ge(Ce.from(e.state.schema.text(t.replace(/\r\n?/g,`
99
+ `))),0,0),e.someProp("transformPasted",b=>{c=b(c,e,!0)}),c;let y=e.someProp("clipboardTextParser",b=>b(t,i,r,e));if(y)c=y;else{let b=i.marks(),{schema:g}=e.state,C=od.fromSchema(g);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(M=>{let L=l.appendChild(document.createElement("p"));M&&L.appendChild(C.serializeNode(g.text(M,b)))})}}else e.someProp("transformPastedHTML",y=>{n=y(n,e)}),l=yD(n),Ap&&bD(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 y=+p[3];y>0;y--){let b=l.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;l=b}if(c||(c=(e.someProp("clipboardParser")||e.someProp("domParser")||Jh.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!pD.test(b.parentNode.nodeName)?{ignore:!0}:null}})),p)c=xD(qS(c,+p[1],+p[2]),p[4]);else if(c=Ge.maxOpen(mD(c.content,i),!0),c.openStart||c.openEnd){let y=0,b=0;for(let g=c.content.firstChild;y<c.openStart&&!g.type.spec.isolating;y++,g=g.firstChild);for(let g=c.content.lastChild;b<c.openEnd&&!g.type.spec.isolating;b++,g=g.lastChild);c=qS(c,y,b)}return e.someProp("transformPasted",y=>{c=y(c,e,f)}),c}const pD=/^(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 mD(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),s,l=[];if(e.forEach(c=>{if(!l)return;let f=i.findWrapping(c.type),d;if(!f)return l=null;if(d=l.length&&s.length&&YA(f,s,c,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=VA(l[l.length-1],s.length));let p=$A(c,f);l.push(p),i=i.matchType(p.type),s=f}}),l)return Ce.from(l)}return e}function $A(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Ce.from(e));return e}function YA(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=YA(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Ce.from($A(n,e,i+1))))}}function VA(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,VA(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Ce.empty,!0);return e.copy(n.append(r))}function P2(e,t,n,r,i,s){let l=t<0?e.firstChild:e.lastChild,c=l.content;return e.childCount>1&&(s=0),i<r-1&&(c=P2(c,t,n,r,i+1,s)),i>=n&&(c=t<0?l.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(Ce.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(c))}function qS(e,t,n){return t<e.openStart&&(e=new Ge(P2(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Ge(P2(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const WA={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let $S=null;function XA(){return $S||($S=document.implementation.createHTMLDocument("title"))}let vy=null;function gD(e){let t=window.trustedTypes;return t?(vy||(vy=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),vy.createHTML(e)):e}function yD(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=XA().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&WA[r[1].toLowerCase()])&&(e=i.map(s=>"<"+s+">").join("")+e+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=gD(e),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function bD(e){let t=e.querySelectorAll(bs?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function xD(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:s,openEnd:l}=e;for(let c=r.length-2;c>=0;c-=2){let f=n.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;i=Ce.from(f.create(r[c+1],i)),s++,l++}return new Ge(i,s,l)}const oa={},sa={},vD={touchstart:!0,touchmove:!0};class wD{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 SD(e){for(let t in oa){let n=oa[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{AD(e,r)&&!C5(e,r)&&(e.editable||!(r.type in sa))&&n(e,r)},vD[t]?{passive:!0}:void 0)}qs&&e.dom.addEventListener("input",()=>null),I2(e)}function lf(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function kD(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function I2(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>C5(e,r))})}function C5(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function AD(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function MD(e,t){!C5(e,t)&&oa[t.type]&&(e.editable||!(t.type in sa))&&oa[t.type](e,t)}sa.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!KA(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(xu&&bs&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Gd&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",i=>i(e,Pf(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||hD(e,n)?n.preventDefault():lf(e,"key")};sa.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};sa.keypress=(e,t)=>{let n=t;if(KA(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Cl&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Hn)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",l=>l(e,r.$from.pos,r.$to.pos,i,s))&&e.dispatch(s()),n.preventDefault()}};function u0(e){return{left:e.clientX,top:e.clientY}}function CD(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function E5(e,t,n,r,i){if(r==-1)return!1;let s=e.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(e.someProp(t,c=>l>s.depth?c(e,n,s.nodeAfter,s.before(l),i,!0):c(e,n,s.node(l),s.before(l),i,!1)))return!0;return!1}function Yd(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function ED(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Cn.isSelectable(r)?(Yd(e,new Cn(n)),!0):!1}function TD(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof Cn&&(r=n.node);let s=e.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&&n.$from.depth>0&&l>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(l);break}}return i!=null?(Yd(e,Cn.create(e.state.doc,i)),!0):!1}function ND(e,t,n,r,i){return E5(e,"handleClickOn",t,n,r)||e.someProp("handleClick",s=>s(e,t,r))||(i?TD(e,n):ED(e,n))}function _D(e,t,n,r){return E5(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",i=>i(e,t,r))}function LD(e,t,n,r){return E5(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",i=>i(e,t,r))||DD(e,n,r)}function DD(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Yd(e,Hn.create(r,0,r.content.size)),!0):!1;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)Yd(e,Hn.create(r,c+1,c+1+l.content.size));else if(Cn.isSelectable(l))Yd(e,Cn.create(r,c));else continue;return!0}}function T5(e){return gg(e)}const GA=Cl?"metaKey":"ctrlKey";oa.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=T5(e),i=Date.now(),s="singleClick";i-e.input.lastClick.time<500&&CD(n,e.input.lastClick)&&!n[GA]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?s="doubleClick":e.input.lastClick.type=="doubleClick"&&(s="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let l=e.posAtCoords(u0(n));l&&(s=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new RD(e,l,n,!!r)):(s=="doubleClick"?_D:LD)(e,l.pos,l.inside,n)?n.preventDefault():lf(e,"pointer"))};class RD{constructor(t,n,r,i){this.view=t,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[GA],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=t.state.doc.nodeAt(n.inside),l=n.inside;else{let p=t.state.doc.resolve(n.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&&Tl&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),lf(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),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(()=>wu(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(u0(t))),this.updateAllowDefault(t),this.allowDefault||!n?lf(this.view,"pointer"):ND(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||qs&&this.mightDrag&&!this.mightDrag.node.isAtom||bs&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yd(this.view,tr.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):lf(this.view,"pointer")}move(t){this.updateAllowDefault(t),lf(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}oa.touchstart=e=>{e.input.lastTouch=Date.now(),T5(e),lf(e,"pointer")};oa.touchmove=e=>{e.input.lastTouch=Date.now(),lf(e,"pointer")};oa.contextmenu=e=>T5(e);function KA(e,t){return e.composing?!0:qs&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const OD=xu?5e3:-1;sa.compositionstart=sa.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Hn&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||bs&&EA&&PD(e)))e.markCursor=e.state.storedMarks||n.marks(),gg(e,!0),e.markCursor=null;else if(gg(e,!t.selection.empty),Tl&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.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=e.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}e.input.composing=!0}JA(e,OD)};function PD(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}sa.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,JA(e,20))};function JA(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>gg(e),t))}function ZA(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=jD());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function ID(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=TL(t.focusNode,t.focusOffset),r=NL(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=e.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function jD(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function gg(e,t=!1){if(!(xu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),ZA(e),t||e.docView&&e.docView.dirty){let n=k5(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function zD(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const pp=_a&&uf<15||Gd&&RL<604;oa.copy=sa.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type=="cut";if(r.empty)return;let s=pp?null:n.clipboardData,l=r.content(),{dom:c,text:f}=M5(e,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):zD(e,c),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function BD(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function FD(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?mp(e,r.value,null,i,t):mp(e,r.textContent,r.innerHTML,i,t)},50)}function mp(e,t,n,r,i){let s=qA(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",f=>f(e,i,s||Ge.empty)))return!0;if(!s)return!1;let l=BD(s),c=l?e.state.tr.replaceSelectionWith(l,r):e.state.tr.replaceSelection(s);return e.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function QA(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}sa.paste=(e,t)=>{let n=t;if(e.composing&&!xu)return;let r=pp?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&mp(e,QA(r),r.getData("text/html"),i,n)?n.preventDefault():FD(e,n)};class tM{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const UD=Cl?"altKey":"ctrlKey";function eM(e,t){let n=e.someProp("dragCopies",r=>!r(t));return n??!t[UD]}oa.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(u0(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Cn?i.to-1:i.to))){if(r&&r.mightDrag)l=Cn.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let y=e.docView.nearestDesc(n.target,!0);y&&y.node.type.spec.draggable&&y!=e.docView&&(l=Cn.create(e.state.doc,y.posBefore))}}let c=(l||e.state.selection).content(),{dom:f,text:d,slice:p}=M5(e,c);(!n.dataTransfer.files.length||!bs||CA>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(pp?"Text":"text/html",f.innerHTML),n.dataTransfer.effectAllowed="copyMove",pp||n.dataTransfer.setData("text/plain",d),e.dragging=new tM(p,eM(e,n),l)};oa.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};sa.dragover=sa.dragenter=(e,t)=>t.preventDefault();sa.drop=(e,t)=>{try{HD(e,t,e.dragging)}finally{e.dragging=null}};function HD(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(u0(t));if(!r)return;let i=e.state.doc.resolve(r.pos),s=n&&n.slice;s?e.someProp("transformPasted",g=>{s=g(s,e,!1)}):s=qA(e,QA(t.dataTransfer),pp?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&eM(e,t));if(e.someProp("handleDrop",g=>g(e,t,s||Ge.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let c=s?oA(e.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let f=e.state.tr;if(l){let{node:g}=n;g?g.replace(f):f.deleteSelection()}let d=f.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,y=f.doc;if(p?f.replaceRangeWith(d,d,s.content.firstChild):f.replaceRange(d,d,s),f.doc.eq(y))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 g=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((C,M,L,D)=>g=D),f.setSelection(A5(e,b,f.doc.resolve(g)))}e.focus(),e.dispatch(f.setMeta("uiEvent","drop"))}oa.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&wu(e)},20))};oa.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};oa.beforeinput=(e,t)=>{if(bs&&xu&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",s=>s(e,Pf(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in sa)oa[e]=sa[e];function gp(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class yg{constructor(t,n){this.toDOM=t,this.spec=n||qf,this.side=this.spec.side||0}map(t,n,r,i){let{pos:s,deleted:l}=t.mapResult(n.from+i,this.side<0?-1:1);return l?null:new ia(s-r,s-r,this)}valid(){return!0}eq(t){return this==t||t instanceof yg&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&gp(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class df{constructor(t,n){this.attrs=t,this.spec=n||qf}map(t,n,r,i){let s=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,l=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new ia(s,l,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof df&&gp(this.attrs,t.attrs)&&gp(this.spec,t.spec)}static is(t){return t.type instanceof df}destroy(){}}class N5{constructor(t,n){this.attrs=t,this.spec=n||qf}map(t,n,r,i){let s=t.mapResult(n.from+i,1);if(s.deleted)return null;let l=t.mapResult(n.to+i,-1);return l.deleted||l.pos<=s.pos?null:new ia(s.pos-r,l.pos-r,this)}valid(t,n){let{index:r,offset:i}=t.content.findIndex(n.from),s;return i==n.from&&!(s=t.child(r)).isText&&i+s.nodeSize==n.to}eq(t){return this==t||t instanceof N5&&gp(this.attrs,t.attrs)&&gp(this.spec,t.spec)}destroy(){}}class ia{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new ia(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new ia(t,t,new yg(n,r))}static inline(t,n,r,i){return new ia(t,n,new df(r,i))}static node(t,n,r,i){return new ia(t,n,new N5(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof df}get widget(){return this.type instanceof yg}}const Od=[],qf={};class Fi{constructor(t,n){this.local=t.length?t:Od,this.children=n.length?n:Od}static create(t,n){return n.length?bg(n,t,0,qf):Hs}find(t,n,r){let i=[];return this.findInner(t??0,n??1e9,i,0,r),i}findInner(t,n,r,i,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&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]<n&&this.children[l+1]>t){let c=this.children[l]+1;this.children[l+2].findInner(t-c,n-c,r,i+c,s)}}map(t,n,r){return this==Hs||t.maps.length==0?this:this.mapInner(t,n,0,0,r||qf)}mapInner(t,n,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(n,f)?(l||(l=[])).push(f):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?qD(this.children,l||[],t,n,r,i,s):l?new Fi(l.sort($f),Od):Hs}add(t,n){return n.length?this==Hs?Fi.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,s=0;t.forEach((c,f)=>{let d=f+r,p;if(p=rM(n,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,bg(p,c,d+1,qf)),s+=3}});let l=nM(s?iM(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||l.splice(c--,1);return new Fi(l.length?this.local.concat(l).sort($f):this.local,i||this.children)}remove(t){return t.length==0||this==Hs?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+n,f=r[s+1]+n;for(let p=0,y;p<t.length;p++)(y=t[p])&&y.from>c&&y.to<f&&(t[p]=null,(l||(l=[])).push(y));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,c+1);d!=Hs?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,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Fi(i,r):Hs}forChild(t,n){if(this==Hs)return this;if(n.isLeaf)return Fi.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+n.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 df){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 Fi(i.sort($f),Od);return r?new nf([c,r]):c}return r||Hs}eq(t){if(this==t)return!0;if(!(t instanceof Fi)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return _5(this.localsInner(t))}localsInner(t){if(this==Hs)return Od;if(t.inlineContent||!this.local.some(df.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof df||n.push(this.local[r]);return n}forEachSet(t){t(this)}}Fi.empty=new Fi([],[]);Fi.removeOverlap=_5;const Hs=Fi.empty;class nf{constructor(t){this.members=t}map(t,n){const r=this.members.map(i=>i.map(t,n,qf));return nf.from(r)}forChild(t,n){if(n.isLeaf)return Fi.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(t,n);s!=Hs&&(s instanceof nf?r=r.concat(s.members):r.push(s))}return nf.from(r)}eq(t){if(!(t instanceof nf)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(t);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let l=0;l<s.length;l++)n.push(s[l])}}return n?_5(r?n:n.sort($f)):Od}static from(t){switch(t.length){case 0:return Hs;case 1:return t[0];default:return new nf(t.every(n=>n instanceof Fi)?t:t.reduce((n,r)=>n.concat(r instanceof Fi?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function qD(e,t,n,r,i,s,l){let c=e.slice();for(let d=0,p=s;d<n.maps.length;d++){let y=0;n.maps[d].forEach((b,g,C,M)=>{let L=M-C-(g-b);for(let D=0;D<c.length;D+=3){let H=c[D+1];if(H<0||b>H+p-y)continue;let V=c[D]+p-y;g>=V?c[D+1]=b<=V?-2:-1:b>=p&&L&&(c[D]+=L,c[D+1]+=L)}y+=L}),p=n.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=n.map(e[d]+s),y=p-i;if(y<0||y>=r.content.size){f=!0;continue}let b=n.map(e[d+1]+s,-1),g=b-i,{index:C,offset:M}=r.content.findIndex(y),L=r.maybeChild(C);if(L&&M==y&&M+L.nodeSize==g){let D=c[d+2].mapInner(n,L,p+1,e[d]+s+1,l);D!=Hs?(c[d]=y,c[d+1]=g,c[d+2]=D):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=$D(c,e,t,n,i,s,l),p=bg(d,r,0,l);t=p.local;for(let y=0;y<c.length;y+=3)c[y+1]<0&&(c.splice(y,3),y-=3);for(let y=0,b=0;y<p.children.length;y+=3){let g=p.children[y];for(;b<c.length&&c[b]<g;)b+=3;c.splice(b,0,p.children[y],p.children[y+1],p.children[y+2])}}return new Fi(t.sort($f),c)}function nM(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new ia(i.from+t,i.to+t,i.type))}return n}function $D(e,t,n,r,i,s,l){function c(f,d){for(let p=0;p<f.local.length;p++){let y=f.local[p].map(r,i,d);y?n.push(y):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<e.length;f+=3)e[f+1]==-1&&c(e[f+2],t[f]+s+1);return n}function rM(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let s=0,l;s<e.length;s++)(l=e[s])&&l.from>n&&l.to<r&&((i||(i=[])).push(l),e[s]=null);return i}function iM(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function bg(e,t,n,r){let i=[],s=!1;t.forEach((c,f)=>{let d=rM(e,c,f+n);if(d){s=!0;let p=bg(d,c,n+f+1,r);p!=Hs&&i.push(f,f+c.nodeSize,p)}});let l=nM(s?iM(e):e,-n).sort($f);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 Fi(l,i):Hs}function $f(e,t){return e.from-t.from||e.to-t.to}function _5(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let s=t[i];if(s.from==r.from){s.to!=r.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,r.to),YS(t,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,s.from),YS(t,i,r.copy(s.from,r.to)));break}}}return t}function YS(e,t,n){for(;t<e.length&&$f(n,e[t])>0;)t++;e.splice(t,0,n)}function wy(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Hs&&t.push(r)}),e.cursorWrapper&&t.push(Fi.create(e.state.doc,[e.cursorWrapper.deco])),nf.from(t)}const YD={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},VD=_a&&uf<=11;class WD{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 XD{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new WD,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]);_a&&uf<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():qs&&t.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),VD&&(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,YD)),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 n=0;n<t.length;n++)this.queue.push(t[n]);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(jS(this.view)){if(this.suppressingSelectionUpdates)return wu(this.view);if(_a&&uf<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&td(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 n=new Set,r;for(let s=t.focusNode;s;s=Xd(s))n.add(s);for(let s=t.anchorNode;s;s=Xd(s))if(n.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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&jS(t)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,f=[];if(t.editable)for(let p=0;p<n.length;p++){let y=this.registerMutation(n[p],f);y&&(s=s<0?y.from:Math.min(y.from,s),l=l<0?y.to:Math.max(y.to,l),y.typeOver&&(c=!0))}if(f.some(p=>p.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let p of f)if(p.nodeName=="BR"&&p.parentNode){let y=p.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&p.parentNode.removeChild(p)}}else if(Tl&&f.length){let p=f.filter(y=>y.nodeName=="BR");if(p.length==2){let[y,b]=p;y.parentNode&&y.parentNode.parentNode==b.parentNode?b.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let b of p){let g=b.parentNode;g&&g.nodeName=="LI"&&(!y||JD(t,y)!=g)&&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&&l0(r)&&(d=k5(t))&&d.eq(tr.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,wu(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,l),GD(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,ZD(t,f)),this.handleDOMChange(s,l,c,f),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||wu(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.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 y=t.addedNodes[p];n.push(y),y.nodeType==3&&(this.lastChangedTextNode=y)}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(_a&&uf<=11&&t.addedNodes.length)for(let p=0;p<t.addedNodes.length;p++){let{previousSibling:y,nextSibling:b}=t.addedNodes[p];(!y||Array.prototype.indexOf.call(t.addedNodes,y)<0)&&(i=y),(!b||Array.prototype.indexOf.call(t.addedNodes,b)<0)&&(s=b)}let l=i&&i.parentNode==t.target?gs(i)+1:0,c=r.localPosFromDOM(t.target,l,-1),f=s&&s.parentNode==t.target?gs(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 VS=new WeakMap,WS=!1;function GD(e){if(!VS.has(e)&&(VS.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Tl,WS)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."),WS=!0}}function XS(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,l=e.domAtPos(e.state.selection.anchor);return td(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function KD(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return XS(e,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?XS(e,n):null}function JD(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function ZD(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let s of t)if(((n=s.parentNode)===null||n===void 0?void 0:n.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&&e.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function QD(e,t,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=e.docView.parseRange(t,n),f=e.domSelectionRange(),d,p=f.anchorNode;if(p&&e.dom.contains(p.nodeType==1?p:p.parentNode)&&(d=[{node:p,offset:f.anchorOffset}],l0(f)||d.push({node:f.focusNode,offset:f.focusOffset})),bs&&e.input.lastKeyCode===8)for(let L=s;L>i;L--){let D=r.childNodes[L-1],H=D.pmViewDesc;if(D.nodeName=="BR"&&!H){s=L;break}if(!H||H.size)break}let y=e.state.doc,b=e.someProp("domParser")||Jh.fromSchema(e.state.schema),g=y.resolve(l),C=null,M=b.parse(r,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:tR,context:g});if(d&&d[0].pos!=null){let L=d[0].pos,D=d[1]&&d[1].pos;D==null&&(D=L),C={anchor:L+l,head:D+l}}return{doc:M,sel:C,from:l,to:c}}function tR(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(qs&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||qs&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const eR=/^(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 nR(e,t,n,r,i){let s=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let kt=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,xt=k5(e,kt);if(xt&&!e.state.selection.eq(xt)){if(bs&&xu&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",jt=>jt(e,Pf(13,"Enter"))))return;let rt=e.state.tr.setSelection(xt);kt=="pointer"?rt.setMeta("pointer",!0):kt=="key"&&rt.scrollIntoView(),s&&rt.setMeta("composition",s),e.dispatch(rt)}return}let l=e.state.doc.resolve(t),c=l.sharedDepth(n);t=l.before(c+1),n=e.state.doc.resolve(n).after(c+1);let f=e.state.selection,d=QD(e,t,n),p=e.state.doc,y=p.slice(d.from,d.to),b,g;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(b=e.state.selection.to,g="end"):(b=e.state.selection.from,g="start"),e.input.lastKeyCode=null;let C=oR(y.content,d.doc.content,d.from,b,g);if(C&&e.input.domChangeCount++,(Gd&&e.input.lastIOSEnter>Date.now()-225||xu)&&i.some(kt=>kt.nodeType==1&&!eR.test(kt.nodeName))&&(!C||C.endA>=C.endB)&&e.someProp("handleKeyDown",kt=>kt(e,Pf(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!C)if(r&&f instanceof Hn&&!f.empty&&f.$head.sameParent(f.$anchor)&&!e.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))C={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let kt=GS(e,e.state.doc,d.sel);if(kt&&!kt.eq(e.state.selection)){let xt=e.state.tr.setSelection(kt);s&&xt.setMeta("composition",s),e.dispatch(xt)}}return}e.state.selection.from<e.state.selection.to&&C.start==C.endB&&e.state.selection instanceof Hn&&(C.start>e.state.selection.from&&C.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?C.start=e.state.selection.from:C.endA<e.state.selection.to&&C.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(C.endB+=e.state.selection.to-C.endA,C.endA=e.state.selection.to)),_a&&uf<=11&&C.endB==C.start+1&&C.endA==C.start&&C.start>d.from&&d.doc.textBetween(C.start-d.from-1,C.start-d.from+1)=="  "&&(C.start--,C.endA--,C.endB--);let M=d.doc.resolveNoCache(C.start-d.from),L=d.doc.resolveNoCache(C.endB-d.from),D=p.resolve(C.start),H=M.sameParent(L)&&M.parent.inlineContent&&D.end()>=C.endA;if((Gd&&e.input.lastIOSEnter>Date.now()-225&&(!H||i.some(kt=>kt.nodeName=="DIV"||kt.nodeName=="P"))||!H&&M.pos<d.doc.content.size&&(!M.sameParent(L)||!M.parent.inlineContent)&&M.pos<L.pos&&!/\S/.test(d.doc.textBetween(M.pos,L.pos,"","")))&&e.someProp("handleKeyDown",kt=>kt(e,Pf(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>C.start&&iR(p,C.start,C.endA,M,L)&&e.someProp("handleKeyDown",kt=>kt(e,Pf(8,"Backspace")))){xu&&bs&&e.domObserver.suppressSelectionUpdates();return}bs&&C.endB==C.start&&(e.input.lastChromeDelete=Date.now()),xu&&!H&&M.start()!=L.start()&&L.parentOffset==0&&M.depth==L.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==C.endA&&(C.endB-=2,L=d.doc.resolveNoCache(C.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(kt){return kt(e,Pf(13,"Enter"))})},20));let V=C.start,W=C.endA,gt=kt=>{let xt=kt||e.state.tr.replace(V,W,d.doc.slice(C.start-d.from,C.endB-d.from));if(d.sel){let rt=GS(e,xt.doc,d.sel);rt&&!(bs&&e.composing&&rt.empty&&(C.start!=C.endB||e.input.lastChromeDelete<Date.now()-100)&&(rt.head==V||rt.head==xt.mapping.map(W)-1)||_a&&rt.empty&&rt.head==V)&&xt.setSelection(rt)}return s&&xt.setMeta("composition",s),xt.scrollIntoView()},_t;if(H)if(M.pos==L.pos){_a&&uf<=11&&M.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>wu(e),20));let kt=gt(e.state.tr.delete(V,W)),xt=p.resolve(C.start).marksAcross(p.resolve(C.endA));xt&&kt.ensureMarks(xt),e.dispatch(kt)}else if(C.endA==C.endB&&(_t=rR(M.parent.content.cut(M.parentOffset,L.parentOffset),D.parent.content.cut(D.parentOffset,C.endA-D.start())))){let kt=gt(e.state.tr);_t.type=="add"?kt.addMark(V,W,_t.mark):kt.removeMark(V,W,_t.mark),e.dispatch(kt)}else if(M.parent.child(M.index()).isText&&M.index()==L.index()-(L.textOffset?0:1)){let kt=M.parent.textBetween(M.parentOffset,L.parentOffset),xt=()=>gt(e.state.tr.insertText(kt,V,W));e.someProp("handleTextInput",rt=>rt(e,V,W,kt,xt))||e.dispatch(xt())}else e.dispatch(gt());else e.dispatch(gt())}function GS(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:A5(e,t.resolve(n.anchor),t.resolve(n.head))}function rR(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,s=r,l,c,f;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)s=n[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(e))return{mark:c,type:l}}function iR(e,t,n,r,i){if(n-t<=i.pos-r.pos||Sy(r,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==t+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=e.resolve(Sy(s,!0,!0));return!l.parent.isTextblock||l.pos>n||Sy(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Sy(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let s=e.node(r).maybeChild(e.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function oR(e,t,n,r,i){let s=e.findDiffStart(t,n);if(s==null)return null;let{a:l,b:c}=e.findDiffEnd(t,n+e.size,n+t.size);if(i=="end"){let f=Math.max(0,s-Math.min(l,c));r-=l+f-s}if(l<s&&e.size<t.size){let f=r<=s&&r>=l?s-r:0;s-=f,s&&s<t.size&&KS(t.textBetween(s-1,s+1))&&(s+=f?1:-1),c=s+(c-l),l=s}else if(c<s){let f=r<=s&&r>=c?s-r:0;s-=f,s&&s<e.size&&KS(e.textBetween(s-1,s+1))&&(s+=f?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function KS(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class oM{constructor(t,n){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 wD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(e3),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=QS(this),ZS(this),this.nodeViews=t3(this),this.docView=LS(this.state.doc,JS(this),wy(this),this.dom,this),this.domObserver=new XD(this,(r,i,s,l)=>nR(this,r,i,s,l)),this.domObserver.start(),SD(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 n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&I2(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(e3),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let i=this.state,s=!1,l=!1;t.storedMarks&&this.composing&&(ZA(this),l=!0),this.state=t;let c=i.plugins!=t.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let g=t3(this);aR(g,this.nodeViews)&&(this.nodeViews=g,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&I2(this),this.editable=QS(this),ZS(this);let f=wy(this),d=JS(this),p=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",y=s||!this.docView.matchesNode(t.doc,d,f);(y||!t.selection.eq(i.selection))&&(l=!0);let b=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&IL(this);if(l){this.domObserver.stop();let g=y&&(_a||bs)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&sR(i.selection,t.selection);if(y){let C=bs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ID(this)),(s||!this.docView.update(t.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=LS(t.doc,d,f,this.dom,this)),C&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(g=!0)}g||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&sD(this))?wu(this,g):(FA(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&&jL(b)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Cn){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&MS(this,n.getBoundingClientRect(),t)}else MS(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 n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new tM(t.slice,t.move,i<0?void 0:Cn.create(this.state.doc,i))}someProp(t,n){let r=this._props&&this._props[t],i;if(r!=null&&(i=n?n(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[t];if(c!=null&&(i=n?n(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=n?n(c):c))return i}}hasFocus(){if(_a){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&&zL(this.dom),wu(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return qL(this,t)}coordsAtPos(t,n=1){return DA(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let i=this.docView.posFromDOM(t,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return XL(this,n||this.state,t)}pasteHTML(t,n){return mp(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return mp(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return M5(this,t)}destroy(){this.docView&&(kD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],wy(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,CL())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return MD(this,t)}domSelectionRange(){let t=this.domSelection();return t?qs&&this.root.nodeType===11&&LL(this.dom.ownerDocument)==this.dom&&KD(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}oM.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function JS(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[ia.node(0,e.state.doc.content.size,t)]}function ZS(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:ia.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function QS(e){return!e.someProp("editable",t=>t(e.state)===!1)}function sR(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function t3(e){let t=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function aR(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r}function e3(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var pf={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:"'"},xg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},lR=typeof navigator<"u"&&/Mac/.test(navigator.platform),cR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ys=0;ys<10;ys++)pf[48+ys]=pf[96+ys]=String(ys);for(var ys=1;ys<=24;ys++)pf[ys+111]="F"+ys;for(var ys=65;ys<=90;ys++)pf[ys]=String.fromCharCode(ys+32),xg[ys]=String.fromCharCode(ys);for(var ky in pf)xg.hasOwnProperty(ky)||(xg[ky]=pf[ky]);function uR(e){var t=lR&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||cR&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?xg:pf)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const fR=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),dR=typeof navigator<"u"&&/Win/.test(navigator.platform);function hR(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");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))fR?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function pR(e){let t=Object.create(null);for(let n in e)t[hR(n)]=e[n];return t}function Ay(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function mR(e){return new Ui({props:{handleKeyDown:sM(e)}})}function sM(e){let t=pR(e);return function(n,r){let i=uR(r),s,l=t[Ay(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=t[Ay(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(dR&&r.ctrlKey&&r.altKey)&&(s=pf[r.keyCode])&&s!=i){let c=t[Ay(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}var gR=Object.defineProperty,L5=(e,t)=>{for(var n in t)gR(e,n,{get:t[n],enumerable:!0})};function f0(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;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=n.selection,i=n.doc,s=n.storedMarks,n}}}var d0=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>{const p=c(...d)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,l=[],c=!!e,f=e||i.tr,d=()=>(!c&&t&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(f),l.every(y=>y===!0)),p={...Object.fromEntries(Object.entries(n).map(([y,b])=>[y,(...C)=>{const M=this.buildProps(f,t),L=b(...C)(M);return l.push(L),p}])),run:d};return p}createCan(e){const{rawCommands:t,state:n}=this,r=!1,i=e||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(t).map(([c,f])=>[c,(...d)=>f(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,l={tr:e,editor:r,view:s,state:f0({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([c,f])=>[c,(...d)=>f(...d)(l)]))}};return l}},aM={};L5(aM,{blur:()=>yR,clearContent:()=>bR,clearNodes:()=>xR,command:()=>vR,createParagraphNear:()=>wR,cut:()=>SR,deleteCurrentNode:()=>kR,deleteNode:()=>AR,deleteRange:()=>MR,deleteSelection:()=>CR,enter:()=>ER,exitCode:()=>TR,extendMarkRange:()=>NR,first:()=>_R,focus:()=>DR,forEach:()=>RR,insertContent:()=>OR,insertContentAt:()=>jR,joinBackward:()=>FR,joinDown:()=>BR,joinForward:()=>UR,joinItemBackward:()=>HR,joinItemForward:()=>qR,joinTextblockBackward:()=>$R,joinTextblockForward:()=>YR,joinUp:()=>zR,keyboardShortcut:()=>WR,lift:()=>XR,liftEmptyBlock:()=>GR,liftListItem:()=>KR,newlineInCode:()=>JR,resetAttributes:()=>ZR,scrollIntoView:()=>QR,selectAll:()=>tO,selectNodeBackward:()=>eO,selectNodeForward:()=>nO,selectParentNode:()=>rO,selectTextblockEnd:()=>iO,selectTextblockStart:()=>oO,setContent:()=>sO,setMark:()=>EO,setMeta:()=>TO,setNode:()=>NO,setNodeSelection:()=>_O,setTextDirection:()=>LO,setTextSelection:()=>DO,sinkListItem:()=>RO,splitBlock:()=>OO,splitListItem:()=>PO,toggleList:()=>IO,toggleMark:()=>jO,toggleNode:()=>zO,toggleWrap:()=>BO,undoInputRule:()=>FO,unsetAllMarks:()=>UO,unsetMark:()=>HO,unsetTextDirection:()=>qO,updateAttributes:()=>$O,wrapIn:()=>YO,wrapInList:()=>VO});var yR=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),bR=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),xR=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{e.doc.nodesBetween(s.pos,l.pos,(c,f)=>{if(c.type.isText)return;const{doc:d,mapping:p}=t,y=d.resolve(p.map(f)),b=d.resolve(p.map(f+c.nodeSize)),g=y.blockRange(b);if(!g)return;const C=nh(g);if(c.type.isTextblock){const{defaultType:M}=y.parent.contentMatchAt(y.index());t.setNodeMarkup(g.start,M)}(C||C===0)&&t.lift(g,C)})}),!0},vR=e=>t=>e(t),wR=()=>({state:e,dispatch:t})=>wA(e,t),SR=(e,t)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const l=r.mapping.map(t);return r.insert(l,s.content),r.setSelection(new Hn(r.doc.resolve(Math.max(l-1,0)))),!0},kR=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(t){const c=i.before(s),f=i.after(s);e.delete(c,f).scrollIntoView()}return!0}return!1};function ko(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var AR=e=>({tr:t,state:n,dispatch:r})=>{const i=ko(e,n.schema),s=t.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const f=s.before(l),d=s.after(l);t.delete(f,d).scrollIntoView()}return!0}return!1},MR=e=>({tr:t,dispatch:n})=>{const{from:r,to:i}=e;return n&&t.delete(r,i),!0},CR=()=>({state:e,dispatch:t})=>y5(e,t),ER=()=>({commands:e})=>e.keyboardShortcut("Enter"),TR=()=>({state:e,dispatch:t})=>fL(e,t);function D5(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function vg(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>n.strict?t[i]===e[i]:D5(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function lM(e,t,n={}){return e.find(r=>r.type===t&&vg(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function n3(e,t,n={}){return!!lM(e,t,n)}function R5(e,t,n){var r;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if((!i.node||!i.node.marks.some(p=>p.type===t))&&(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(p=>p.type===t)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!lM([...i.node.marks],t,n)))return;let l=i.index,c=e.start()+i.offset,f=l+1,d=c+i.node.nodeSize;for(;l>0&&n3([...e.parent.child(l-1).marks],t,n);)l-=1,c-=e.parent.child(l).nodeSize;for(;f<e.parent.childCount&&n3([...e.parent.child(f).marks],t,n);)d+=e.parent.child(f).nodeSize,f+=1;return{from:c,to:d}}function ku(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var NR=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const s=ku(e,r.schema),{doc:l,selection:c}=n,{$from:f,from:d,to:p}=c;if(i){const y=R5(f,s,t);if(y&&y.from<=d&&y.to>=p){const b=Hn.create(l,y.from,y.to);n.setSelection(b)}}return!0},_R=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function cM(e){return e instanceof Hn}function zf(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function uM(e,t=null){if(!t)return null;const n=tr.atStart(e),r=tr.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const i=n.from,s=r.to;return t==="all"?Hn.create(e,zf(0,i,s),zf(e.content.size,i,s)):Hn.create(e,zf(t,i,s),zf(t,i,s))}function r3(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function wg(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function LR(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var DR=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};const l=()=>{(wg()||r3())&&r.dom.focus(),LR()&&!wg()&&!r3()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(s&&e===null&&!cM(n.state.selection))return l(),!0;const c=uM(i.doc,e)||n.state.selection,f=n.state.selection.eq(c);return s&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},RR=(e,t)=>n=>e.every((r,i)=>t(r,{...n,index:i})),OR=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),fM=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&fM(r)}return e};function Tm(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return fM(n)}function yp(e,t,n){if(e instanceof cf||e instanceof Ce)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,i=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return Ce.fromArray(e.map(c=>t.nodeFromJSON(c)));const l=t.nodeFromJSON(e);return n.errorOnInvalidContent&&l.check(),l}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",s),yp("",t,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const f=new X4({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(n.slice?Jh.fromSchema(f).parseSlice(Tm(e),n.parseOptions):Jh.fromSchema(f).parse(Tm(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=Jh.fromSchema(t);return n.slice?s.parseSlice(Tm(e),n.parseOptions).content:s.parse(Tm(e),n.parseOptions)}return yp("",t,n)}function PR(e,t,n){const r=e.steps.length-1;if(r<t)return;const i=e.steps[r];if(!(i instanceof Ho||i instanceof qo))return;const s=e.mapping.maps[r];let l=0;s.forEach((c,f,d,p)=>{l===0&&(l=p)}),e.setSelection(tr.near(e.doc.resolve(l),n))}var IR=e=>!("type"in e),jR=(e,t,n)=>({tr:r,dispatch:i,editor:s})=>{var l;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const f=L=>{s.emit("contentError",{editor:s,error:L,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{yp(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(L){f(L)}try{c=yp(t,s.schema,{parseOptions:d,errorOnInvalidContent:(l=n.errorOnInvalidContent)!=null?l:s.options.enableContentCheck})}catch(L){return f(L),!1}let{from:p,to:y}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},b=!0,g=!0;if((IR(c)?c:[c]).forEach(L=>{L.check(),b=b?L.isText&&L.marks.length===0:!1,g=g?L.isBlock:!1}),p===y&&g){const{parent:L}=r.doc.resolve(p);L.isTextblock&&!L.type.spec.code&&!L.childCount&&(p-=1,y+=1)}let M;if(b){if(Array.isArray(t))M=t.map(L=>L.text||"").join("");else if(t instanceof Ce){let L="";t.forEach(D=>{D.text&&(L+=D.text)}),M=L}else typeof t=="object"&&t&&t.text?M=t.text:M=t;r.insertText(M,p,y)}else{M=c;const L=r.doc.resolve(p),D=L.node(),H=L.parentOffset===0,V=D.isText||D.isTextblock,W=D.content.size>0;H&&V&&W&&(p=Math.max(0,p-1)),r.replaceWith(p,y,M)}n.updateSelection&&PR(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:M}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:M})}return!0},zR=()=>({state:e,dispatch:t})=>lL(e,t),BR=()=>({state:e,dispatch:t})=>cL(e,t),FR=()=>({state:e,dispatch:t})=>pA(e,t),UR=()=>({state:e,dispatch:t})=>bA(e,t),HR=()=>({state:e,dispatch:t,tr:n})=>{try{const r=o0(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},qR=()=>({state:e,dispatch:t,tr:n})=>{try{const r=o0(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},$R=()=>({state:e,dispatch:t})=>sL(e,t),YR=()=>({state:e,dispatch:t})=>aL(e,t);function dM(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function VR(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");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))wg()||dM()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var WR=e=>({editor:t,view:n,tr:r,dispatch:i})=>{const s=VR(e).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(()=>{n.someProp("handleKeyDown",d=>d(n,c))});return f?.steps.forEach(d=>{const p=d.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function mf(e,t,n={}){const{from:r,to:i,empty:s}=e.selection,l=t?ko(t,e.schema):null,c=[];e.doc.nodesBetween(r,i,(y,b)=>{if(y.isText)return;const g=Math.max(r,b),C=Math.min(i,b+y.nodeSize);c.push({node:y,from:g,to:C})});const f=i-r,d=c.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>vg(y.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((y,b)=>y+b.to-b.from,0)>=f}var XR=(e,t={})=>({state:n,dispatch:r})=>{const i=ko(e,n.schema);return mf(n,i,t)?uL(n,r):!1},GR=()=>({state:e,dispatch:t})=>SA(e,t),KR=e=>({state:t,dispatch:n})=>{const r=ko(e,t.schema);return SL(r)(t,n)},JR=()=>({state:e,dispatch:t})=>vA(e,t);function h0(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function i3(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,i)=>(n.includes(i)||(r[i]=e[i]),r),{})}var ZR=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=h0(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(s=ko(e,r.schema)),c==="mark"&&(l=ku(e,r.schema));let f=!1;return n.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(p,y)=>{s&&s===p.type&&(f=!0,i&&n.setNodeMarkup(y,void 0,i3(p.attrs,t))),l&&p.marks.length&&p.marks.forEach(b=>{l===b.type&&(f=!0,i&&n.addMark(y,y+p.nodeSize,l.create(i3(b.attrs,t))))})})}),f},QR=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),tO=()=>({tr:e,dispatch:t})=>{if(t){const n=new tl(e.doc);e.setSelection(n)}return!0},eO=()=>({state:e,dispatch:t})=>gA(e,t),nO=()=>({state:e,dispatch:t})=>xA(e,t),rO=()=>({state:e,dispatch:t})=>pL(e,t),iO=()=>({state:e,dispatch:t})=>yL(e,t),oO=()=>({state:e,dispatch:t})=>gL(e,t);function j2(e,t,n={},r={}){return yp(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var sO=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{const{doc:f}=s;if(r.preserveWhitespace!=="full"){const d=j2(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return l&&s.replaceWith(0,f.content.size,d).setMeta("preventUpdate",!n),!0}return l&&s.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:f.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function hM(e,t){const n=ku(t,e.schema),{from:r,to:i,empty:s}=e.selection,l=[];s?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,f=>{l.push(...f.marks)});const c=l.find(f=>f.type.name===n.name);return c?{...c.attrs}:{}}function pM(e,t){const n=new uA(e);return t.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function aO(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function lO(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function cO(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function p0(e){return t=>cO(t.$from,e)}function yn(e,t,n){return e.config[t]===void 0&&e.parent?yn(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?yn(e.parent,t,n):null}):e.config[t]}function O5(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=yn(t,"addExtensions",n);return r?[t,...O5(r())]:t}).flat(10)}function P5(e,t){const n=od.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function mM(e){return typeof e=="function"}function qr(e,t=void 0,...n){return mM(e)?t?e.bind(t)(...n):e(...n):e}function uO(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Kd(e){const t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),r=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function gM(e){const t=[],{nodeExtensions:n,markExtensions:r}=Kd(e),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=n.filter(d=>d.name!=="text").map(d=>d.name),c=r.map(d=>d.name),f=[...l,...c];return e.forEach(d=>{const p={name:d.name,options:d.options,storage:d.storage,extensions:i},y=yn(d,"addGlobalAttributes",p);if(!y)return;y().forEach(g=>{let C;Array.isArray(g.types)?C=g.types:g.types==="*"?C=f:g.types==="nodes"?C=l:g.types==="marks"?C=c:C=[],C.forEach(M=>{Object.entries(g.attributes).forEach(([L,D])=>{t.push({type:M,name:L,attribute:{...s,...D}})})})})}),i.forEach(d=>{const p={name:d.name,options:d.options,storage:d.storage},y=yn(d,"addAttributes",p);if(!y)return;const b=y();Object.entries(b).forEach(([g,C])=>{const M={...s,...C};typeof M?.default=="function"&&(M.default=M.default()),M?.isRequired&&M?.default===void 0&&delete M.default,t.push({type:d.name,name:g,attribute:M})})}),t}function fO(e){const t=[];let n="",r=!1,i=!1,s=0;const l=e.length;for(let c=0;c<l;c+=1){const f=e[c];if(f==="'"&&!i){r=!r,n+=f;continue}if(f==='"'&&!r){i=!i,n+=f;continue}if(!r&&!i){if(f==="("){s+=1,n+=f;continue}if(f===")"&&s>0){s-=1,n+=f;continue}if(f===";"&&s===0){t.push(n),n="";continue}}n+=f}return n&&t.push(n),t}function o3(e){const t=[],n=fO(e||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[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 co(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const c=s?String(s).split(" "):[],f=r[i]?r[i].split(" "):[],d=c.filter(p=>!f.includes(p));r[i]=[...f,...d].join(" ")}else if(i==="style"){const c=new Map([...o3(r[i]),...o3(s)]);r[i]=Array.from(c.entries()).map(([f,d])=>`${f}: ${d}`).join("; ")}else r[i]=s}),r},{})}function bp(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>co(n,r),{})}function dO(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function s3(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const i=t.reduce((s,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):dO(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function a3(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&uO(n)?!1:n!=null))}function l3(e){var t,n;const r={};return!((t=e?.attribute)!=null&&t.isRequired)&&"default"in(e?.attribute||{})&&(r.default=e.attribute.default),((n=e?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function hO(e,t){var n;const r=gM(e),{nodeExtensions:i,markExtensions:s}=Kd(e),l=(n=i.find(d=>yn(d,"topNode")))==null?void 0:n.name,c=Object.fromEntries(i.map(d=>{const p=r.filter(D=>D.type===d.name),y={name:d.name,options:d.options,storage:d.storage,editor:t},b=e.reduce((D,H)=>{const V=yn(H,"extendNodeSchema",y);return{...D,...V?V(d):{}}},{}),g=a3({...b,content:qr(yn(d,"content",y)),marks:qr(yn(d,"marks",y)),group:qr(yn(d,"group",y)),inline:qr(yn(d,"inline",y)),atom:qr(yn(d,"atom",y)),selectable:qr(yn(d,"selectable",y)),draggable:qr(yn(d,"draggable",y)),code:qr(yn(d,"code",y)),whitespace:qr(yn(d,"whitespace",y)),linebreakReplacement:qr(yn(d,"linebreakReplacement",y)),defining:qr(yn(d,"defining",y)),isolating:qr(yn(d,"isolating",y)),attrs:Object.fromEntries(p.map(l3))}),C=qr(yn(d,"parseHTML",y));C&&(g.parseDOM=C.map(D=>s3(D,p)));const M=yn(d,"renderHTML",y);M&&(g.toDOM=D=>M({node:D,HTMLAttributes:bp(D,p)}));const L=yn(d,"renderText",y);return L&&(g.toText=L),[d.name,g]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(L=>L.type===d.name),y={name:d.name,options:d.options,storage:d.storage,editor:t},b=e.reduce((L,D)=>{const H=yn(D,"extendMarkSchema",y);return{...L,...H?H(d):{}}},{}),g=a3({...b,inclusive:qr(yn(d,"inclusive",y)),excludes:qr(yn(d,"excludes",y)),group:qr(yn(d,"group",y)),spanning:qr(yn(d,"spanning",y)),code:qr(yn(d,"code",y)),attrs:Object.fromEntries(p.map(l3))}),C=qr(yn(d,"parseHTML",y));C&&(g.parseDOM=C.map(L=>s3(L,p)));const M=yn(d,"renderHTML",y);return M&&(g.toDOM=L=>M({mark:L,HTMLAttributes:bp(L,p)})),[d.name,g]}));return new X4({topNode:l,nodes:c,marks:f})}function pO(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function ep(e){return e.sort((n,r)=>{const i=yn(n,"priority")||100,s=yn(r,"priority")||100;return i>s?-1:i<s?1:0})}function yM(e){const t=ep(O5(e)),n=pO(t.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function bM(e,t,n){const{from:r,to:i}=t,{blockSeparator:s=`
100
+
101
+ `,textSerializers:l={}}=n||{};let c="";return e.nodesBetween(r,i,(f,d,p,y)=>{var b;f.isBlock&&d>r&&(c+=s);const g=l?.[f.type.name];if(g)return p&&(c+=g({node:f,pos:d,parent:p,index:y,range:t})),!1;f.isText&&(c+=(b=f?.text)==null?void 0:b.slice(Math.max(r,d)-d,i-d))}),c}function mO(e,t){const n={from:0,to:e.content.size};return bM(e,n,t)}function xM(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function gO(e,t){const n=ko(t,e.schema),{from:r,to:i}=e.selection,s=[];e.doc.nodesBetween(r,i,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function vM(e,t){const n=h0(typeof t=="string"?t:t.name,e.schema);return n==="node"?gO(e,t):n==="mark"?hM(e,t):{}}function yO(e,t=JSON.stringify){const n={};return e.filter(r=>{const i=t(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function bO(e){const t=yO(e);return t.length===1?t:t.filter((n,r)=>!t.filter((s,l)=>l!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function wM(e){const{mapping:t,steps:n}=e,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}=n[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),y=t.invert().map(d,-1),b=t.invert().map(p);r.push({oldRange:{from:y,to:b},newRange:{from:d,to:p}})})}),bO(r)}function I5(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(i=>{const s=n.resolve(e),l=R5(s,i.type);l&&r.push({mark:i,...l})}):n.nodesBetween(e,t,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),r}var xO=(e,t,n,r=20)=>{const i=e.doc.resolve(n);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 Ih(e,t){return t.nodes[e]||t.marks[e]||null}function Qm(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=e.find(s=>s.type===t&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var vO=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(i,s,l,c)=>{var f,d;const p=((d=(f=i.type.spec).toText)==null?void 0:d.call(f,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),n};function z2(e,t,n={}){const{empty:r,ranges:i}=e.selection,s=t?ku(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(y=>s?s.name===y.type.name:!0).find(y=>vg(y.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:y,$to:b})=>{const g=y.pos,C=b.pos;e.doc.nodesBetween(g,C,(M,L)=>{if(s&&M.inlineContent&&!M.type.allowsMarkType(s))return!1;if(!M.isText&&!M.marks.length)return;const D=Math.max(g,L),H=Math.min(C,L+M.nodeSize),V=H-D;l+=V,c.push(...M.marks.map(W=>({mark:W,from:D,to:H})))})}),l===0)return!1;const f=c.filter(y=>s?s.name===y.mark.type.name:!0).filter(y=>vg(y.mark.attrs,n,{strict:!1})).reduce((y,b)=>y+b.to-b.from,0),d=c.filter(y=>s?y.mark.type!==s&&y.mark.type.excludes(s):!0).reduce((y,b)=>y+b.to-b.from,0);return(f>0?f+d:f)>=l}function wO(e,t,n={}){if(!t)return mf(e,null,n)||z2(e,null,n);const r=h0(t,e.schema);return r==="node"?mf(e,t,n):r==="mark"?z2(e,t,n):!1}var SO=(e,t)=>{const{$from:n,$to:r,$anchor:i}=e.selection;if(t){const s=p0(c=>c.type.name===t)(e.selection);if(!s)return!1;const l=e.doc.resolve(s.pos+1);return i.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},kO=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function c3(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function u3(e,t){const{nodeExtensions:n}=Kd(t),r=n.find(l=>l.name===e);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=qr(yn(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function m0(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return!/\S/.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let i=!0;return e.content.forEach(s=>{i!==!1&&(m0(s,{ignoreWhitespace:n,checkChildren:t})||(i=!1))}),i}return!1}function SM(e){return e instanceof Cn}var kM=class AM{constructor(t){this.position=t}static fromJSON(t){return new AM(t.position)}toJSON(){return{position:this.position}}};function AO(e,t){const n=t.mapping.mapResult(e.position);return{position:new kM(n.pos),mapResult:n}}function MO(e){return new kM(e)}function CO(e,t,n){var r;const{selection:i}=t;let s=null;if(cM(i)&&(s=i.$cursor),s){const c=(r=e.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(d=>d.type.excludes(n)))}const{ranges:l}=i;return l.some(({$from:c,$to:f})=>{let d=c.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(c.pos,f.pos,(p,y,b)=>{if(d)return!1;if(p.isInline){const g=!b||b.type.allowsMarkType(n),C=!!n.isInSet(p.marks)||!p.marks.some(M=>M.type.excludes(n));d=g&&C}return!d}),d})}var EO=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,f=ku(e,r.schema);if(i)if(l){const d=hM(r,f);n.addStoredMark(f.create({...d,...t}))}else c.forEach(d=>{const p=d.$from.pos,y=d.$to.pos;r.doc.nodesBetween(p,y,(b,g)=>{const C=Math.max(g,p),M=Math.min(g+b.nodeSize,y);b.marks.find(D=>D.type===f)?b.marks.forEach(D=>{f===D.type&&n.addMark(C,M,f.create({...D.attrs,...t}))}):n.addMark(C,M,f.create(t))})});return CO(r,n,f)},TO=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),NO=(e,t={})=>({state:n,dispatch:r,chain:i})=>{const s=ko(e,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>SS(s,{...l,...t})(n)?!0:c.clearNodes()).command(({state:c})=>SS(s,{...l,...t})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},_O=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,i=zf(e,0,r.content.size),s=Cn.create(r,i);t.setSelection(s)}return!0},LO=(e,t)=>({tr:n,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&&n.doc.nodesBetween(l,c,(f,d)=>{f.isText||n.setNodeMarkup(d,void 0,{...f.attrs,dir:e})}),!0},DO=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:i,to:s}=typeof e=="number"?{from:e,to:e}:e,l=Hn.atStart(r).from,c=Hn.atEnd(r).to,f=zf(i,l,c),d=zf(s,l,c),p=Hn.create(r,f,d);t.setSelection(p)}return!0},RO=e=>({state:t,dispatch:n})=>{const r=ko(e,t.schema);return ML(r)(t,n)};function f3(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(i=>t?.includes(i.type.name));e.tr.ensureMarks(r)}}var OO=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=t,{$from:c,$to:f}=s,d=i.extensionManager.attributes,p=Qm(d,c.node().type.name,c.node().attrs);if(s instanceof Cn&&s.node.isBlock)return!c.parentOffset||!vu(l,c.pos)?!1:(r&&(e&&f3(n,i.extensionManager.splittableMarks),t.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const y=f.parentOffset===f.parent.content.size,b=c.depth===0?void 0:aO(c.node(-1).contentMatchAt(c.indexAfter(-1)));let g=y&&b?[{type:b,attrs:p}]:void 0,C=vu(t.doc,t.mapping.map(c.pos),1,g);if(!g&&!C&&vu(t.doc,t.mapping.map(c.pos),1,b?[{type:b}]:void 0)&&(C=!0,g=b?[{type:b,attrs:p}]:void 0),r){if(C&&(s instanceof Hn&&t.deleteSelection(),t.split(t.mapping.map(c.pos),1,g),b&&!y&&!c.parentOffset&&c.parent.type!==b)){const M=t.mapping.map(c.before()),L=t.doc.resolve(M);c.node(-1).canReplaceWith(L.index(),L.index()+1,b)&&t.setNodeMarkup(t.mapping.map(c.before()),b)}e&&f3(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return C},PO=(e,t={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=ko(e,r.schema),{$from:f,$to:d}=r.selection,p=r.selection.node;if(p&&p.isBlock||f.depth<2||!f.sameParent(d))return!1;const y=f.node(-1);if(y.type!==c)return!1;const b=s.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==c||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let D=Ce.empty;const H=f.index(-1)?1:f.index(-2)?2:3;for(let xt=f.depth-H;xt>=f.depth-3;xt-=1)D=Ce.from(f.node(xt).copy(D));const V=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,W={...Qm(b,f.node().type.name,f.node().attrs),...t},gt=((l=c.contentMatch.defaultType)==null?void 0:l.createAndFill(W))||void 0;D=D.append(Ce.from(c.createAndFill(null,gt)||void 0));const _t=f.before(f.depth-(H-1));n.replace(_t,f.after(-V),new Ge(D,4-H,0));let kt=-1;n.doc.nodesBetween(_t,n.doc.content.size,(xt,rt)=>{if(kt>-1)return!1;xt.isTextblock&&xt.content.size===0&&(kt=rt+1)}),kt>-1&&n.setSelection(Hn.near(n.doc.resolve(kt))),n.scrollIntoView()}return!0}const g=d.pos===f.end()?y.contentMatchAt(0).defaultType:null,C={...Qm(b,y.type.name,y.attrs),...t},M={...Qm(b,f.node().type.name,f.node().attrs),...t};n.delete(f.pos,d.pos);const L=g?[{type:c,attrs:C},{type:g,attrs:M}]:[{type:c,attrs:C}];if(!vu(n.doc,f.pos,2))return!1;if(i){const{selection:D,storedMarks:H}=r,{splittableMarks:V}=s.extensionManager,W=H||D.$to.parentOffset&&D.$from.marks();if(n.split(f.pos,2,L).scrollIntoView(),!W||!i)return!0;const gt=W.filter(_t=>V.includes(_t.type.name));n.ensureMarks(gt)}return!0},My=(e,t)=>{const n=p0(l=>l.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===i?.type&&gf(e.doc,n.pos)&&e.join(n.pos),!0},Cy=(e,t)=>{const n=p0(l=>l.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===i?.type&&gf(e.doc,r)&&e.join(r),!0},IO=(e,t,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:f,commands:d,can:p})=>{const{extensions:y,splittableMarks:b}=i.extensionManager,g=ko(e,l.schema),C=ko(t,l.schema),{selection:M,storedMarks:L}=l,{$from:D,$to:H}=M,V=D.blockRange(H),W=L||M.$to.parentOffset&&M.$from.marks();if(!V)return!1;const gt=p0(_t=>u3(_t.type.name,y))(M);if(V.depth>=1&&gt&&V.depth-gt.depth<=1){if(gt.node.type===g)return d.liftListItem(C);if(u3(gt.node.type.name,y)&&g.validContent(gt.node.content)&&c)return f().command(()=>(s.setNodeMarkup(gt.pos,g),!0)).command(()=>My(s,g)).command(()=>Cy(s,g)).run()}return!n||!W||!c?f().command(()=>p().wrapInList(g,r)?!0:d.clearNodes()).wrapInList(g,r).command(()=>My(s,g)).command(()=>Cy(s,g)).run():f().command(()=>{const _t=p().wrapInList(g,r),kt=W.filter(xt=>b.includes(xt.type.name));return s.ensureMarks(kt),_t?!0:d.clearNodes()}).wrapInList(g,r).command(()=>My(s,g)).command(()=>Cy(s,g)).run()},jO=(e,t={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=ku(e,r.schema);return z2(r,l,t)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,t)},zO=(e,t,n={})=>({state:r,commands:i})=>{const s=ko(e,r.schema),l=ko(t,r.schema),c=mf(r,s,n);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,...n})},BO=(e,t={})=>({state:n,commands:r})=>{const i=ko(e,n.schema);return mf(n,i,t)?r.lift(i):r.wrapIn(i,t)},FO=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(e))){if(t){const l=e.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,e.schema.text(s.text,f))}else l.delete(s.from,s.to)}return!0}}return!1},UO=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(s=>{e.removeMark(s.$from.pos,s.$to.pos)}),!0},HO=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=t,{selection:c}=n,f=ku(e,r.schema),{$from:d,empty:p,ranges:y}=c;if(!i)return!0;if(p&&l){let{from:b,to:g}=c;const C=(s=d.marks().find(L=>L.type===f))==null?void 0:s.attrs,M=R5(d,f,C);M&&(b=M.from,g=M.to),n.removeMark(b,g,f)}else y.forEach(b=>{n.removeMark(b.$from.pos,b.$to.pos,f)});return n.removeStoredMark(f),!0},qO=e=>({tr:t,state:n,dispatch:r})=>{const{selection:i}=n;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.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},$O=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=h0(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(s=ko(e,r.schema)),c==="mark"&&(l=ku(e,r.schema));let f=!1;return n.selection.ranges.forEach(d=>{const p=d.$from.pos,y=d.$to.pos;let b,g,C,M;n.selection.empty?r.doc.nodesBetween(p,y,(L,D)=>{s&&s===L.type&&(f=!0,C=Math.max(D,p),M=Math.min(D+L.nodeSize,y),b=D,g=L)}):r.doc.nodesBetween(p,y,(L,D)=>{D<p&&s&&s===L.type&&(f=!0,C=Math.max(D,p),M=Math.min(D+L.nodeSize,y),b=D,g=L),D>=p&&D<=y&&(s&&s===L.type&&(f=!0,i&&n.setNodeMarkup(D,void 0,{...L.attrs,...t})),l&&L.marks.length&&L.marks.forEach(H=>{if(l===H.type&&(f=!0,i)){const V=Math.max(D,p),W=Math.min(D+L.nodeSize,y);n.addMark(V,W,l.create({...H.attrs,...t}))}}))}),g&&(b!==void 0&&i&&n.setNodeMarkup(b,void 0,{...g.attrs,...t}),l&&g.marks.length&&g.marks.forEach(L=>{l===L.type&&i&&n.addMark(C,M,l.create({...L.attrs,...t}))}))}),f},YO=(e,t={})=>({state:n,dispatch:r})=>{const i=ko(e,n.schema);return bL(i,t)(n,r)},VO=(e,t={})=>({state:n,dispatch:r})=>{const i=ko(e,n.schema);return xL(i,t)(n,r)},WO=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},g0=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},XO=(e,t)=>{if(D5(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Nm(e){var t;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=e,{view:f}=n;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.marks.find(b=>b.type.spec.code))return!1;let p=!1;const y=vO(d)+s;return l.forEach(b=>{if(p)return;const g=XO(y,b.find);if(!g)return;const C=f.state.tr,M=f0({state:f.state,transaction:C}),L={from:r-(g[0].length-s.length),to:i},{commands:D,chain:H,can:V}=new d0({editor:n,state:M});b.handler({state:M,range:L,match:g,commands:D,chain:H,can:V})===null||!C.steps.length||(b.undoable&&C.setMeta(c,{transform:C,from:r,to:i,text:s}),f.dispatch(C),p=!0)}),p}function GO(e){const{editor:t,rules:n}=e,r=new Ui({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:p}=f;typeof p=="string"?p=p:p=P5(Ce.from(p),l.schema);const{from:y}=f,b=y+p.length;Nm({editor:t,from:y,to:b,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return Nm({editor:t,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Nm({editor:t,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?Nm({editor:t,from:l.pos,to:l.pos,text:`
102
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function KO(e){return Object.prototype.toString.call(e).slice(8,-1)}function _m(e){return KO(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function MM(e,t){const n={...e};return _m(e)&&_m(t)&&Object.keys(t).forEach(r=>{_m(t[r])&&_m(e[r])?n[r]=MM(e[r],t[r]):n[r]=t[r]}),n}var j5=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...qr(yn(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...qr(yn(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>MM(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},bf=class CM extends j5{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new CM(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(d=>d?.type.name===n.name))return!1;const f=l.find(d=>d?.type.name===n.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function JO(e){return typeof e=="number"}var ZO=class{constructor(e){this.find=e.find,this.handler=e.handler}},QO=(e,t,n)=>{if(D5(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=e,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 t7(e){const{editor:t,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=e,{commands:f,chain:d,can:p}=new d0({editor:t,state:n}),y=[];return n.doc.nodesBetween(r,i,(g,C)=>{var M,L,D,H,V;if((L=(M=g.type)==null?void 0:M.spec)!=null&&L.code||!(g.isText||g.isTextblock||g.isInline))return;const W=(V=(H=(D=g.content)==null?void 0:D.size)!=null?H:g.nodeSize)!=null?V:0,gt=Math.max(r,C),_t=Math.min(i,C+W);if(gt>=_t)return;const kt=g.isText?g.text||"":g.textBetween(gt-C,_t-C,void 0,"");QO(kt,s.find,l).forEach(rt=>{if(rt.index===void 0)return;const jt=gt+rt.index+1,J=jt+rt[0].length,ct={from:n.tr.mapping.map(jt),to:n.tr.mapping.map(J)},X=s.handler({state:n,range:ct,match:rt,commands:f,chain:d,can:p,pasteEvent:l,dropEvent:c});y.push(X)})}),y.every(g=>g!==null)}var Lm=null,e7=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function n7(e){const{editor:t,rules:n}=e;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:p,from:y,to:b,rule:g,pasteEvt:C})=>{const M=p.tr,L=f0({state:p,transaction:M});if(!(!t7({editor:t,state:L,from:Math.max(y-1,0),to:b.b-1,rule:g,pasteEvent:C,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 n.map(p=>new Ui({view(y){const b=C=>{var M;r=(M=y.dom.parentElement)!=null&&M.contains(C.target)?y.dom.parentElement:null,r&&(Lm=t)},g=()=>{Lm&&(Lm=null)};return window.addEventListener("dragstart",b),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",b),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(y,b)=>{if(s=r===y.dom.parentElement,c=b,!s){const g=Lm;g?.isEditable&&setTimeout(()=>{const C=g.state.selection;C&&g.commands.deleteRange({from:C.from,to:C.to})},10)}return!1},paste:(y,b)=>{var g;const C=(g=b.clipboardData)==null?void 0:g.getData("text/html");return l=b,i=!!C?.includes("data-pm-slice"),!1}}},appendTransaction:(y,b,g)=>{const C=y[0],M=C.getMeta("uiEvent")==="paste"&&!i,L=C.getMeta("uiEvent")==="drop"&&!s,D=C.getMeta("applyPasteRules"),H=!!D;if(!M&&!L&&!H)return;if(H){let{text:gt}=D;typeof gt=="string"?gt=gt:gt=P5(Ce.from(gt),g.schema);const{from:_t}=D,kt=_t+gt.length,xt=e7(gt);return f({rule:p,state:g,from:_t,to:{b:kt},pasteEvt:xt})}const V=b.doc.content.findDiffStart(g.doc.content),W=b.doc.content.findDiffEnd(g.doc.content);if(!(!JO(V)||!W||V===W.b))return f({rule:p,state:g,from:V,to:W,pasteEvt:l})}}))}var y0=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=yM(e),this.schema=hO(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Ih(t.name,this.schema)},r=yn(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this;return ep([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Ih(r.name,this.schema)},s=[],l=yn(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&yn(r,"exitable",i)&&(c.ArrowRight=()=>bf.handleExit({editor:e,mark:r})),l){const b=Object.fromEntries(Object.entries(l()).map(([g,C])=>[g,()=>C({editor:e})]));c={...c,...b}}const f=mR(c);s.push(f);const d=yn(r,"addInputRules",i);if(c3(r,e.options.enableInputRules)&&d){const b=d();if(b&&b.length){const g=GO({editor:e,rules:b}),C=Array.isArray(g)?g:[g];s.push(...C)}}const p=yn(r,"addPasteRules",i);if(c3(r,e.options.enablePasteRules)&&p){const b=p();if(b&&b.length){const g=n7({editor:e,rules:b});s.push(...g)}}const y=yn(r,"addProseMirrorPlugins",i);if(y){const b=y();s.push(...b)}return s})}get attributes(){return gM(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Kd(this.extensions);return Object.fromEntries(t.filter(n=>!!yn(n,"addNodeView")).map(n=>{const r=this.attributes.filter(f=>f.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:ko(n.name,this.schema)},s=yn(n,"addNodeView",i);if(!s)return[];const l=s();if(!l)return[];const c=(f,d,p,y,b)=>{const g=bp(f,r);return l({node:f,view:d,getPos:p,decorations:y,innerDecorations:b,editor:e,extension:n,HTMLAttributes:g})};return[n.name,c]}))}dispatchTransaction(e){const{editor:t}=this;return ep([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Ih(i.name,this.schema)},l=yn(i,"dispatchTransaction",s);return l?c=>{l.call(s,{transaction:c,next:r})}:r},e)}transformPastedHTML(e){const{editor:t}=this;return ep([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Ih(i.name,this.schema)},l=yn(i,"transformPastedHTML",s);return l?(c,f)=>{const d=r(c,f);return l.call(s,d)}:r},e||(r=>r))}get markViews(){const{editor:e}=this,{markExtensions:t}=Kd(this.extensions);return Object.fromEntries(t.filter(n=>!!yn(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:ku(n.name,this.schema)},s=yn(n,"addMarkView",i);if(!s)return[];const l=(c,f,d)=>{const p=bp(c,r);return s()({mark:c,view:f,inline:d,editor:e,extension:n,HTMLAttributes:p,updateAttributes:y=>{g7(c,e,y)}})};return[n.name,l]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Ih(t.name,this.schema)};t.type==="mark"&&((n=qr(yn(t,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(t.name);const i=yn(t,"onBeforeCreate",r),s=yn(t,"onCreate",r),l=yn(t,"onUpdate",r),c=yn(t,"onSelectionUpdate",r),f=yn(t,"onTransaction",r),d=yn(t,"onFocus",r),p=yn(t,"onBlur",r),y=yn(t,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),f&&this.editor.on("transaction",f),d&&this.editor.on("focus",d),p&&this.editor.on("blur",p),y&&this.editor.on("destroy",y)})}};y0.resolve=yM;y0.sort=ep;y0.flatten=O5;var r7={};L5(r7,{ClipboardTextSerializer:()=>TM,Commands:()=>NM,Delete:()=>_M,Drop:()=>LM,Editable:()=>DM,FocusEvents:()=>OM,Keymap:()=>PM,Paste:()=>IM,Tabindex:()=>jM,TextDirection:()=>zM,focusEventsPluginKey:()=>RM});var li=class EM extends j5{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new EM(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},TM=li.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ui({key:new Ro("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:s}=i,l=Math.min(...s.map(p=>p.$from.pos)),c=Math.max(...s.map(p=>p.$to.pos)),f=xM(n);return bM(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}}),NM=li.create({name:"commands",addCommands(){return{...aM}}}),_M=li.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;const s=()=>{var l,c,f,d;if((d=(f=(c=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:c.filterTransaction)==null?void 0:f.call(c,e))!=null?d:e.getMeta("y-sync$"))return;const p=pM(e.before,[e,...t]);wM(p).forEach(g=>{p.mapping.mapResult(g.oldRange.from).deletedAfter&&p.mapping.mapResult(g.oldRange.to).deletedBefore&&p.before.nodesBetween(g.oldRange.from,g.oldRange.to,(C,M)=>{const L=M+C.nodeSize-2,D=g.oldRange.from<=M&&L<=g.oldRange.to;this.editor.emit("delete",{type:"node",node:C,from:M,to:L,newFrom:p.mapping.map(M),newTo:p.mapping.map(L),deletedRange:g.oldRange,newRange:g.newRange,partial:!D,editor:this.editor,transaction:e,combinedTransform:p})})});const b=p.mapping;p.steps.forEach((g,C)=>{var M,L;if(g instanceof ec){const D=b.slice(C).map(g.from,-1),H=b.slice(C).map(g.to),V=b.invert().map(D,-1),W=b.invert().map(H),gt=(M=p.doc.nodeAt(D-1))==null?void 0:M.marks.some(kt=>kt.eq(g.mark)),_t=(L=p.doc.nodeAt(H))==null?void 0:L.marks.some(kt=>kt.eq(g.mark));this.editor.emit("delete",{type:"mark",mark:g.mark,from:g.from,to:g.to,deletedRange:{from:V,to:W},newRange:{from:D,to:H},partial:!!(_t||gt),editor:this.editor,transaction:e,combinedTransform:p})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),LM=li.create({name:"drop",addProseMirrorPlugins(){return[new Ui({key:new Ro("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),DM=li.create({name:"editable",addProseMirrorPlugins(){return[new Ui({key:new Ro("editable"),props:{editable:()=>this.editor.options.editable}})]}}),RM=new Ro("focusEvents"),OM=li.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Ui({key:RM,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),PM=li.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:f,doc:d}=c,{empty:p,$anchor:y}=f,{pos:b,parent:g}=y,C=y.parent.isTextblock&&b>0?c.doc.resolve(b-1):y,M=C.parent.type.spec.isolating,L=y.pos-y.parentOffset,D=M&&C.parent.childCount===1?L===y.pos:tr.atStart(d).from===b;return!p||!g.type.isTextblock||g.textContent.length||!D||D&&y.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:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":e,"Alt-Backspace":e,"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 wg()||dM()?s:i},addProseMirrorPlugins(){return[new Ui({key:new Ro("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(M=>M.getMeta("composition")))return;const r=e.some(M=>M.docChanged)&&!t.doc.eq(n.doc),i=e.some(M=>M.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=t.selection,f=tr.atStart(t.doc).from,d=tr.atEnd(t.doc).to;if(s||!(l===f&&c===d)||!m0(n.doc))return;const b=n.tr,g=f0({state:n,transaction:b}),{commands:C}=new d0({editor:this.editor,state:g});if(C.clearNodes(),!!b.steps.length)return b}})]}}),IM=li.create({name:"paste",addProseMirrorPlugins(){return[new Ui({key:new Ro("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),jM=li.create({name:"tabindex",addProseMirrorPlugins(){return[new Ui({key:new Ro("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),zM=li.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Kd(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ui({key:new Ro("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),i7=class $h{constructor(t,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}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:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=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}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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),n=this.resolvedPos.doc.resolve(t);return new $h(n,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 $h(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 $h(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,l=n.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 $h(f,this.editor,i,i||l?n: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,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===t)if(Object.keys(n).length>0){const s=i.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const f=l[c];if(s[f]!==n[f])break}}else r=i;i=i.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===t&&s.every(f=>n[f]===l.node.attrs[f])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(t,n,r))))}),i}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},o7=`.ProseMirror {
103
+ position: relative;
104
+ }
105
+
106
+ .ProseMirror {
107
+ word-wrap: break-word;
108
+ white-space: pre-wrap;
109
+ white-space: break-spaces;
110
+ -webkit-font-variant-ligatures: none;
111
+ font-variant-ligatures: none;
112
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
113
+ }
114
+
115
+ .ProseMirror [contenteditable="false"] {
116
+ white-space: normal;
117
+ }
118
+
119
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
120
+ white-space: pre-wrap;
121
+ }
122
+
123
+ .ProseMirror pre {
124
+ white-space: pre-wrap;
125
+ }
126
+
127
+ img.ProseMirror-separator {
128
+ display: inline !important;
129
+ border: none !important;
130
+ margin: 0 !important;
131
+ width: 0 !important;
132
+ height: 0 !important;
133
+ }
134
+
135
+ .ProseMirror-gapcursor {
136
+ display: none;
137
+ pointer-events: none;
138
+ position: absolute;
139
+ margin: 0;
140
+ }
141
+
142
+ .ProseMirror-gapcursor:after {
143
+ content: "";
144
+ display: block;
145
+ position: absolute;
146
+ top: -2px;
147
+ width: 20px;
148
+ border-top: 1px solid black;
149
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
150
+ }
151
+
152
+ @keyframes ProseMirror-cursor-blink {
153
+ to {
154
+ visibility: hidden;
155
+ }
156
+ }
157
+
158
+ .ProseMirror-hideselection *::selection {
159
+ background: transparent;
160
+ }
161
+
162
+ .ProseMirror-hideselection *::-moz-selection {
163
+ background: transparent;
164
+ }
165
+
166
+ .ProseMirror-hideselection * {
167
+ caret-color: transparent;
168
+ }
169
+
170
+ .ProseMirror-focused .ProseMirror-gapcursor {
171
+ display: block;
172
+ }`;function s7(e,t,n){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=e,document.getElementsByTagName("head")[0].appendChild(i),i}var a7=class extends WO{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),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:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:AO,createMappablePosition:MO},this.setOptions(e),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:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=uM(t,this.options.autofocus);this.editorState=Bd.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),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){const e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=s7(o7,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,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(e,t){const n=mM(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(l=>!l.key.startsWith(s))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[DM,TM.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),NM,OM,PM,jM,LM,IM,_M,zM.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new y0(r,this)}createCommandManager(){this.commandManager=new d0({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=j2(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;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(n=>n.name!=="collaboration"),this.createExtensionManager()}}),e=j2(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(s);this.editorView=new oM(e,{...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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var p;return(p=this.capturedTransaction)==null?void 0:p.step(d)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=n.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}),!(e.getMeta("preventUpdate")||!n.some(d=>d.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return vM(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return wO(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return P5(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
173
+
174
+ `,textSerializers:n={}}=e||{};return mO(this.state.doc,{blockSeparator:t,textSerializers:{...xM(this.schema),...n}})}get isEmpty(){return m0(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new i7(t,this)}get $doc(){return this.$pos(0)}};function Jd(e){return new g0({find:e.find,handler:({state:t,range:n,match:r})=>{const i=qr(e.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=n.from+c.indexOf(l),p=d+l.length;if(I5(n.from,n.to,t.doc).filter(g=>g.mark.type.excluded.find(M=>M===e.type&&M!==g.mark.type)).filter(g=>g.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+f,d);const b=n.from+f+l.length;s.addMark(n.from+f,b,e.type.create(i||{})),s.removeStoredMark(e.type)}},undoable:e.undoable})}function l7(e){return new g0({find:e.find,handler:({state:t,range:n,match:r})=>{const i=qr(e.getAttributes,void 0,r)||{},{tr:s}=t,l=n.from;let c=n.to;const f=e.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let p=l+d;p>c?p=c:c=p+r[1].length;const y=r[0][r[0].length-1];s.insertText(y,l+r[0].length-1),s.replaceWith(p,c,f)}else if(r[0]){const d=e.type.isInline?l:l-1;s.insert(d,e.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()},undoable:e.undoable})}function B2(e){return new g0({find:e.find,handler:({state:t,range:n,match:r})=>{const i=t.doc.resolve(n.from),s=qr(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,s)},undoable:e.undoable})}function Zd(e){return new g0({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{const s=qr(e.getAttributes,void 0,r)||{},l=t.tr.delete(n.from,n.to),f=l.doc.resolve(n.from).blockRange(),d=f&&m5(f,e.type,s);if(!d)return null;if(l.wrap(f,d),e.keepMarks&&e.editor){const{selection:y,storedMarks:b}=t,{splittableMarks:g}=e.editor.extensionManager,C=b||y.$to.parentOffset&&y.$from.marks();if(C){const M=C.filter(L=>g.includes(L.type.name));l.ensureMarks(M)}}if(e.keepAttributes){const y=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(y,s).run()}const p=l.doc.resolve(n.from-1).nodeBefore;p&&p.type===e.type&&gf(l.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,p))&&l.join(n.from-1)},undoable:e.undoable})}function c7(e,t){const{selection:n}=e,{$from:r}=n;if(n 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}var u7={};L5(u7,{createAtomBlockMarkdownSpec:()=>f7,createBlockMarkdownSpec:()=>d7,createInlineMarkdownSpec:()=>m7,parseAttributes:()=>z5,parseIndentedBlocks:()=>F2,renderNestedMarkdownContent:()=>F5,serializeAttributes:()=>B5});function z5(e){if(!e?.trim())return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,d=>(n.push(d),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const d=i.map(p=>p.trim().slice(1));t.class=d.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(t.id=s[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(l)).forEach(([,d,p])=>{var y;const b=parseInt(((y=p.match(/__QUOTED_(\d+)__/))==null?void 0:y[1])||"0",10),g=n[b];g&&(t[d]=g.slice(1,-1))});const f=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return f&&f.split(/\s+/).filter(Boolean).forEach(p=>{p.match(/^[a-zA-Z][\w-]*$/)&&(t[p]=!0)}),t}function B5(e){if(!e||Object.keys(e).length===0)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function f7(e){const{nodeName:t,name:n,parseAttributes:r=z5,serializeAttributes:i=B5,defaultAttributes:s={},requiredAttributes:l=[],allowedAttributes:c}=e,f=n||t,d=p=>{if(!c)return p;const y={};return c.forEach(b=>{b in p&&(y[b]=p[b])}),y};return{parseMarkdown:(p,y)=>{const b={...s,...p.attributes};return y.createNode(t,b,[])},markdownTokenizer:{name:t,level:"block",start(p){var y;const b=new RegExp(`^:::${f}(?:\\s|$)`,"m"),g=(y=p.match(b))==null?void 0:y.index;return g!==void 0?g:-1},tokenize(p,y,b){const g=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),C=p.match(g);if(!C)return;const M=C[1]||"",L=r(M);if(!l.find(H=>!(H in L)))return{type:t,raw:C[0],attributes:L}}},renderMarkdown:p=>{const y=d(p.attrs||{}),b=i(y),g=b?` {${b}}`:"";return`:::${f}${g} :::`}}}function d7(e){const{nodeName:t,name:n,getContent:r,parseAttributes:i=z5,serializeAttributes:s=B5,defaultAttributes:l={},content:c="block",allowedAttributes:f}=e,d=n||t,p=y=>{if(!f)return y;const b={};return f.forEach(g=>{g in y&&(b[g]=y[g])}),b};return{parseMarkdown:(y,b)=>{let g;if(r){const M=r(y);g=typeof M=="string"?[{type:"text",text:M}]:M}else c==="block"?g=b.parseChildren(y.tokens||[]):g=b.parseInline(y.tokens||[]);const C={...l,...y.attributes};return b.createNode(t,C,g)},markdownTokenizer:{name:t,level:"block",start(y){var b;const g=new RegExp(`^:::${d}`,"m"),C=(b=y.match(g))==null?void 0:b.index;return C!==void 0?C:-1},tokenize(y,b,g){var C;const M=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),L=y.match(M);if(!L)return;const[D,H=""]=L,V=i(H);let W=1;const gt=D.length;let _t="";const kt=/^:::([\w-]*)(\s.*)?/gm,xt=y.slice(gt);for(kt.lastIndex=0;;){const rt=kt.exec(xt);if(rt===null)break;const jt=rt.index,J=rt[1];if(!((C=rt[2])!=null&&C.endsWith(":::"))){if(J)W+=1;else if(W-=1,W===0){const ct=xt.slice(0,jt);_t=ct.trim();const X=y.slice(0,gt+jt+rt[0].length);let bt=[];if(_t)if(c==="block")for(bt=g.blockTokens(ct),bt.forEach(Lt=>{Lt.text&&(!Lt.tokens||Lt.tokens.length===0)&&(Lt.tokens=g.inlineTokens(Lt.text))});bt.length>0;){const Lt=bt[bt.length-1];if(Lt.type==="paragraph"&&(!Lt.text||Lt.text.trim()===""))bt.pop();else break}else bt=g.inlineTokens(_t);return{type:t,raw:X,attributes:V,content:_t,tokens:bt}}}}}},renderMarkdown:(y,b)=>{const g=p(y.attrs||{}),C=s(g),M=C?` {${C}}`:"",L=b.renderChildren(y.content||[],`
175
+
176
+ `);return`:::${d}${M}
177
+
178
+ ${L}
179
+
180
+ :::`}}}function h7(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,i,s,l]=r;t[i]=s||l,r=n.exec(e)}return t}function p7(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function m7(e){const{nodeName:t,name:n,getContent:r,parseAttributes:i=h7,serializeAttributes:s=p7,defaultAttributes:l={},selfClosing:c=!1,allowedAttributes:f}=e,d=n||t,p=b=>{if(!f)return b;const g={};return f.forEach(C=>{const M=typeof C=="string"?C:C.name,L=typeof C=="string"?void 0:C.skipIfDefault;if(M in b){const D=b[M];if(L!==void 0&&D===L)return;g[M]=D}}),g},y=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(b,g)=>{const C={...l,...b.attributes};if(c)return g.createNode(t,C);const M=r?r(b):b.content||"";return M?g.createNode(t,C,[g.createTextNode(M)]):g.createNode(t,C,[])},markdownTokenizer:{name:t,level:"inline",start(b){const g=c?new RegExp(`\\[${y}\\s*[^\\]]*\\]`):new RegExp(`\\[${y}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${y}\\]`),C=b.match(g),M=C?.index;return M!==void 0?M:-1},tokenize(b,g,C){const M=c?new RegExp(`^\\[${y}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${y}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${y}\\]`),L=b.match(M);if(!L)return;let D="",H="";if(c){const[,W]=L;H=W}else{const[,W,gt]=L;H=W,D=gt||""}const V=i(H.trim());return{type:t,raw:L[0],content:D.trim(),attributes:V}}},renderMarkdown:b=>{let g="";r?g=r(b):b.content&&b.content.length>0&&(g=b.content.filter(D=>D.type==="text").map(D=>D.text).join(""));const C=p(b.attrs||{}),M=s(C),L=M?` ${M}`:"";return c?`[${d}${L}]`:`[${d}${L}]${g}[/${d}]`}}}function F2(e,t,n){var r,i,s,l;const c=e.split(`
181
+ `),f=[];let d="",p=0;const y=t.baseIndentSize||2;for(;p<c.length;){const b=c[p],g=b.match(t.itemPattern);if(!g){if(f.length>0)break;if(b.trim()===""){p+=1,d=`${d}${b}
182
+ `;continue}else return}const C=t.extractItemData(g),{indentLevel:M,mainContent:L}=C;d=`${d}${b}
183
+ `;const D=[L];for(p+=1;p<c.length;){const gt=c[p];if(gt.trim()===""){const kt=c.slice(p+1).findIndex(jt=>jt.trim()!=="");if(kt===-1)break;if((((i=(r=c[p+1+kt].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>M){D.push(gt),d=`${d}${gt}
184
+ `,p+=1;continue}else break}if((((l=(s=gt.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:l.length)||0)>M)D.push(gt),d=`${d}${gt}
185
+ `,p+=1;else break}let H;const V=D.slice(1);if(V.length>0){const gt=V.map(_t=>_t.slice(M+y)).join(`
186
+ `);gt.trim()&&(t.customNestedParser?H=t.customNestedParser(gt):H=n.blockTokens(gt))}const W=t.createToken(C,H);f.push(W)}if(f.length!==0)return{items:f,raw:d}}function F5(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const i=typeof n=="function"?n(r):n,[s,...l]=e.content,c=t.renderChildren([s]);let f=`${i}${c}`;return l&&l.length>0&&l.forEach((d,p)=>{var y,b;const g=(b=(y=t.renderChild)==null?void 0:y.call(t,d,p+1))!=null?b:t.renderChildren([d]);if(g!=null){const C=g.split(`
187
+ `).map(M=>M?t.indent(M):t.indent("")).join(`
188
+ `);f+=d.type==="paragraph"?`
189
+
190
+ ${C}`:`
191
+ ${C}`}}),f}function g7(e,t,n={}){const{state:r}=t,{doc:i,tr:s}=r,l=e;i.descendants((c,f)=>{const d=s.mapping.map(f),p=s.mapping.map(f)+c.nodeSize;let y=null;if(c.marks.forEach(g=>{if(g!==l)return!1;y=g}),!y)return;let b=!1;if(Object.keys(n).forEach(g=>{n[g]!==y.attrs[g]&&(b=!0)}),b){const g=e.type.create({...e.attrs,...n});s.removeMark(d,p,e.type),s.addMark(d,p,g)}}),s.docChanged&&t.view.dispatch(s)}var el=class BM extends j5{constructor(){super(...arguments),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new BM(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function nd(e){return new ZO({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{const s=qr(e.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=n.to;if(c){const p=f.search(/\S/),y=n.from+f.indexOf(c),b=y+c.length;if(I5(n.from,n.to,t.doc).filter(C=>C.mark.type.excluded.find(L=>L===e.type&&L!==C.mark.type)).filter(C=>C.to>y).length)return null;b<n.to&&l.delete(b,n.to),y>n.from&&l.delete(n.from+p,y),d=n.from+p+c.length,l.addMark(n.from+p,d,e.type.create(s||{})),l.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:y7,getOwnPropertySymbols:b7}=Object,{hasOwnProperty:x7}=Object.prototype;function Ey(e,t){return function(r,i,s){return e(r,i,s)&&t(r,i,s)}}function Dm(e){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i);const{cache:s}=i,l=s.get(n),c=s.get(r);if(l&&c)return l===r&&c===n;s.set(n,r),s.set(r,n);const f=e(n,r,i);return s.delete(n),s.delete(r),f}}function v7(e){return e?.[Symbol.toStringTag]}function d3(e){return y7(e).concat(b7(e))}const w7=Object.hasOwn||((e,t)=>x7.call(e,t));function sd(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const S7="__v",k7="__o",A7="_owner",{getOwnPropertyDescriptor:h3,keys:p3}=Object;function M7(e,t){return e.byteLength===t.byteLength&&Sg(new Uint8Array(e),new Uint8Array(t))}function C7(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function E7(e,t){return e.byteLength===t.byteLength&&Sg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function T7(e,t){return sd(e.getTime(),t.getTime())}function N7(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function _7(e,t){return e===t}function m3(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=e.entries();let l,c,f=0;for(;(l=s.next())&&!l.done;){const d=t.entries();let p=!1,y=0;for(;(c=d.next())&&!c.done;){if(i[y]){y++;continue}const b=l.value,g=c.value;if(n.equals(b[0],g[0],f,y,e,t,n)&&n.equals(b[1],g[1],b[0],g[0],e,t,n)){p=i[y]=!0;break}y++}if(!p)return!1;f++}return!0}const L7=sd;function D7(e,t,n){const r=p3(e);let i=r.length;if(p3(t).length!==i)return!1;for(;i-- >0;)if(!FM(e,t,n,r[i]))return!1;return!0}function jh(e,t,n){const r=d3(e);let i=r.length;if(d3(t).length!==i)return!1;let s,l,c;for(;i-- >0;)if(s=r[i],!FM(e,t,n,s)||(l=h3(e,s),c=h3(t,s),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function R7(e,t){return sd(e.valueOf(),t.valueOf())}function O7(e,t){return e.source===t.source&&e.flags===t.flags}function g3(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=e.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]&&n.equals(l.value,c.value,l.value,c.value,e,t,n)){d=i[p]=!0;break}p++}if(!d)return!1}return!0}function Sg(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function P7(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function FM(e,t,n,r){return(r===A7||r===k7||r===S7)&&(e.$$typeof||t.$$typeof)?!0:w7(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const I7="[object ArrayBuffer]",j7="[object Arguments]",z7="[object Boolean]",B7="[object DataView]",F7="[object Date]",U7="[object Error]",H7="[object Map]",q7="[object Number]",$7="[object Object]",Y7="[object RegExp]",V7="[object Set]",W7="[object String]",X7={"[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},G7="[object URL]",K7=Object.prototype.toString;function J7({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:l,areNumbersEqual:c,areObjectsEqual:f,arePrimitiveWrappersEqual:d,areRegExpsEqual:p,areSetsEqual:y,areTypedArraysEqual:b,areUrlsEqual:g,unknownTagComparators:C}){return function(L,D,H){if(L===D)return!0;if(L==null||D==null)return!1;const V=typeof L;if(V!==typeof D)return!1;if(V!=="object")return V==="number"?c(L,D,H):V==="function"?s(L,D,H):!1;const W=L.constructor;if(W!==D.constructor)return!1;if(W===Object)return f(L,D,H);if(Array.isArray(L))return t(L,D,H);if(W===Date)return r(L,D,H);if(W===RegExp)return p(L,D,H);if(W===Map)return l(L,D,H);if(W===Set)return y(L,D,H);const gt=K7.call(L);if(gt===F7)return r(L,D,H);if(gt===Y7)return p(L,D,H);if(gt===H7)return l(L,D,H);if(gt===V7)return y(L,D,H);if(gt===$7)return typeof L.then!="function"&&typeof D.then!="function"&&f(L,D,H);if(gt===G7)return g(L,D,H);if(gt===U7)return i(L,D,H);if(gt===j7)return f(L,D,H);if(X7[gt])return b(L,D,H);if(gt===I7)return e(L,D,H);if(gt===B7)return n(L,D,H);if(gt===z7||gt===q7||gt===W7)return d(L,D,H);if(C){let _t=C[gt];if(!_t){const kt=v7(L);kt&&(_t=C[kt])}if(_t)return _t(L,D,H)}return!1}}function Z7({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:M7,areArraysEqual:n?jh:C7,areDataViewsEqual:E7,areDatesEqual:T7,areErrorsEqual:N7,areFunctionsEqual:_7,areMapsEqual:n?Ey(m3,jh):m3,areNumbersEqual:L7,areObjectsEqual:n?jh:D7,arePrimitiveWrappersEqual:R7,areRegExpsEqual:O7,areSetsEqual:n?Ey(g3,jh):g3,areTypedArraysEqual:n?Ey(Sg,jh):Sg,areUrlsEqual:P7,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const i=Dm(r.areArraysEqual),s=Dm(r.areMapsEqual),l=Dm(r.areObjectsEqual),c=Dm(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return r}function Q7(e){return function(t,n,r,i,s,l,c){return e(t,n,c)}}function tP({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(c,f){const{cache:d=e?new WeakMap:void 0,meta:p}=n();return t(c,f,{cache:d,equals:r,meta:p,strict:i})};if(e)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 eP=xf();xf({strict:!0});xf({circular:!0});xf({circular:!0,strict:!0});xf({createInternalComparator:()=>sd});xf({strict:!0,createInternalComparator:()=>sd});xf({circular:!0,createInternalComparator:()=>sd});xf({circular:!0,createInternalComparator:()=>sd,strict:!0});function xf(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,s=Z7(e),l=J7(s),c=n?n(l):Q7(l);return tP({circular:t,comparator:l,createState:r,equals:c,strict:i})}var Ty={exports:{}},Ny={};var y3;function nP(){if(y3)return Ny;y3=1;var e=wp(),t=L4();function n(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,s=e.useRef,l=e.useEffect,c=e.useMemo,f=e.useDebugValue;return Ny.useSyncExternalStoreWithSelector=function(d,p,y,b,g){var C=s(null);if(C.current===null){var M={hasValue:!1,value:null};C.current=M}else M=C.current;C=c(function(){function D(_t){if(!H){if(H=!0,V=_t,_t=b(_t),g!==void 0&&M.hasValue){var kt=M.value;if(g(kt,_t))return W=kt}return W=_t}if(kt=W,r(V,_t))return kt;var xt=b(_t);return g!==void 0&&g(kt,xt)?(V=_t,kt):(V=_t,W=xt)}var H=!1,V,W,gt=y===void 0?null:y;return[function(){return D(p())},gt===null?void 0:function(){return D(gt())}]},[p,y,b,g]);var L=i(d,C[0],C[1]);return l(function(){M.hasValue=!0,M.value=L},[L]),f(L),L},Ny}var b3;function rP(){return b3||(b3=1,Ty.exports=nP()),Ty.exports}var iP=rP(),oP=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},sP=({contentComponent:e})=>{const t=D4.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return T.jsx(T.Fragment,{children:Object.values(t)})};function aP(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:c8.createPortal(r.reactElement,r.element,n)},e.forEach(i=>i())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(i=>i())}}}var lP=class extends Su.Component{constructor(e){var t;super(e),this.editorContentRef=Su.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=aP(),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 e;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(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return T.jsxs(T.Fragment,{children:[T.jsx("div",{ref:oP(t,this.editorContentRef),...n}),e?.contentComponent&&T.jsx(sP,{contentComponent:e.contentComponent})]})}},cP=U.forwardRef((e,t)=>{const n=Su.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Su.createElement(lP,{key:n,innerRef:t,...e})}),UM=Su.memo(cP),uP=typeof window<"u"?U.useLayoutEffect:U.useEffect,fP=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",t),()=>{n.off("transaction",t)}}}};function dP(e){var t;const[n]=U.useState(()=>new fP(e.editor)),r=iP.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:eP);return uP(()=>n.watch(e.editor),[e.editor,n]),U.useDebugValue(r),r}var hP=!1,U2=typeof window>"u",pP=U2||!!(typeof window<"u"&&window.next),mP=class HM{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(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?U2||pP?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 a7(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((i,s)=>{var l;return i===((l=n.extensions)==null?void 0:l[s])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?HM.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,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function gP(e={},t=[]){const n=U.useRef(e);n.current=e;const[r]=U.useState(()=>new mP(n)),i=D4.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return U.useDebugValue(i),U.useEffect(r.onRender(t)),dP({editor:i,selector:({transactionNumber:s})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&s===0?0:s+1}),i}var qM=U.createContext({editor:null});qM.Consumer;var yP=U.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),bP=()=>U.useContext(yP);Su.forwardRef((e,t)=>{const{onDragStart:n}=bP(),r=e.as||"div";return T.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});Su.createContext({markViewContentRef:()=>{}});var U5=U.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});U5.displayName="TiptapContext";var xP=()=>U.useContext(U5);function $M({editor:e,instance:t,children:n}){const r=e??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(qM.Provider,{value:s,children:T.jsx(U5.Provider,{value:i,children:n})})}$M.displayName="Tiptap";function YM({...e}){const{editor:t}=xP();return T.jsx(UM,{editor:t,...e})}YM.displayName="Tiptap.Content";Object.assign($M,{Content:YM});var kg=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:n,...r}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},vP=/^\s*>\s$/,wP=el.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return kg("blockquote",{...co(this.options.HTMLAttributes,e),children:kg("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=">",r=[];return e.content.forEach(i=>{const c=t.renderChildren([i]).split(`
192
+ `).map(f=>f.trim()===""?n:`${n} ${f}`);r.push(c.join(`
193
+ `))}),r.join(`
194
+ ${n}
195
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Zd({find:vP,type:this.type})]}}),SP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,kP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,AP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,MP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,CP=bf.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return kg("strong",{...co(this.options.HTMLAttributes,e),children:kg("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Jd({find:SP,type:this.type}),Jd({find:AP,type:this.type})]},addPasteRules(){return[nd({find:kP,type:this.type}),nd({find:MP,type:this.type})]}}),EP=/(^|[^`])`([^`]+)`(?!`)$/,TP=/(^|[^`])`([^`]+)`(?!`)/g,NP=bf.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",co(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Jd({find:EP,type:this.type})]},addPasteRules(){return[nd({find:TP,type:this.type})]}}),_y=4,_P=/^```([a-z]+)?[\s\n]$/,LP=/^~~~([a-z]+)?[\s\n]$/,DP=el.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:_y,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((t=e.firstElementChild)==null?void 0:t.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",co(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return((n=e.raw)==null?void 0:n.startsWith("```"))===!1&&((r=e.raw)==null?void 0:r.startsWith("~~~"))===!1&&e.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const i=((n=e.attrs)==null?void 0:n.language)||"";return e.content?r=[`\`\`\`${i}`,t.renderChildren(e.content),"```"].join(`
196
+ `):r=`\`\`\`${i}
197
+
198
+ \`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:_y,{state:r}=e,{selection:i}=r,{$from:s,empty:l}=i;if(s.parent.type!==this.type)return!1;const c=" ".repeat(n);return l?e.commands.insertContent(c):e.commands.command(({tr:f})=>{const{from:d,to:p}=i,g=r.doc.textBetween(d,p,`
199
+ `,`
200
+ `).split(`
201
+ `).map(C=>c+C).join(`
202
+ `);return f.replaceWith(d,p,r.schema.text(g)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:_y,{state:r}=e,{selection:i}=r,{$from:s,empty:l}=i;return s.parent.type!==this.type?!1:l?e.commands.command(({tr:c})=>{var f;const{pos:d}=s,p=s.start(),y=s.end(),g=r.doc.textBetween(p,y,`
203
+ `,`
204
+ `).split(`
205
+ `);let C=0,M=0;const L=d-p;for(let _t=0;_t<g.length;_t+=1){if(M+g[_t].length>=L){C=_t;break}M+=g[_t].length+1}const H=((f=g[C].match(/^ */))==null?void 0:f[0])||"",V=Math.min(H.length,n);if(V===0)return!0;let W=p;for(let _t=0;_t<C;_t+=1)W+=g[_t].length+1;return c.delete(W,W+V),d-W<=V&&c.setSelection(Hn.create(c.doc,W)),!0}):e.commands.command(({tr:c})=>{const{from:f,to:d}=i,b=r.doc.textBetween(f,d,`
206
+ `,`
207
+ `).split(`
208
+ `).map(g=>{var C;const M=((C=g.match(/^ */))==null?void 0:C[0])||"",L=Math.min(M.length,n);return g.slice(L)}).join(`
209
+ `);return c.replaceWith(f,d,r.schema.text(b)),!0})},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
210
+
211
+ `);return!s||!l?!1:e.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:s}=n;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)?e.commands.command(({tr:d})=>(d.setSelection(tr.near(r.resolve(c))),!0)):e.commands.exitCode()}}},addInputRules(){return[B2({find:_P,type:this.type,getAttributes:e=>({language:e[1]})}),B2({find:LP,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Ui({key:new Ro("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:l,schema:c}=e.state,f=c.text(n.replace(/\r\n?/g,`
212
+ `));return l.replaceSelectionWith(this.type.create({language:s},f)),l.selection.$from.parent.type!==this.type&&l.setSelection(Hn.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),e.dispatch(l),!0}}})]}}),RP=el.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
213
+
214
+ `):""}),OP=el.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",co(this.options.HTMLAttributes,e)]},renderText(){return`
215
+ `},renderMarkdown:()=>`
216
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:i,storedMarks:s}=n;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 y=f.filter(b=>c.includes(b.type.name));d.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),PP=el.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,co(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>B2({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),IP=el.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",co(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!c7(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,i=e();return SM(n)?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(Hn.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(Cn.create(l.doc,f.pos)):l.setSelection(Hn.create(l.doc,f.pos));else{const p=s.schema.nodes[this.options.nextNodeType]||f.parent.type.contentMatch.defaultType,y=p?.create();y&&(l.insert(d,y),l.setSelection(Hn.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[l7({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),jP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,zP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,BP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,FP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,UP=bf.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",co(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Jd({find:jP,type:this.type}),Jd({find:BP,type:this.type})]},addPasteRules(){return[nd({find:zP,type:this.type}),nd({find:FP,type:this.type})]}});const HP="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",qP="ελ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",H2="numeric",q2="ascii",$2="alpha",np="asciinumeric",Yh="alphanumeric",Y2="domain",VM="emoji",$P="scheme",YP="slashscheme",Ly="whitespace";function VP(e,t){return e in t||(t[e]=[]),t[e]}function Bf(e,t,n){t[H2]&&(t[np]=!0,t[Yh]=!0),t[q2]&&(t[np]=!0,t[$2]=!0),t[np]&&(t[Yh]=!0),t[$2]&&(t[Yh]=!0),t[Yh]&&(t[Y2]=!0),t[VM]&&(t[Y2]=!0);for(const r in t){const i=VP(r,n);i.indexOf(e)<0&&i.push(e)}}function WP(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Na(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Na.groups={};Na.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const i=t.jr[r][0],s=t.jr[r][1];if(s&&i.test(e))return s}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r=r||Na.groups;let i;return t&&t.j?i=t:(i=new Na(t),n&&r&&Bf(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this;const s=e.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(e[l]);return i.tt(e[s-1],t,n,r)},tt(e,t,n,r){r=r||Na.groups;const i=this;if(t&&t.j)return i.j[e]=t,t;const s=t;let l,c=i.go(e);if(c?(l=new Na,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Na,s){if(r)if(l.t&&typeof l.t=="string"){const f=Object.assign(WP(l.t,r),n);Bf(s,f,r)}else n&&Bf(s,n,r);l.t=s}return i.j[e]=l,l}};const Qn=(e,t,n,r,i)=>e.ta(t,n,r,i),Gi=(e,t,n,r,i)=>e.tr(t,n,r,i),x3=(e,t,n,r,i)=>e.ts(t,n,r,i),Ne=(e,t,n,r,i)=>e.tt(t,n,r,i),gu="WORD",V2="UWORD",WM="ASCIINUMERICAL",XM="ALPHANUMERICAL",xp="LOCALHOST",W2="TLD",X2="UTLD",tg="SCHEME",Pd="SLASH_SCHEME",H5="NUM",G2="WS",q5="NL",rp="OPENBRACE",ip="CLOSEBRACE",Ag="OPENBRACKET",Mg="CLOSEBRACKET",Cg="OPENPAREN",Eg="CLOSEPAREN",Tg="OPENANGLEBRACKET",Ng="CLOSEANGLEBRACKET",_g="FULLWIDTHLEFTPAREN",Lg="FULLWIDTHRIGHTPAREN",Dg="LEFTCORNERBRACKET",Rg="RIGHTCORNERBRACKET",Og="LEFTWHITECORNERBRACKET",Pg="RIGHTWHITECORNERBRACKET",Ig="FULLWIDTHLESSTHAN",jg="FULLWIDTHGREATERTHAN",zg="AMPERSAND",Bg="APOSTROPHE",Fg="ASTERISK",tf="AT",Ug="BACKSLASH",Hg="BACKTICK",qg="CARET",rf="COLON",$5="COMMA",$g="DOLLAR",Nc="DOT",Yg="EQUALS",Y5="EXCLAMATION",Al="HYPHEN",op="PERCENT",Vg="PIPE",Wg="PLUS",Xg="POUND",sp="QUERY",V5="QUOTE",GM="FULLWIDTHMIDDLEDOT",W5="SEMI",_c="SLASH",ap="TILDE",Gg="UNDERSCORE",KM="EMOJI",Kg="SYM";var JM=Object.freeze({__proto__:null,ALPHANUMERICAL:XM,AMPERSAND:zg,APOSTROPHE:Bg,ASCIINUMERICAL:WM,ASTERISK:Fg,AT:tf,BACKSLASH:Ug,BACKTICK:Hg,CARET:qg,CLOSEANGLEBRACKET:Ng,CLOSEBRACE:ip,CLOSEBRACKET:Mg,CLOSEPAREN:Eg,COLON:rf,COMMA:$5,DOLLAR:$g,DOT:Nc,EMOJI:KM,EQUALS:Yg,EXCLAMATION:Y5,FULLWIDTHGREATERTHAN:jg,FULLWIDTHLEFTPAREN:_g,FULLWIDTHLESSTHAN:Ig,FULLWIDTHMIDDLEDOT:GM,FULLWIDTHRIGHTPAREN:Lg,HYPHEN:Al,LEFTCORNERBRACKET:Dg,LEFTWHITECORNERBRACKET:Og,LOCALHOST:xp,NL:q5,NUM:H5,OPENANGLEBRACKET:Tg,OPENBRACE:rp,OPENBRACKET:Ag,OPENPAREN:Cg,PERCENT:op,PIPE:Vg,PLUS:Wg,POUND:Xg,QUERY:sp,QUOTE:V5,RIGHTCORNERBRACKET:Rg,RIGHTWHITECORNERBRACKET:Pg,SCHEME:tg,SEMI:W5,SLASH:_c,SLASH_SCHEME:Pd,SYM:Kg,TILDE:ap,TLD:W2,UNDERSCORE:Gg,UTLD:X2,UWORD:V2,WORD:gu,WS:G2});const hu=/[a-z]/,zh=new RegExp("\\p{L}","u"),Dy=new RegExp("\\p{Emoji}","u"),pu=/\d/,Ry=/\s/,v3="\r",Oy=`
217
+ `,XP="️",GP="‍",Py="";let Rm=null,Om=null;function KP(e=[]){const t={};Na.groups=t;const n=new Na;Rm==null&&(Rm=w3(HP)),Om==null&&(Om=w3(qP)),Ne(n,"'",Bg),Ne(n,"{",rp),Ne(n,"}",ip),Ne(n,"[",Ag),Ne(n,"]",Mg),Ne(n,"(",Cg),Ne(n,")",Eg),Ne(n,"<",Tg),Ne(n,">",Ng),Ne(n,"(",_g),Ne(n,")",Lg),Ne(n,"「",Dg),Ne(n,"」",Rg),Ne(n,"『",Og),Ne(n,"』",Pg),Ne(n,"<",Ig),Ne(n,">",jg),Ne(n,"&",zg),Ne(n,"*",Fg),Ne(n,"@",tf),Ne(n,"`",Hg),Ne(n,"^",qg),Ne(n,":",rf),Ne(n,",",$5),Ne(n,"$",$g),Ne(n,".",Nc),Ne(n,"=",Yg),Ne(n,"!",Y5),Ne(n,"-",Al),Ne(n,"%",op),Ne(n,"|",Vg),Ne(n,"+",Wg),Ne(n,"#",Xg),Ne(n,"?",sp),Ne(n,'"',V5),Ne(n,"/",_c),Ne(n,";",W5),Ne(n,"~",ap),Ne(n,"_",Gg),Ne(n,"\\",Ug),Ne(n,"・",GM);const r=Gi(n,pu,H5,{[H2]:!0});Gi(r,pu,r);const i=Gi(r,hu,WM,{[np]:!0}),s=Gi(r,zh,XM,{[Yh]:!0}),l=Gi(n,hu,gu,{[q2]:!0});Gi(l,pu,i),Gi(l,hu,l),Gi(i,pu,i),Gi(i,hu,i);const c=Gi(n,zh,V2,{[$2]:!0});Gi(c,hu),Gi(c,pu,s),Gi(c,zh,c),Gi(s,pu,s),Gi(s,hu),Gi(s,zh,s);const f=Ne(n,Oy,q5,{[Ly]:!0}),d=Ne(n,v3,G2,{[Ly]:!0}),p=Gi(n,Ry,G2,{[Ly]:!0});Ne(n,Py,p),Ne(d,Oy,f),Ne(d,Py,p),Gi(d,Ry,p),Ne(p,v3),Ne(p,Oy),Gi(p,Ry,p),Ne(p,Py,p);const y=Gi(n,Dy,KM,{[VM]:!0});Ne(y,"#"),Gi(y,Dy,y),Ne(y,XP,y);const b=Ne(y,GP);Ne(b,"#"),Gi(b,Dy,y);const g=[[hu,l],[pu,i]],C=[[hu,null],[zh,c],[pu,s]];for(let M=0;M<Rm.length;M++)Wu(n,Rm[M],W2,gu,g);for(let M=0;M<Om.length;M++)Wu(n,Om[M],X2,V2,C);Bf(W2,{tld:!0,ascii:!0},t),Bf(X2,{utld:!0,alpha:!0},t),Wu(n,"file",tg,gu,g),Wu(n,"mailto",tg,gu,g),Wu(n,"http",Pd,gu,g),Wu(n,"https",Pd,gu,g),Wu(n,"ftp",Pd,gu,g),Wu(n,"ftps",Pd,gu,g),Bf(tg,{scheme:!0,ascii:!0},t),Bf(Pd,{slashscheme:!0,ascii:!0},t),e=e.sort((M,L)=>M[0]>L[0]?1:-1);for(let M=0;M<e.length;M++){const L=e[M][0],H=e[M][1]?{[$P]:!0}:{[YP]:!0};L.indexOf("-")>=0?H[Y2]=!0:hu.test(L)?pu.test(L)?H[np]=!0:H[q2]=!0:H[H2]=!0,x3(n,L,L,H)}return x3(n,"localhost",xp,{ascii:!0}),n.jd=new Na(Kg),{start:n,tokens:Object.assign({groups:t},JM)}}function ZM(e,t){const n=JP(t.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=e,f=null,d=0,p=null,y=-1,b=-1;for(;l<r&&(f=c.go(n[l]));)c=f,c.accepts()?(y=0,b=0,p=c):y>=0&&(y+=n[l].length,b++),d+=n[l].length,s+=n[l].length,l++;s-=y,l-=b,d-=y,i.push({t:p.t,v:t.slice(s-d,s),s:s-d,e:s})}return i}function JP(e){const t=[],n=e.length;let r=0;for(;r<n;){let i=e.charCodeAt(r),s,l=i<55296||i>56319||r+1===n||(s=e.charCodeAt(r+1))<56320||s>57343?e[r]:e.slice(r,r+2);t.push(l),r+=l.length}return t}function Wu(e,t,n,r,i){let s;const l=t.length;for(let c=0;c<l-1;c++){const f=t[c];e.j[f]?s=e.j[f]:(s=new Na(r),s.jr=i.slice(),e.j[f]=s),e=s}return s=new Na(n),s.jr=i.slice(),e.j[t[l-1]]=s,s}function w3(e){const t=[],n=[];let r=0,i="0123456789";for(;r<e.length;){let s=0;for(;i.indexOf(e[r+s])>=0;)s++;if(s>0){t.push(n.join(""));for(let l=parseInt(e.substring(r,r+s),10);l>0;l--)n.pop();r+=s}else n.push(e[r]),r++}return t}const vp={defaultProtocol:"http",events:null,format:S3,formatHref:S3,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function X5(e,t=null){let n=Object.assign({},vp);e&&(n=Object.assign(n,e instanceof X5?e.o:e));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}X5.prototype={o:vp,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let i=this.o[e];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:vp[e],typeof i=="function"&&r&&(i=i(t,n))):typeof i=="function"&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function S3(e){return e}function QM(e,t){this.t="token",this.v=e,this.tk=t}QM.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=vp.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),i=e.get("tagName",n,t),s=this.toFormattedString(e),l={},c=e.get("className",n,t),f=e.get("target",n,t),d=e.get("rel",n,t),p=e.getObj("attributes",n,t),y=e.getObj("events",n,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:y}}};function b0(e,t){class n extends QM{constructor(i,s){super(i,s),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const k3=b0("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),A3=b0("text"),ZP=b0("nl"),Pm=b0("url",{isLink:!0,toHref(e=vp.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==xp&&e[1].t===rf}}),wl=e=>new Na(e);function QP({groups:e}){const t=e.domain.concat([zg,Fg,tf,Ug,Hg,qg,$g,Yg,Al,H5,op,Vg,Wg,Xg,_c,Kg,ap,Gg]),n=[Bg,rf,$5,Nc,Y5,op,sp,V5,W5,Tg,Ng,rp,ip,Mg,Ag,Cg,Eg,_g,Lg,Dg,Rg,Og,Pg,Ig,jg],r=[zg,Bg,Fg,Ug,Hg,qg,$g,Yg,Al,rp,ip,op,Vg,Wg,Xg,sp,_c,Kg,ap,Gg],i=wl(),s=Ne(i,ap);Qn(s,r,s),Qn(s,e.domain,s);const l=wl(),c=wl(),f=wl();Qn(i,e.domain,l),Qn(i,e.scheme,c),Qn(i,e.slashscheme,f),Qn(l,r,s),Qn(l,e.domain,l);const d=Ne(l,tf);Ne(s,tf,d),Ne(c,tf,d),Ne(f,tf,d);const p=Ne(s,Nc);Qn(p,r,s),Qn(p,e.domain,s);const y=wl();Qn(d,e.domain,y),Qn(y,e.domain,y);const b=Ne(y,Nc);Qn(b,e.domain,y);const g=wl(k3);Qn(b,e.tld,g),Qn(b,e.utld,g),Ne(d,xp,g);const C=Ne(y,Al);Ne(C,Al,C),Qn(C,e.domain,y),Qn(g,e.domain,y),Ne(g,Nc,b),Ne(g,Al,C);const M=Ne(g,rf);Qn(M,e.numeric,k3);const L=Ne(l,Al),D=Ne(l,Nc);Ne(L,Al,L),Qn(L,e.domain,l),Qn(D,r,s),Qn(D,e.domain,l);const H=wl(Pm);Qn(D,e.tld,H),Qn(D,e.utld,H),Qn(H,e.domain,l),Qn(H,r,s),Ne(H,Nc,D),Ne(H,Al,L),Ne(H,tf,d);const V=Ne(H,rf),W=wl(Pm);Qn(V,e.numeric,W);const gt=wl(Pm),_t=wl();Qn(gt,t,gt),Qn(gt,n,_t),Qn(_t,t,gt),Qn(_t,n,_t),Ne(H,_c,gt),Ne(W,_c,gt);const kt=Ne(c,rf),xt=Ne(f,rf),rt=Ne(xt,_c),jt=Ne(rt,_c);Qn(c,e.domain,l),Ne(c,Nc,D),Ne(c,Al,L),Qn(f,e.domain,l),Ne(f,Nc,D),Ne(f,Al,L),Qn(kt,e.domain,gt),Ne(kt,_c,gt),Ne(kt,sp,gt),Qn(jt,e.domain,gt),Qn(jt,t,gt),Ne(jt,_c,gt);const J=[[rp,ip],[Ag,Mg],[Cg,Eg],[Tg,Ng],[_g,Lg],[Dg,Rg],[Og,Pg],[Ig,jg]];for(let ct=0;ct<J.length;ct++){const[X,bt]=J[ct],Lt=Ne(gt,X);Ne(_t,X,Lt),Ne(Lt,bt,gt);const dt=wl(Pm);Qn(Lt,t,dt);const st=wl();Qn(Lt,n),Qn(dt,t,dt),Qn(dt,n,st),Qn(st,t,dt),Qn(st,n,st),Ne(dt,bt,gt),Ne(st,bt,gt)}return Ne(i,xp,H),Ne(i,q5,ZP),{start:i,tokens:JM}}function tI(e,t,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=e,f=null,d=null,p=0,y=null,b=-1;for(;i<r&&!(f=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(d=f||c.go(n[i].t));)f=null,c=d,c.accepts()?(b=0,y=c):b>=0&&b++,i++,p++;if(b<0)i-=p,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(Iy(A3,t,l)),l=[]),i-=b,p-=b;const g=y.t,C=n.slice(i-p,i);s.push(Iy(g,t,C))}}return l.length>0&&s.push(Iy(A3,t,l)),s}function Iy(e,t,n){const r=n[0].s,i=n[n.length-1].e,s=t.slice(r,i);return new e(s,n)}const eI=typeof console<"u"&&console&&console.warn||(()=>{}),nI="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 rI(){return Na.groups={},Mi.scanner=null,Mi.parser=null,Mi.tokenQueue=[],Mi.pluginQueue=[],Mi.customSchemes=[],Mi.initialized=!1,Mi}function M3(e,t=!1){if(Mi.initialized&&eI(`linkifyjs: already initialized - will not register custom scheme "${e}" ${nI}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
218
+ 1. Must only contain digits, lowercase ASCII letters or "-"
219
+ 2. Cannot start or end with "-"
220
+ 3. "-" cannot repeat`);Mi.customSchemes.push([e,t])}function iI(){Mi.scanner=KP(Mi.customSchemes);for(let e=0;e<Mi.tokenQueue.length;e++)Mi.tokenQueue[e][1]({scanner:Mi.scanner});Mi.parser=QP(Mi.scanner.tokens);for(let e=0;e<Mi.pluginQueue.length;e++)Mi.pluginQueue[e][1]({scanner:Mi.scanner,parser:Mi.parser});return Mi.initialized=!0,Mi}function G5(e){return Mi.initialized||iI(),tI(Mi.parser.start,e,ZM(Mi.scanner.start,e))}G5.scan=ZM;function tC(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new X5(n),i=G5(e),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 K5="[\0-   ᠎ -\u2029  ]",oI=new RegExp(K5),sI=new RegExp(`${K5}$`),aI=new RegExp(K5,"g");function lI(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function cI(e){return new Ui({key:new Ro("autolink"),appendTransaction:(t,n,r)=>{const i=t.some(d=>d.docChanged)&&!n.doc.eq(r.doc),s=t.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=pM(n.doc,[...t]);if(wM(c).forEach(({newRange:d})=>{const p=lO(r.doc,d,g=>g.isTextblock);let y,b;if(p.length>1)y=p[0],b=r.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(p.length){const g=r.doc.textBetween(d.from,d.to," "," ");if(!sI.test(g))return;y=p[0],b=r.doc.textBetween(y.pos,d.to,void 0," ")}if(y&&b){const g=b.split(oI).filter(Boolean);if(g.length<=0)return!1;const C=g[g.length-1],M=y.pos+b.lastIndexOf(C);if(!C)return!1;const L=G5(C).map(D=>D.toObject(e.defaultProtocol));if(!lI(L))return!1;L.filter(D=>D.isLink).map(D=>({...D,from:M+D.start+1,to:M+D.end+1})).filter(D=>r.schema.marks.code?!r.doc.rangeHasMark(D.from,D.to,r.schema.marks.code):!0).filter(D=>e.validate(D.value)).filter(D=>e.shouldAutoLink(D.value)).forEach(D=>{I5(D.from,D.to,r.doc).some(H=>H.mark.type===e.type)||l.addMark(D.from,D.to,e.type.create({href:D.href}))})}}),!!l.steps.length)return l}})}function uI(e){return new Ui({key:new Ro("handleClickLink"),props:{handleClick:(t,n,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=e.editor.view.dom;l=f.closest("a"),l&&!d.contains(l)&&(l=null)}if(!l)return!1;let c=!1;if(e.enableClickSelection&&(c=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const f=vM(t.state,e.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 fI(e){return new Ui({key:new Ro("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:i}=e,{state:s}=t,{selection:l}=s,{empty:c}=l;if(c)return!1;let f="";r.content.forEach(p=>{f+=p.textContent});const d=tC(f,{defaultProtocol:e.defaultProtocol}).find(p=>p.isLink&&p.value===f);return!f||!d||i!==void 0&&!i(d.value)?!1:e.editor.commands.setMark(e.type,{href:d.href})}}})}function _f(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!e||e.replace(aI,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var dI=bf.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(e=>{if(typeof e=="string"){M3(e);return}M3(e.scheme,e.optionalSlashes)})},onDestroy(){rI()},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:(e,t)=>!!_f(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const i=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.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:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!_f(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!_f(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",co(this.options.HTMLAttributes,e),0]:["a",co(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,s;const l=(r=(n=e.attrs)==null?void 0:n.href)!=null?r:"",c=(s=(i=e.attrs)==null?void 0:i.title)!=null?s:"",f=t.renderChildren(e);return c?`[${f}](${l} "${c}")`:`[${f}](${l})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!_f(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!_f(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[nd({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,i=tC(e).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!_f(l,n),protocols:n,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:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(cI({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!_f(i,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(uI({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(fI({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),hI=Object.defineProperty,pI=(e,t)=>{for(var n in t)hI(e,n,{get:t[n],enumerable:!0})},mI="listItem",C3="textStyle",E3=/^\s*([-+*])\s$/,eC=el.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:e}){return["ul",co(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
221
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(mI,this.editor.getAttributes(C3)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Zd({find:E3,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Zd({find:E3,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(C3),editor:this.editor})),[e]}}),nC=el.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",co(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if(e.type!=="list_item")return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(i=>i.type==="paragraph"))n=t.parseChildren(e.tokens);else{const i=e.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(i.tokens)}],e.tokens.length>1){const l=e.tokens.slice(1),c=t.parseChildren(l);n.push(...c)}}else n=t.parseChildren(e.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>F5(e,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}. `:"- "},n),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={};pI(gI,{findListItemPos:()=>Cp,getNextListDepth:()=>J5,handleBackspace:()=>K2,handleDelete:()=>J2,hasListBefore:()=>rC,hasListItemAfter:()=>yI,hasListItemBefore:()=>iC,listItemHasSubList:()=>oC,nextListIsDeeper:()=>sC,nextListIsHigher:()=>aC});var Cp=(e,t)=>{const{$from:n}=t.selection,r=ko(e,t.schema);let i=null,s=n.depth,l=n.pos,c=null;for(;s>0&&c===null;)i=n.node(s),i.type===r?c=s:(s-=1,l-=1);return c===null?null:{$pos:t.doc.resolve(l),depth:c}},J5=(e,t)=>{const n=Cp(e,t);if(!n)return!1;const[,r]=xO(t,e,n.$pos.pos+4);return r},rC=(e,t,n)=>{const{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),s=e.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},iC=(e,t)=>{var n;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==e)},oC=(e,t,n)=>{if(!n)return!1;const r=ko(e,t.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},K2=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!mf(e.state,t)&&rC(e.state,t,n)){const{$anchor:c}=e.state.selection,f=e.state.doc.resolve(c.before()-1),d=[];f.node().descendants((b,g)=>{b.type.name===t&&d.push({node:b,pos:g})});const p=d.at(-1);if(!p)return!1;const y=e.state.doc.resolve(f.start()+p.pos+1);return e.chain().cut({from:c.start()-1,to:c.end()+1},y.end()).joinForward().run()}if(!mf(e.state,t)||!kO(e.state))return!1;const r=Cp(t,e.state);if(!r)return!1;const s=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=oC(t,e.state,s);return iC(t,e.state)&&!l?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},sC=(e,t)=>{const n=J5(e,t),r=Cp(e,t);return!r||!n?!1:n>r.depth},aC=(e,t)=>{const n=J5(e,t),r=Cp(e,t);return!r||!n?!1:n<r.depth},J2=(e,t)=>{if(!mf(e.state,t)||!SO(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:sC(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():aC(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},yI=(e,t)=>{var n;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==e)},lC=li.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&J2(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&J2(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&K2(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&K2(e,n,r)&&(t=!0)}),t}}}}),T3=/^(\s*)(\d+)\.\s+(.*)$/,bI=/^\s/;function xI(e){const t=[];let n=0,r=0;for(;n<e.length;){const i=e[n],s=i.match(T3);if(!s)break;const[,l,c,f]=s,d=l.length;let p=f,y=n+1;const b=[i];for(;y<e.length;){const g=e[y];if(g.match(T3))break;if(g.trim()==="")b.push(g),p+=`
222
+ `,y+=1;else if(g.match(bI))b.push(g),p+=`
223
+ ${g.slice(d+2)}`,y+=1;else break}t.push({indent:d,number:parseInt(c,10),content:p.trim(),raw:b.join(`
224
+ `)}),r=y,n=y}return[t,r]}function cC(e,t,n){var r;const i=[];let s=0;for(;s<e.length;){const l=e[s];if(l.indent===t){const c=l.content.split(`
225
+ `),f=((r=c[0])==null?void 0:r.trim())||"",d=[];f&&d.push({type:"paragraph",raw:f,tokens:n.inlineTokens(f)});const p=c.slice(1).join(`
226
+ `).trim();if(p){const g=n.blockTokens(p);d.push(...g)}let y=s+1;const b=[];for(;y<e.length&&e[y].indent>t;)b.push(e[y]),y+=1;if(b.length>0){const g=Math.min(...b.map(M=>M.indent)),C=cC(b,g,n);d.push({type:"list",ordered:!0,start:b[0].number,items:C,raw:b.map(M=>M.raw).join(`
227
+ `)})}i.push({type:"list_item",raw:l.raw,tokens:d}),s=y}else s+=1}return i}function vI(e,t){return e.map(n=>{if(n.type!=="list_item")return t.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.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 wI="listItem",N3="textStyle",_3=/^(\d+)\.\s$/,uC=el.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",co(this.options.HTMLAttributes,n),0]:["ol",co(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if(e.type!=="list"||!e.ordered)return[];const n=e.start||1,r=e.items?vI(e.items,t):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
228
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=t?.index;return n!==void 0?n:-1},tokenize:(e,t,n)=>{var r;const i=e.split(`
229
+ `),[s,l]=xI(i);if(s.length===0)return;const c=cC(s,0,n);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(`
230
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(wI,this.editor.getAttributes(N3)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Zd({find:_3,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Zd({find:_3,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(N3)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),SI=/^\s*(\[([( |x])?\])\s$/,kI=el.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:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",co(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;const i=`- [${(n=e.attrs)!=null&&n.checked?"x":" "}] `;return F5(e,t,i)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),c=document.createElement("input"),f=document.createElement("div"),d=y=>{var b,g;c.ariaLabel=((g=(b=this.options.a11y)==null?void 0:b.checkboxLabel)==null?void 0:g.call(b,y,c.checked))||`Task item checkbox for ${y.textContent||"empty task item"}`};d(e),s.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",y=>y.preventDefault()),c.addEventListener("change",y=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:b}=y.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:g})=>{const C=n();if(typeof C!="number")return!1;const M=g.doc.nodeAt(C);return g.setNodeMarkup(C,void 0,{...M?.attrs,checked:b}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,b)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([y,b])=>{i.setAttribute(y,b)}),i.dataset.checked=e.attrs.checked,c.checked=e.attrs.checked,s.append(c,l),i.append(s,f),Object.entries(t).forEach(([y,b])=>{i.setAttribute(y,b)});let p=new Set(Object.keys(t));return{dom:i,contentDOM:f,update:y=>{if(y.type!==this.type)return!1;i.dataset.checked=y.attrs.checked,c.checked=y.attrs.checked,d(y);const b=r.extensionManager.attributes,g=bp(y,b),C=new Set(Object.keys(g)),M=this.options.HTMLAttributes;return p.forEach(L=>{C.has(L)||(L in M?i.setAttribute(L,M[L]):i.removeAttribute(L))}),Object.entries(g).forEach(([L,D])=>{D==null?L in M?i.setAttribute(L,M[L]):i.removeAttribute(L):i.setAttribute(L,D)}),p=C,!0}}}},addInputRules(){return[Zd({find:SI,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),AI=el.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:e}){return["ul",co(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
231
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const r=s=>{const l=F2(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:n.inlineTokens(c.mainContent),nestedTokens:f}),customNestedParser:r},n);return l?[{type:"taskList",raw:l.raw,items:l.items}]:n.blockTokens(s)},i=F2(e,{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:n.inlineTokens(s.mainContent),nestedTokens:l}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});li.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(eC.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(nC.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(lC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(uC.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(kI.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(AI.configure(this.options.taskList)),e}});var L3="&nbsp;",MI=" ",CI=el.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",co(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);const r=t.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===L3||r[0].text===MI)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return n.length===0?L3:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),EI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,TI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,NI=bf.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",co(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Jd({find:EI,type:this.type})]},addPasteRules(){return[nd({find:TI,type:this.type})]}}),_I=el.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),LI=bf.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",co(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function DI(e={}){return new Ui({view(t){return new RI(t,e)}})}class RI{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.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:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.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),n=!t.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),l=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(n){let y=t.nodeBefore,b=t.nodeAfter;if(y||b){let g=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(g){let C=g.getBoundingClientRect(),M=y?C.bottom:C.top;y&&b&&(M=(M+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let L=this.width/2*c;r={left:C.left,right:C.right,top:M-L,bottom:M+L}}}}if(!r){let y=this.editorView.coordsAtPos(this.cursorPos),b=this.width/2*l;r={left:y.left-b,right:y.left+b,top:y.top,bottom:y.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let d,p;if(!f||f==document.body&&getComputedStyle(f).position=="static")d=-pageXOffset,p=-pageYOffset;else{let y=f.getBoundingClientRect(),b=y.width/f.offsetWidth,g=y.height/f.offsetHeight;d=y.left-f.scrollLeft*b,p=y.top-f.scrollTop*g}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 n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,t):i;if(n&&!s){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=oA(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 Ji extends tr{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Ji.valid(r)?new Ji(r):tr.near(r)}content(){return Ge.empty}eq(t){return t instanceof Ji&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ji(t.resolve(n.pos))}getBookmark(){return new Z5(this.anchor)}static valid(t){let n=t.parent;if(n.inlineContent||!OI(t)||!PI(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,n,r=!1){t:for(;;){if(!r&&Ji.valid(t))return t;let i=t.pos,s=null;for(let l=t.depth;;l--){let c=t.node(l);if(n>0?t.indexAfter(l)<c.childCount:t.index(l)>0){s=c.child(n>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;i+=n;let f=t.doc.resolve(i);if(Ji.valid(f))return f}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Cn.isSelectable(s)){t=t.doc.resolve(i+s.nodeSize*n),r=!1;continue t}break}s=l,i+=n;let c=t.doc.resolve(i);if(Ji.valid(c))return c}return null}}}Ji.prototype.visible=!1;Ji.findFrom=Ji.findGapCursorFrom;tr.jsonID("gapcursor",Ji);class Z5{constructor(t){this.pos=t}map(t){return new Z5(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Ji.valid(n)?new Ji(n):tr.near(n)}}function fC(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function OI(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||fC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function PI(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||fC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function II(){return new Ui({props:{decorations:FI,createSelectionBetween(e,t,n){return t.pos==n.pos&&Ji.valid(n)?new Ji(n):null},handleClick:zI,handleKeyDown:jI,handleDOMEvents:{beforeinput:BI}}})}const jI=sM({ArrowLeft:Im("horiz",-1),ArrowRight:Im("horiz",1),ArrowUp:Im("vert",-1),ArrowDown:Im("vert",1)});function Im(e,t){const n=e=="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 Hn){if(!s.endOfTextblock(n)||c.depth==0)return!1;f=!1,c=r.doc.resolve(t>0?c.after():c.before())}let d=Ji.findGapCursorFrom(c,t,f);return d?(i&&i(r.tr.setSelection(new Ji(d))),!0):!1}}function zI(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Ji.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Cn.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Ji(r))),!0)}function BI(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Ji))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.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=e.state.tr.replace(n.pos,n.pos,new Ge(i,0,0));return s.setSelection(Hn.near(s.doc.resolve(n.pos+1))),e.dispatch(s),!1}function FI(e){if(!(e.selection instanceof Ji))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Fi.create(e.doc,[ia.widget(e.selection.head,t,{key:"gapcursor"})])}var Jg=200,$o=function(){};$o.prototype.append=function(t){return t.length?(t=$o.from(t),!this.length&&t||t.length<Jg&&this.leafAppend(t)||this.length<Jg&&t.leafPrepend(this)||this.appendInner(t)):this};$o.prototype.prepend=function(t){return t.length?$o.from(t).append(this):this};$o.prototype.appendInner=function(t){return new UI(this,t)};$o.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?$o.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};$o.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};$o.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};$o.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,l){return i.push(t(s,l))},n,r),i};$o.from=function(t){return t instanceof $o?t:t&&t.length?new dC(t):$o.empty};var dC=(function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={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<=Jg)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=Jg)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})($o);$o.empty=new dC([]);var UI=(function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.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})($o);const HI=500;class tc{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){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;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let l=t.tr,c,f,d=[],p=[];return this.items.forEach((y,b)=>{if(!y.step){i||(i=this.remapping(r,b+1),s=i.maps.length),s--,p.push(y);return}if(i){p.push(new Lc(y.map));let g=y.step.map(i.slice(s)),C;g&&l.maybeStep(g).doc&&(C=l.mapping.maps[l.mapping.maps.length-1],d.push(new Lc(C,void 0,void 0,d.length+p.length))),s--,C&&i.appendMap(C,s)}else l.maybeStep(y.step);if(y.selection)return c=i?y.selection.map(i.slice(s)):y.selection,f=new tc(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,n,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 y=t.steps[p].invert(t.docs[p]),b=new Lc(t.mapping.maps[p],y,n),g;(g=f&&f.merge(b))&&(b=g,p?s.pop():c=c.slice(0,c.length-1)),s.push(b),n&&(l++,n=void 0),i||(f=b)}let d=l-r.depth;return d>$I&&(c=qI(c,d),l-=d),new tc(c.append(s),l)}remapping(t,n){let r=new dp;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,n),r}addMaps(t){return this.eventCount==0?this:new tc(this.items.append(t.map(n=>new Lc(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=t.mapping,l=t.steps.length,c=this.eventCount;this.items.forEach(b=>{b.selection&&c--},i);let f=n;this.items.forEach(b=>{let g=s.getMirror(--f);if(g==null)return;l=Math.min(l,g);let C=s.maps[g];if(b.step){let M=t.steps[g].invert(t.docs[g]),L=b.selection&&b.selection.map(s.slice(f+1,g));L&&c++,r.push(new Lc(C,M,L))}else r.push(new Lc(C))},i);let d=[];for(let b=n;b<l;b++)d.push(new Lc(s.maps[b]));let p=this.items.slice(0,i).append(d).append(r),y=new tc(p,c);return y.emptyItemCount()>HI&&(y=y.compress(this.items.length-r.length)),y}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.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(n.slice(r)),d=f&&f.getMap();if(r--,d&&n.appendMap(d,r),f){let p=l.selection&&l.selection.map(n.slice(r));p&&s++;let y=new Lc(d.invert(),f,p),b,g=i.length-1;(b=i.length&&i[g].merge(y))?i[g]=b:i.push(y)}}else l.map&&r--},this.items.length,0),new tc($o.from(i.reverse()),s)}}tc.empty=new tc($o.empty,0);function qI(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}class Lc{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Lc(n.getMap().invert(),n,this.selection)}}}class ef{constructor(t,n,r,i,s){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const $I=20;function YI(e,t,n,r){let i=n.getMeta(Yf),s;if(i)return i.historyState;n.getMeta(XI)&&(e=new ef(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(l&&l.getMeta(Yf))return l.getMeta(Yf).redo?new ef(e.done.addTransform(n,void 0,r,eg(t)),e.undone,D3(n.mapping.maps),e.prevTime,e.prevComposition):new ef(e.done,e.undone.addTransform(n,void 0,r,eg(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),f=e.prevTime==0||!l&&e.prevComposition!=c&&(e.prevTime<(n.time||0)-r.newGroupDelay||!VI(n,e.prevRanges)),d=l?jy(e.prevRanges,n.mapping):D3(n.mapping.maps);return new ef(e.done.addTransform(n,f?t.selection.getBookmark():void 0,r,eg(t)),tc.empty,d,n.time,c??e.prevComposition)}else return(s=n.getMeta("rebased"))?new ef(e.done.rebased(n,s),e.undone.rebased(n,s),jy(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ef(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),jy(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function VI(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<t.length;s+=2)r<=t[s+1]&&i>=t[s]&&(n=!0)}),n}function D3(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,i,s,l)=>t.push(s,l));return t}function jy(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),s=t.map(e[r+1],-1);i<=s&&n.push(i,s)}return n}function WI(e,t,n){let r=eg(t),i=Yf.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),f=new ef(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(Yf,{redo:n,historyState:f})}let zy=!1,R3=null;function eg(e){let t=e.plugins;if(R3!=t){zy=!1,R3=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){zy=!0;break}}return zy}const Yf=new Ro("history"),XI=new Ro("closeHistory");function GI(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ui({key:Yf,state:{init(){return new ef(tc.empty,tc.empty,null,0,-1)},apply(t,n,r){return YI(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,i=r=="historyUndo"?pC:r=="historyRedo"?mC:null;return!i||!t.editable?!1:(n.preventDefault(),i(t.state,t.dispatch))}}}})}function hC(e,t){return(n,r)=>{let i=Yf.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let s=WI(i,n,e);s&&r(t?s.scrollIntoView():s)}return!0}}const pC=hC(!1,!0),mC=hC(!0,!0);li.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=e?.node||this.editor.state.doc;if((e?.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=e=>{const t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Ui({key:new Ro("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const i=this.options.limit;if(i==null||i===0){e=!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 e=!0,d}e=!0},filterTransaction:(t,n)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.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 KI=li.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[DI(this.options)]}});li.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ui({key:new Ro("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!n||!r)return Fi.create(e,[]);let l=0;this.options.mode==="deepest"&&e.descendants((f,d)=>{if(f.isText)return;if(!(i>=d&&i<=d+f.nodeSize-1))return!1;l+=1});let c=0;return e.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(ia.node(d,d+f.nodeSize,{class:this.options.className}))}),Fi.create(e,s)}}})]}});var JI=li.create({name:"gapCursor",addProseMirrorPlugins(){return[II()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=qr(yn(e,"allowGapCursor",n)))!=null?t:null}}}),O3="placeholder";function ZI(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}li.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:O3,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${ZI(this.options.dataAttribute)}`:`data-${O3}`;return[new Ui({key:new Ro("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,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&&m0(c);if((d||!this.options.showOnlyCurrent)&&p){const y=[this.options.emptyNodeClass];l&&y.push(this.options.emptyEditorClass);const b=ia.node(f,f+c.nodeSize,{class:y.join(" "),[e]: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}),Fi.create(t,s)}}})]}});li.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Ui({key:new Ro("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||SM(n.selection)||e.view.dragging?null:Fi.create(n.doc,[ia.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function P3({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var QI=li.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Ro(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Ui({key:t,appendTransaction:(i,s,l)=>{const{doc:c,tr:f,schema:d}=l,p=t.getState(l),y=c.content.size,b=d.nodes[n];if(p)return f.insert(y,b.create())},state:{init:(i,s)=>{const l=s.tr.doc.lastChild;return!P3({node:l,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const l=i.doc.lastChild;return!P3({node:l,types:r})}}})]}}),tj=li.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>pC(e,t),redo:()=>({state:e,dispatch:t})=>mC(e,t)}},addProseMirrorPlugins(){return[GI(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()}}}),ej=li.create({name:"starterKit",addExtensions(){var e,t,n,r;const i=[];return this.options.bold!==!1&&i.push(CP.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(wP.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(eC.configure(this.options.bulletList)),this.options.code!==!1&&i.push(NP.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(DP.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(RP.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(KI.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(JI.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(OP.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(PP.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(tj.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(IP.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(UP.configure(this.options.italic)),this.options.listItem!==!1&&i.push(nC.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(lC.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&i.push(dI.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&i.push(uC.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(CI.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(NI.configure(this.options.strike)),this.options.text!==!1&&i.push(_I.configure(this.options.text)),this.options.underline!==!1&&i.push(LI.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(QI.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),nj=ej,rj=20,gC=(e,t=0)=>{const n=[];return!e.children.length||t>rj||Array.from(e.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...gC(r,t+1))}),n},ij=e=>{if(!e.children.length)return;const t=gC(e);t&&t.forEach(n=>{var r,i;const s=n.getAttribute("style"),l=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${l};${s}`)})},yC=bf.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&ij(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",co(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||e.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),oj=li.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const r=n.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=e.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),sj=li.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const r=n.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=e.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),aj=li.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),lj=li.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),cj=li.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});li.create({name:"textStyleKit",addExtensions(){const e=[];return this.options.backgroundColor!==!1&&e.push(oj.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(sj.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(aj.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(lj.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(cj.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(yC.configure(this.options.textStyle)),e}});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 Qd(){return/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function hn(e,t){const n=t?.isMac??Qd();return e.keys.map(i=>i.kind==="cmdOrCtrl"?n?"⌘":"Ctrl":i.kind==="shift"?n?"⇧":"Shift":i.kind==="plusMinus"||i.kind==="digits"?i.value:i.value.toUpperCase()).join(n?"":"+")}function Ai(e,t){const n=t?.isMac??Qd();return e.keys.map(r=>r.kind==="cmdOrCtrl"?n?"⌘":"Ctrl":r.kind==="shift"?n?"⇧":"Shift":r.kind==="plusMinus"||r.kind==="digits"?r.value:r.value.toUpperCase())}const Ja={minWidth:16,height:16,paddingV:0,paddingH:4,borderRadius:4,fontSize:11,translateY:-.5},I3={display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:Ja.minWidth,height:Ja.height,padding:`0 ${Ja.paddingH}px`,borderRadius:Ja.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:Ja.fontSize,fontWeight:900,lineHeight:1,letterSpacing:"0.02em",transform:`translateY(${Ja.translateY}px)`,userSelect:"none",boxShadow:"0 1px 0 0 rgba(255,255,255,0.2)"};function Ql({children:e,title:t,scale:n=1}){const r=n,i=r===1?I3:{...I3,minWidth:Ja.minWidth*r,height:Ja.height*r,padding:`${Ja.paddingV*r}px ${Ja.paddingH*r}px`,borderRadius:Ja.borderRadius*r,fontSize:Ja.fontSize*r,transform:`translateY(${Ja.translateY*r}px)`};return T.jsx("span",{style:i,title:t,children:e})}const Zg="tyts-callout-insert-plain-text";function uj(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Si="bi",On=Jr*s5,ki=Math.round(12*On),fj=8,Xu=18*On,bC=5*On,dj=Math.max(bC,18*On),hj=1.5*On,pj="#1a1a2e",mj=.45,gj="rgba(0,0,0,0.001)",j3="blur(12px)",yj=2*On,bj=2*On,xj="88",z3="33",vj=10*On,wj="1.5em",Sj="#d0d0d0",kj="#111111",Aj="rgba(10,10,16,0.88)",Mj="rgba(245,245,250,0.98)",B3=4*On,Cj=4*On,Ej=`${2*On}px ${6*On}px`,Tj=10*On,Nj=4*On,_j="rgba(0,0,0,0.6)",Lj="#ddd",x0="rgba(255,255,255,0.08)",Q5="1px solid rgba(255,255,255,0.18)",xC="#ccc",Dj="rgba(230,57,70,0.1)",Rj="1px solid rgba(230,57,70,0.8)",Z2="#ff6b6b",v0=4*On,w0=14*On,Oj=`${3*On}px ${8*On}px`,F3=8*On,Pj=14*On,Ij="#888",jj=8*On,zj=12*On,Bj="rgba(255,255,255,0.5)",Fj=2,Uj=1*On,U3={background:x0,border:Q5,color:xC,cursor:"pointer",borderRadius:v0,fontSize:w0,padding:Oj,fontFamily:"inherit",display:"inline-flex",alignItems:"center",gap:6*On},H3=10*On,q3=8*On,Hj=8*On,qj=4*On,$j=12*On,Yj="rgba(20,20,32,0.95)",Vj="1px solid rgba(60,60,80,0.9)",By=6*On,Zl=16*On,$3=6*On,jm=4*On,Fy="2px solid #fff",Wj="1px solid rgba(255,255,255,0.2)",Y3="rgba(255,255,255,0.05)",V3="1px solid rgba(255,255,255,0.35)",W3="1.8",Xj="2.2 1.8",X3="#fff",Gj=10*On,Kj=3*On,Jj=10*On,Zj=32*On,G3=16*On,Qg="#aaa",Qj={width:G3,height:G3,padding:0,margin:0,background:"transparent",border:"none",color:Qg,cursor:"pointer",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},S0=28*On,tz=26*On,vC=`${2*On}px ${6*On}px`,ez=4*On,wC={minWidth:tz,height:S0,cursor:"pointer",borderRadius:v0,fontSize:w0,padding:vC,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:ez,lineHeight:1,boxSizing:"border-box"},zm={...wC,background:x0,border:Q5,color:Qg},Bm={...wC,background:Dj,border:Rj,color:Z2},SC=S0,nz=4*On,Ed={minWidth:SC,height:S0,background:x0,border:Q5,color:xC,cursor:"pointer",borderRadius:v0,fontSize:w0,padding:vC,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,boxSizing:"border-box"},rz="1px solid rgba(255,255,255,0.4)",K3=18*On,iz=3*On,oz=10*On,sz="1px solid rgba(255,255,255,0.25)",az="#f5f5fa",lz="#111",cz="#111",uz="#fff",t0=32*On,fz=`${3*On}px`,dz=6,kC="rgba(20, 20, 32, 0.95)",hz="1px solid rgba(255,255,255,0.28)",pz="#cfcfcf",mz="background 0.15s, border 0.15s, color 0.15s",J3="1px solid rgba(230,57,70,0.7)",gz="rgba(230,57,70,0.95)",yz="1px solid #ff6b6b",bz="#fff",Uy={position:"absolute",top:"50%",width:t0,height:t0,transform:"translateY(-50%)",background:kC,border:hz,color:pz,cursor:"pointer",borderRadius:"50%",fontSize:w0,padding:fz,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:mz};function Hy(e){return e*(t0+dz)}const xz=[{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"}],vz=Su.memo(function({pin:t,position:n,imageSize:r,active:i,isSelected:s,justCreated:l,fontFamily:c,strokeWidthScale:f=1,controlsLayer:d,onUpdateDescription:p,onUpdateImage:y,onClearImage:b,onDragStart:g,onResizeStart:C,onActivate:M,onUpdateColor:L,onUpdateStrokeStyle:D,onUpdateFillStyle:H,onUpdateStrokeWidthScale:V,onContextMenu:W,onToggleDescPos:gt,onToggleTheme:_t,onHide:kt,onAddLinked:xt,onDelete:rt,onUpdateTextStyle:jt,onUpdateTextFontSize:J}){const ct=Qt=>Qt,X=U.useRef(null),bt=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,Mt=f5(t.anchor),K=C4(t.anchor),P=(t.strokeStyle??Xh)==="dashed",Y=(t.fillStyle??sg)==="none",tt=l_(t.anchor),yt=t.strokeWidthScale!==void 0,wt=(f-Rc)/(Kf-Rc)*100,At=(t.textFontSize??Us)*l4,qt=t.anchor.type==="standalone"?"Блок виноски":`Виноска ${t.label}`,Rt=t.theme==="light"&&lt,Zt=t.textColor??(Rt?kj:Sj),Me=t.textBackgroundColor===null?"transparent":t.textBackgroundColor??(Rt?Mj:Aj),le=gP({extensions:[nj,yC],content:t.description||"",autofocus:!1,editorProps:{attributes:{style:["width: 100%",`min-height: ${wj}`,"background: transparent","border: none","outline: none",`color: ${Zt}`,`font-size: ${At}px`,`line-height: ${Gh}`,`font-family: ${c}`,"direction: ltr","unicode-bidi: plaintext","text-align: left","white-space: pre-wrap","word-break: break-word"].join("; ")}},onUpdate({editor:Qt}){let we=Qt.getHTML();(we==="<p></p>"||we===`<p></p>
232
+ `)&&(we=""),p(t.id,we),!dt&&we.trim().length>0&&st(!0)}}),Ie=U.useCallback(Qt=>Math.max(vj,Qt),[]),Ue=U.useCallback(Qt=>{if(!lt||!le)return;const we=le.state.selection;if(!we.empty&&we.from!==we.to){const We=le.getAttributes("textStyle"),He=We?.fontSize?Number.parseFloat(We.fontSize):Number.NaN,Pe=Number.isFinite(He)?He:At,Wn=Ie(Pe+Qt*On);le.chain().focus().setMark("textStyle",{fontSize:`${Wn}px`}).run();return}J&&J(t.id,Qt)},[lt,le,At,Ie,J,t.id]),ft=U.useCallback(()=>{M(t.id),st(!0),requestAnimationFrame(()=>{le?.commands.focus("end")})},[M,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=we=>{const ge=we;if(ge.detail?.pinId!==t.id)return;const We=ge.detail.text??"";if(!We.trim())return;st(!0);const He=()=>{if(!le||le.isDestroyed)return;le.isFocused||le.commands.focus("end");const Pe=uj(We);le.chain().focus().insertContent(Pe).run()};requestAnimationFrame(()=>requestAnimationFrame(He))};return document.addEventListener(Zg,Qt),()=>document.removeEventListener(Zg,Qt)},[i,le,t.id]),U.useEffect(()=>{if(!l||!le)return;M(t.id);const Qt=setTimeout(()=>{document.activeElement?.blur?.(),le.commands.focus("end")},0);return()=>clearTimeout(Qt)},[l,t.id,M,le]);const Re=(i||s)&&!!le;U.useEffect(()=>{if(!Re||!le)return;const Qt=we=>{const ge=we.target;ge&&(ge.tagName==="TEXTAREA"||ge.tagName==="INPUT"&&ge!==Lt.current||ge.getAttribute?.("contenteditable")==="true")||we.ctrlKey||we.metaKey||we.altKey||we.key.length===1&&(le.isFocused||(we.preventDefault(),we.stopPropagation(),M(t.id),le.chain().focus().insertContent(we.key).run(),st(!0)))};return window.addEventListener("keydown",Qt,!0),()=>window.removeEventListener("keydown",Qt,!0)},[Re,t.id,M,le]);const rn=Qd();U.useEffect(()=>{if(!i||!L||!gt||!rt)return;const Qt=rn?ge=>ge.metaKey:ge=>ge.ctrlKey,we=ge=>{const We=ge.key,He=Qt(ge),Pe=ge.shiftKey;if(He&&We==="b"){ge.preventDefault(),ge.stopPropagation(),lt&&le&&le.chain().focus().toggleBold().run();return}if(He&&We==="i"){ge.preventDefault(),ge.stopPropagation(),lt&&le&&le.chain().focus().toggleItalic().run();return}if(He&&We==="u"){ge.preventDefault(),ge.stopPropagation(),lt&&le&&le.chain().focus().toggleUnderline?.().run?.();return}if(He&&Pe&&(We==="S"||We==="s")){ge.preventDefault(),ge.stopPropagation(),lt&&le&&le.chain().focus().toggleStrike?.().run?.();return}if(He&&(We==="-"||We==="Minus")){ge.preventDefault(),ge.stopPropagation(),Ue(-2);return}if(He&&(We==="="||We==="+")){ge.preventDefault(),ge.stopPropagation(),Ue(2);return}if(He&&Pe&&(We==="T"||We==="t")){ge.preventDefault(),ge.stopPropagation(),M(t.id),st(!0),requestAnimationFrame(()=>le?.commands.focus("end"));return}if(He&&Pe&&(We==="I"||We==="i")){ge.preventDefault(),ge.stopPropagation(),bt.current?.click();return}if(He&&Pe&&(We==="X"||We==="x")){ge.preventDefault(),ge.stopPropagation(),p(t.id,""),st(!1);return}if(He&&Pe&&(We==="E"||We==="e")){ge.preventDefault(),ge.stopPropagation(),zt&&b&&b(t.id);return}if(He&&Pe&&(We==="P"||We==="p")){ge.preventDefault(),ge.stopPropagation(),zt&&(lt||dt)&&gt(t.id);return}if(He&&Pe&&(We==="L"||We==="l")){ge.preventDefault(),ge.stopPropagation(),lt&&_t&&_t(t.id);return}We==="Delete"&&(ge.preventDefault(),ge.stopPropagation(),rt(t.id))};return window.addEventListener("keydown",we,!0),()=>window.removeEventListener("keydown",we,!0)},[i,t.id,lt,zt,dt,rn,M,p,gt,_t,rt,b,J,L,le,Ue]);const{x:on,y:xe,width:_e,height:Te}=n,{w:De,h:$e}=r,fn=Hy(1),In=Hy(2),bn=Hy(3),Nn=on+_e+In+t0>De,xn=U.useCallback(Qt=>["TEXTAREA","BUTTON","INPUT","LABEL"].includes(Qt.tagName)||Qt.getAttribute("contenteditable")==="true"||!!Qt.closest('[contenteditable="true"]')||!!Qt.closest(".ProseMirror"),[]),ze=U.useCallback(Qt=>{g(t.id,ct(Qt))},[g,t.id]),[Qe,je]=U.useState(1),dr=U.useRef(null),mn=U.useCallback(()=>{const Qt=dr.current;if(!Qt)return;const we=Math.ceil(Qt.getBoundingClientRect().height),ge=Math.ceil(Qt.scrollHeight),We=Math.max(1,we,ge);je(He=>He!==We?We:He)},[]);U.useLayoutEffect(()=>{if(!i)return;const Qt=dr.current;if(!Qt)return;mn();const we=requestAnimationFrame(()=>{mn(),requestAnimationFrame(mn)}),ge=new ResizeObserver(()=>mn());return ge.observe(Qt),()=>{cancelAnimationFrame(we),ge.disconnect()}},[i,zt,lt,dt,t.theme,t.descPos,mn]);const an=U.useCallback(()=>{},[]);U.useEffect(()=>{(dt||lt)&&an()},[dt,lt,an,Te]);const dn=Qt=>{const we=Qt.target.files?.[0];if(!we)return;const ge=new FileReader;ge.onload=We=>y(t.id,We.target?.result),ge.readAsDataURL(we),Qt.target.value=""},Vn=t.image?T.jsx("div",{style:{width:"100%",flex:lt||dt?"1 1 auto":"1 1 100%",minHeight:f4,background:`url(${t.image}) center/cover no-repeat`,position:"relative",borderTop:t.descPos==="above"&&(lt||dt)?`1px solid ${t.color}${z3}`:"none",borderBottom:t.descPos==="below"&&(lt||dt)?`1px solid ${t.color}${z3}`:"none",boxSizing:"border-box"},children:T.jsxs("label",{style:{position:"absolute",bottom:B3,right:B3,cursor:"pointer",background:_j,borderRadius:Cj,padding:Ej,fontSize:Tj,color:Lj,display:"inline-flex",alignItems:"center",gap:Nj},children:[T.jsx("i",{className:`${Si} bi-arrow-repeat`,style:{fontSize:ki},"aria-hidden":!0}),"замінити (",zd(),")",T.jsx("input",{type:"file",accept:"image/*",style:{display:"none"},onChange:dn})]})}):null,tn=lt||dt||!zt?T.jsx("div",{style:{flex:zt?"0 0 auto":"1 1 auto",padding:`${d2}px ${h2}px ${h4}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(UM,{editor:le,onContextMenu:Qt=>Qt.preventDefault(),onPointerDown:()=>{M(t.id)},onMouseDown:()=>{M(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:F3,color:Ij,fontSize:Pj},children:[T.jsxs("div",{style:{display:"flex",gap:F3},children:[!zt&&T.jsxs("button",{type:"button",onPointerDown:Qt=>Qt.stopPropagation(),onMouseDown:Qt=>Qt.stopPropagation(),onClick:Qt=>{Qt.stopPropagation(),M(t.id),bt.current?.click()},style:U3,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:U3,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:jj,fontSize:zj,color:Bj,marginTop:Fj},children:["Або вставте з буфера"," ",Ai(oe.pasteInCallout,{isMac:Qd()}).map(Qt=>T.jsx(Ql,{title:zd(),scale:Uj,children:Qt},Qt))]})]})}):null;return T.jsxs("g",{onContextMenu:W?Qt=>W(t.id,Qt):void 0,children:[T.jsx("foreignObject",{x:on,y:xe,width:_e,height:Te,style:{overflow:"visible"},onPointerDown:Qt=>{Qt.stopPropagation(),M(t.id);const we=Qt.target;if(xn(we)){X.current={pointerId:Qt.pointerId,pointerType:Qt.pointerType,startX:Qt.clientX,startY:Qt.clientY};return}ze(Qt)},onPointerMove:Qt=>{const we=X.current;if(!we||we.pointerId!==Qt.pointerId)return;const ge=window.getSelection();if(we.pointerType==="mouse"&&ge&&!ge.isCollapsed&&ge.toString().trim().length>0){X.current=null;return}const We=Qt.clientX-we.startX,He=Qt.clientY-we.startY;Math.hypot(We,He)<fj||(X.current=null,ze(Qt))},onPointerUp:Qt=>{X.current?.pointerId===Qt.pointerId&&(X.current=null)},onPointerCancel:Qt=>{X.current?.pointerId===Qt.pointerId&&(X.current=null)},onMouseDown:Qt=>{Qt.stopPropagation(),M(t.id);const we=Qt.target;xn(we)||g(t.id,Qt)},children:T.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{width:"100%",height:"100%",border:`${d4*m4(f)}px solid ${t.color}`,borderRadius:u2,background:Me,backdropFilter:j3,WebkitBackdropFilter:j3,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:c,cursor:"grab",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",outline:i?`${yj}px solid ${t.color}${xj}`:"none",outlineOffset:bj},onDragOver:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),Qt.dataTransfer.dropEffect="copy"},onDrop:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),M(t.id);const we=Qt.dataTransfer.files?.[0];if(we?.type.startsWith("image/")){const ge=new FileReader;ge.onload=We=>{const He=We.target?.result;He&&y(t.id,He)},ge.readAsDataURL(we)}},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:bt,type:"file",accept:"image/*",style:{display:"none"},onChange:dn}),T.jsxs("div",{style:{display:"flex",flexDirection:t.descPos==="above"?"column":"column-reverse",height:"100%"},children:[tn,Vn]}),T.jsx("div",{"data-drag-hit-zone":"top",style:{position:"absolute",top:0,left:0,right:0,height:Xu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(M(t.id),ze(Qt))}}),T.jsx("div",{"data-drag-hit-zone":"bottom",style:{position:"absolute",bottom:0,left:0,right:0,height:Xu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(M(t.id),ze(Qt))}}),T.jsx("div",{"data-drag-hit-zone":"left",style:{position:"absolute",top:Xu,bottom:Xu,left:0,width:Xu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(M(t.id),ze(Qt))}}),T.jsx("div",{"data-drag-hit-zone":"right",style:{position:"absolute",top:Xu,bottom:Xu,right:0,width:Xu,cursor:"grab",background:"transparent"},onPointerDown:Qt=>{Qt.stopPropagation(),Qt.pointerType==="touch"&&(M(t.id),ze(Qt))}})]})}),i&&L&&gt&&rt&&(()=>{const Qt=xe-Qe-H3,we=xe+Te+H3,ge=xe+Te/2,We=$e/2,Pe=!(ge<We),Yo=Math.max(0,Math.min(Pe?Qt:we,$e-Qe)),ci=(Mt&&D?1:0)+(K&&H?1:0),Hi=Ml.length+ci,Ke=Hi*Zl+(Hi-1)*$3+q3*2,xs=Math.max(0,Math.min(on+(_e-Ke)/2,De-Ke)),Zi=T.jsx("foreignObject",{x:xs,y:Yo,width:Ke,height:Qe,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:dr,style:{display:"flex",flexDirection:"column",gap:Hj,width:"100%",padding:q3,boxSizing:"border-box",background:Yj,borderRadius:qj,border:Vj,fontFamily:c,fontSize:$j,position:"relative"},children:[T.jsxs("div",{style:{display:"flex",gap:$3,justifyContent:"center"},children:[Ml.map(Xt=>T.jsx("button",{type:"button",onPointerDown:Ei=>Ei.stopPropagation(),onClick:Ei=>{Ei.stopPropagation(),L(t.id,Xt)},title:Xt,style:{width:Zl,height:Zl,borderRadius:"50%",background:Xt,border:t.color===Xt?Fy:Wj,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},Xt)),Mt&&D&&T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),D(t.id,P?"solid":"dashed")},onMouseDown:Xt=>Xt.preventDefault(),"aria-label":"Перемикач стилю обводки",title:P?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:Zl,height:Zl,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Y3,border:P?Fy:V3,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("svg",{width:Zl-jm,height:Zl-jm,viewBox:"0 0 16 16","aria-hidden":!0,children:T.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:X3,strokeWidth:W3,strokeDasharray:Xj})})}),K&&H&&T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),H(t.id,Y?"filled":"none")},onMouseDown:Xt=>Xt.preventDefault(),"aria-label":"Перемикач фону фігури",title:Y?"Додати фон фігури":"Прибрати фон фігури",style:{width:Zl,height:Zl,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Y3,border:Y?Fy:V3,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("svg",{width:Zl-jm,height:Zl-jm,viewBox:"0 0 16 16","aria-hidden":!0,children:T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:X3,strokeWidth:W3})})})]}),tt&&V&&T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:By},children:[T.jsx("i",{className:`${Si} bi-border-width`,style:{fontSize:ki,color:Qg,flexShrink:0},"aria-hidden":!0}),T.jsx("input",{type:"range",min:Rc,max:Kf,step:a5,value:f,"aria-label":"Товщина ліній виноски",title:"Товщина контуру, лінії та маркера",onPointerDown:Xt=>Xt.stopPropagation(),onMouseDown:Xt=>Xt.stopPropagation(),onChange:Xt=>V(t.id,Number(Xt.target.value)),className:"tyts-range",style:{flex:1,minWidth:0,"--tyts-range-accent":t.color,"--tyts-range-bg":x0,"--tyts-range-track":`${Kj}px`,"--tyts-range-thumb":`${Gj}px`,"--tyts-range-fill":`${wt}%`}}),T.jsxs("span",{style:{color:Qg,fontSize:Jj,fontVariantNumeric:"tabular-nums",minWidth:Zj,textAlign:"right",flexShrink:0},children:["×",c5(f)]}),yt&&T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onMouseDown:Xt=>Xt.preventDefault(),onClick:Xt=>{Xt.stopPropagation(),V(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:Qj,children:T.jsx("i",{className:`${Si} bi-arrow-counterclockwise`,style:{fontSize:ki},"aria-hidden":!0})})]}),(zt&&!lt||!zt&&lt||zt&&(lt||dt)||lt&&jt&&J&&le||lt&&_t)&&T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:By,flexShrink:0,flexWrap:"wrap",overflowX:"visible",rowGap:By},children:[zt&&!lt&&!dt&&T.jsxs(T.Fragment,{children:[T.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),M(t.id),st(!0)},title:`Додати текст (${hn(oe.calloutAddText,{isMac:rn})})`,style:zm,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:`Прибрати фото (${hn(oe.calloutRemoveImage,{isMac:rn})})`,style:Bm,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(),bt.current?.click()},onMouseDown:Xt=>Xt.preventDefault(),title:`Додати фото (${zd()} або ${hn(oe.calloutAddImage,{isMac:rn})})`,style:zm,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:`Прибрати текст (${hn(oe.calloutRemoveText,{isMac:rn})})`,style:Bm,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(),bt.current?.click()},onMouseDown:Xt=>Xt.preventDefault(),title:`Змінити фото (${zd()} або ${hn(oe.calloutAddImage,{isMac:rn})})`,style:zm,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(),gt(t.id)},onMouseDown:Xt=>Xt.preventDefault(),title:`${t.descPos==="above"?"Текст вниз":"Текст вгору"} (${hn(oe.calloutToggleDescPos,{isMac:rn})})`,style:zm,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:`Прибрати текст (${hn(oe.calloutRemoveText,{isMac:rn})})`,style:Bm,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:`Прибрати фото (${hn(oe.calloutRemoveImage,{isMac:rn})})`,style:Bm,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&&J&&le&&T.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:nz,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:`Жирний текст (${hn(oe.calloutBold,{isMac:rn})})`,style:{...Ed,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:`Курсив (${hn(oe.calloutItalic,{isMac:rn})})`,style:{...Ed,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:`Підкреслення (${hn(oe.calloutUnderline,{isMac:rn})})`,style:{...Ed,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:`Закреслення (${hn(oe.calloutStrike,{isMac:rn})})`,style:{...Ed,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:`Менший шрифт (${hn(oe.calloutFontSizeDown,{isMac:rn})})`,style:Ed,children:"A–"}),T.jsx("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),Ue(2)},onMouseDown:Xt=>Xt.preventDefault(),title:`Більший шрифт (${hn(oe.calloutFontSizeUp,{isMac:rn})})`,style:Ed,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?"Світлий фон, темний текст":"Темний фон, світлий текст"} (${hn(oe.calloutToggleTheme,{isMac:rn})})`,style:{width:SC,height:S0,borderRadius:v0,background:"transparent",border:rz,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:"pointer",padding:0,boxSizing:"border-box"},children:T.jsx("span",{style:{width:K3,height:K3,borderRadius:iz,background:Rt?az:lz,color:Rt?cz:uz,border:sz,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:oz,fontWeight:700,lineHeight:1},children:"Aa"})})]}),kt&&T.jsx("button",{type:"button",onPointerDown:Xt=>{Xt.stopPropagation()},onClick:Xt=>{Xt.stopPropagation(),kt(t.id)},title:"Приховати виноску",style:{...Uy,right:Nn?"auto":-In,left:Nn?-In:"auto"},children:T.jsx("i",{className:`${Si} bi-eye-slash`,style:{fontSize:ki},"aria-hidden":!0})}),xt&&T.jsx("button",{type:"button",onPointerDown:Xt=>{Xt.stopPropagation()},onClick:Xt=>{Xt.stopPropagation(),xt(t.id)},title:"Додати ще одну виноску до цієї фігури",style:{...Uy,right:Nn?"auto":-bn,left:Nn?-bn:"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(),rt(t.id)},title:`Видалити виноску (${hn(oe.calloutDelete,{isMac:rn})})`,style:{...Uy,right:Nn?"auto":-fn,left:Nn?-fn:"auto",border:J3,color:Z2},onMouseEnter:Xt=>{Xt.currentTarget.style.background=gz,Xt.currentTarget.style.border=yz,Xt.currentTarget.style.color=bz},onMouseLeave:Xt=>{Xt.currentTarget.style.background=kC,Xt.currentTarget.style.border=J3,Xt.currentTarget.style.color=Z2},children:T.jsx("i",{className:`${Si} bi-trash`,style:{fontSize:ki},"aria-hidden":!0})})]})})});return d?_4.createPortal(Zi,d):Zi})(),xz.map(Qt=>T.jsxs("g",{children:[T.jsx("circle",{cx:on+Qt.cx*_e,cy:xe+Qt.cy*Te,r:dj,fill:gj,stroke:"none","data-resize-handle-hit":Qt.id,style:{cursor:Qt.cursor},onPointerDown:we=>{we.stopPropagation(),M(t.id),C(t.id,Qt.id,ct(we))},onMouseDown:we=>{we.stopPropagation(),M(t.id),C(t.id,Qt.id,we)}}),T.jsx("circle",{cx:on+Qt.cx*_e,cy:xe+Qt.cy*Te,r:bC,fill:i?t.color:pj,stroke:t.color,strokeWidth:hj,opacity:i?1:mj,pointerEvents:"none"})]},Qt.id))]})},(e,t)=>e.pin===t.pin&&e.position===t.position&&e.active===t.active&&e.isSelected===t.isSelected&&e.imageSize===t.imageSize&&e.justCreated===t.justCreated),wz=U.memo(function({anchor:t,card:n,color:r,widthScale:i=1,points:s}){if(t.type==="standalone")return null;const l=H_(x2(t,n,s));return T.jsx("g",{children:T.jsx("path",{d:l,fill:"none",stroke:r,strokeWidth:u4*i,strokeLinecap:"round",strokeLinejoin:"round"})})});function Sz({isMac:e,backgroundImage:t,pinsLength:n,showExportMenu:r,sourceImageSize:i,imageSize:s,activePin:l,calloutControlPinId:c,undo:f,redo:d,handleExport:p,handleExportPdf:y,stepZoom:b,handleFitToWindow:g,deletePin:C,movePinZ:M,copyPin:L,duplicatePin:D,pastePinFromClipboard:H,setMode:V,setPolygonDraft:W,setPolylineDraft:gt,setShapeDraftType:_t,setPlacementTool:kt,setShowExportMenu:xt,beginCrop:rt,insertCurrentDateTimeText:jt,toggleCompassMenu:J,toggleImageObjectMenu:ct,newBgFileRef:X,replaceBgFileRef:bt,exportMenuOpenedViaHotkeyRef:Lt}){U.useEffect(()=>{const dt=Mt=>Mt?Mt.isContentEditable?!0:["INPUT","TEXTAREA","BUTTON"].includes(Mt.tagName):!1,st=Mt=>Mt.code==="NumpadAdd"||Mt.key==="+"||Mt.key==="="||Mt.code==="Equal"&&Mt.shiftKey,lt=Mt=>Mt.code==="NumpadSubtract"||Mt.code==="Minus"||Mt.key==="-"||Mt.key==="_",zt=Mt=>{const K=Mt.target;if(dt(K))return;const P=e?Mt.metaKey:Mt.ctrlKey;if(r&&!P&&!Mt.altKey&&!Mt.shiftKey){const Y=/^[1-9]$/.test(Mt.key)?Number(Mt.key):null;if(Y!=null){Mt.preventDefault();const tt=[];i&&tt.push(()=>{const{w:wt}=s;if(!wt)return;const At=i.w/wt/2;p("png",At)}),tt.push(()=>p("png",1)),tt.push(()=>p("png",2)),tt.push(()=>p("jpeg",2)),tt.push(()=>y()),tt.push(()=>{t&&window.print()});const yt=tt[Y-1];yt&&(xt(!1),Lt.current=!1,yt());return}}if(P&&Mt.shiftKey&&Mt.code==="KeyV"){Mt.preventDefault(),H();return}if(P&&!Mt.shiftKey&&(Mt.code==="KeyC"||Mt.code==="KeyJ")){const Y=c??l;if(Y){Mt.preventDefault(),Mt.code==="KeyC"?L(Y):D(Y);return}}if(P&&(Mt.code==="BracketRight"||Mt.code==="BracketLeft")){const Y=c??l;if(Y){Mt.preventDefault();const tt=Mt.code==="BracketRight",yt=Mt.shiftKey?tt?"front":"back":tt?"up":"down";M(Y,yt);return}}if(P&&(Mt.code==="KeyZ"||Mt.key.toLowerCase()==="z")){Mt.preventDefault(),Mt.shiftKey?d():f();return}if(!e&&Mt.ctrlKey&&Mt.key.toLowerCase()==="y"){Mt.preventDefault(),d();return}if(P&&!Mt.shiftKey&&(Mt.code==="KeyD"||Mt.key.toLowerCase()==="d")){Mt.preventDefault(),t&&p("jpeg");return}if(P&&Mt.shiftKey&&Mt.code==="KeyD"){if(Mt.preventDefault(),!t)return;Lt.current=!0,xt(!0);return}if((Mt.key==="Delete"||Mt.key==="Backspace")&&(c||l)){Mt.preventDefault(),C(c??l);return}if(P&&!Mt.altKey&&!Mt.shiftKey){if(Mt.code==="KeyN"){Mt.preventDefault(),X.current?.click();return}if(Mt.code==="KeyB"){Mt.preventDefault(),(bt.current??X.current)?.click();return}if(Mt.code==="KeyO"){Mt.preventDefault(),t&&g();return}}if(t){if(!P&&!Mt.altKey&&!Mt.shiftKey){if(Mt.code==="Digit1"||Mt.code==="Numpad1"){Mt.preventDefault(),V("place"),W(null),gt(null),_t(null),kt("point");return}if(Mt.code==="Digit0"||Mt.code==="Numpad0"||Mt.key==="0"){Mt.preventDefault(),V("place"),W(null),gt(null),_t(null),kt("numbering");return}if(Mt.code==="Digit2"||Mt.code==="Numpad2"){Mt.preventDefault(),V("place"),W([]),gt(null),_t(null);return}if(Mt.code==="Digit3"||Mt.code==="Numpad3"){Mt.preventDefault(),V("place"),W(null),gt([]),_t(null);return}if(Mt.code==="Digit4"||Mt.code==="Numpad4"){Mt.preventDefault(),V("place"),W(null),gt(null),_t("rectangle");return}if(Mt.code==="Digit5"||Mt.code==="Numpad5"){Mt.preventDefault(),V("place"),W(null),gt(null),_t("ellipse"),kt("point");return}if(Mt.code==="Digit6"||Mt.code==="Numpad6"){Mt.preventDefault(),V("place"),W(null),gt(null),_t(null),kt("text");return}if(Mt.code==="Digit7"||Mt.code==="Numpad7"){Mt.preventDefault(),V("place"),W(null),gt(null),_t(null),kt("arrow");return}if(Mt.code==="Digit8"||Mt.code==="Numpad8"){Mt.preventDefault(),jt();return}if(Mt.code==="Digit9"||Mt.code==="Numpad9"){Mt.preventDefault(),V("place"),W(null),gt(null),_t(null),kt("standalone");return}if(Mt.code==="KeyK"){Mt.preventDefault(),J();return}if(Mt.code==="KeyP"){Mt.preventDefault(),V("place"),W(null),gt(null),_t(null),kt("pointText");return}if(Mt.code==="KeyR"){Mt.preventDefault(),V("place"),W(null),gt(null),_t("redact");return}if(Mt.code==="KeyI"){Mt.preventDefault(),ct();return}if(Mt.code==="KeyC"){Mt.preventDefault(),rt();return}}if(!P&&!Mt.altKey){if(st(Mt)){Mt.preventDefault(),b("in");return}if(lt(Mt)){Mt.preventDefault(),b("out");return}}}};return window.addEventListener("keydown",zt,!0),()=>window.removeEventListener("keydown",zt,!0)},[t,n,f,d,l,c,r,i,s,p,y,b,g,e,C,M,L,D,H,V,W,gt,_t,kt,xt,rt,jt,J,ct,X,bt,Lt])}function kz(){return{past:[],future:[]}}function tb(e){return e.map(t=>({x:t.x,y:t.y}))}function Az(e){e.past=[],e.future=[]}function Mz(e,t,n=100){e.past.push(tb(t)),e.past.length>n&&e.past.shift(),e.future=[]}function Cz(e,t){if(e.past.length===0)return null;const n=e.past.pop();return e.future.push(tb(t)),n}function Ez(e,t){if(e.future.length===0)return null;const n=e.future.pop();return e.past.push(tb(t)),n}const Tz=100;function Nz(){const e=U.useRef(kz()),[t,n]=U.useState(!1),[r,i]=U.useState(!1),s=U.useCallback(()=>{n(e.current.past.length>0),i(e.current.future.length>0)},[]),l=U.useCallback(()=>{Az(e.current),n(!1),i(!1)},[]),c=U.useCallback(p=>{Mz(e.current,p,Tz),s()},[s]),f=U.useCallback(p=>{const y=Cz(e.current,p);return s(),y},[s]),d=U.useCallback(p=>{const y=Ez(e.current,p);return s(),y},[s]);return{canUndo:t,canRedo:r,reset:l,record:c,undo:f,redo:d}}const eb="tyts-collage-autosave",_z=2e3,Lz=.82;function fr(e){return typeof e=="number"&&Number.isFinite(e)}function AC(e){if(!e||typeof e!="object")return!1;const t=e;return fr(t.w)&&fr(t.h)&&t.w>0&&t.h>0}function Dz(e){return e===null?!0:AC(e)}function Rz(e){if(!e||typeof e!="object")return!1;const t=e;return fr(t.x)&&fr(t.y)&&fr(t.width)&&fr(t.height)&&t.width>0&&t.height>0}function Gu(e){if(!e||typeof e!="object")return!1;const t=e;return fr(t.x)&&fr(t.y)}function Oz(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.type!="string")return!1;switch(t.type){case"point":case"standalone":return Gu(t);case"linked":{const n=t.pinId;return typeof n=="string"&&n.length>0}case"numbering":return Gu(t.start)&&Gu(t.end);case"polygon":case"polyline":{const n=t.points;return Array.isArray(n)&&n.every(Gu)}case"arrow":{const n=t;return Gu(n.start)&&Gu(n.end)&&Gu(n.control)}case"rectangle":{const n=t;return fr(n.x)&&fr(n.y)&&fr(n.width)&&fr(n.height)}case"ellipse":{const n=t;return fr(n.cx)&&fr(n.cy)&&fr(n.rx)&&fr(n.ry)}case"compass":{const n=t;return fr(n.cx)&&fr(n.cy)&&fr(n.radius)&&n.radius>0}case"redact":{const n=t;return fr(n.x)&&fr(n.y)&&fr(n.width)&&fr(n.height)&&fr(n.strength)&&(n.mode==="blur"||n.mode==="pixelate"||n.mode==="fill")}case"image":{const n=t;return fr(n.x)&&fr(n.y)&&fr(n.width)&&fr(n.height)&&fr(n.aspect)&&typeof n.src=="string"&&n.src.length>0}case"text":{const n=t;return n.point!==void 0&&!Gu(n.point)?!1:fr(n.x)&&fr(n.y)&&fr(n.width)&&fr(n.height)}default:return!1}}function Pz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id!="string"||!t.id||typeof t.color!="string"||!t.color||!fr(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&&!fr(t.imageAspect)?!1:Oz(t.anchor)}function MC(e){return CC(e)?e:null}function CC(e){if(!e||typeof e!="object")return!1;const t=e;return t.version!==1&&t.version!==2||!fr(t.savedAt)||t.sourceUrl!==void 0&&typeof t.sourceUrl!="string"||t.sourceTitle!==void 0&&typeof t.sourceTitle!="string"||t.capturedAt!==void 0&&!fr(t.capturedAt)||typeof t.backgroundImage!="string"||!t.backgroundImage.startsWith("data:")||!AC(t.imageSize)||!Dz(t.sourceImageSize??null)||!Array.isArray(t.pins)||!t.pins.every(Pz)||!t.cardPositions||typeof t.cardPositions!="object"?!1:Object.values(t.cardPositions).every(Rz)}function Iz(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>n(new Error("Image load failed")),r.src=e})}function jz(e){return new Promise(t=>{const n=new FileReader;n.onload=()=>{const r=n.result;t(typeof r=="string"?r:null)},n.onerror=()=>t(null),n.readAsDataURL(e)})}async function zz(e){if(e.startsWith("data:"))return e;if(e.startsWith("blob:"))try{const n=await(await fetch(e)).blob();return jz(n)}catch{return null}return e}async function Bz(e,t=_z,n=Lz){try{const r=await Iz(e),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",n)):null}catch{return null}}function Z3(e){try{return localStorage.setItem(eb,JSON.stringify(e)),!0}catch(t){if(t instanceof DOMException&&t.name==="QuotaExceededError")return!1;throw t}}function qy(){try{const e=localStorage.getItem(eb);if(!e)return null;const t=JSON.parse(e);return CC(t)?t:null}catch{return null}}function Fz(){localStorage.removeItem(eb)}async function Uz(e){const t=await zz(e.backgroundImage);if(!t||!t.startsWith("data:"))return{ok:!1,error:"invalid_background"};const n={version:2,savedAt:Date.now(),backgroundImage:t,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,sourceUrl:e.sourceUrl,sourceTitle:e.sourceTitle,capturedAt:e.capturedAt};if(Z3(n))return{ok:!0,compressed:!1};const r=await Bz(t);if(!r)return{ok:!1,error:"quota"};const i={...n,backgroundImage:r};return Z3(i)?{ok:!0,compressed:!0}:{ok:!1,error:"quota"}}const Hz=800,qz=2e3;function Q3(e){return e.backgroundImage?JSON.stringify({backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,sourceUrl:e.sourceUrl??null,sourceTitle:e.sourceTitle??null,capturedAt:e.capturedAt??null}):null}function $z({state:e,onRestore:t,enabled:n=!0}){const[r,i]=U.useState("idle"),[s,l]=U.useState(null),[c,f]=U.useState(null),[d,p]=U.useState(()=>qy()),[y,b]=U.useState(!1),[g,C]=U.useState(!1),M=U.useRef(t),L=U.useRef(e),D=U.useRef(null),H=U.useRef(!1),V=U.useRef(!1),W=U.useRef(null),gt=U.useRef(null),_t=U.useRef(async()=>!1);U.useEffect(()=>{M.current=t,L.current=e});const kt=U.useCallback(async(bt=!1)=>{if(!n)return!1;const Lt=L.current;if(!Lt.backgroundImage)return!1;const dt=Q3(Lt);if(!dt)return!1;if(!bt&&dt===D.current)return!0;if(H.current)return V.current=!0,!1;H.current=!0,i("saving"),f(null);const st=await Uz({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}D.current=dt;const lt=Date.now();return l(lt),i("saved"),p(qy()),C(!0),gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>C(!1),qz),V.current&&(V.current=!1,queueMicrotask(()=>{_t.current()})),!0},[n]);U.useEffect(()=>{_t.current=kt},[kt]);const xt=U.useCallback(()=>{n&&L.current.backgroundImage&&(W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=null,_t.current()},Hz))},[n]),rt=U.useCallback(()=>{n&&(Fz(),p(null),b(!0),D.current=null,i("idle"),l(null),f(null),C(!1))},[n]),jt=U.useCallback(()=>{const bt=qy();return bt?(M.current(bt),D.current=Q3({backgroundImage:bt.backgroundImage,imageSize:bt.imageSize,sourceImageSize:bt.sourceImageSize,pins:bt.pins,cardPositions:bt.cardPositions,sourceUrl:bt.sourceUrl,sourceTitle:bt.sourceTitle,capturedAt:bt.capturedAt}),p(bt),l(bt.savedAt),i("saved"),f(null),b(!0),!0):(p(null),!1)},[]),J=U.useCallback(()=>{b(!0)},[]);U.useEffect(()=>{n&&e.backgroundImage&&xt()},[n,e.backgroundImage,e.imageSize,e.sourceImageSize,e.pins,e.cardPositions,e.sourceUrl,e.sourceTitle,e.capturedAt,xt]),U.useEffect(()=>{if(!n)return;const bt=()=>{W.current&&(clearTimeout(W.current),W.current=null),_t.current()},Lt=()=>bt(),dt=()=>{document.visibilityState==="hidden"&&bt()};return window.addEventListener("beforeunload",Lt),document.addEventListener("visibilitychange",dt),()=>{window.removeEventListener("beforeunload",Lt),document.removeEventListener("visibilitychange",dt),W.current&&clearTimeout(W.current),gt.current&&clearTimeout(gt.current)}},[n]);const ct=n&&d!==null,X=n&&ct&&!e.backgroundImage;return{status:r,lastSavedAt:s,errorMessage:c,hasStoredDraft:ct,canRestore:X,showRestorePrompt:X&&!y,storedDraftSavedAt:d?.savedAt??null,saveFlash:g,saveNow:kt,restoreDraft:jt,clearDraft:rt,dismissRestorePrompt:J}}const nb=1;function Yz(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==nb)return!1;const n={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 MC(n)!==null}function tk(e){if(Yz(e))return e;const t=MC(e);return t?Vz(t):null}function Vz(e){return{version:nb,backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,meta:e.sourceUrl!==void 0||e.sourceTitle!==void 0||e.capturedAt!==void 0?{sourceUrl:e.sourceUrl,sourceTitle:e.sourceTitle,capturedAt:e.capturedAt}:void 0}}function Wz(e){return{version:2,savedAt:Date.now(),backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,sourceUrl:e.meta?.sourceUrl,sourceTitle:e.meta?.sourceTitle,capturedAt:e.meta?.capturedAt}}function Xz(e){return!e.backgroundImage||!e.imageSize.w?null:{version:nb,backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,settings:e.settings,meta:e.meta??void 0}}function Gz(e){return`${e.length}:${e.slice(0,64)}:${e.slice(-64)}`}function Kz(e){return JSON.stringify({...e,backgroundImage:Gz(e.backgroundImage)})}async function Jz(e){if(typeof e=="string")return e;const t=await Zz(e);if(!t)throw new Error("Failed to read image");return t}async function Zz(e){return new Promise(t=>{const n=new FileReader;n.onload=()=>{const r=n.result;t(typeof r=="string"?r:null)},n.onerror=()=>t(null),n.readAsDataURL(e)})}const $y=1;function Qz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.type=="string"&&t.type.startsWith("tyts:")}const tB=250;function eB(){if(typeof window>"u")return null;try{if(window.parent===window)return null}catch{return null}return{parentWindow:window.parent,post:(e,t)=>window.parent.postMessage(e,t)}}function nB(e){return(e??[]).map(t=>t.trim()).filter(Boolean)}function Sl(e,t){return{code:e,message:t}}function ek(e,t){return e instanceof Error?e.message:t}function rB(e){const t=e.transport===void 0?eB():e.transport,n=nB(e.config?.allowedOrigins),r=n.length===0||n.includes("*"),i=e.config?.token||void 0,s=e.changeDebounceMs??tB;let l=null,c=!1,f=null,d=null;const p=(H,V)=>{c||t?.post(H,V)},y=(H,V,W)=>{e.onError?.(V),p({type:"tyts:error",requestId:H,error:V},W)},b=H=>r||n.includes(H),g=()=>{if(f=null,!d||l===null)return;const H=d;d=null,p({type:"tyts:change",document:H.document,dirty:H.dirty},l)},C=()=>{l===null||c||(f&&clearTimeout(f),f=setTimeout(g,s))},M=(H,V)=>{if(!b(V)){y(H.requestId,Sl("origin_denied",`Origin not allowed: ${V}`),V);return}if(H.protocol!==$y){y(H.requestId,Sl("protocol_mismatch","Unsupported embed protocol version"),V);return}if(i&&H.token!==i){y(H.requestId,Sl("invalid_token","Invalid embed token"),V);return}l=V,(async()=>{try{if(H.document){const W=tk(H.document);if(!W){y(H.requestId,Sl("invalid_document","Invalid initial document"),V);return}await e.editor.loadDocument(W)}p({type:"tyts:initialized",requestId:H.requestId,protocol:$y},V),e.onReady?.(),d&&C()}catch(W){y(H.requestId,Sl("init_failed",ek(W,"Init failed")),V)}})()},L=async(H,V)=>{switch(H.type){case"tyts:loadDocument":{const W=tk(H.document);if(!W){y(H.requestId,Sl("invalid_document","Invalid document"),V);return}await e.editor.loadDocument(W),H.requestId&&p({type:"tyts:done",requestId:H.requestId},V);return}case"tyts:loadImage":await e.editor.loadImage(H.dataUrl),H.requestId&&p({type:"tyts:done",requestId:H.requestId},V);return;case"tyts:getDocument":p({type:"tyts:document",requestId:H.requestId,document:e.editor.getDocument()},V);return;case"tyts:export":{if(H.format==="pdf"){const gt=await e.editor.exportPdf();if(!gt){y(H.requestId,Sl("export_failed","PDF export failed"),V);return}const _t=await oB(gt);p({type:"tyts:exportResult",requestId:H.requestId,format:"pdf",mime:"application/pdf",dataUrl:_t},V);return}const W=await e.editor.exportImage(H.format,H.scale??1);if(!W){y(H.requestId,Sl("export_failed","Image export failed"),V);return}p({type:"tyts:exportResult",requestId:H.requestId,format:H.format,mime:W.mime,dataUrl:W.dataUrl},V);return}case"tyts:markSaved":e.editor.markSaved(),H.requestId&&p({type:"tyts:done",requestId:H.requestId},V);return;case"tyts:reset":e.editor.reset(),H.requestId&&p({type:"tyts:done",requestId:H.requestId},V);return;case"tyts:init":return;default:{const W=H;y(W.requestId,Sl("unknown_message",`Unknown message: ${W.type}`),V)}}};return{handleMessage:H=>{if(c||!t||H.source!==t.parentWindow||!Qz(H.data))return;const V=H.data,W="requestId"in V?V.requestId:void 0;if(V.type==="tyts:init"){M(V,H.origin);return}if(l===null){y(W,Sl("not_initialized","Editor is not initialized"),H.origin);return}if(H.origin!==l){y(W,Sl("origin_denied",`Origin not allowed: ${H.origin}`),H.origin);return}L(V,l).catch(gt=>{y(W,Sl("handler_error",ek(gt,"Handler error")),H.origin)})},notifyChange(H,V){d={document:H,dirty:V},C()},announceReady(){const H={type:"tyts:ready",protocol:$y};if(r){p(H,"*");return}for(const V of n)p(H,V)},stop(){c=!0,f&&clearTimeout(f),f=null,d=null}}}function iB(e){const t=rB(e),n=r=>{t.handleMessage({data:r.data,origin:r.origin,source:r.source})};return window.addEventListener("message",n),t.announceReady(),{...t,stop(){window.removeEventListener("message",n),t.stop()}}}async function oB(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const i=r.result;typeof i=="string"?t(i):n(new Error("Failed to encode blob"))},r.onerror=()=>n(new Error("Failed to encode blob")),r.readAsDataURL(e)})}const sB={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_TYTS_EMBED:"1",VITE_UAF_SANS:"0"};function aB(){return!0}function lB(e=sB){const t=e.VITE_TYTS_EMBED_ALLOWED_ORIGINS,n=typeof t=="string"?t.split(",").map(s=>s.trim()).filter(Boolean):[],r=e.VITE_TYTS_EMBED_TOKEN,i=typeof r=="string"&&r.trim()?r.trim():void 0;return{allowedOrigins:n.length>0?n:void 0,token:i}}function Vf(){return typeof window>"u"||window.location.protocol!=="chrome-extension:"?!1:!!globalThis.chrome?.runtime?.id}function cB(e){if(typeof e!="object"||e===null)return!1;const t=e;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 EC(e){const t=new URL(window.location.href);t.searchParams.delete(e),window.history.replaceState(null,"",t.toString())}function uB(){return Vf()?new URLSearchParams(window.location.search).has("capture"):!1}function fB(){if(!Vf())return!1;const e=new URLSearchParams(window.location.search).get("restore")==="1";return e&&EC("restore"),e}async function dB(){if(!Vf())return null;const e=new URLSearchParams(window.location.search).get("capture");if(!e)return null;EC("capture");const t=`capture:${e}`,n=[chrome.storage.session,chrome.storage.local].filter(Boolean);for(const r of n)try{const i=(await r.get(t))[t];if(i===void 0)continue;return r.remove(t),cB(i)?i:null}catch{}return null}const nk="tyts-ext-settings",Bh={downloadSubfolder:"Tyts",saveAs:!1};function hB(e){return e.trim().replace(/[/\\]/g,"").replace(/\.\./g,"").replace(/[<>:"|?*]/g,"").slice(0,60)}async function pB(){if(!Vf())return{...Bh};try{const e=(await chrome.storage.sync.get(nk))[nk];if(!e||typeof e!="object")return{...Bh};const t=e;return{downloadSubfolder:typeof t.downloadSubfolder=="string"?hB(t.downloadSubfolder):Bh.downloadSubfolder,saveAs:typeof t.saveAs=="boolean"?t.saveAs:Bh.saveAs}}catch{return{...Bh}}}const $n="bi",ir=14,mB=2800,gB=.5,yB=250,bB=16*Jr,xB={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},vB=1500,wB=150,SB=/\.(png|jpe?g|svg|webp|gif|avif|bmp)$/i;function Yy(e){if(!e)return null;const t=Array.from(e.files??[]),n=Array.from(e.items??[]).filter(i=>i.kind==="file").map(i=>i.getAsFile()).filter(i=>!!i);return[...t,...n].find(i=>i.type.startsWith("image/")||SB.test(i.name))??null}const rk=96,ik=44,de=Jr,cn=Jr*s5,Fm=e=>`${jd[0]*e} ${jd[1]*e}`;async function ok(e,t){try{const n=await pB(),r=n.downloadSubfolder?`${n.downloadSubfolder}/${t}`:t;return await chrome.downloads.download({url:e,filename:r,saveAs:n.saveAs}),!0}catch{return!1}}function sk(e,t){const n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>=Math.abs(r)?{x:t.x,y:e.y}:{x:e.x,y:t.y}}const mu=Ml[0];function kB(e){return e.filter(t=>t.anchor.type==="numbering").length+1}function Ku(e){return e.filter(t=>t.anchor.type!=="numbering"&&t.anchor.type!=="linked").length+1}function ak(e){let t=0,n=0;const r=new Map;return e.map(s=>s.anchor.type==="linked"?s:s.anchor.type==="numbering"?(t+=1,r.set(s.id,t),{...s,label:t}):(n+=1,r.set(s.id,n),{...s,label:n})).map(s=>s.anchor.type==="linked"?{...s,label:r.get(s.anchor.pinId)??s.label}:s)}function AB(e,t){const n=t.x-e.x,r=t.y-e.y;if(n===0&&r===0)return t;const i=Math.max(Math.abs(n),Math.abs(r)),s=n===0?r>=0?1:-1:Math.sign(n),l=r===0?n>=0?1:-1:Math.sign(r);return{x:e.x+s*i,y:e.y+l*i}}function lk(e,t){return{x:t.x-e.x,y:t.y-e.y}}const TC=5.25*de,Um=18*cn,Vy=6*cn,ck={fontSize:12*cn,color:"#aaa",flexShrink:0},Lf={minWidth:28*cn,height:28*cn,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.18)",color:"#ccc",cursor:"pointer",borderRadius:4*cn,fontSize:16*cn,padding:`${3*cn}px ${8*cn}px`,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},kl=4*de,MB=22*de,CB=18*de,EB=12*de,Wy=5*de;function Td(e,t,n,r=1,i=[]){const s=MB*r,l=TC*1.6*r,c=(e.minX+e.maxX)/2,f=(e.minY+e.maxY)/2,d=[{cx:c,cy:e.minY-s},{cx:c,cy:e.maxY+s},{cx:e.maxX+s,cy:f},{cx:e.minX-s,cy:f}],p=y=>{if(y.cx<l||y.cx>t-l||y.cy<l||y.cy>n-l)return!1;for(const b of i)if(y.cx>=b.x-l&&y.cx<=b.x+b.w+l&&y.cy>=b.y-l&&y.cy<=b.y+b.h+l)return!1;return!0};for(const y of d)if(p(y))return y;return{cx:Math.max(l,Math.min(c,t-l)),cy:Math.max(l,Math.min(e.minY+s,n-l))}}function Xy(e,t,n=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 e.map(l=>{let c=1/0;for(const y of t){const b=Math.hypot(l.cx-y.x,l.cy-y.y);b<c&&(c=b)}if(c>=CB*n)return l;const[f,d]=r[l.handle],p=EB*n*s(l.handle);return{...l,cx:l.cx+f*p,cy:l.cy+d*p}})}function Nd({color:e,scale:t=1}){const n=TC*t,r=`M 0 ${-n} L ${n} 0 L 0 ${n} L ${-n} 0 Z`;return T.jsx("path",{d:r,fill:e,stroke:"#fff",strokeWidth:1.5*de*t})}function uk(e){const t=e.indexOf(",");if(t<0)return null;const n=e.slice(0,t),r=e.slice(t+1),s=n.match(/data:([^;]+)(;base64)?/)?.[1]??"image/png",l=/;base64/i.test(n);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 TB=new Set(["jpg","jpeg","png","webp","gif","bmp","svg","avif","heic","heif"]),NB=15e3;function Q2(e){if(!e)return!1;if(e.type.startsWith("image/"))return!0;if(e.type)return!1;const t=e.name.lastIndexOf(".");if(t<0||t===e.name.length-1)return!1;const n=e.name.slice(t+1).toLowerCase();return TB.has(n)}function _B(e,t,n=NB){const r=Math.max(e,t);return r<=n?null:`Зображення завелике (${r} px по довгій стороні). Зменште до ${n} px або менше.`}async function LB(e){const t=URL.createObjectURL(e),n=new Image;try{return await new Promise((r,i)=>{n.onload=()=>r(),n.onerror=()=>i(new Error("Image decode failed")),n.src=t}),{width:n.naturalWidth,height:n.naturalHeight}}catch{return null}finally{URL.revokeObjectURL(t)}}const Ta=24,fk=[{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 Gy(e){switch(e){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 dk(e,t,n){if(!n)return{x:0,y:0,width:e,height:t};let r=e,i=r/n;return i>t&&(i=t,r=i*n),{x:(e-r)/2,y:(t-i)/2,width:r,height:i}}const DB=U.forwardRef(function(t,n){const{mode:r="standalone",initialDocument:i,embedConfig:s,features:l,onReady:c,onChange:f,onError:d}=t,p=r==="embed"||aB(),y=U.useMemo(()=>({autosave:l?.autosave??!p}),[p,l]),b=Qd(),g=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),C=typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent),[M,L]=U.useState(null),[D,H]=U.useState(null),[V,W]=U.useState(!1),[gt,_t]=U.useState("free"),[kt,xt]=U.useState(!1),[rt,jt]=U.useState(null),[J,ct]=U.useState(!1),[X,bt]=U.useState({w:0,h:0}),[Lt,dt]=U.useState(null),[st,lt]=U.useState([]),[zt,Mt]=U.useState({}),[K,P]=U.useState("select"),[Y,tt]=U.useState(null),[yt,wt]=U.useState(null),[At,qt]=U.useState(null),[Rt,Zt]=U.useState(null),{canUndo:Me,canRedo:le,reset:Ie,record:Ue,undo:ft,redo:Re}=Nz(),rn=U.useRef(Ue);rn.current=Ue;const on=At!==null?"polygon":Rt!==null?"polyline":"none",xe=U.useRef(on);U.useEffect(()=>{xe.current!==on&&(Ie(),xe.current=on)},[on,Ie]);const[_e,Te]=U.useState(null),[De,$e]=U.useState("point"),[fn,In]=U.useState(null),[bn,Nn]=U.useState(null),xn=U.useRef(null),[ze,Qe]=U.useState(null),[je,dr]=U.useState(null),mn=U.useRef(null),an=U.useRef(null);U.useEffect(()=>{an.current=rt},[rt]);const dn=U.useRef(null),[Vn,tn]=U.useState(!1),Qt=U.useRef(!1),[we,ge]=U.useState(!1),[We,He]=U.useState(!1),[Pe,Wn]=U.useState(()=>new Date),[Yo,ci]=U.useState(()=>Of(new Date)),[Hi,Vo]=U.useState(f2),[Ke,xs]=U.useState(!1),[Zi,Xt]=U.useState(null);U.useEffect(()=>{(De!=="numbering"||K!=="place")&&fn&&(In(null),Nn(null),xn.current=null)},[De,K,fn]);const{settings:Ei,fontFamily:Gn,setFontId:ui,setStrokeWidthScale:Ti}=h_(),Wo=U.useRef(Gn);Wo.current=Gn;const pi=Ei.strokeWidthScale,Ar=U.useRef(pi);Ar.current=pi;const or=U.useCallback(w=>Uw(w,pi),[pi]),[Kn,Xo]=U.useState(!1),[vs,Da]=U.useState(!1),[Go,Ao]=U.useState(!1);U.useEffect(()=>{if(!Go)return;const w=k=>{k.key==="Escape"&&Ao(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Go]);const[Ll,aa]=U.useState(!1),[ws,nl]=U.useState(!1),[Ko,fi]=U.useState(!1),rl=typeof window<"u"&&!!navigator.clipboard&&"ClipboardItem"in window,[Pi,Yr]=U.useState(null),[Ss,Dl]=U.useState(null),[oc,jc]=U.useState({w:420*cn,h:96*cn}),zc=U.useRef(null),Qi=U.useRef(null),mi=U.useRef(null),Ni=U.useRef(!1),Fn=U.useRef([]),Oo=U.useRef([]),hr=U.useRef(st),uo=U.useRef(zt),to=U.useRef(M),Ir=U.useRef(null),Pn=U.useRef(X),jr=U.useRef(Lt);U.useEffect(()=>{hr.current=st,uo.current=zt},[st,zt]),U.useEffect(()=>{to.current=M},[M]),U.useEffect(()=>{Pn.current=X},[X]),U.useEffect(()=>{jr.current=Lt},[Lt]);const Ra=20;function la(w){const k=c4,_=c2,{w:N,h:j}=Pn.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(ot=>ot.x)),nt=Math.max(...ut.map(ot=>ot.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+Ra,Z=nt+Ra;return z=Math.max(0,Math.min(z,Math.max(0,N-k))),Z=Math.max(0,Math.min(Z,Math.max(0,j-_))),{x:z,y:Z,width:k,height:_}}const te=U.useCallback(()=>{const w={pins:structuredClone(hr.current),cardPositions:structuredClone(uo.current),backgroundImage:to.current,imageSize:structuredClone(Pn.current),sourceImageSize:structuredClone(jr.current)};Fn.current=[...Fn.current.slice(-99),w],Oo.current=[],ca(Fn.current.length),fo(0)},[]),[Mo,ca]=U.useState(0),[Bc,fo]=U.useState(0),il=At!==null||Rt!==null,Au=il?Me:Mo>0,Mu=il?le:Bc>0,sc=U.useCallback(()=>{if(Fn.current.length===0)return;Oo.current=[{pins:structuredClone(hr.current),cardPositions:structuredClone(uo.current),backgroundImage:to.current,imageSize:structuredClone(Pn.current),sourceImageSize:structuredClone(jr.current)},...Oo.current];const w=Fn.current.pop();lt(w.pins),Mt(w.cardPositions),L(w.backgroundImage),bt(w.imageSize),dt(w.sourceImageSize),ca(Fn.current.length),fo(Oo.current.length)},[]),ac=U.useCallback(()=>{if(Oo.current.length===0)return;Fn.current=[...Fn.current,{pins:structuredClone(hr.current),cardPositions:structuredClone(uo.current),backgroundImage:to.current,imageSize:structuredClone(Pn.current),sourceImageSize:structuredClone(jr.current)}];const w=Oo.current.shift();lt(w.pins),Mt(w.cardPositions),L(w.backgroundImage),bt(w.imageSize),dt(w.sourceImageSize),ca(Fn.current.length),fo(Oo.current.length)},[]),Rl=U.useCallback(()=>{if(At!==null){const w=ft(At);w!==null&&qt(w);return}if(Rt!==null){const w=ft(Rt);w!==null&&Zt(w);return}sc()},[At,Rt,sc,ft]),eo=U.useCallback(()=>{if(At!==null){const w=Re(At);w!==null&&qt(w);return}if(Rt!==null){const w=Re(Rt);w!==null&&Zt(w);return}ac()},[At,Rt,ac,Re]),Jo=U.useRef(null),ks=U.useRef(null),ol=U.useRef(null),Oa=U.useRef(()=>{}),Sn=U.useRef(null),lc=U.useRef(null),vr=U.useRef(null),cc=U.useRef(null),ho=U.useRef(!1),_i=U.useRef(null),sl=U.useRef(null),As=U.useRef(null),qi=U.useRef(null),ua=U.useRef(null),Zo=U.useRef(null),Ol=U.useRef(null),po=U.useRef(null),Pa=U.useRef(null),Ia=U.useRef(null),gi=U.useRef(null),Po=U.useRef(null),Co=U.useRef(null),Ms=U.useRef(null),ja=U.useRef(null),fa=U.useRef(null),Cs=U.useRef(null),Es=U.useRef(null),da=U.useRef(null),al=U.useRef(null),Qo=U.useRef(null),Ts=U.useRef(null),Pl=U.useRef(null),Ns=U.useRef(null),Il=U.useRef(null),A=U.useRef(null),B=U.useRef(null),mt=U.useRef(null),Nt=U.useRef(null),Ft=U.useRef(null);U.useEffect(()=>{Ft.current=At},[At]);const ie=U.useRef(null),ve=U.useRef(null),nn=U.useRef(null),ln=U.useRef(null),Rn=U.useRef(null),zn=U.useRef(null),sr=U.useRef(null),Li=U.useRef(null),Zr=U.useRef(null),Tr=U.useRef(null);U.useEffect(()=>{Tr.current=Rt},[Rt]),U.useEffect(()=>{dn.current=ze},[ze]),U.useEffect(()=>{xn.current=fn&&bn?{start:fn,end:bn}:null},[fn,bn]);const ue=U.useRef(!1),Qr=20,di=10,An=20,[vn,za]=U.useState(!1),[jl,uc]=U.useState(!1),[pr,mo]=U.useState(1),[zl,_s]=U.useState(!1),[$i,ha]=U.useState(null);U.useEffect(()=>{if(!M){ha(null);return}let w=!1;const k=new Image;return k.onload=()=>{w||ha(k)},k.onerror=()=>{w||ha(null)},k.src=M,()=>{w=!0}},[M]),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));jc(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()}},[Y,yt,Ss]);const Ba=U.useRef(null),Fa=U.useRef(null),Ys=U.useRef(null),go=U.useRef(null),pa=U.useRef(null),Bl=U.useRef(null),fc=U.useRef(null),Io=U.useRef(null),[jo,Eo]=U.useState(!1),[dc,ts]=U.useState(!1),Ua=U.useRef(null),hi=U.useRef({isPanning:!1,startX:0,startY:0,startScrollLeft:0,startScrollTop:0}),Nr=U.useRef(new Map),es=U.useRef(null),Yi=U.useRef(!0),Vs=U.useRef(null),Fl=U.useRef(1),ll=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];Vs.current="viewport-center",mo(_=>{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 Yi.current=!1,nt})},[]),pe=U.useCallback((w,k)=>{if(!cc.current)return{x:0,y:0};const _=w,N=k,j=cc.current.getBoundingClientRect(),G=pr||1,nt=(_-j.left)/G,z=(N-j.top)/G;return{x:nt,y:z}},[pr]),To=U.useCallback((w,k,_)=>{const N=new Image;N.onload=()=>{const j=l2,G=Math.min(j/N.naturalWidth,j/N.naturalHeight,Number.POSITIVE_INFINITY),nt=Math.round(N.naturalWidth*G),z=Math.round(N.naturalHeight*G);bt({w:nt,h:z}),dt({w:N.naturalWidth,h:N.naturalHeight}),L(w),tt(null),wt(null),qt(null),Zt(null),Te(null),dr(null),W(!1),jt(null),k&&(lt([]),Mt({})),ho.current=!0,Yi.current=!0,_?.(!0)},N.onerror=()=>{_?.(!1)},N.src=w},[]);U.useEffect(()=>()=>{Ir.current&&(URL.revokeObjectURL(Ir.current),Ir.current=null)},[]),U.useEffect(()=>{if(!M||!vr.current||!X.w||!X.h)return;const w=vr.current,k=X.w*pr,_=X.h*pr,{clientWidth:N,clientHeight:j}=w;if(Vs.current==="viewport-center"){const G=Fl.current,nt=w.scrollLeft+N/2,z=w.scrollTop+j/2,Z=nt/G,ut=z/G;w.scrollLeft=Math.max(0,Math.min(k-N,Z*pr-N/2)),w.scrollTop=Math.max(0,Math.min(_-j,ut*pr-j/2)),Vs.current=null}else Yi.current&&(w.scrollLeft=Math.max(0,(k-N)/2),w.scrollTop=Math.max(0,(_-j)/2));Fl.current=pr},[M,X.w,X.h,pr]),U.useEffect(()=>{if(!ho.current||!M||!X.w||!X.h)return;const w=vr.current,k=X.w,_=X.h,N=()=>{const nt=vr.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 Z=Math.max(bm,Math.min(xm,+z.toFixed(vm)));return ho.current=!1,mo(Z),!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()}},[M,X.w,X.h]);const Ws=U.useCallback(()=>{if(!M||!vr.current||!X.w||!X.h)return;const w=vr.current,{clientWidth:k,clientHeight:_}=w;if(!k||!_)return;const N=Math.min(k/X.w,_/X.h);if(!N||!Number.isFinite(N))return;const j=Math.max(bm,Math.min(xm,+N.toFixed(vm)));Yi.current=!0,mo(j)},[M,X.w,X.h]);U.useEffect(()=>{const w=vr.current;if(!w)return;const k=_=>{if(!to.current||!(_.ctrlKey||_.metaKey))return;_.preventDefault();const N=w.getBoundingClientRect(),j=_.clientX,G=_.clientY,nt=j-N.left,z=G-N.top,Z=_.deltaY>0?1/Rw:Rw;mo(ut=>{const ot=Math.min(xm,Math.max(bm,+(ut*Z).toFixed(vm))),it=w.scrollLeft+nt,I=w.scrollTop+z,Ct=it/ut,It=I/ut,St=Pn.current.w*ot,Et=Pn.current.h*ot;return w.scrollLeft=Math.max(0,Math.min(St-w.clientWidth,Ct*ot-nt)),w.scrollTop=Math.max(0,Math.min(Et-w.clientHeight,It*ot-z)),Yi.current=!1,ot})};return w.addEventListener("wheel",k,{passive:!1}),()=>w.removeEventListener("wheel",k)},[]);const Ls=U.useCallback(async w=>{if(!Q2(w))return;const k=await LB(w);if(!k){H("Не вдалося відкрити зображення. Спробуйте інший файл.");return}const _=_B(k.width,k.height);if(_){H(_);return}H(null),Xt(null);const N=URL.createObjectURL(w);To(N,!0,j=>{if(!j){H("Не вдалося завантажити зображення. Спробуйте файл меншого розміру."),URL.revokeObjectURL(N);return}Ir.current&&Ir.current!==N&&URL.revokeObjectURL(Ir.current),Ir.current=N})},[To]),no=U.useCallback(w=>{if(!Q2(w)||!to.current)return;te(),Xt(null);const k=URL.createObjectURL(w);To(k,!1,_=>{if(!_){URL.revokeObjectURL(k);return}Ir.current&&Ir.current!==k&&URL.revokeObjectURL(Ir.current),Ir.current=k})},[To,te]),Xs=w=>{const k=w.target.files?.[0];k&&(Ls(k),w.target.value="")},hc=w=>{const k=w.target.files?.[0];k&&(no(k),w.target.value="")},Ul=U.useCallback(()=>{if(!to.current)return;const{w,h:k}=Pn.current;if(!w||!k)return;const _=Gy(gt);jt(dk(w,k,_)),W(!0),xt(!1),P("select")},[gt]),Ha=U.useCallback(()=>{W(!1),xt(!1),jt(null),As.current=null,qi.current=null},[]),qa=U.useCallback(w=>{_t(w);const{w:k,h:_}=Pn.current;!k||!_||jt(dk(k,_,Gy(w)))},[]),Gs=U.useCallback(w=>{if(!an.current)return;w.preventDefault(),w.stopPropagation();const k=pe(w.clientX,w.clientY);As.current={startRect:an.current,startSvgX:k.x,startSvgY:k.y}},[pe]),cl=U.useCallback((w,k)=>{if(!an.current)return;k.preventDefault(),k.stopPropagation();const _=pe(k.clientX,k.clientY);qi.current={corner:w,startRect:an.current,startSvgX:_.x,startSvgY:_.y,aspect:Gy(gt)}},[gt,pe]),ns=U.useCallback(async()=>{if(!an.current||!to.current||!jr.current||!Pn.current.w||!Pn.current.h)return;const w=to.current,k=an.current,_=jr.current,N=Pn.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)),Z=Math.max(1,Math.round(k.width*j)),ut=Math.max(1,Math.round(k.height*G)),ot=new Image;ct(!0);try{await new Promise((vt,Bt)=>{ot.onload=()=>vt(),ot.onerror=()=>Bt(new Error("Crop image load failed")),ot.src=w});const it=document.createElement("canvas");it.width=Z,it.height=ut;const I=it.getContext("2d");if(!I)return;I.drawImage(ot,nt,z,Z,ut,0,0,Z,ut);const Ct=it.toDataURL("image/png"),It=L_(Z,ut),{pins:St,cardPositions:Et}=R_(hr.current,uo.current,k,It);te(),lt(St),Mt(Et),tt(null),wt(null),Yr(null),To(Ct,!1),W(!1),xt(!1),jt(null)}finally{ct(!1),As.current=null,qi.current=null}},[To,te]);U.useEffect(()=>{const w=k=>{if(M)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),To(z,!0))},G.readAsDataURL(j);return}}};return document.addEventListener("paste",w),()=>document.removeEventListener("paste",w)},[M,To]),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(!to.current){Ls(N);return}Oa.current(N)}};return window.addEventListener("dragover",w),window.addEventListener("drop",k),()=>{window.removeEventListener("dragover",w),window.removeEventListener("drop",k)}},[Ls]),U.useEffect(()=>{const w=()=>{if(!Fa.current)return;const N=Fa.current,j=N.scrollWidth>N.clientWidth,G=typeof window<"u"&&window.innerWidth<(g?1280:mB),nt=j||G,z=typeof window<"u"&&window.innerWidth<(g?1040:1320),Z=N.clientWidth<(g?980:1240);za(nt),uc(z||j&&Z)};w(),window.addEventListener("resize",w);const k=Fa.current;let _=null;return k&&typeof ResizeObserver<"u"&&(_=new ResizeObserver(()=>w()),_.observe(k)),()=>{window.removeEventListener("resize",w),_&&_.disconnect()}},[g]),U.useEffect(()=>{X.w&&Mt(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:_:__(N,X.w,X.h)})},[st.length,X]);const ma=U.useCallback(w=>{if(V||K!=="place"||!M)return;const k=w.target;if(k!==Jo.current&&k.getAttribute?.("data-background")!=="true")return;w.preventDefault();const{x:_,y:N}=pe(w.clientX,w.clientY),{w:j,h:G}=Pn.current,nt=Math.max(0,Math.min(_,j)),z=Math.max(0,Math.min(N,G));if(De==="arrow"&&!_e&&At===null&&Rt===null){const Z={start:{x:nt,y:z},end:{x:nt,y:z},control:{x:nt,y:z}};dn.current=Z,Qe(Z);return}if(De==="numbering"&&!_e&&At===null&&Rt===null){const Z={start:{x:nt,y:z},end:{x:nt,y:z}};xn.current=Z,In(Z.start),Nn(Z.end);return}_e&&(mn.current={shape:_e,x1:nt,y1:z,x2:nt,y2:z},dr({x1:nt,y1:z,x2:nt,y2:z}))},[K,_e,M,pe,De,At,Rt,V]),yi=U.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!At||At.length<2)return;const k=vl(),_=mu,N={type:"polygon",points:[...At],rotation:0},j=la(N);te(),lt(G=>[...G,{id:k,anchor:N,color:_,strokeStyle:Xh,fillStyle:sg,label:Ku(G),image:null,imageAspect:null,description:"",descPos:"below"}]),Mt(G=>({...G,[k]:j})),qt(null),tt(k),wt(k),P("select"),mi.current=k,Ni.current=!0},[At,te]),No=U.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!Rt||Rt.length<2)return;const k=vl(),_=mu,N={type:"polyline",points:[...Rt],rotation:0},j=la(N);te(),lt(G=>[...G,{id:k,anchor:N,color:_,strokeStyle:Xh,label:Ku(G),image:null,imageAspect:null,description:"",descPos:"below"}]),Mt(G=>({...G,[k]:j})),Zt(null),tt(k),wt(k),P("select"),mi.current=k,Ni.current=!0},[Rt,te]),br=U.useCallback(w=>{if(V)return;const k=w.target;if(K!=="place"&&(k===Jo.current||k.getAttribute?.("data-background")==="true")){tt(null),wt(null);return}if(K!=="place"||!M)return;if(ue.current){ue.current=!1;return}const{x:_,y:N}=pe(w.clientX,w.clientY),{w:j,h:G}=Pn.current;if(_<0||N<0||_>j||N>G)return;let nt=_,z=N;if(At!==null){if(w.shiftKey&&At.length>0){const vt=sk(At[At.length-1],{x:_,y:N});nt=Math.max(0,Math.min(vt.x,j)),z=Math.max(0,Math.min(vt.y,G))}if(At.length>=2){const vt=At[0];if(Math.hypot(nt-vt.x,z-vt.y)<18*de){w.preventDefault(),w.stopPropagation(),yi(w);return}}Ue(At),qt(vt=>[...vt??[],{x:nt,y:z}]);return}if(Rt!==null){if(w.shiftKey&&Rt.length>0){const vt=sk(Rt[Rt.length-1],{x:_,y:N});nt=Math.max(0,Math.min(vt.x,j)),z=Math.max(0,Math.min(vt.y,G))}Ue(Rt),Zt(vt=>[...vt??[],{x:nt,y:z}]);return}if(De==="arrow"||De==="numbering")return;w.preventDefault(),w.stopPropagation();const Z=vl(),ut=mu,ot=De==="pointText",it=De==="text"||ot,I=De==="standalone",Ct={width:rk,height:ik},It=ot?w4({x:_,y:N},r_,Ct):{x:_,y:N},St=it?{type:"text",x:It.x,y:It.y,...Ct,...ot?{point:{x:_,y:N}}:{}}:I?{type:"standalone",x:_,y:N}:{type:"point",x:_,y:N},Et=it?null:la(St);te(),lt(vt=>[...vt,{id:Z,anchor:St,color:ut,label:Ku(vt),image:null,imageAspect:null,description:it?iy:"",descPos:"below",textColor:ot?i_:void 0,textBackgroundColor:ot?o_:it?null:void 0}]),Et&&Mt(vt=>({...vt,[Z]:Et})),tt(Z),wt(Z),P("select"),mi.current=Z,Ni.current=!0,it&&Yr(Z)},[K,M,pe,At,Rt,te,yi,De,V,Ue]),ar=U.useCallback(w=>{if(!M||(Yt.current=pe(w.clientX,w.clientY),K!=="place"||De!=="numbering"||!fn))return;const{x:k,y:_}=pe(w.clientX,w.clientY),{w:N,h:j}=Pn.current;Nn({x:Math.max(0,Math.min(k,N)),y:Math.max(0,Math.min(_,j))})},[M,K,De,fn,pe]);U.useEffect(()=>{const w=k=>{k.key==="Enter"&&(At&&At.length>=2?yi():Rt&&Rt.length>=2&&No()),k.key==="Escape"&&K==="place"&&(k.preventDefault(),fn&&(In(null),Nn(null),xn.current=null),At&&At.length>0&&qt(null),Rt&&Rt.length>0&&Zt(null),_e&&(Te(null),dr(null),mn.current=null),dn.current&&(Qe(null),dn.current=null),P("select"))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[K,fn,At,Rt,yi,No,_e]);const Dr=U.useCallback((w,k)=>{if(K==="place")return;k.preventDefault();const _=zt[w];if(!_)return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,_i.current={pinId:w,startCardX:_.x,startCardY:_.y,startSvgX:N.x,startSvgY:N.y}},[zt,pe,K,te]),bi=U.useCallback((w,k,_)=>{_.preventDefault();const N=zt[w];if(!N)return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,sl.current={pinId:w,handle:k,startCardX:N.x,startCardY:N.y,startCardW:N.width,startCardH:N.height,startSvgX:j.x,startSvgY:j.y}},[zt,pe,te]);U.useEffect(()=>{const w=N=>pe(N.clientX,N.clientY),k=N=>{const{w:j,h:G}=Pn.current;if(As.current){const{startRect:nt,startSvgX:z,startSvgY:Z}=As.current,ut=w(N),ot=ut.x-z,it=ut.y-Z;jt({x:Math.max(0,Math.min(nt.x+ot,j-nt.width)),y:Math.max(0,Math.min(nt.y+it,G-nt.height)),width:nt.width,height:nt.height});return}if(qi.current){const{corner:nt,startRect:z,startSvgX:Z,startSvgY:ut,aspect:ot}=qi.current,it=w(N),I=it.x-Z,Ct=it.y-ut;let It={...z};if(ot==null)if(nt==="nw"){const St=z.x+z.width,Et=z.y+z.height,vt=Math.max(0,Math.min(z.x+I,St-Ta)),Bt=Math.max(0,Math.min(z.y+Ct,Et-Ta));It={x:vt,y:Bt,width:St-vt,height:Et-Bt}}else if(nt==="ne"){const St=z.y+z.height,Et=Math.max(Ta,Math.min(z.width+I,j-z.x)),vt=Math.max(0,Math.min(z.y+Ct,St-Ta));It={x:z.x,y:vt,width:Et,height:St-vt}}else if(nt==="se"){const St=Math.max(Ta,Math.min(z.width+I,j-z.x)),Et=Math.max(Ta,Math.min(z.height+Ct,G-z.y));It={x:z.x,y:z.y,width:St,height:Et}}else{const St=z.x+z.width,Et=Math.max(0,Math.min(z.x+I,St-Ta)),vt=Math.max(Ta,Math.min(z.height+Ct,G-z.y));It={x:Et,y:z.y,width:St-Et,height:vt}}else{const St=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,St.x-Ta)):Math.max(St.x+Ta,Math.min(z.x+z.width+I,j)),vt=nt==="nw"||nt==="ne"?Math.max(0,Math.min(z.y+Ct,St.y-Ta)):Math.max(St.y+Ta,Math.min(z.y+z.height+Ct,G)),Bt=Math.abs(Et-St.x),Vt=Math.abs(vt-St.y),me=nt==="nw"||nt==="sw"?St.x:j-St.x,se=nt==="nw"||nt==="ne"?St.y:G-St.y;let Ee=Bt,Ze=Vt;Ee/Math.max(1,Ze)>ot?Ze=Ee/ot:Ee=Ze*ot;const En=Math.max(Ta,Math.min(me,se*ot));Ee=Math.max(Ta,Math.min(Ee,En)),Ze=Ee/ot,It={x:nt==="nw"||nt==="sw"?St.x-Ee:St.x,y:nt==="nw"||nt==="ne"?St.y-Ze:St.y,width:Ee,height:Ze}}jt(It);return}if(Nt.current){const{pointIndex:nt,startX:z,startY:Z,startSvgX:ut,startSvgY:ot}=Nt.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0);const It=Math.max(0,Math.min(z+I,j)),St=Math.max(0,Math.min(Z+Ct,G));qt(Et=>{if(!Et||nt<0||nt>=Et.length)return Et;const vt=[...Et];return vt[nt]={x:It,y:St},vt});return}if(Rn.current){const{pointIndex:nt,startX:z,startY:Z,startSvgX:ut,startSvgY:ot}=Rn.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0);const It=Math.max(0,Math.min(z+I,j)),St=Math.max(0,Math.min(Z+Ct,G));Zt(Et=>{if(!Et||nt<0||nt>=Et.length)return Et;const vt=[...Et];return vt[nt]={x:It,y:St},vt});return}if(mn.current){const nt=w(N);let z=Math.max(0,Math.min(nt.x,j)),Z=Math.max(0,Math.min(nt.y,G));if(N.shiftKey){const ut=AB({x:mn.current.x1,y:mn.current.y1},{x:z,y:Z});z=Math.max(0,Math.min(ut.x,j)),Z=Math.max(0,Math.min(ut.y,G))}mn.current.x2=z,mn.current.y2=Z,dr({x1:mn.current.x1,y1:mn.current.y1,x2:z,y2:Z});return}if(dn.current){const nt=w(N),z=Math.max(0,Math.min(nt.x,j)),Z=Math.max(0,Math.min(nt.y,G)),ut=dn.current.start;(Math.abs(z-ut.x)>2||Math.abs(Z-ut.y)>2)&&(ue.current=!0);const ot={start:ut,end:{x:z,y:Z},control:{x:(ut.x+z)/2,y:(ut.y+Z)/2}};dn.current=ot,Qe(ot);return}if(xn.current){const nt=w(N),z=Math.max(0,Math.min(nt.x,j)),Z=Math.max(0,Math.min(nt.y,G)),ut=xn.current.start;(Math.abs(z-ut.x)>2||Math.abs(Z-ut.y)>2)&&(ue.current=!0);const ot={start:ut,end:{x:z,y:Z}};xn.current=ot,In(ut),Nn(ot.end);return}if(gi.current){const{pinId:nt,startCenterX:z,startCenterY:Z,startDist:ut,startFontSize:ot}=gi.current,it=w(N),I=Math.hypot(it.x-z,it.y-Z);Math.abs(I-ut)>1.5&&(ue.current=!0);const Ct=Math.max(.25,I/Math.max(1,ut)),It=Math.max(10,Math.round(ot*Ct));lt(St=>St.map(Et=>{if(Et.id!==nt||Et.anchor.type!=="text")return Et;const vt=xi(Et.description||"",{fontSize:It,bold:Et.textBold??!1,italic:Et.textItalic??!1}),Bt=vt.width,Vt=vt.height,me=Math.max(0,Math.min(z-Bt/2,j-Bt)),se=Math.max(0,Math.min(Z-Vt/2,G-Vt));return{...Et,textFontSize:It,anchor:{...Et.anchor,x:me,y:se,width:Bt,height:Vt}}}));return}if(Ms.current){const{pinId:nt,startX:z,startY:Z,startSvgX:ut,startSvgY:ot}=Ms.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),lt(It=>It.map(St=>St.id!==nt||St.anchor.type!=="redact"?St:{...St,anchor:{...St.anchor,x:Math.max(0,Math.min(z+I,j-St.anchor.width)),y:Math.max(0,Math.min(Z+Ct,G-St.anchor.height))}}));return}if(ja.current){const{pinId:nt,handle:z,startX:Z,startY:ut,startW:ot,startH:it,startSvgX:I,startSvgY:Ct}=ja.current,It=w(N),St=It.x-I,Et=It.y-Ct;(Math.abs(St)>2||Math.abs(Et)>2)&&(ue.current=!0);const vt=Z+ot,Bt=ut+it,Vt=z==="nw"||z==="sw",me=z==="nw"||z==="ne",se=Vt?Math.min(Z+St,vt-Sm):Z,Ee=me?Math.min(ut+Et,Bt-Sm):ut,Ze=Vt?vt-se:Math.max(Sm,ot+St),En=me?Bt-Ee:Math.max(Sm,it+Et);lt(fe=>fe.map(Xe=>Xe.id!==nt||Xe.anchor.type!=="redact"?Xe:{...Xe,anchor:{...Xe.anchor,x:se,y:Ee,width:Ze,height:En}}));return}if(fa.current){const{pinId:nt,startX:z,startY:Z,startSvgX:ut,startSvgY:ot}=fa.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),lt(It=>It.map(St=>St.id!==nt||St.anchor.type!=="image"?St:{...St,anchor:{...St.anchor,x:Math.max(0,Math.min(z+I,j-St.anchor.width)),y:Math.max(0,Math.min(Z+Ct,G-St.anchor.height))}}));return}if(Cs.current){const{pinId:nt,handle:z,startX:Z,startY:ut,startW:ot,startH:it,startSvgX:I,startSvgY:Ct}=Cs.current,It=w(N),St=It.x-I,Et=It.y-Ct;(Math.abs(St)>2||Math.abs(Et)>2)&&(ue.current=!0);const Bt=Math.max(km,ot+(z==="ne"||z==="se"?1:-1)*St);lt(Vt=>Vt.map(me=>{if(me.id!==nt||me.anchor.type!=="image")return me;const se=me.anchor.aspect||1,Ee=Bt,Ze=Math.max(km,Ee/se),En=z==="nw"||z==="sw"?Z+ot-Ee:Z,fe=z==="nw"||z==="ne"?ut+it-Ze:ut;return{...me,anchor:{...me.anchor,x:En,y:fe,width:Ee,height:Ze}}}));return}if(Pa.current){const{pinId:nt,startPoint:z,startBox:Z,startSvgX:ut,startSvgY:ot}=Pa.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0);const It=Math.max(0,Math.min(z.x+I,j)),St=Math.max(0,Math.min(z.y+Ct,G));lt(Et=>Et.map(vt=>vt.id!==nt||vt.anchor.type!=="text"||!vt.anchor.point?vt:{...vt,anchor:{...vt.anchor,point:{x:It,y:St},x:Z.x+(It-z.x),y:Z.y+(St-z.y)}}));return}if(Ia.current){const{pinId:nt,startX:z,startY:Z,startSvgX:ut,startSvgY:ot}=Ia.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),lt(It=>It.map(St=>{if(St.id!==nt||St.anchor.type!=="text")return St;const Et={width:St.anchor.width,height:St.anchor.height};if(St.anchor.point){const Vt={x:z+I+Et.width/2,y:Z+Ct+Et.height/2},me=I_(St.anchor.point,Vt,Et);return{...St,anchor:{...St.anchor,x:me.x,y:me.y}}}const vt=Math.max(0,Math.min(z+I,j-Et.width)),Bt=Math.max(0,Math.min(Z+Ct,G-Et.height));return{...St,anchor:{...St.anchor,x:vt,y:Bt}}}));return}if(ua.current){const{pinId:nt,startPinX:z,startPinY:Z,startSvgX:ut,startSvgY:ot}=ua.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),lt(It=>It.map(St=>St.id!==nt||St.anchor.type!=="point"?St:{...St,anchor:{type:"point",x:Math.max(0,Math.min(z+I,j)),y:Math.max(0,Math.min(Z+Ct,G))}}));return}if(Zo.current){const{pinId:nt,startStart:z,startEnd:Z,startSvgX:ut,startSvgY:ot}=Zo.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),lt(It=>It.map(St=>St.id!==nt||St.anchor.type!=="numbering"?St:{...St,anchor:{type:"numbering",start:{x:Math.max(0,Math.min(z.x+I,j)),y:Math.max(0,Math.min(z.y+Ct,G))},end:{x:Math.max(0,Math.min(Z.x+I,j)),y:Math.max(0,Math.min(Z.y+Ct,G))}}}));return}if(Ol.current){const{pinId:nt,endpoint:z,startStart:Z,startEnd:ut,startSvgX:ot,startSvgY:it}=Ol.current,I=w(N),Ct=I.x-ot,It=I.y-it;(Math.abs(Ct)>2||Math.abs(It)>2)&&(ue.current=!0);const St=z==="start"?{x:Math.max(0,Math.min(Z.x+Ct,j)),y:Math.max(0,Math.min(Z.y+It,G))}:Z,Et=z==="end"?{x:Math.max(0,Math.min(ut.x+Ct,j)),y:Math.max(0,Math.min(ut.y+It,G))}:ut;lt(vt=>vt.map(Bt=>Bt.id!==nt||Bt.anchor.type!=="numbering"?Bt:{...Bt,anchor:{type:"numbering",start:St,end:Et}}));return}if(Po.current){const{pinId:nt,pointIndex:z,startPoints:Z,startSvgX:ut,startSvgY:ot}=Po.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),lt(It=>It.map(St=>{if(St.id!==nt||St.anchor.type!=="polygon")return St;const Et=[...St.anchor.points];return Et[z]={x:Math.max(0,Math.min(Z[z].x+I,j)),y:Math.max(0,Math.min(Z[z].y+Ct,G))},{...St,anchor:{type:"polygon",points:Et,rotation:St.anchor.rotation??0}}}));return}if(Co.current){const{pinId:nt,startPoints:z,startSvgX:Z,startSvgY:ut}=Co.current,ot=w(N),it=ot.x-Z,I=ot.y-ut;(Math.abs(it)>2||Math.abs(I)>2)&&(ue.current=!0),lt(Ct=>Ct.map(It=>{if(It.id!==nt||It.anchor.type!=="polygon")return It;const St=z.map(Et=>({x:Math.max(0,Math.min(Et.x+it,j)),y:Math.max(0,Math.min(Et.y+I,G))}));return{...It,anchor:{type:"polygon",points:St,rotation:It.anchor.rotation??0}}}));return}if(ie.current){const{pinId:nt,pointIndex:z,startPoints:Z,startSvgX:ut,startSvgY:ot}=ie.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),lt(It=>It.map(St=>{if(St.id!==nt||St.anchor.type!=="polyline")return St;const Et=[...St.anchor.points];return Et[z]={x:Math.max(0,Math.min(Z[z].x+I,j)),y:Math.max(0,Math.min(Z[z].y+Ct,G))},{...St,anchor:{type:"polyline",points:Et,rotation:St.anchor.rotation??0}}}));return}if(ve.current){const{pinId:nt,startPoints:z,startSvgX:Z,startSvgY:ut}=ve.current,ot=w(N),it=ot.x-Z,I=ot.y-ut;(Math.abs(it)>2||Math.abs(I)>2)&&(ue.current=!0),lt(Ct=>Ct.map(It=>{if(It.id!==nt||It.anchor.type!=="polyline")return It;const St=z.map(Et=>({x:Math.max(0,Math.min(Et.x+it,j)),y:Math.max(0,Math.min(Et.y+I,G))}));return{...It,anchor:{type:"polyline",points:St,rotation:It.anchor.rotation??0}}}));return}if(ln.current){const{pinId:nt,handle:z,startPoints:Z,startMinX:ut,startMinY:ot,startMaxX:it,startMaxY:I,startSvgX:Ct,startSvgY:It}=ln.current,St=w(N);(Math.abs(St.x-Ct)>2||Math.abs(St.y-It)>2)&&(ue.current=!0);const Et=Math.max(An,it-ut),vt=Math.max(An,I-ot);let Bt=ut,Vt=ot,me=it,se=I;switch(z){case"se":me=Math.max(ut+An,St.x),se=Math.max(ot+An,St.y);break;case"sw":Bt=Math.min(it-An,St.x),se=Math.max(ot+An,St.y);break;case"nw":Bt=Math.min(it-An,St.x),Vt=Math.min(I-An,St.y);break;case"ne":me=Math.max(ut+An,St.x),Vt=Math.min(I-An,St.y);break;case"n":Vt=Math.min(I-An,St.y);break;case"s":se=Math.max(ot+An,St.y);break;case"e":me=Math.max(ut+An,St.x);break;case"w":Bt=Math.min(it-An,St.x);break}const Ee=me-Bt,Ze=se-Vt,En=Z.map(fe=>({x:Bt+(fe.x-ut)/Et*Ee,y:Vt+(fe.y-ot)/vt*Ze}));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(mt.current){const{pinId:nt,handle:z,startPoints:Z,startMinX:ut,startMinY:ot,startMaxX:it,startMaxY:I,startSvgX:Ct,startSvgY:It}=mt.current,St=w(N);(Math.abs(St.x-Ct)>2||Math.abs(St.y-It)>2)&&(ue.current=!0);const Et=Math.max(An,it-ut),vt=Math.max(An,I-ot);let Bt=ut,Vt=ot,me=it,se=I;switch(z){case"se":me=Math.max(ut+An,St.x),se=Math.max(ot+An,St.y);break;case"sw":Bt=Math.min(it-An,St.x),se=Math.max(ot+An,St.y);break;case"nw":Bt=Math.min(it-An,St.x),Vt=Math.min(I-An,St.y);break;case"ne":me=Math.max(ut+An,St.x),Vt=Math.min(I-An,St.y);break;case"n":Vt=Math.min(I-An,St.y);break;case"s":se=Math.max(ot+An,St.y);break;case"e":me=Math.max(ut+An,St.x);break;case"w":Bt=Math.min(it-An,St.x);break}const Ee=me-Bt,Ze=se-Vt,En=Z.map(fe=>({x:Bt+(fe.x-ut)/Et*Ee,y:Vt+(fe.y-ot)/vt*Ze}));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(Es.current){const{pinId:nt,startX:z,startY:Z,startW:ut,startH:ot,startSvgX:it,startSvgY:I}=Es.current,Ct=w(N),It=Ct.x-it,St=Ct.y-I;(Math.abs(It)>2||Math.abs(St)>2)&&(ue.current=!0);const Et=Math.max(0,Math.min(z+It,j-ut)),vt=Math.max(0,Math.min(Z+St,G-ot));lt(Bt=>Bt.map(Vt=>Vt.id!==nt||Vt.anchor.type!=="rectangle"?Vt:{...Vt,anchor:{type:"rectangle",x:Et,y:vt,width:ut,height:ot,rotation:Vt.anchor.rotation??0}}));return}if(da.current){const{pinId:nt,startCx:z,startCy:Z,startRx:ut,startRy:ot,startSvgX:it,startSvgY:I}=da.current,Ct=w(N),It=Ct.x-it,St=Ct.y-I;(Math.abs(It)>2||Math.abs(St)>2)&&(ue.current=!0);const Et=Math.max(ut,Math.min(z+It,j-ut)),vt=Math.max(ot,Math.min(Z+St,G-ot));lt(Bt=>Bt.map(Vt=>Vt.id!==nt||Vt.anchor.type!=="ellipse"?Vt:{...Vt,anchor:{type:"ellipse",cx:Et,cy:vt,rx:ut,ry:ot,rotation:Vt.anchor.rotation??0}}));return}if(Ns.current){const{pinId:nt,startCx:z,startCy:Z,startRadius:ut,startSvgX:ot,startSvgY:it}=Ns.current,I=w(N),Ct=I.x-ot,It=I.y-it;(Math.abs(Ct)>2||Math.abs(It)>2)&&(ue.current=!0);const St=Math.max(ut,Math.min(z+Ct,j-ut)),Et=Math.max(ut,Math.min(Z+It,G-ut));lt(vt=>vt.map(Bt=>Bt.id!==nt||Bt.anchor.type!=="compass"?Bt:{...Bt,anchor:{type:"compass",cx:St,cy:Et,radius:ut,rotation:Bt.anchor.rotation??0}}));return}if(zn.current){const{pinId:nt,startStart:z,startEnd:Z,startControl:ut,startSvgX:ot,startSvgY:it}=zn.current,I=w(N),Ct=I.x-ot,It=I.y-it;(Math.abs(Ct)>2||Math.abs(It)>2)&&(ue.current=!0),lt(St=>St.map(Et=>Et.id!==nt||Et.anchor.type!=="arrow"?Et:{...Et,anchor:{type:"arrow",start:{x:Math.max(0,Math.min(z.x+Ct,j)),y:Math.max(0,Math.min(z.y+It,G))},end:{x:Math.max(0,Math.min(Z.x+Ct,j)),y:Math.max(0,Math.min(Z.y+It,G))},control:{x:Math.max(0,Math.min(ut.x+Ct,j)),y:Math.max(0,Math.min(ut.y+It,G))}}}));return}if(sr.current){const{pinId:nt,handle:z,startStart:Z,startEnd:ut,startControl:ot,startSvgX:it,startSvgY:I}=sr.current,Ct=w(N),It=Ct.x-it,St=Ct.y-I;(Math.abs(It)>2||Math.abs(St)>2)&&(ue.current=!0),lt(Et=>Et.map(vt=>{if(vt.id!==nt||vt.anchor.type!=="arrow")return vt;const Bt={...Z},Vt={...ut},me={...ot};return z==="start"?(Bt.x=Math.max(0,Math.min(Bt.x+It,j)),Bt.y=Math.max(0,Math.min(Bt.y+St,G))):z==="end"?(Vt.x=Math.max(0,Math.min(Vt.x+It,j)),Vt.y=Math.max(0,Math.min(Vt.y+St,G))):(me.x=Math.max(0,Math.min(me.x+It,j)),me.y=Math.max(0,Math.min(me.y+St,G))),{...vt,anchor:{type:"arrow",start:Bt,end:Vt,control:me}}}));return}if(Zr.current){const{pinId:nt,handle:z,startStart:Z,startEnd:ut,startControl:ot,startMinX:it,startMinY:I,startMaxX:Ct,startMaxY:It,startSvgX:St,startSvgY:Et}=Zr.current,vt=w(N);(Math.abs(vt.x-St)>2||Math.abs(vt.y-Et)>2)&&(ue.current=!0);const Bt=Math.max(An,Ct-it),Vt=Math.max(An,It-I);let me=it,se=I,Ee=Ct,Ze=It;switch(z){case"se":Ee=Math.max(it+An,vt.x),Ze=Math.max(I+An,vt.y);break;case"sw":me=Math.min(Ct-An,vt.x),Ze=Math.max(I+An,vt.y);break;case"nw":me=Math.min(Ct-An,vt.x),se=Math.min(It-An,vt.y);break;case"ne":Ee=Math.max(it+An,vt.x),se=Math.min(It-An,vt.y);break;case"n":se=Math.min(It-An,vt.y);break;case"s":Ze=Math.max(I+An,vt.y);break;case"e":Ee=Math.max(it+An,vt.x);break;case"w":me=Math.min(Ct-An,vt.x);break}const En=Ee-me,fe=Ze-se,Xe=Se=>({x:me+(Se.x-it)/Bt*En,y:se+(Se.y-I)/Vt*fe});lt(Se=>Se.map(Tn=>Tn.id!==nt||Tn.anchor.type!=="arrow"?Tn:{...Tn,anchor:{type:"arrow",start:Xe(Z),end:Xe(ut),control:Xe(ot)}}));return}if(Li.current){const{pinId:nt,startStart:z,startEnd:Z,startControl:ut,centerX:ot,centerY:it,startAngle:I,startSvgX:Ct,startSvgY:It}=Li.current,St=w(N);(Math.abs(St.x-Ct)>2||Math.abs(St.y-It)>2)&&(ue.current=!0);const vt=Math.atan2(St.y-it,St.x-ot)-I,Bt=Math.cos(vt),Vt=Math.sin(vt),me=se=>({x:ot+(se.x-ot)*Bt-(se.y-it)*Vt,y:it+(se.x-ot)*Vt+(se.y-it)*Bt});lt(se=>se.map(Ee=>Ee.id!==nt||Ee.anchor.type!=="arrow"?Ee:{...Ee,anchor:{type:"arrow",start:me(z),end:me(Z),control:me(ut)}}));return}if(Ts.current){const{pinId:nt,startRotation:z,centerX:Z,centerY:ut,startSvgX:ot,startSvgY:it}=Ts.current,I=w(N);(Math.abs(I.x-ot)>2||Math.abs(I.y-it)>2)&&(ue.current=!0);const Ct=vt=>vt*180/Math.PI,It=Ct(Math.atan2(it-ut,ot-Z)),St=Ct(Math.atan2(I.y-ut,I.x-Z));let Et=z+(St-It);for(;Et<0;)Et+=360;for(;Et>=360;)Et-=360;lt(vt=>vt.map(Bt=>Bt.id!==nt||Bt.anchor.type!=="rectangle"?Bt:{...Bt,anchor:{...Bt.anchor,rotation:Et}}));return}if(Pl.current){const{pinId:nt,startRotation:z,centerX:Z,centerY:ut,startSvgX:ot,startSvgY:it}=Pl.current,I=w(N);(Math.abs(I.x-ot)>2||Math.abs(I.y-it)>2)&&(ue.current=!0);const Ct=vt=>vt*180/Math.PI,It=Ct(Math.atan2(it-ut,ot-Z)),St=Ct(Math.atan2(I.y-ut,I.x-Z));let Et=z+(St-It);for(;Et<0;)Et+=360;for(;Et>=360;)Et-=360;lt(vt=>vt.map(Bt=>Bt.id!==nt||Bt.anchor.type!=="ellipse"?Bt:{...Bt,anchor:{...Bt.anchor,rotation:Et}}));return}if(A.current){const{pinId:nt,startRotation:z,centerX:Z,centerY:ut,startSvgX:ot,startSvgY:it}=A.current,I=w(N);(Math.abs(I.x-ot)>2||Math.abs(I.y-it)>2)&&(ue.current=!0);const Ct=vt=>vt*180/Math.PI,It=Ct(Math.atan2(it-ut,ot-Z)),St=Ct(Math.atan2(I.y-ut,I.x-Z));let Et=z+(St-It);for(;Et<0;)Et+=360;for(;Et>=360;)Et-=360;lt(vt=>vt.map(Bt=>Bt.id!==nt||Bt.anchor.type!=="compass"?Bt:{...Bt,anchor:{...Bt.anchor,rotation:Et}}));return}if(B.current){const{pinId:nt,startPoints:z,centerX:Z,centerY:ut,startAngle:ot,startRotation:it,startSvgX:I,startSvgY:Ct}=B.current,It=w(N);(Math.abs(It.x-I)>2||Math.abs(It.y-Ct)>2)&&(ue.current=!0);const Et=Math.atan2(It.y-ut,It.x-Z)-ot,vt=Math.cos(Et),Bt=Math.sin(Et),Vt=z.map(Ee=>({x:Z+(Ee.x-Z)*vt-(Ee.y-ut)*Bt,y:ut+(Ee.x-Z)*Bt+(Ee.y-ut)*vt}));let se=it+(Ee=>Ee*180/Math.PI)(Et);for(;se<0;)se+=360;for(;se>=360;)se-=360;lt(Ee=>Ee.map(Ze=>Ze.id!==nt||Ze.anchor.type!=="polygon"?Ze:{...Ze,anchor:{type:"polygon",points:Vt,rotation:se}}));return}if(nn.current){const{pinId:nt,startPoints:z,centerX:Z,centerY:ut,startAngle:ot,startRotation:it,startSvgX:I,startSvgY:Ct}=nn.current,It=w(N);(Math.abs(It.x-I)>2||Math.abs(It.y-Ct)>2)&&(ue.current=!0);const Et=Math.atan2(It.y-ut,It.x-Z)-ot,vt=Math.cos(Et),Bt=Math.sin(Et),Vt=z.map(Ee=>({x:Z+(Ee.x-Z)*vt-(Ee.y-ut)*Bt,y:ut+(Ee.x-Z)*Bt+(Ee.y-ut)*vt}));let se=it+(Ee=>Ee*180/Math.PI)(Et);for(;se<0;)se+=360;for(;se>=360;)se-=360;lt(Ee=>Ee.map(Ze=>Ze.id!==nt||Ze.anchor.type!=="polyline"?Ze:{...Ze,anchor:{type:"polyline",points:Vt,rotation:se}}));return}if(al.current){const{pinId:nt,handle:z,startX:Z,startY:ut,startW:ot,startH:it,startRotation:I,startSvgX:Ct,startSvgY:It}=al.current,St=w(N);(Math.abs(St.x-Ct)>2||Math.abs(St.y-It)>2)&&(ue.current=!0);const Et=I*Math.PI/180,vt=Math.cos(Et),Bt=Math.sin(Et),Vt=Z+ot/2,me=ut+it/2,se=(lr,xr)=>({x:Vt+lr*vt-xr*Bt,y:me+lr*Bt+xr*vt}),Ee={nw:se(-ot/2,-it/2),ne:se(ot/2,-it/2),se:se(ot/2,it/2),sw:se(-ot/2,it/2)},Ze={n:se(0,-it/2),s:se(0,it/2),e:se(ot/2,0),w:se(-ot/2,0)},En={nw:Ee.se,ne:Ee.sw,se:Ee.nw,sw:Ee.ne},fe={n:Ze.s,s:Ze.n,e:Ze.w,w:Ze.e},Xe=En[z]??fe[z],Se=(St.x+Xe.x)/2,Tn=(St.y+Xe.y)/2,$t=Xe.x-Se,Le=Xe.y-Tn,Be={x:$t*vt+Le*Bt,y:-$t*Bt+Le*vt},Fe=z==="n"||z==="e"||z==="s"||z==="w",Ae=Fe?z==="e"||z==="w"?Math.max(Qr,2*Math.abs(Be.x)):ot:Math.max(Qr,2*Math.abs(Be.x)),_n=Fe?z==="n"||z==="s"?Math.max(Qr,2*Math.abs(Be.y)):it:Math.max(Qr,2*Math.abs(Be.y)),qe=Se-Ae/2,rr=Tn-_n/2;lt(lr=>lr.map(xr=>xr.id!==nt||xr.anchor.type!=="rectangle"?xr:{...xr,anchor:{type:"rectangle",x:qe,y:rr,width:Ae,height:_n,rotation:I}}));return}if(Qo.current){const{pinId:nt,handle:z,startCx:Z,startCy:ut,startRx:ot,startRy:it,startSvgX:I,startSvgY:Ct}=Qo.current,It=w(N);(Math.abs(It.x-I)>2||Math.abs(It.y-Ct)>2)&&(ue.current=!0);const{startRotation:St}=Qo.current,Et=St*Math.PI/180,vt=Math.cos(Et),Bt=Math.sin(Et),Vt=(fe,Xe)=>({x:Z+fe*vt-Xe*Bt,y:ut+fe*Bt+Xe*vt}),me=z==="nw"||z==="ne"||z==="se"||z==="sw";let se=Z,Ee=ut,Ze=ot,En=it;if(me){const fe={nw:Vt(-ot,-it),ne:Vt(ot,-it),se:Vt(ot,it),sw:Vt(-ot,it)},Se={nw:fe.se,ne:fe.sw,se:fe.nw,sw:fe.ne}[z];se=(It.x+Se.x)/2,Ee=(It.y+Se.y)/2;const Tn=Se.x-se,$t=Se.y-Ee;Ze=Math.max(di,Math.abs(Tn*vt+$t*Bt)),En=Math.max(di,Math.abs(-Tn*Bt+$t*vt))}else{if(z==="n"){const fe=ut+it;En=Math.max(di,(fe-It.y)/2),Ee=fe-En}else if(z==="s"){const fe=ut-it;En=Math.max(di,(It.y-fe)/2),Ee=fe+En}else if(z==="e"){const fe=Z-ot;Ze=Math.max(di,(It.x-fe)/2),se=fe+Ze}else if(z==="w"){const fe=Z+ot;Ze=Math.max(di,(fe-It.x)/2),se=fe-Ze}se=Math.max(Ze,Math.min(se,j-Ze)),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:Ze,ry:En,rotation:Xe.anchor.rotation??0}}));return}if(Il.current){const{pinId:nt,startCx:z,startCy:Z,startSvgX:ut,startSvgY:ot}=Il.current,it=w(N);(Math.abs(it.x-ut)>2||Math.abs(it.y-ot)>2)&&(ue.current=!0);const I=Math.hypot(it.x-z,it.y-Z),Ct=Math.min(z,Z,j-z,G-Z),It=Math.max(K_,Math.min(I,Ct));lt(St=>St.map(Et=>Et.id!==nt||Et.anchor.type!=="compass"?Et:{...Et,anchor:{type:"compass",cx:z,cy:Z,radius:It,rotation:Et.anchor.rotation??0}}));return}if(po.current){const{pinId:nt,pointIndex:z,startPoints:Z,startSvgX:ut,startSvgY:ot}=po.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0);const It=Z.map((St,Et)=>Et===z?{x:Math.max(0,Math.min(St.x+I,j)),y:Math.max(0,Math.min(St.y+Ct,G))}:St);lt(St=>St.map(Et=>Et.id===nt?{...Et,leaderPoints:It}:Et));return}if(_i.current){const{pinId:nt,startCardX:z,startCardY:Z,startSvgX:ut,startSvgY:ot}=_i.current,it=w(N),I=it.x-ut,Ct=it.y-ot;(Math.abs(I)>2||Math.abs(Ct)>2)&&(ue.current=!0),Mt(It=>{const St=It[nt];return St?{...It,[nt]:{...St,x:Math.max(0,Math.min(z+I,j-St.width)),y:Math.max(0,Math.min(Z+Ct,G-St.height))}}:It});return}if(sl.current){const{pinId:nt,handle:z,startCardX:Z,startCardY:ut,startCardW:ot,startCardH:it,startSvgX:I,startSvgY:Ct}=sl.current,It=w(N),St=It.x-I,Et=It.y-Ct;(Math.abs(St)>2||Math.abs(Et)>2)&&(ue.current=!0);let vt=Z,Bt=ut,Vt=ot,me=it;z.includes("e")&&(Vt=Math.max(Ow,ot+St)),z.includes("s")&&(me=Math.max(Pw,it+Et)),z.includes("w")&&(Vt=Math.max(Ow,ot-St),vt=Z+ot-Vt),z.includes("n")&&(me=Math.max(Pw,it-Et),Bt=ut+it-me),vt=Math.max(0,Math.min(vt,j-Vt)),Bt=Math.max(0,Math.min(Bt,G-me)),Mt(se=>({...se,[nt]:{x:vt,y:Bt,width:Vt,height:me}}))}},_=()=>{if(As.current=null,qi.current=null,mn.current){const N=mn.current,j=20,G=Math.min(N.x1,N.x2),nt=Math.max(N.x1,N.x2),z=Math.min(N.y1,N.y2),Z=Math.max(N.y1,N.y2),ut=Math.max(j,nt-G),ot=Math.max(j,Z-z),it=vl(),I=mu;te();const Ct=N.shape==="rectangle"?{type:"rectangle",x:G,y:z,width:ut,height:ot}:N.shape==="redact"?{type:"redact",x:G,y:z,width:ut,height:ot,mode:t_,strength:e_}:{type:"ellipse",cx:(G+nt)/2,cy:(z+Z)/2,rx:ut/2,ry:ot/2},It=N.shape==="redact"?null:la(Ct);lt(St=>[...St,{id:it,anchor:Ct,color:I,strokeStyle:Xh,fillStyle:sg,label:Ku(St),image:null,imageAspect:null,description:"",descPos:"below"}]),It&&Mt(St=>({...St,[it]:It})),tt(it),wt(it),P("select"),dr(null),Te(null),mn.current=null,mi.current=it,Ni.current=!0}if(dn.current){const N=dn.current;if(Math.hypot(N.end.x-N.start.x,N.end.y-N.start.y)>=6){const G=vl(),nt=mu,z={type:"arrow",start:N.start,end:N.end,control:N.control},Z=la(z);te(),lt(ut=>[...ut,{id:G,anchor:z,color:nt,label:Ku(ut),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),Mt(ut=>({...ut,[G]:Z})),tt(G),wt(null),P("select"),mi.current=G,Ni.current=!0}Qe(null),dn.current=null}if(xn.current){const N=xn.current;if(Math.hypot(N.end.x-N.start.x,N.end.y-N.start.y)>=6){const G=vl(),nt=mu;te(),lt(z=>[...z,{id:G,anchor:{type:"numbering",start:N.start,end:N.end},color:nt,label:kB(z),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),tt(G),wt(null),P("select"),mi.current=G,Ni.current=!0}In(null),Nn(null),xn.current=null}_i.current=null,sl.current=null,ua.current=null,Zo.current=null,Ol.current=null,Ia.current=null,gi.current=null,Po.current=null,Nt.current&&ue.current&&rn.current(Nt.current.startPoints),Nt.current=null,Co.current=null,ie.current=null,Rn.current&&ue.current&&rn.current(Rn.current.startPoints),Rn.current=null,ve.current=null,nn.current=null,ln.current=null,Es.current=null,da.current=null,Ns.current=null,al.current=null,Qo.current=null,Il.current=null,Ts.current=null,Pl.current=null,A.current=null,B.current=null,mt.current=null,zn.current=null,sr.current=null,Li.current=null,Zr.current=null,xn.current=null,po.current=null,Pa.current=null,fa.current=null,Cs.current=null,Ms.current=null,ja.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",_)}},[pe]);const Ks=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=pe(k.clientX,k.clientY);ue.current=!1,ua.current={pinId:w,startPinX:_.anchor.x,startPinY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[K,st,pe,te]),Ds=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=pe(k.clientX,k.clientY);ue.current=!1,Zo.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startSvgX:N.x,startSvgY:N.y}},[K,st,pe,te]),ga=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=pe(_.clientX,_.clientY);ue.current=!1,Ol.current={pinId:w,endpoint:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startSvgX:j.x,startSvgY:j.y}},[K,st,pe,te]),pc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=Ft.current;if(!_||w<0||w>=_.length)return;const N=_[w],{x:j,y:G}=pe(k.clientX,k.clientY);ue.current=!1,Nt.current={pointIndex:w,startX:N.x,startY:N.y,startSvgX:j,startSvgY:G,startPoints:_.map(nt=>({x:nt.x,y:nt.y}))}},[pe]),Cu=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=Tr.current;if(!_||w<0||w>=_.length)return;const N=_[w],{x:j,y:G}=pe(k.clientX,k.clientY);ue.current=!1,Rn.current={pointIndex:w,startX:N.x,startY:N.y,startSvgX:j,startSvgY:G,startPoints:_.map(nt=>({x:nt.x,y:nt.y}))}},[pe]),vf=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=hr.current.find(G=>G.id===w);if(!N)return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,po.current={pinId:w,pointIndex:k,startPoints:(N.leaderPoints??[]).map(G=>({x:G.x,y:G.y})),startSvgX:j.x,startSvgY:j.y}},[pe,te]),wf=U.useCallback((w,k,_,N)=>{N.preventDefault(),N.stopPropagation();const j=hr.current.find(Z=>Z.id===w);if(!j)return;te();const G=pe(N.clientX,N.clientY);ue.current=!1;const nt=(j.leaderPoints??[]).map(Z=>({x:Z.x,y:Z.y})),z=[...nt.slice(0,k),{x:_.x,y:_.y},...nt.slice(k)];lt(Z=>Z.map(ut=>ut.id===w?{...ut,leaderPoints:z}:ut)),po.current={pinId:w,pointIndex:k,startPoints:z,startSvgX:G.x,startSvgY:G.y}},[pe,te]),ad=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]),Eu=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="polygon")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,Po.current={pinId:w,pointIndex:k,startPoints:N.anchor.points.map(G=>({x:G.x,y:G.y})),startSvgX:j.x,startSvgY:j.y}},[st,pe,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,Z)=>Z!==k);return{...j,anchor:{type:"polygon",points:nt,rotation:j.anchor.rotation??0}}}))},[te]),ul=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,G=j.length,nt=j[k],z=j[(k+1)%G],Z={x:(nt.x+z.x)/2,y:(nt.y+z.y)/2},ut=[...j.slice(0,k+1),Z,...j.slice(k+1)];te(),lt(it=>it.map(I=>I.id!==w||I.anchor.type!=="polygon"?I:{...I,anchor:{type:"polygon",points:ut,rotation:I.anchor.rotation??0}}));const ot=pe(_.clientX,_.clientY);ue.current=!1,Po.current={pinId:w,pointIndex:k+1,startPoints:ut.map(it=>({x:it.x,y:it.y})),startSvgX:ot.x,startSvgY:ot.y}},[st,pe,te]),rs=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="polygon")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,Co.current={pinId:w,startPoints:_.anchor.points.map(j=>({x:j.x,y:j.y})),startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),mc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="rectangle")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,Es.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startW:_.anchor.width,startH:_.anchor.height,startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),zo=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="ellipse")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,da.current={pinId:w,startCx:_.anchor.cx,startCy:_.anchor.cy,startRx:_.anchor.rx,startRy:_.anchor.ry,startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),fl=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="rectangle")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,al.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,pe,te]),Fc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="ellipse")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,Qo.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,pe,te]),gc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(ot=>ot.id===w);if(!N||N.anchor.type!=="polygon")return;const j=N.anchor.points;if(j.length<2)return;te();const G=pe(_.clientX,_.clientY),nt=Math.min(...j.map(ot=>ot.x)),z=Math.min(...j.map(ot=>ot.y)),Z=Math.max(...j.map(ot=>ot.x)),ut=Math.max(...j.map(ot=>ot.y));ue.current=!1,mt.current={pinId:w,handle:k,startPoints:j.map(ot=>({x:ot.x,y:ot.y})),startMinX:nt,startMinY:z,startMaxX:Z,startMaxY:ut,startSvgX:G.x,startSvgY:G.y}},[st,pe,te]),yc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(nt=>nt.id===w);if(!_||_.anchor.type!=="rectangle")return;te();const N=pe(k.clientX,k.clientY),j=_.anchor.x+_.anchor.width/2,G=_.anchor.y+_.anchor.height/2;ue.current=!1,Ts.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:j,centerY:G,startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),Uc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="ellipse")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,Pl.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:_.anchor.cx,centerY:_.anchor.cy,startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),ya=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="compass")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,Ns.current={pinId:w,startCx:_.anchor.cx,startCy:_.anchor.cy,startRadius:_.anchor.radius,startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),bc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="compass")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,Il.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,pe,te]),ro=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="compass")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,A.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:_.anchor.cx,centerY:_.anchor.cy,startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),Vi=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(Z=>Z.id===w);if(!_||_.anchor.type!=="polygon")return;const N=_.anchor.points;if(N.length<2)return;te();const j=pe(k.clientX,k.clientY),G=N.reduce((Z,ut)=>Z+ut.x,0)/N.length,nt=N.reduce((Z,ut)=>Z+ut.y,0)/N.length,z=Math.atan2(j.y-nt,j.x-G);ue.current=!1,B.current={pinId:w,startPoints:N.map(Z=>({x:Z.x,y:Z.y})),centerX:G,centerY:nt,startAngle:z,startRotation:_.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[st,pe,te]),Hc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="polyline")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,ie.current={pinId:w,pointIndex:k,startPoints:N.anchor.points.map(G=>({x:G.x,y:G.y})),startSvgX:j.x,startSvgY:j.y}},[st,pe,te]),yo=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,Z)=>Z!==k);return{...j,anchor:{type:"polyline",points:nt,rotation:j.anchor.rotation??0}}}))},[te]),qc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(ot=>ot.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},Z=[...j.slice(0,k+1),z,...j.slice(k+1)];te(),lt(ot=>ot.map(it=>it.id!==w||it.anchor.type!=="polyline"?it:{...it,anchor:{type:"polyline",points:Z,rotation:it.anchor.rotation??0}}));const ut=pe(_.clientX,_.clientY);ue.current=!1,ie.current={pinId:w,pointIndex:k+1,startPoints:Z.map(ot=>({x:ot.x,y:ot.y})),startSvgX:ut.x,startSvgY:ut.y}},[st,pe,te]),is=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="polyline")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,ve.current={pinId:w,startPoints:_.anchor.points.map(j=>({x:j.x,y:j.y})),startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),xc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="arrow")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,zn.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startControl:{..._.anchor.control},startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),Js=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(G=>G.id===w);if(!N||N.anchor.type!=="arrow")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,sr.current={pinId:w,handle:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},startSvgX:j.x,startSvgY:j.y}},[st,pe,te]),$a=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(ot=>ot.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(ot=>ot.x)),nt=Math.min(...j.map(ot=>ot.y)),z=Math.max(...j.map(ot=>ot.x)),Z=Math.max(...j.map(ot=>ot.y)),ut=pe(_.clientX,_.clientY);ue.current=!1,Zr.current={pinId:w,handle:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},startMinX:G,startMinY:nt,startMaxX:z,startMaxY:Z,startSvgX:ut.x,startSvgY:ut.y}},[st,pe,te]),vc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(Z=>Z.id===w);if(!_||_.anchor.type!=="arrow")return;te();const N=pe(k.clientX,k.clientY),j=[_.anchor.start,_.anchor.end,_.anchor.control],G=j.reduce((Z,ut)=>Z+ut.x,0)/j.length,nt=j.reduce((Z,ut)=>Z+ut.y,0)/j.length,z=Math.atan2(N.y-nt,N.x-G);ue.current=!1,Li.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,pe,te]),$c=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(ot=>ot.id===w);if(!N||N.anchor.type!=="polyline")return;te();const j=N.anchor.points,G=Math.min(...j.map(ot=>ot.x)),nt=Math.min(...j.map(ot=>ot.y)),z=Math.max(...j.map(ot=>ot.x)),Z=Math.max(...j.map(ot=>ot.y)),ut=pe(_.clientX,_.clientY);ue.current=!1,ln.current={pinId:w,handle:k,startPoints:j.map(ot=>({x:ot.x,y:ot.y})),startMinX:G,startMinY:nt,startMaxX:z,startMaxY:Z,startSvgX:ut.x,startSvgY:ut.y}},[st,pe,te]),Hl=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(Z=>Z.id===w);if(!_||_.anchor.type!=="polyline")return;const N=_.anchor.points;if(N.length<2)return;te();const j=pe(k.clientX,k.clientY),G=N.reduce((Z,ut)=>Z+ut.x,0)/N.length,nt=N.reduce((Z,ut)=>Z+ut.y,0)/N.length,z=Math.atan2(j.y-nt,j.x-G);ue.current=!1,nn.current={pinId:w,startPoints:N.map(Z=>({x:Z.x,y:Z.y})),centerX:G,centerY:nt,startAngle:z,startRotation:_.anchor.rotation??0,startSvgX:j.x,startSvgY:j.y}},[st,pe,te]),ql=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=st.find(j=>j.id===w);if(!_||_.anchor.type!=="text")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,Ia.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[st,pe,te]),bo=U.useCallback(async w=>{const k=await new Promise(it=>{const I=new FileReader;I.onload=Ct=>it(Ct.target?.result??null),I.onerror=()=>it(null),I.readAsDataURL(w)});if(!k)return;const _=await new Promise(it=>{const I=new Image;I.onload=()=>it({w:I.naturalWidth||ry,h:I.naturalHeight||ry}),I.onerror=()=>it(null),I.src=k});if(!_)return;const N=_.w/_.h,j=ry/Math.max(_.w,_.h),G=Math.max(km,_.w*j),nt=Math.max(km,_.h*j),{w:z,h:Z}=Pn.current,ut={type:"image",x:Math.max(0,(z-G)/2),y:Math.max(0,(Z-nt)/2),width:G,height:nt,src:k,aspect:N},ot=vl();te(),lt(it=>[...it,{id:ot,anchor:ut,color:mu,label:Ku(it),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),Mt(it=>({...it,[ot]:la(ut)})),tt(ot),wt(ot),P("select")},[te]);Oa.current=bo;const $l=U.useRef(0),Rs=U.useCallback(w=>{const k=Date.now();k-$l.current<800||($l.current=k,bo(w),Eo(!1))},[bo]);U.useEffect(()=>{if(!jo)return;Ua.current?.focus();const w=_=>{const N=Yy(_.clipboardData);N&&(_.preventDefault(),_.stopPropagation(),Rs(N))},k=_=>{if(_.key==="Escape"){Eo(!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),vB))]);for(const G of j??[]){const nt=G.types.find(Z=>Z.startsWith("image/"));if(!nt)continue;const z=await G.getType(nt);Rs(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)}},[jo,b,Rs]);const Yc=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=hr.current.find(j=>j.id===w);if(!_||_.anchor.type!=="redact")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,Ms.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[pe,te]),wc=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=hr.current.find(G=>G.id===w);if(!N||N.anchor.type!=="redact")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,ja.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}},[pe,te]),ss=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id===w&&N.anchor.type==="redact"?{...N,anchor:{...N.anchor,...k}}:N))},[te]),as=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=hr.current.find(j=>j.id===w);if(!_||_.anchor.type!=="image")return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,fa.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[pe,te]),Ya=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=hr.current.find(G=>G.id===w);if(!N||N.anchor.type!=="image")return;te();const j=pe(_.clientX,_.clientY);ue.current=!1,Cs.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}},[pe,te]),ls=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=hr.current.find(j=>j.id===w);if(!_||_.anchor.type!=="text"||!_.anchor.point)return;te();const N=pe(k.clientX,k.clientY);ue.current=!1,tt(w),Pa.current={pinId:w,startPoint:{..._.anchor.point},startBox:{x:_.anchor.x,y:_.anchor.y},startSvgX:N.x,startSvgY:N.y}},[pe,te]),cs=U.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=st.find(z=>z.id===w);if(!N||N.anchor.type!=="text")return;te();const j=pe(_.clientX,_.clientY),G=N.anchor.x+N.anchor.width/2,nt=N.anchor.y+N.anchor.height/2;gi.current={pinId:w,handle:k,startCenterX:G,startCenterY:nt,startDist:Math.max(1,Math.hypot(j.x-G,j.y-nt)),startFontSize:N.textFontSize??Us},ue.current=!1},[st,te,pe]),xi=U.useCallback((w,k)=>{const _=k?.fontSize??Us,N=k?.bold?"700":"400",j=k?.italic?"italic ":"",nt=document.createElement("canvas").getContext("2d");return nt?(nt.font=`${j}${N} ${_}px ${Wo.current}`,O_(w,z=>nt.measureText(z).width,k)):{width:rk,height:ik}},[]),Vc=U.useCallback((w,k)=>{const _=hr.current.find(nt=>nt.id===w);if(!_||_.anchor.type!=="text")return;const N=xi(k,{fontSize:_.textFontSize??Us,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 Z=Math.max(0,Pn.current.w-j),ut=Math.max(0,Pn.current.h-G);return{...z,anchor:{...z.anchor,width:j,height:G,x:Math.max(0,Math.min(z.anchor.x,Z)),y:Math.max(0,Math.min(z.anchor.y,ut))}}}))},[xi]),Zs=U.useCallback(w=>{const k=w.trim()?w:iy;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},[]),Yl=U.useCallback((w=new Date,k=f2)=>{if(!M)return;const{w:_,h:N}=Pn.current;if(!_||!N)return;const j=Dd(w,k),G=Zs(`<p>${j}</p>`),nt=xi(G,{fontSize:Us,bold:!1,italic:!1}),z=12*de,Z=Math.max(0,Math.min(z,_-nt.width)),ut=Math.max(0,Math.min(N-nt.height-z,N-nt.height)),ot=vl(),it=mu;te(),lt(I=>[...I,{id:ot,anchor:{type:"text",x:Z,y:ut,width:nt.width,height:nt.height},color:it,label:Ku(I),image:null,imageAspect:null,description:G,descPos:"below",textColor:"#FFFFFF",textBackgroundColor:"#000000"}]),tt(ot),wt(ot),Yr(ot),P("select"),mi.current=ot,Ni.current=!0,ge(!1)},[M,xi,Zs,te]),ld=U.useCallback(w=>{if(!M)return;const{w:k,h:_}=Pn.current;if(!k||!_)return;const N=E4,{cx:j,cy:G}=Z_(w,k,_,N),nt=vl(),z=mu;te(),lt(Z=>[...Z,{id:nt,anchor:{type:"compass",cx:j,cy:G,radius:N,rotation:0},color:z,label:Ku(Z),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),tt(nt),wt(nt),P("select"),mi.current=nt,Ni.current=!0,He(!1)},[M,te]),io=U.useCallback(()=>{Eo(w=>!w)},[]),Rr=U.useCallback(()=>{M&&(ge(!1),He(w=>!w))},[M]),er=U.useCallback(()=>{M&&(He(!1),ge(w=>{if(w)return!1;if(Ke)ci(Of(Pe));else{const k=new Date;Wn(k),ci(Of(k))}return!0}))},[M,Pe,Ke]),_o=U.useCallback(()=>{const w=new Date;Wn(w),ci(Of(w))},[]),ti=U.useCallback(()=>{Yl(Ke?Pe:new Date,Hi)},[Pe,Hi,Ke,Yl]),Qs=U.useCallback(()=>{Yl(Pe,Hi)},[Pe,Hi,Yl]),ta=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=Zs(_.innerHTML);return _.innerHTML=G,lt(nt=>nt.map(z=>z.id===w?{...z,description:G}:z)),Vc(w,G),!0},[te,Vc,Zs]),dl=U.useCallback((w,k)=>{const _=hr.current.find(N=>N.id===w);!_||_.description===k||(te(),lt(N=>N.map(j=>j.id===w?{...j,description:k}:j)))},[te]),ea=U.useCallback(w=>{const k=Qi.current;if(!k)return;const _=Zs(k.innerHTML);dl(w,_),Vc(w,_)},[Vc,Zs,dl]);U.useEffect(()=>{if(!Ss)return;const w=k=>{k.target?.closest('[data-text-bg-picker="true"]')||Dl(null)};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[Ss]),U.useEffect(()=>{if(!Pi){Qi.current=null;return}const w=hr.current.find(N=>N.id===Pi);if(!w||w.anchor.type!=="text")return;const k=Zs(w.description),_=!w.description.trim()||w.description===iy;requestAnimationFrame(()=>{const N=Qi.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,Zs]),U.useEffect(()=>{if(!Pi)return;const w=k=>{const _=k.target,N=Qi.current;!N||_&&N.contains(_)||(ea(Pi),Yr(null))};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[Pi,ea]);const Ii=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 _=yt??Y;if(!_){if(!to.current)return;const ot=Yy(k.clipboardData);if(!ot)return;k.preventDefault(),Rs(ot);return}const N=hr.current.find(ot=>ot.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),Z=k.clipboardData?.items;if(Z){for(const ot of Z)if(ot.type.startsWith("image/")){k.preventDefault(),k.stopPropagation();const it=ot.getAsFile();if(!it)return;const I=new FileReader;I.onload=Ct=>{const It=Ct.target?.result;It&&Ii(_,It)},I.readAsDataURL(it);return}}let ut=k.clipboardData?.getData("text/plain")??"";if(!ut&&k.clipboardData?.items?.length){for(const it of k.clipboardData.items)if(it.kind==="string"&&it.type==="text/plain"){k.preventDefault();const I=_,Ct=yt;it.getAsString(It=>{const St=It??"";if(St.trim()){if(Ct&&I===Ct&&N?.anchor.type!=="text"){document.dispatchEvent(new CustomEvent(Zg,{detail:{pinId:Ct,text:St},bubbles:!0}));return}dl(I,St)}});return}const ot=k.clipboardData.getData("text/html");if(ot)try{ut=new DOMParser().parseFromString(ot,"text/html").body?.textContent??""}catch{ut=""}}if(ut.trim().length>0){if(yt&&_===yt&&N?.anchor.type!=="text"){k.preventDefault(),k.stopPropagation(),document.dispatchEvent(new CustomEvent(Zg,{detail:{pinId:yt,text:ut},bubbles:!0}));return}if(z)return;k.preventDefault(),dl(_,ut)}};return document.addEventListener("paste",w,!0),()=>document.removeEventListener("paste",w,!0)},[yt,Y,Ii,dl,Rs]);const ba=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||!f5(N.anchor)?N:{...N,strokeStyle:k}))},[te]),Sc=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id!==w||!C4(N.anchor)?N:{...N,fillStyle:k}))},[te]),Wc=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:Jf(k)}}))},[te]),Va=U.useCallback((w,k)=>{te(),lt(_=>Y_(_,w,k))},[te]),xa=U.useCallback(w=>{te(),lt(k=>k.map(_=>_.id===w?{..._,descPos:_.descPos==="above"?"below":"above"}:_))},[te]),us=U.useCallback(w=>{te();const k=UN(w,hr.current);lt(_=>ak(_.filter(N=>!k.has(N.id)))),Mt(_=>{const N={..._};for(const j of k)delete N[j];return N}),tt(null),wt(null),Yr(_=>_===w?null:_)},[te]),Os=U.useCallback(w=>{const k=hr.current.find(Ct=>Ct.id===w),_=k?a2(k,hr.current):null;if(!_||!Dw(_))return;const N=_.id;te();const j=vl(),nt=[N,...o5(N,hr.current)].map(Ct=>uo.current[Ct]).filter(Ct=>!!Ct),z=nt.length>0?nt.reduce((Ct,It)=>It.y+It.height>Ct.y+Ct.height?It:Ct):la(_.anchor),{w:Z,h:ut}=Pn.current,ot=z.width,it=c2,I={x:Math.max(0,Math.min(z.x+Ra,Math.max(0,Z-ot))),y:Math.max(0,Math.min(z.y+z.height+Ra,Math.max(0,ut-it))),width:ot,height:it};lt(Ct=>[...Ct,{id:j,anchor:{type:"linked",pinId:N},color:_.color,label:_.label,image:null,imageAspect:null,description:"",descPos:_.descPos,theme:_.theme,textFontSize:_.textFontSize}]),Mt(Ct=>({...Ct,[j]:I})),mi.current=j,tt(j),wt(j)},[te]),Vl=U.useCallback((w,k)=>{te(),lt(_=>_.map(N=>N.id===w?{...N,calloutHidden:k}:N)),k?(tt(w),wt(null)):(tt(w),wt(w))},[te]),Wi=U.useCallback(async(w="png",k=1,_)=>{if(!to.current||!Pn.current.w)return;const N=$t=>new Promise((Le,Be)=>{const Fe=new Image;Fe.onload=()=>Le(Fe),Fe.onerror=Be,Fe.src=$t});let j=null;try{j=await N(to.current)}catch{j=null}const G=hr.current,nt=uo.current,{w:z,h:Z}=Pn.current;if(!z)return;const ot=2*(k||1),it=document.createElement("canvas");it.width=z*ot,it.height=Z*ot;const I=it.getContext("2d");I.scale(ot,ot);const Ct=($t,Le,Be,Fe,Ae)=>{I.beginPath(),I.moveTo($t+Ae,Le),I.lineTo($t+Be-Ae,Le),I.arcTo($t+Be,Le,$t+Be,Le+Ae,Ae),I.lineTo($t+Be,Le+Fe-Ae),I.arcTo($t+Be,Le+Fe,$t+Be-Ae,Le+Fe,Ae),I.lineTo($t+Ae,Le+Fe),I.arcTo($t,Le+Fe,$t,Le+Fe-Ae,Ae),I.lineTo($t,Le+Ae),I.arcTo($t,Le,$t+Ae,Le,Ae),I.closePath()},It=await Promise.allSettled(G.map($t=>$t.image?N($t.image):Promise.resolve(null))),St=await Promise.all(G.filter($t=>$t.anchor.type==="image").map(async $t=>{const Le=$t.anchor.type==="image"?$t.anchor.src:"";try{return[$t.id,await N(Le)]}catch{return[$t.id,null]}})),Et=new Map(St),vt=new Map(It.map(($t,Le)=>[G[Le].id,$t.status==="fulfilled"?$t.value:null]));j&&I.drawImage(j,0,0,z,Z);const Bt=$t=>Uw($t,Ar.current),Vt=lg(G);I.lineCap="round";const me=$t=>{if($t.calloutHidden||$t.anchor.type==="text"||$t.anchor.type==="standalone"||$t.anchor.type==="redact")return;const Le=nt[$t.id];if(!Le)return;const Be=ny($t,G);if(!Be)return;const Fe=x2(Be,Le,$t.leaderPoints);I.beginPath(),Fe.forEach((Ae,_n)=>_n===0?I.moveTo(Ae.x,Ae.y):I.lineTo(Ae.x,Ae.y)),I.strokeStyle=$t.color,I.lineJoin="round",I.lineWidth=u4*Bt($t),I.stroke()},se=$t=>{const Le=Bt($t);if($t.anchor.type==="redact"){if(_?.skipRedaction)return;N4(I,it,{rect:$t.anchor,mode:$t.anchor.mode,strength:$t.anchor.strength,imageSize:{w:z,h:Z},sourceSize:{w:it.width,h:it.height}});return}if($t.anchor.type==="image"){const Be=Et.get($t.id);if(Be){const{x:Fe,y:Ae,width:_n,height:qe}=$t.anchor;I.drawImage(Be,Fe,Ae,_n,qe)}return}if($t.anchor.type==="point"){const{x:Be,y:Fe}=$t.anchor,Ae=Fh*Le;I.beginPath(),I.arc(Be+Iw*Le,Fe+jw*Le,Ae+zw*Le,0,Math.PI*2),I.fillStyle=Bw,I.fill(),I.beginPath(),I.arc(Be,Fe,Ae,0,Math.PI*2),I.fillStyle=$t.color,I.fill(),I.strokeStyle="white",I.lineWidth=Xm*Le,I.stroke()}else if($t.anchor.type==="numbering"){const{start:Be,end:Fe}=$t.anchor;I.beginPath(),I.moveTo(Be.x,Be.y),I.lineTo(Fe.x,Fe.y),I.strokeStyle=$t.color,I.lineWidth=Nf*Le,I.stroke();const Ae=String($t.label),_n=14*de,qe=0*_n,rr=.4*_n,lr=.35*_n;I.font=`700 ${_n}px ${Wo.current}`;const ii=Math.max(_n*.62,I.measureText(Ae).width)+rr*2,Wr=_n+qe+lr,mr=Fe.x-ii/2,Mr=Fe.y-Wr/2,vi=4*de;I.beginPath(),I.moveTo(mr+vi,Mr),I.lineTo(mr+ii-vi,Mr),I.quadraticCurveTo(mr+ii,Mr,mr+ii,Mr+vi),I.lineTo(mr+ii,Mr+Wr-vi),I.quadraticCurveTo(mr+ii,Mr+Wr,mr+ii-vi,Mr+Wr),I.lineTo(mr+vi,Mr+Wr),I.quadraticCurveTo(mr,Mr+Wr,mr,Mr+Wr-vi),I.lineTo(mr,Mr+vi),I.quadraticCurveTo(mr,Mr,mr+vi,Mr),I.closePath(),I.fillStyle="rgba(10,10,16,0.95)",I.fill(),I.strokeStyle=$t.color,I.lineWidth=1.5*de,I.stroke(),I.textAlign="center",I.textBaseline="middle",I.fillStyle="#ffffff",I.fillText(Ae,Fe.x,Fe.y),I.textAlign="left",I.textBaseline="alphabetic"}else if($t.anchor.type==="polygon"){const Fe=$t.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 Ae=Gm($t.color,$t.fillStyle);Ae&&(I.fillStyle=Ae,I.fill()),I.setLineDash(Vu($t)?jd.map(_n=>_n*Le):[]),I.strokeStyle=$t.color,I.lineWidth=Nf*Le,I.stroke(),I.setLineDash([])}}else if($t.anchor.type==="polyline"){const Fe=$t.anchor.points;if(Fe.length>=2){I.beginPath(),I.moveTo(Fe[0].x,Fe[0].y);for(let Ae=1;Ae<Fe.length;Ae++)I.lineTo(Fe[Ae].x,Fe[Ae].y);I.setLineDash(Vu($t)?jd.map(Ae=>Ae*Le):[]),I.strokeStyle=$t.color,I.lineWidth=Nf*Le,I.stroke(),I.setLineDash([])}}else if($t.anchor.type==="rectangle"){const{x:Be,y:Fe,width:Ae,height:_n,rotation:qe=0}=$t.anchor,rr=Be+Ae/2,lr=Fe+_n/2,xr=qe*Math.PI/180;I.save(),I.translate(rr,lr),I.rotate(xr),I.translate(-Ae/2,-_n/2),I.beginPath(),I.rect(0,0,Ae,_n);const ii=Gm($t.color,$t.fillStyle);ii&&(I.fillStyle=ii,I.fill()),I.setLineDash(Vu($t)?jd.map(Wr=>Wr*Le):[]),I.strokeStyle=$t.color,I.lineWidth=Nf*Le,I.stroke(),I.setLineDash([]),I.restore()}else if($t.anchor.type==="ellipse"){const{cx:Be,cy:Fe,rx:Ae,ry:_n,rotation:qe=0}=$t.anchor,rr=qe*Math.PI/180;I.save(),I.translate(Be,Fe),I.rotate(rr),I.beginPath(),I.ellipse(0,0,Ae,_n,0,0,Math.PI*2);const lr=Gm($t.color,$t.fillStyle);lr&&(I.fillStyle=lr,I.fill()),I.setLineDash(Vu($t)?jd.map(xr=>xr*Le):[]),I.strokeStyle=$t.color,I.lineWidth=Nf*Le,I.stroke(),I.setLineDash([]),I.restore()}else if($t.anchor.type==="compass")t8(I,{cx:$t.anchor.cx,cy:$t.anchor.cy,radius:$t.anchor.radius,rotation:$t.anchor.rotation??0,color:$t.color,strokeWidth:Km*Le});else if($t.anchor.type==="arrow"){const{start:Be,end:Fe,control:Ae}=$t.anchor;I.beginPath(),I.moveTo(Be.x,Be.y),I.quadraticCurveTo(Ae.x,Ae.y,Fe.x,Fe.y),I.strokeStyle=$t.color,I.lineWidth=Nf*Le,I.stroke();const _n=lk(Ae,Fe),qe=Math.atan2(_n.y,_n.x),rr=8*de,lr=Math.PI/7,xr=Fe.x-Math.cos(qe-lr)*rr,ii=Fe.y-Math.sin(qe-lr)*rr,Wr=Fe.x-Math.cos(qe+lr)*rr,mr=Fe.y-Math.sin(qe+lr)*rr;I.beginPath(),I.moveTo(Fe.x,Fe.y),I.lineTo(xr,ii),I.lineTo(Wr,mr),I.closePath(),I.fillStyle=$t.color,I.fill(),I.stroke()}},Ee=$t=>{if($t.anchor.type!=="text")return;if($t.anchor.point){const Mr=Bt($t),{x:vi,y:xo}=$t.anchor.point;I.beginPath(),I.arc(vi+Iw*Mr,xo+jw*Mr,Fh*Mr+zw*Mr,0,Math.PI*2),I.fillStyle=Bw,I.fill(),I.beginPath(),I.arc(vi,xo,Fh*Mr,0,Math.PI*2),I.fillStyle=$t.color,I.fill(),I.strokeStyle="white",I.lineWidth=Xm*Mr,I.stroke()}const{x:Le,y:Be,width:Fe}=$t.anchor,Ae=$t.textBackgroundColor,_n=$t.textColor??"#ffffff",qe=$t.textFontSize??Us,rr=$t.textBold?700:400,lr=$t.textItalic?"italic ":"",xr=x4($t.description||""),ii=v4(xr.length,qe);Ae!=null&&Ae!=="transparent"&&(I.fillStyle=Ae,Ct(Le,Be,Fe,ii,Fw),I.fill()),I.font=`${lr}${rr} ${qe}px ${Wo.current}`,I.fillStyle=_n,I.textBaseline="top";const Wr=Le+ag+p2;let mr=Be+ag+s_;for(const Mr of xr){I.fillText(Mr,Wr,mr);const vi=mr+qe*.9,xo=I.measureText(Mr).width;$t.textUnderline&&(I.strokeStyle=_n,I.lineWidth=1,I.beginPath(),I.moveTo(Wr,vi+1),I.lineTo(Wr+xo,vi+1),I.stroke()),$t.textStrike&&(I.strokeStyle=_n,I.lineWidth=1,I.beginPath(),I.moveTo(Wr,mr+qe*.55),I.lineTo(Wr+xo,mr+qe*.55),I.stroke()),mr+=qe*Gh}},Ze=$t=>{if($t.calloutHidden||$t.anchor.type==="text"||$t.anchor.type==="redact")return;const Le=nt[$t.id];if(!Le)return;const{x:Be,y:Fe,width:Ae,height:_n}=Le,qe=d4*m4(Bt($t)),rr=qe,lr=Be+rr,xr=Fe+rr,ii=Math.max(0,Ae-2*rr),Wr=Math.max(0,_n-2*rr);let mr=0,Mr=0,vi=[];const xo=[],Kc=($t.textFontSize??Us)*l4;if(Mr=Math.round(Kc*Gh),$t.description){I.save();const Xr=ii-h2*2,Bo=document.createElement("div");let Br=$t.description;Br=Br.replace(/<br\s*\/?>/gi,`
233
+ `),Br=Br.replace(/<p[^>]*>/gi,""),Br=Br.replace(/<\/p>/gi,`
234
+ `),Br=Br.replace(/<div[^>]*>/gi,""),Br=Br.replace(/<\/div>/gi,`
235
+ `),Bo.innerHTML=Br;const Lo=[],Ps=(wr,fs,gl,Mf,ih,oh)=>{if(wr.nodeType===Node.TEXT_NODE)wr.textContent&&Lo.push({text:wr.textContent,b:fs,i:gl,u:Mf,s:ih,fs:oh});else if(wr.nodeType===Node.ELEMENT_NODE){const yl=wr,ra=yl.style||{},Ep=fs||yl.tagName==="B"||yl.tagName==="STRONG"||ra.fontWeight==="bold"||parseInt(ra.fontWeight||"0")>=600,Tp=gl||yl.tagName==="I"||yl.tagName==="EM"||ra.fontStyle==="italic",sh=Mf||yl.tagName==="U"||!!ra.textDecoration&&typeof ra.textDecoration=="string"&&ra.textDecoration.includes("underline"),Np=ih||yl.tagName==="S"||yl.tagName==="STRIKE"||!!ra.textDecoration&&typeof ra.textDecoration=="string"&&ra.textDecoration.includes("line-through"),ah=ra.fontSize?Number.parseFloat(ra.fontSize):Number.NaN,k0=Number.isFinite(ah)?ah:oh;for(const lh of yl.childNodes)Ps(lh,Ep,Tp,sh,Np,k0)}};for(const wr of Bo.childNodes)Ps(wr,!1,!1,!1,!1,Kc);const oo=[];for(const wr of Lo){const fs=wr.text.split(/([ \n])/);for(const gl of fs)gl&&oo.push({text:gl,b:wr.b,i:wr.i,u:wr.u,s:wr.s,fs:wr.fs})}let Pr=[],Fr=0;const Sa=(wr,fs,gl)=>`${fs?"italic ":""}${wr?"600":"400"} ${gl}px ${Wo.current}`;for(const wr of oo){if(wr.text===`
236
+ `){xo.push({tokens:Pr,width:Fr}),Pr=[],Fr=0;continue}I.font=Sa(wr.b,wr.i,wr.fs);const fs=I.measureText(wr.text).width;if(wr.text===" ")Pr.push(wr),Fr+=fs;else if(Fr+fs>Xr&&Pr.length>0){for(;Pr.length>0&&Pr[Pr.length-1].text===" ";)Pr.pop();xo.push({tokens:Pr,width:Fr}),Pr=[wr],Fr=fs}else Pr.push(wr),Fr+=fs}Pr.length>0&&xo.push({tokens:Pr,width:Fr}),xo.length>0&&xo[0].tokens.length===0&&xo.length>1,vi=xo.map(wr=>{const fs=wr.tokens.reduce((gl,Mf)=>Math.max(gl,Mf.fs),Kc);return Math.round(fs*Gh)}),mr=vi.reduce((wr,fs)=>wr+fs,0)+d2+h4,I.restore()}const na=!!$t.description,Af=$t.image?f4:0;let Nu=na?mr:$t.image?0:Wr,Xl=$t.image?Wr-Nu:0;$t.image&&Xl<Af&&(Xl=Af,Nu=Math.max(0,Wr-Xl));const Jc=$t.descPos==="above"?xr+Nu:xr,_u=$t.descPos==="above"?xr:xr+Xl;I.save(),Ct(Be,Fe,Ae,_n,u2),I.clip();const ml=$t.theme==="light"&&na,Zc=$t.textColor??(ml?"#111111":"#d0d0d0"),Qc=$t.textBackgroundColor===null?"rgba(0,0,0,0)":$t.textBackgroundColor??(ml?"rgba(245,245,250,0.98)":"rgba(10,10,16,0.88)");if(I.fillStyle=Qc,I.fillRect(Be,Fe,Ae,_n),$t.image){const Xr=vt.get($t.id)??null;if(Xr){const Bo=Xr.width/Xr.height,Br=ii/Xl;let Lo=0,Ps=0,oo=Xr.width,Pr=Xr.height;Bo>Br?(oo=Pr*Br,Lo=(Xr.width-oo)/2):(Pr=oo/Br,Ps=(Xr.height-Pr)/2),I.drawImage(Xr,Lo,Ps,oo,Pr,lr,Jc,ii,Xl)}I.strokeStyle=$t.color+"44",I.lineWidth=1*de,I.beginPath(),$t.descPos==="above"?na&&(I.moveTo(lr,Jc),I.lineTo(lr+ii,Jc)):na&&(I.moveTo(lr,_u),I.lineTo(lr+ii,_u)),I.stroke()}if($t.description){let Xr=_u+d2;const Bo=lr+h2;I.textAlign="left",I.textBaseline="top";const Br=(Lo,Ps,oo)=>`${Ps?"italic ":""}${Lo?"600":"400"} ${oo}px ${Wo.current}`;for(let Lo=0;Lo<xo.length;Lo+=1){const Ps=xo[Lo],oo=vi[Lo]??Mr;let Pr=Bo;for(const Fr of Ps.tokens){I.font=Br(Fr.b,Fr.i,Fr.fs),I.fillStyle=Zc,I.fillText(Fr.text,Pr,Xr);const Sa=I.measureText(Fr.text).width;if(Fr.u||Fr.s){if(I.strokeStyle=Zc,I.lineWidth=1*de,I.beginPath(),Fr.u){const tu=Xr+Fr.fs*1.1;I.moveTo(Pr,tu),I.lineTo(Pr+Sa,tu)}if(Fr.s){const tu=Xr+Fr.fs*.6;I.moveTo(Pr,tu),I.lineTo(Pr+Sa,tu)}I.stroke()}Pr+=Sa}Xr+=oo}}I.restore(),Ct(Be,Fe,Ae,_n,u2),I.strokeStyle=$t.color,I.lineWidth=qe,I.stroke()};for(const $t of Vt)me($t),$t.anchor.type==="text"?Ee($t):se($t),Ze($t);const En=w==="jpeg"?"image/jpeg":"image/png",fe=it.toDataURL(En,w==="jpeg"?.92:void 0);if(_?.returnDataUrl)return fe;const Xe=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),Se=w==="jpeg"?`img_${Xe}.jpg`:`img_${Xe}.png`;if(Vf()&&await ok(fe,Se))return;const Tn=document.createElement("a");if(Tn.href=fe,Tn.download=Se,C){window.open(fe,"_blank","noopener,noreferrer");return}Tn.click()},[C]);ol.current=Wi;const va=U.useCallback(async()=>{if(!M||!X.w)return null;const w=await Wi("png",1,{returnDataUrl:!0});if(!w||typeof w!="string")return null;const{w:k,h:_}=X,N=new gn({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,Z=_*nt,ut=Math.min(j/z,G/Z),ot=z*ut,it=Z*ut,I=(j-ot)/2,Ct=(G-it)/2;return N.addImage(w,"PNG",I,Ct,ot,it),N.output("blob")},[M,X,Wi]),Xc=U.useCallback(async()=>{const w=await va();if(!w)return;const _=`collage_${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.pdf`,N=URL.createObjectURL(w);if(setTimeout(()=>URL.revokeObjectURL(N),6e4),Vf()&&await ok(N,_))return;const j=document.createElement("a");j.href=N,j.download=_,j.click()},[va]),hl=U.useCallback(async()=>{if(!(!M||!X.w||Ko)){fi(!0);try{const k=window.ClipboardItem;if(!rl||!k)return;const _=await Wi("png",1,{returnDataUrl:!0});if(!_||typeof _!="string")return;const N=uk(_);if(!N)return;const j=new k({[N.type]:N});await navigator.clipboard.write([j]),nl(!0),setTimeout(()=>nl(!1),1500)}catch{}finally{fi(!1)}}},[M,X.w,Ko,Wi,rl]),Di=U.useCallback(w=>{const k=new Date(w);Wn(k),ci(Of(k)),xs(!0)},[]),kc=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),L(w.backgroundImage),bt(w.imageSize),dt(w.sourceImageSize),lt(w.pins),Mt(w.cardPositions),tt(null),wt(null),Yr(null),qt(null),Zt(null),Te(null),dr(null),Qe(null),W(!1),jt(null),ho.current=!0,Yi.current=!0,Fn.current=[],Oo.current=[],ca(0),fo(0)},[Di]),Tu=U.useCallback(()=>Xz({backgroundImage:M,imageSize:X,sourceImageSize:Lt,pins:st,cardPositions:zt,settings:{fontId:Ei.fontId,strokeWidthScale:pi},meta:Zi}),[M,X,Lt,st,zt,Ei.fontId,pi,Zi]),rh=U.useCallback(()=>{L(null),bt({w:0,h:0}),dt(null),lt([]),Mt({}),Xt(null),tt(null),wt(null),Yr(null),qt(null),Zt(null),Te(null),dr(null),Qe(null),W(!1),jt(null),Fn.current=[],Oo.current=[],ca(0),fo(0),Ac.current=null,Vr.current=null},[]),Ac=U.useRef(null),cd=U.useRef(0),Vr=U.useRef(null),wa=U.useRef(null),pl=U.useCallback(()=>{Ac.current=null,cd.current=performance.now()+wB},[]),Wl=U.useRef(f);Wl.current=f;const Gc=U.useRef(c);Gc.current=c;const m=U.useRef(d);m.current=d;const v=U.useCallback(w=>{w&&((w.fontId==="road-ui"||w.fontId==="uaf-sans"&&g4)&&ui(w.fontId),typeof w.strokeWidthScale=="number"&&Ti(w.strokeWidthScale))},[ui,Ti]),E=U.useCallback(async w=>{kc(Wz(w)),v(w.settings),pl()},[kc,v,pl]),R=U.useCallback(async w=>{const k=await Jz(w);await new Promise((_,N)=>{To(k,!0,j=>{j?_():N(new Error("Failed to load image"))})}),pl()},[To,pl]),F=U.useCallback(()=>{const w=Vr.current;w&&(Ac.current=w.fingerprint,Wl.current?.(w.document,{dirty:!1}),wa.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=Tu,q.current.exportImage=async(w,k=1)=>{const _=await Wi(w,k,{returnDataUrl:!0});if(!_||typeof _!="string")return null;const N=w==="jpeg"?"image/jpeg":"image/png",j=uk(_);return j?{mime:N,dataUrl:_,blob:j}:null},q.current.exportPdf=va,q.current.markSaved=F,q.current.reset=rh,U.useImperativeHandle(n,()=>q.current,[]);const $=U.useRef(!1);U.useEffect(()=>{$.current||!i||($.current=!0,E(i))},[i,E]),U.useEffect(()=>{const w=Tu();if(!w){Vr.current=null;return}const k=Kz(w);(Ac.current===null||performance.now()<cd.current)&&(Ac.current=k),Vr.current={document:w,fingerprint:k};const _=k!==Ac.current;Wl.current?.(w,{dirty:_}),wa.current?.notifyChange(w,_)},[Tu]),U.useEffect(()=>{const w=iB({editor:q.current,config:{...lB(),...s},onReady:()=>Gc.current?.(),onError:k=>m.current?.(k)});return wa.current=w,()=>{w.stop(),wa.current===w&&(wa.current=null)}},[p,s]);const Q=$z({state:{backgroundImage:M,imageSize:X,sourceImageSize:Lt,pins:st,cardPositions:zt,sourceUrl:Zi?.sourceUrl,sourceTitle:Zi?.sourceTitle,capturedAt:Zi?.capturedAt},onRestore:kc,enabled:y.autosave}),{restoreDraft:at,dismissRestorePrompt:pt}=Q,Dt=U.useRef(!1);U.useEffect(()=>{if(!Dt.current&&(Dt.current=!0,!!Vf())){if(fB()){at();return}uB()&&(pt(),dB().then(w=>{if(!w){H("Не вдалося отримати знімок від розширення.");return}To(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,pt,To,Di]);const Wt=Q.errorMessage??(Q.status==="saving"?"Збереження чернетки…":Q.status==="saved"&&Q.lastSavedAt?`Чернетка збережена: ${Dd(new Date(Q.lastSavedAt))}`:Q.canRestore&&Q.storedDraftSavedAt?`Знайдено чернетку від ${Dd(new Date(Q.storedDraftSavedAt))}`:null),ht=Q.status==="error"?"#E63946":"#555",[Ot,Ht]=U.useState(null),re=U.useRef(null),Yt=U.useRef(null),[ne,ce]=U.useState(!1),ke=U.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation(),w&&tt(w),Ht({pinId:w,x:k.clientX,y:k.clientY,at:pe(k.clientX,k.clientY)})},[pe]),ye=U.useCallback(w=>{const k=hr.current.find(_=>_.id===w);k&&(re.current=Qw(k,uo.current[w]),ce(!0))},[]),Je=U.useCallback(w=>{te(),lt(k=>ak([...k,w.pin])),w.card&&Mt(k=>({...k,[w.pin.id]:w.card})),tt(w.pin.id),wt(w.pin.id),mi.current=null},[te]),Ye=U.useCallback(w=>{const k=hr.current.find(N=>N.id===w);if(!k)return;const _=bB;Je(M4(Qw(k,uo.current[w]),_,_,vl()))},[Je]),Ln=U.useCallback(w=>{const k=re.current;k&&Je(G_(k,w,vl()))},[Je]),en=U.useCallback(()=>{const{w,h:k}=Pn.current;Ln(Yt.current??{x:w/2,y:k/2})},[Ln]);Sz({isMac:b,backgroundImage:M,pinsLength:st.length,showExportMenu:Vn,sourceImageSize:Lt,imageSize:X,activePin:Y,calloutControlPinId:yt,undo:Rl,redo:eo,handleExport:Wi,handleExportPdf:Xc,stepZoom:ll,handleFitToWindow:Ws,deletePin:us,movePinZ:Va,copyPin:ye,duplicatePin:Ye,pastePinFromClipboard:en,setMode:P,setPolygonDraft:qt,setPolylineDraft:Zt,setShapeDraftType:Te,setPlacementTool:$e,setShowExportMenu:tn,beginCrop:Ul,insertCurrentDateTimeText:ti,toggleCompassMenu:Rr,toggleImageObjectMenu:io,newBgFileRef:ks,replaceBgFileRef:lc,exportMenuOpenedViaHotkeyRef:Qt}),U.useEffect(()=>{if(!mi.current)return;const w=setTimeout(()=>{mi.current=null},500);return()=>clearTimeout(w)},[yt]);const Zn=U.useMemo(()=>lg(st),[st]),[zr,Bn]=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||!M||!X.w){Bn(null);return}let w=!1;const k=setTimeout(async()=>{const _=await ol.current?.("png",gB,{returnDataUrl:!0,skipRedaction:!0});if(w||typeof _!="string")return;const N=new Image;N.onload=()=>{w||Bn(N)},N.src=_},yB);return()=>{w=!0,clearTimeout(k)}},[Ve,M,X.w,X.h,Oe,zt]);const[ei,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(_,X.w-k),G=Math.max(N,X.h-k),nt=(ut,ot,it)=>Math.max(ot,Math.min(ut,it));let z=k,Z=k;if(w.anchor.type==="point")z=w.anchor.x+k,Z=w.anchor.y+k;else if(w.anchor.type==="image")z=w.anchor.x+w.anchor.width+k,Z=w.anchor.y+k;else if(w.anchor.type==="polygon"||w.anchor.type==="polyline"){const ut=jn[w.id];ut&&(z=ut.maxX+k,Z=ut.maxY+k)}else if(w.anchor.type==="rectangle"){const{x:ut,y:ot,width:it,height:I,rotation:Ct=0}=w.anchor,It=ut+it/2,St=ot+I/2,Et=Ct*Math.PI/180,vt=Math.cos(Et),Bt=Math.sin(Et),Vt=[{lx:-it/2,ly:-I/2},{lx:it/2,ly:-I/2},{lx:it/2,ly:I/2},{lx:-it/2,ly:I/2}].map(Ee=>({x:It+Ee.lx*vt-Ee.ly*Bt,y:St+Ee.lx*Bt+Ee.ly*vt})),me=Math.max(...Vt.map(Ee=>Ee.x)),se=Math.max(...Vt.map(Ee=>Ee.y));z=me+k,Z=se+k}else if(w.anchor.type==="ellipse"){const{cx:ut,cy:ot,rx:it,ry:I,rotation:Ct=0}=w.anchor,It=Ct*Math.PI/180,St=Math.cos(It),Et=Math.sin(It),vt=Math.sqrt((it*St)**2+(I*Et)**2),Bt=Math.sqrt((it*Et)**2+(I*St)**2);z=ut+vt+k,Z=ot+Bt+k}else if(w.anchor.type==="compass")z=w.anchor.cx+w.anchor.radius+k,Z=w.anchor.cy+w.anchor.radius+k;else if(w.anchor.type==="arrow"){const ut=[w.anchor.start,w.anchor.end,w.anchor.control],ot=Math.max(...ut.map(I=>I.x)),it=Math.max(...ut.map(I=>I.y));z=ot+k,Z=it+k}return{x:nt(z,_,j),y:nt(Z,N,G)}},[X.h,X.w,jn]),ji=w=>{const k=a2(w,st);return k!==null&&Dw(k)},zi=jl,Or=jl,ni=Ys.current?.getBoundingClientRect()??null,Bi=go.current?.getBoundingClientRect()??null,ri=pa.current?.getBoundingClientRect()??null,Un=Bl.current?.getBoundingClientRect()??null,wn=!!M&&X.w>0,_r=fc.current?.getBoundingClientRect()??null,nr=Io.current?.getBoundingClientRect()??null;return T.jsxs("div",{ref:Ba,style:{display:"flex",flexDirection:"column",height:"100dvh",minHeight:"100vh",background:"#08080d",color:"#ddd",fontFamily:Gn},onClick:()=>{if(Ni.current){Ni.current=!1;return}tt(null),wt(null),tn(!1),Ao(!1),xt(!1),ge(!1),He(!1),Eo(!1)},onDragOver:w=>{w.dataTransfer?.types?.includes("Files")&&(w.preventDefault(),w.dataTransfer.dropEffect="copy",_s(!0))},onDragLeave:w=>{const k=w.relatedTarget;k&&Ba.current?.contains(k)||_s(!1)},onDrop:()=>{_s(!1)},children:[T.jsxs("div",{ref:Fa,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}),!jl&&T.jsx("span",{style:{fontWeight:700,letterSpacing:"0.03em"},children:"Тиць"}),M?T.jsxs(T.Fragment,{children:[T.jsx(Sr,{title:"Створити новий колаж (виноски будуть видалені)",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Q.clearDraft(),L(null),bt({w:0,h:0}),dt(null),lt([]),Mt({}),tt(null),wt(null),Yr(null),qt(null),Zt(null),Te(null),Qe(null),$e("point"),Qe(null),dr(null),W(!1),xt(!1),jt(null),tn(!1),_s(!1),Fn.current=[],Oo.current=[],ca(0),fo(0),P("select"),$e("point"),mo(1)},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-file-earmark-plus`,style:{fontSize:ir},"aria-hidden":!0}),!vn&&"Нове"]})}),T.jsx(Sr,{title:"Замінити фон, зберегти виноски",onClick:()=>lc.current?.click(),children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-arrow-repeat`,style:{fontSize:ir},"aria-hidden":!0}),!vn&&"Замінити"]})}),T.jsxs("div",{ref:Ys,style:{position:"relative"},children:[T.jsx(Sr,{title:`Обрізати фон (${hn(oe.toolCrop,{isMac:b})})`,tooltip:`Обрізати фон (${hn(oe.toolCrop,{isMac:b})})`,onClick:Ul,disabled:!M,active:V,hotkeyParts:Ai(oe.toolCrop,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-crop`,style:{fontSize:ir,display:"block",lineHeight:1,transform:"translate(-1px, -1px)"},"aria-hidden":!0}),!vn&&"Crop"]})}),V&&T.jsxs("div",{style:{position:"fixed",top:ni?ni.bottom+6:0,left:ni?ni.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(Sr,{title:"Обрати формат обрізки",onClick:()=>xt(w=>!w),children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:128,whiteSpace:"nowrap"},children:T.jsx("span",{children:`${fk.find(w=>w.id===gt)?.label??"Вільний формат"}`})})}),kt&&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:fk.map(w=>{const k=w.id===gt;return T.jsxs("button",{type:"button",onClick:()=>{qa(w.id),xt(!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:Gn,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(Sr,{title:"Скасувати crop",onClick:Ha,children:T.jsx("i",{className:`${$n} bi-x-lg`,style:{fontSize:ir-1},"aria-hidden":!0})}),T.jsx(Sr,{primary:!0,title:"Застосувати crop",onClick:()=>{ns()},disabled:J,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-check-lg`,style:{fontSize:ir},"aria-hidden":!0}),!vn&&(J?"Обробка…":"Застосувати")]})})]})]}),T.jsx("input",{ref:ks,type:"file",accept:"image/*",style:{display:"none"},onChange:Xs}),T.jsx("input",{ref:lc,type:"file",accept:"image/*",style:{display:"none"},onChange:hc})]}):T.jsxs(T.Fragment,{children:[T.jsx(Sr,{title:"Завантажити фонове зображення",onClick:()=>ks.current?.click(),children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-image`,style:{fontSize:ir},"aria-hidden":!0}),!vn&&"Нове зображення"]})}),T.jsx("input",{ref:ks,type:"file",accept:"image/*",style:{display:"none"},onChange:Xs})]})]}),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(Sr,{disabled:!M,active:K==="place"&&At===null&&Rt===null&&_e===null&&De==="point",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),$e("point")},title:`${K==="place"&&At===null&&!_e?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${hn(oe.toolPoint,{isMac:b})})`,tooltip:`${K==="place"&&At===null&&!_e?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${hn(oe.toolPoint,{isMac:b})})`,hotkeyParts:Ai(oe.toolPoint,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-pin-map`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Точка"]})}),T.jsxs("div",{ref:go,style:{position:"relative"},children:[T.jsx(Sr,{disabled:!M,active:K==="place"&&At!==null,onClick:()=>{P("place"),qt([]),Zt(null),Te(null),Qe(null),$e("point")},title:`${K==="place"&&At!==null?"Клік — додати вершину; тягніть вершину — перемістити; «Готово» — закрити":"Додати район (полігон)"} (${hn(oe.toolRegion,{isMac:b})})`,tooltip:`${K==="place"&&At!==null?"Клік — додати вершину; тягніть вершину — перемістити; подвійний клік, клік на першу точку або «Готово» — закрити район":"Додати район (полігон). Кліки задають вершини."} (${hn(oe.toolRegion,{isMac:b})})`,hotkeyParts:Ai(oe.toolRegion,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-hexagon`,style:{fontSize:ir},"aria-hidden":!0}),!vn&&"Район"]})}),At!==null&&T.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:Bi?Bi.bottom+6:0,left:Bi?Bi.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(Sr,{title:"Скасувати район",onClick:()=>qt(null),children:T.jsx("i",{className:`${$n} bi-x-lg`,style:{fontSize:ir-1},"aria-hidden":!0})}),T.jsx(pk,{canUndo:Me,canRedo:le,onUndo:Rl,onRedo:eo,isMac:b}),T.jsx(Sr,{accent:!0,title:"Завершити район із поточних вершин",tooltip:"Завершити район із поточних вершин",onClick:yi,disabled:At.length<2,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-check-lg`,style:{fontSize:ir},"aria-hidden":!0}),!zi&&`Готово (${At.length})`]})})]})]}),T.jsxs("div",{ref:pa,style:{position:"relative"},children:[T.jsx(Sr,{disabled:!M,active:K==="place"&&Rt!==null,onClick:()=>{P("place"),qt(null),Zt([]),Te(null),Qe(null),$e("point")},title:`${K==="place"&&Rt!==null?"Клік — додати точку маршруту; «Готово» — завершити":"Додати маршрут (полілінія)"} (${hn(oe.toolRoute,{isMac:b})})`,tooltip:`${K==="place"&&Rt!==null?"Клік — додати точку; тягніть вершину — перемістити; подвійний клік або «Готово» — завершити маршрут (без замикання)":"Додати маршрут (полілінія). Кліки задають точки; лінія не замикається."} (${hn(oe.toolRoute,{isMac:b})})`,hotkeyParts:Ai(oe.toolRoute,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("svg",{width:ir,height:ir,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"})}),!vn&&"Маршрут"]})}),Rt!==null&&T.jsxs("div",{onClick:w=>w.stopPropagation(),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(Sr,{title:"Скасувати маршрут",onClick:()=>Zt(null),children:T.jsx("i",{className:`${$n} bi-x-lg`,style:{fontSize:ir-1},"aria-hidden":!0})}),T.jsx(pk,{canUndo:Me,canRedo:le,onUndo:Rl,onRedo:eo,isMac:b}),T.jsx(Sr,{accent:!0,title:"Завершити маршрут",tooltip:"Завершити маршрут із поточних точок",onClick:No,disabled:Rt.length<2,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-check-lg`,style:{fontSize:ir},"aria-hidden":!0}),!zi&&`Готово (${Rt.length})`]})})]})]}),T.jsx(Sr,{disabled:!M,active:K==="place"&&_e==="rectangle",onClick:()=>{P("place"),qt(null),Zt(null),Te("rectangle"),Qe(null),$e("point")},title:`${_e==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область"} (${hn(oe.toolRectangle,{isMac:b})})`,tooltip:`${_e==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область. Потягніть на фото для малювання."} (${hn(oe.toolRectangle,{isMac:b})})`,hotkeyParts:Ai(oe.toolRectangle,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-square`,style:{fontSize:ir-2},"aria-hidden":!0}),!vn&&"Прямокутник"]})}),T.jsx(Sr,{disabled:!M,active:K==="place"&&_e==="ellipse",onClick:()=>{P("place"),qt(null),Zt(null),Te("ellipse"),Qe(null),$e("point")},title:`${_e==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область"} (${hn(oe.toolEllipse,{isMac:b})})`,tooltip:`${_e==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область. Потягніть на фото для малювання."} (${hn(oe.toolEllipse,{isMac:b})})`,hotkeyParts:Ai(oe.toolEllipse,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-circle`,style:{fontSize:ir-2},"aria-hidden":!0}),!vn&&"Еліпс"]})}),T.jsx(Sr,{disabled:!M,active:K==="place"&&At===null&&Rt===null&&_e===null&&De==="arrow",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),Qe(null),$e("arrow")},title:`${De==="arrow"&&K==="place"?"Потягніть на фото, щоб намалювати стрілку":"Додати стрілку"} (${hn(oe.toolArrow,{isMac:b})})`,tooltip:`${De==="arrow"&&K==="place"?"Потягніть на фото, щоб намалювати стрілку; центральний важіль згинає лінію":"Додати стрілку (drag для створення, центральний важіль для вигину)."} (${hn(oe.toolArrow,{isMac:b})})`,hotkeyParts:Ai(oe.toolArrow,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-arrow-right`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Стрілка"]})}),T.jsx(Sr,{disabled:!M,active:K==="place"&&At===null&&Rt===null&&_e===null&&De==="text",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),Qe(null),$e("text")},title:`${De==="text"&&K==="place"?"Клікніть на фото, щоб додати текст":"Додати текст"} (${hn(oe.toolText,{isMac:b})})`,tooltip:`${De==="text"&&K==="place"?"Клікніть на фото, щоб додати текстову виноску":"Додати текстову виноску"} (${hn(oe.toolText,{isMac:b})})`,hotkeyParts:Ai(oe.toolText,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-type`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Текст"]})}),T.jsx(Sr,{disabled:!M,active:K==="place"&&At===null&&Rt===null&&_e===null&&De==="pointText",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),Qe(null),$e("pointText")},title:`${De==="pointText"&&K==="place"?"Клікніть на фото, щоб поставити точку з текстом":"Точка з текстом"} (${hn(oe.toolPointText,{isMac:b})})`,tooltip:`${De==="pointText"&&K==="place"?"Клікніть на фото, щоб поставити точку з підписом":"Точка з підписом, без виноски"} (${hn(oe.toolPointText,{isMac:b})})`,hotkeyParts:Ai(oe.toolPointText,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsxs("svg",{width:ir,height:ir,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:"А"})]}),!vn&&"Точка з текстом"]})}),T.jsx(Sr,{disabled:!M,active:K==="place"&&_e==="redact",onClick:()=>{P("place"),qt(null),Zt(null),Qe(null),Te("redact")},title:`Замалювати ділянку фону (${hn(oe.toolRedact,{isMac:b})})`,tooltip:`Виділіть ділянку — її можна розмити, пікселізувати або залити середнім кольором (${hn(oe.toolRedact,{isMac:b})})`,hotkeyParts:Ai(oe.toolRedact,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-droplet-half`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Замалювати"]})}),T.jsxs("div",{ref:Io,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[T.jsx(Sr,{disabled:!M,active:jo,onClick:()=>Eo(w=>!w),title:`Додати зображення (${hn(oe.toolImageObject,{isMac:b})})`,tooltip:`Покласти зображення поверх фото — можна совати й масштабувати (${hn(oe.toolImageObject,{isMac:b})})`,hotkeyParts:Ai(oe.toolImageObject,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-image`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Картинка"]})}),jo&&T.jsxs("div",{style:{position:"fixed",top:nr?nr.bottom+6:0,left:nr?nr.left+nr.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:Ua,type:"text","aria-label":"Вставте зображення з буфера",onChange:()=>{},value:"",onPaste:w=>{const k=Yy(w.clipboardData);k&&(w.preventDefault(),Rs(k))},style:{position:"absolute",width:1,height:1,opacity:0,border:"none",outline:"none",padding:0,margin:0}}),T.jsxs("button",{type:"button",onClick:()=>Sn.current?.click(),onDragOver:w=>{w.preventDefault(),ts(!0)},onDragLeave:()=>ts(!1),onDrop:w=>{w.preventDefault(),w.stopPropagation(),ts(!1);const k=Array.from(w.dataTransfer.files).find(_=>_.type.startsWith("image/"));k&&(bo(k),Eo(!1))},style:{width:260,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,padding:14,borderRadius:8,border:`2px dashed ${dc?Ju:"rgba(255,255,255,0.28)"}`,background:dc?"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:`${$n} 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:GN.join(" · ")}),T.jsxs("span",{style:{color:"rgba(255,255,255,0.45)",fontSize:11,lineHeight:1.5},children:["або клікніть, щоб вибрати файл",T.jsx("br",{}),"чи вставте з буфера (",zd(),")"]})]})]})]}),T.jsx(Sr,{disabled:!M,active:K==="place"&&At===null&&Rt===null&&_e===null&&De==="standalone",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),Qe(null),$e("standalone")},title:`${De==="standalone"&&K==="place"?"Клікніть на фото, щоб додати блок виноски":"Додати блок виноски"} (${hn(oe.toolStandaloneCallout,{isMac:b})})`,tooltip:`${De==="standalone"&&K==="place"?"Клікніть на фото, щоб додати блок виноски без лінії та фігури":"Додати блок виноски без лінії та фігури"} (${hn(oe.toolStandaloneCallout,{isMac:b})})`,hotkeyParts:Ai(oe.toolStandaloneCallout,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-chat-square-text`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Блок"]})}),T.jsxs("div",{ref:Bl,style:{position:"relative"},children:[T.jsx(OB,{disabled:!M,menuOpen:we,onMainClick:ti,onMenuClick:er,mainTitle:Ke?`Вставити зафіксовані дату та час (${hn(oe.toolDateTime,{isMac:b})})`:`Вставити поточні дату та час (${hn(oe.toolDateTime,{isMac:b})})`,mainTooltip:Ke?`Вставляє зафіксовані дату й час: ${Dd(Pe,Hi)}`:"Додає редагований текст із поточними датою й часом у лівому нижньому куті",menuTitle:"Відкрити календар і вибір часу",menuTooltip:"Відкрити календар (3 місяці) та вибрати дату й час",hotkeyParts:Ai(oe.toolDateTime,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[T.jsx("i",{className:`${$n} bi-clock`,style:{fontSize:ir-1},"aria-hidden":!0}),Ke&&T.jsx("i",{className:`${$n} bi-lock-fill`,style:{fontSize:ir-3,opacity:.85},"aria-hidden":!0}),!vn&&"Дата/час"]})}),we&&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(A_,{value:Pe,viewMonth:Yo,format:Hi,locked:Ke,onChange:Wn,onViewMonthChange:ci,onFormatChange:Vo,onLockedChange:xs,onInsert:Qs,onNow:_o,onClose:()=>ge(!1)})})]}),T.jsx(Sr,{disabled:!M,active:K==="place"&&At===null&&Rt===null&&_e===null&&De==="numbering",onClick:()=>{P("place"),qt(null),Zt(null),Te(null),Qe(null),$e("numbering")},title:`${De==="numbering"&&K==="place"?fn?"Клікніть кінцеву точку лінії нумерації":"Клікніть початкову точку лінії нумерації":"Нумерація (2 точки: початок -> кінець)"} (${hn(oe.toolNumbering,{isMac:b})})`,tooltip:`${De==="numbering"&&K==="place"?fn?"Другий клік поставить кінець і номер на кінці":"Перший клік задає старт лінії":"Поставте старт і фініш лінії, номер буде на кінці"} (${hn(oe.toolNumbering,{isMac:b})})`,hotkeyParts:Ai(oe.toolNumbering,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-123`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Нумерація"]})}),T.jsxs("div",{ref:fc,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[T.jsx(Sr,{disabled:!M,active:We,onClick:Rr,title:`Додати компас (${hn(oe.toolCompass,{isMac:b})})`,tooltip:`Оберіть кут, щоб додати компас на зображення (${hn(oe.toolCompass,{isMac:b})})`,hotkeyParts:Ai(oe.toolCompass,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-compass`,style:{fontSize:ir-1},"aria-hidden":!0}),!vn&&"Компас"]})}),We&&T.jsx("div",{style:{position:"fixed",top:_r?_r.bottom+6:0,left:_r?_r.left+_r.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:()=>ld(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(RB,{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(Sr,{disabled:!M,title:`Зменшити масштаб (${hn(oe.zoomOut,{isMac:b})})`,onClick:()=>ll("out"),hotkeyParts:Ai(oe.zoomOut,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${$n} bi-zoom-out`,style:{fontSize:ir-2},"aria-hidden":!0})})}),!zi&&T.jsxs("span",{style:{minWidth:52,textAlign:"center",color:"#888",fontVariantNumeric:"tabular-nums"},children:[Math.round(pr*100),"%"]}),T.jsx(Sr,{disabled:!M,title:`Збільшити масштаб (${hn(oe.zoomIn,{isMac:b})})`,onClick:()=>ll("in"),hotkeyParts:Ai(oe.zoomIn,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${$n} bi-zoom-in`,style:{fontSize:ir-2},"aria-hidden":!0})})}),T.jsx(Sr,{disabled:!M,title:`Припасувати розмір зображення під розмір вікна (${hn(oe.fitToWindow,{isMac:b})})`,tooltip:`Припасувати розмір зображення під розмір вікна (${hn(oe.fitToWindow,{isMac:b})})`,onClick:Ws,hotkeyParts:Ai(oe.fitToWindow,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${$n} bi-aspect-ratio`,style:{fontSize:ir-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(Sr,{title:`Відмінити останню дію (${hn(oe.undo,{isMac:b})})`,tooltip:`Відмінити останню дію (${hn(oe.undo,{isMac:b})})`,onClick:Rl,disabled:!M||!Au,hotkeyParts:Ai(oe.undo,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:T.jsx("i",{className:`${$n} bi-arrow-counterclockwise`,style:{fontSize:ir},"aria-hidden":!0})})}),T.jsx(Sr,{title:`Повернути скасовану дію (${hn(oe.redo,{isMac:b})})`,tooltip:`Повернути скасовану дію (${hn(oe.redo,{isMac:b})})`,onClick:eo,disabled:!M||!Mu,hotkeyParts:Ai(oe.redo,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:T.jsx("i",{className:`${$n} bi-arrow-clockwise`,style:{fontSize:ir},"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(Sr,{title:M?`Швидке збереження у форматі JPEG (${hn(oe.downloadJpg,{isMac:b})})`:"Спочатку завантажте фонове зображення",onClick:()=>Wi("jpeg"),disabled:!wn,hotkeyParts:Ai(oe.downloadJpg,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} bi-download`,style:{fontSize:ir},"aria-hidden":!0}),!Or&&"JPG"]})}),T.jsx(Sr,{title:rl?"Скопіювати зображення в буфер обміну":"Ваш браузер не підтримує копіювання зображення в буфер",onClick:hl,disabled:!wn||Ko||!rl,success:ws,children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[T.jsx("i",{className:`${$n} ${Ko?"bi-arrow-repeat tyts-spin":ws?"bi-check-lg":"bi-clipboard-plus"}`,style:{fontSize:ir-2},"aria-hidden":!0}),!vn&&"Копіювати"]})}),T.jsx(Sr,{title:`Більше опцій збереження (${hn(oe.openExportMenu,{isMac:b})})`,onClick:()=>{tn(w=>!w)},disabled:!wn,hotkeyParts:Ai(oe.openExportMenu,{isMac:b}),showHotkeyBadge:Kn&&!vn,children:T.jsx("i",{className:`${$n} bi-caret-down-fill`,style:{fontSize:ir-4},"aria-hidden":!0})})]}),Vn&&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:!wn,onClick:()=>{if(!Lt)return;tn(!1);const{w}=X;if(!w)return;const k=Lt.w/w/2;Wi("png",k)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:wn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Gn,fontSize:13,cursor:wn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(Ql,{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:!wn,onClick:()=>{tn(!1),Wi("png",1)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:wn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Gn,fontSize:13,cursor:wn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(Ql,{children:Lt?"2":"1"}),T.jsxs("span",{children:["PNG"," ",T.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",X.w,"×",X.h," px"]})]})]})}),T.jsx("button",{type:"button",disabled:!wn,onClick:()=>{tn(!1),Wi("png",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:wn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Gn,fontSize:13,cursor:wn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(Ql,{children:Lt?"3":"2"}),T.jsxs("span",{children:["PNG ×2"," ",T.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",X.w*2,"×",X.h*2," px"]})]})]})}),T.jsx("button",{type:"button",disabled:!wn,onClick:()=>{tn(!1),Wi("jpeg",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:wn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Gn,fontSize:13,cursor:wn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(Ql,{children:Lt?"4":"3"}),T.jsxs("span",{children:["JPG ×2"," ",T.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",X.w*2,"×",X.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:!wn,onClick:()=>{tn(!1),Xc()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:wn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Gn,fontSize:13,cursor:wn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(Ql,{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:!wn,onClick:()=>{tn(!1),st.length>0&&window.print()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:wn?"#fff":"rgba(255,255,255,0.35)",fontFamily:Gn,fontSize:13,cursor:wn?"pointer":"not-allowed"},children:T.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[T.jsx(Ql,{children:Lt?"6":"5"}),T.jsx("span",{children:"Друк… (діалог друку)"})]})})]})]})]}),T.jsx("div",{ref:vr,style:{flex:1,minHeight:0,overflow:M?"auto":"hidden",position:"relative",touchAction:"none"},onClick:w=>w.stopPropagation(),onPointerDown:w=>{if(!M||!vr.current)return;const k=w.target,_=g&&w.pointerType!=="mouse";if(_&&(Nr.current.set(w.pointerId,{x:w.clientX,y:w.clientY}),Nr.current.size>=2)){const z=Array.from(Nr.current.values()),Z=z[0],ut=z[1],ot=Math.hypot(ut.x-Z.x,ut.y-Z.y);if(ot>0){const it=vr.current.getBoundingClientRect(),I=(Z.x+ut.x)/2,Ct=(Z.y+ut.y)/2,It=I-it.left,St=Ct-it.top,Et=pr||1,vt=(vr.current.scrollLeft+It)/Et,Bt=(vr.current.scrollTop+St)/Et;es.current={active:!0,startDistance:ot,startZoom:Et,anchorImageX:vt,anchorImageY:Bt},hi.current.isPanning=!1,vr.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(),Yi.current=!1,hi.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:vr.current.scrollLeft,startScrollTop:vr.current.scrollTop},vr.current.style.cursor="grabbing")},onPointerMove:w=>{const k=vr.current;if(!k)return;g&&w.pointerType!=="mouse"&&Nr.current.has(w.pointerId)&&Nr.current.set(w.pointerId,{x:w.clientX,y:w.clientY});const N=es.current;if(N?.active&&Nr.current.size>=2){const z=Array.from(Nr.current.values()),Z=z[0],ut=z[1],ot=Math.hypot(ut.x-Z.x,ut.y-Z.y);if(ot>0&&N.startDistance>0){const it=k.getBoundingClientRect(),I=(Z.x+ut.x)/2-it.left,Ct=(Z.y+ut.y)/2-it.top,It=ot/N.startDistance,St=Math.min(xm,Math.max(bm,+(N.startZoom*It).toFixed(vm))),Et=Pn.current.w*St,vt=Pn.current.h*St;k.scrollLeft=Math.max(0,Math.min(Et-k.clientWidth,N.anchorImageX*St-I)),k.scrollTop=Math.max(0,Math.min(vt-k.clientHeight,N.anchorImageY*St-Ct)),Yi.current=!1,mo(St)}w.preventDefault();return}const j=hi.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=vr.current;k&&(Nr.current.has(w.pointerId)&&Nr.current.delete(w.pointerId),Nr.current.size<2&&(es.current=null),hi.current.isPanning=!1,k.style.cursor="default")},onPointerCancel:w=>{const k=vr.current;k&&(Nr.current.has(w.pointerId)&&Nr.current.delete(w.pointerId),Nr.current.size<2&&(es.current=null),hi.current.isPanning=!1,k.style.cursor="default")},onMouseDown:w=>{if(!M||!vr.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(),Yi.current=!1,hi.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:vr.current.scrollLeft,startScrollTop:vr.current.scrollTop},vr.current.style.cursor="grabbing")},onMouseMove:w=>{const k=hi.current,_=vr.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=vr.current;w&&(hi.current.isPanning=!1,w.style.cursor="default")},onMouseLeave:()=>{const w=vr.current;w&&(hi.current.isPanning=!1,w.style.cursor="default")},children:M?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:X.w*pr,height:X.h*pr,position:"relative"},children:T.jsx("div",{ref:cc,style:{transform:`scale(${pr})`,transformOrigin:"top left",width:X.w,height:X.h},children:T.jsxs("svg",{ref:Jo,width:X.w,height:X.h,viewBox:`0 0 ${X.w} ${X.h}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",cursor:V?"default":K==="place"?"crosshair":"default",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},onContextMenu:w=>{V||ke(null,w)},onPointerDown:w=>ma(w),onMouseDown:ma,onPointerMove:w=>ar(w),onMouseMove:ar,onClick:br,onDoubleClick:()=>{At&&At.length>=2&&yi(),Rt&&Rt.length>=2&&No()},children:[T.jsx("image",{href:M,x:0,y:0,width:X.w,height:X.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:X.w,height:X.h,fill:"url(#vignette)",pointerEvents:"none","data-background":"true"}),V&&rt&&T.jsxs("g",{children:[T.jsx("rect",{x:0,y:0,width:X.w,height:rt.y,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:0,y:rt.y+rt.height,width:X.w,height:Math.max(0,X.h-rt.y-rt.height),fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:0,y:rt.y,width:rt.x,height:rt.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:rt.x+rt.width,y:rt.y,width:Math.max(0,X.w-rt.x-rt.width),height:rt.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),T.jsx("rect",{x:rt.x,y:rt.y,width:rt.width,height:rt.height,fill:"rgba(78,205,196,0.12)",stroke:"#4ECDC4",strokeWidth:2*de,style:{cursor:"move"},onPointerDown:w=>Gs(w),onMouseDown:Gs}),[{key:"nw",x:rt.x,y:rt.y,cursor:"nwse-resize"},{key:"ne",x:rt.x+rt.width,y:rt.y,cursor:"nesw-resize"},{key:"se",x:rt.x+rt.width,y:rt.y+rt.height,cursor:"nwse-resize"},{key:"sw",x:rt.x,y:rt.y+rt.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))]}),At&&At.length>0&&T.jsxs("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"none",children:[At.length>=2&&T.jsx("polyline",{points:At.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*de} ${4*de}`,pointerEvents:"none"}),At.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:_=>pc(k,_),onMouseDown:_=>pc(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:_=>Cu(k,_),onMouseDown:_=>Cu(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})}),ze&&T.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*de,fill:"none",pointerEvents:"none",children:T.jsx("path",{d:`M ${ze.start.x} ${ze.start.y} Q ${ze.control.x} ${ze.control.y} ${ze.end.x} ${ze.end.y}`,strokeDasharray:`${6*de} ${4*de}`})}),fn&&bn&&K==="place"&&De==="numbering"&&T.jsx("g",{stroke:"#4ECDC4",fill:"none",pointerEvents:"none",children:T.jsx("line",{x1:fn.x,y1:fn.y,x2:bn.x,y2:bn.y,strokeWidth:2*de,strokeDasharray:`${6*de} ${4*de}`})}),Zn.map(w=>T.jsxs("g",{onContextMenu:k=>ke(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=ny(k,st);return N?T.jsx(wz,{anchor:N,card:_,color:k.color,widthScale:or(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(e8,{x:_,y:N,color:k.color,label:k.label,widthScale:or(k),active:Y===k.id,onPointerDown:j=>Ks(k.id,j),onMouseDown:j=>Ks(k.id,j),onClick:j=>{if(j.stopPropagation(),ue.current){ue.current=!1;return}tt(G=>G===k.id?null:k.id),wt(null)}},k.id+"-pin")}),st.filter(k=>k.id===w.id&&k.anchor.type==="numbering").map(k=>{const{start:_,end:N}=k.anchor,j=Y===k.id,G=or(k),nt=String(k.label),z=14*de,Z=.075*z,ut=.4*z,ot=.35*z,I=Math.max(z*.62,nt.length*.62*z)+ut*2,Ct=z+Z+ot,It=N.x-I/2,St=N.y-Ct/2,Et=14*de,vt=4*de,Bt=7*de,Vt=6*de,me=Bt*2+Et*Ml.length+vt*Math.max(0,Ml.length-1),se=Vt*2+Et,Ee=10*de,Ze=N.x-me/2,En=Math.max(0,Math.min(Ze,X.w-me)),fe=St-Ee-se,Xe=Math.max(0,Math.min(fe,X.h-se)),Se=24*de,Tn=6*de,$t=En+me+Tn,Le=En-Se-Tn,Be=$t+Se<=X.w?$t:Le>=0?Le:Math.max(0,Math.min($t,X.w-Se)),Fe=Math.max(0,Math.min(Xe+se/2-Se/2,X.h-Se));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:Ae=>Ds(k.id,Ae),onMouseDown:Ae=>Ds(k.id,Ae),onClick:Ae=>{if(Ae.stopPropagation(),ue.current){ue.current=!1;return}tt(_n=>_n===k.id?null:k.id),wt(null)}}),T.jsx("rect",{x:It,y:St,width:I,height:Ct,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:Ae=>ga(k.id,"start",Ae),onMouseDown:Ae=>ga(k.id,"start",Ae)}),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:Ae=>ga(k.id,"end",Ae),onMouseDown:Ae=>ga(k.id,"end",Ae)})]}),j&&T.jsx("foreignObject",{x:En,y:Xe,width:me,height:se,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Ae=>Ae.stopPropagation(),onMouseDown:Ae=>Ae.stopPropagation(),onClick:Ae=>Ae.stopPropagation(),style:{width:me,height:se,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Vt}px ${Bt}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:`${vt}px`},children:Ml.map(Ae=>T.jsx("button",{type:"button",title:`Колір ${Ae}`,onClick:()=>ba(k.id,Ae),style:{width:Et,height:Et,borderRadius:"50%",border:k.color===Ae?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:Ae,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${k.id}-num-color-${Ae}`))})})}),j&&T.jsx("foreignObject",{x:Be,y:Fe,width:Se,height:Se,children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Ae=>Ae.stopPropagation(),onMouseDown:Ae=>Ae.stopPropagation(),onClick:Ae=>Ae.stopPropagation(),children:T.jsx("button",{type:"button",title:"Видалити",onClick:()=>us(k.id),style:{width:Se,height:Se,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:`${$n} 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(pr,1e-4),j=1.5*de*N,G=yt===k.id,nt=or(k),{minX:z,minY:Z,maxX:ut,maxY:ot}=jn[k.id],it=ut-z,I=ot-Z,Ct=Td({minX:z,minY:Z,maxX:ut,maxY:ot},X.w,X.h,N),It=[{cx:z,cy:Z,handle:"nw"},{cx:z+it/2,cy:Z,handle:"n"},{cx:ut,cy:Z,handle:"ne"},{cx:ut,cy:Z+I/2,handle:"e"},{cx:ut,cy:ot,handle:"se"},{cx:z+it/2,cy:ot,handle:"s"},{cx:z,cy:ot,handle:"sw"},{cx:z,cy:Z+I/2,handle:"w"}],St=Xy(It,_,N),Et=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("polygon",{points:_.map(vt=>`${vt.x},${vt.y}`).join(" "),fill:ay(k.color,k.fillStyle),stroke:k.color,strokeWidth:(G?3:2.5)*de*nt,strokeDasharray:Vu(k)?Fm(nt):void 0,style:G?{cursor:"grab"}:void 0,onPointerDown:vt=>{G&&(vt.stopPropagation(),rs(k.id,vt))},onMouseDown:vt=>{G&&(vt.stopPropagation(),rs(k.id,vt))},onClick:vt=>{if(vt.stopPropagation(),ue.current){ue.current=!1;return}tt(Bt=>Bt===k.id?null:k.id),wt(k.id)}}),G&&_.map((vt,Bt)=>T.jsx("circle",{cx:vt.x,cy:vt.y,r:8*de*N,fill:k.color,stroke:"white",strokeWidth:2*de*N,style:{cursor:"grab"},onPointerDown:Vt=>Eu(k.id,Bt,Vt),onMouseDown:Vt=>Eu(k.id,Bt,Vt),onDoubleClick:Vt=>Sf(k.id,Bt,Vt)},`v-${Bt}`)),G&&_.map((vt,Bt)=>{const Vt=_.length,me=_[Bt],se=_[(Bt+1)%Vt],Ee=(me.x+se.x)/2,Ze=(me.y+se.y)/2;return T.jsx("circle",{cx:Ee,cy:Ze,r:6*de*N,fill:"white",stroke:k.color,strokeWidth:j,style:{cursor:"pointer"},onPointerDown:En=>ul(k.id,Bt,En),onMouseDown:En=>ul(k.id,Bt,En)},`m-${Bt}`)}),G&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:z,y:Z,width:it,height:I,fill:"none",stroke:k.color,strokeWidth:j,strokeDasharray:`${6*de*N} ${4*de*N}`,opacity:.8,style:{pointerEvents:"none"}}),St.map(({cx:vt,cy:Bt,handle:Vt})=>T.jsx("rect",{x:vt-kl*N,y:Bt-kl*N,width:kl*2*N,height:kl*2*N,fill:"white",stroke:k.color,strokeWidth:j,style:{cursor:Et(Vt)},onPointerDown:me=>gc(k.id,Vt,me),onMouseDown:me=>gc(k.id,Vt,me)},`bbox-${Vt}`))]}),G&&T.jsx("g",{transform:`translate(${Ct.cx}, ${Ct.cy})`,style:{cursor:"move"},onPointerDown:vt=>Vi(k.id,vt),onMouseDown:vt=>Vi(k.id,vt),children:T.jsx(Nd,{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(pr,1e-4),j=1.5*de*N,G=yt===k.id,nt=or(k),{minX:z,minY:Z,maxX:ut,maxY:ot}=jn[k.id],it=ut-z,I=ot-Z,Ct=Td({minX:z,minY:Z,maxX:ut,maxY:ot},X.w,X.h,N),It=[{cx:z,cy:Z,handle:"nw"},{cx:z+it/2,cy:Z,handle:"n"},{cx:ut,cy:Z,handle:"ne"},{cx:ut,cy:Z+I/2,handle:"e"},{cx:ut,cy:ot,handle:"se"},{cx:z+it/2,cy:ot,handle:"s"},{cx:z,cy:ot,handle:"sw"},{cx:z,cy:Z+I/2,handle:"w"}],St=Xy(It,_,N),Et=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("polyline",{points:_.map(vt=>`${vt.x},${vt.y}`).join(" "),fill:"none",stroke:k.color,strokeWidth:(G?3:2.5)*de*nt,strokeDasharray:Vu(k)?Fm(nt):void 0,style:G?{cursor:"grab"}:void 0,onPointerDown:vt=>{G&&(vt.stopPropagation(),is(k.id,vt))},onMouseDown:vt=>{G&&(vt.stopPropagation(),is(k.id,vt))},onClick:vt=>{if(vt.stopPropagation(),ue.current){ue.current=!1;return}tt(Bt=>Bt===k.id?null:k.id),wt(k.id)}}),G&&_.map((vt,Bt)=>T.jsx("circle",{cx:vt.x,cy:vt.y,r:8*de*N,fill:k.color,stroke:"white",strokeWidth:2*de*N,style:{cursor:"grab"},onPointerDown:Vt=>Hc(k.id,Bt,Vt),onMouseDown:Vt=>Hc(k.id,Bt,Vt),onDoubleClick:Vt=>yo(k.id,Bt,Vt)},`v-${Bt}`)),G&&_.slice(0,-1).map((vt,Bt)=>{const Vt=_[Bt],me=_[Bt+1],se=(Vt.x+me.x)/2,Ee=(Vt.y+me.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:Ze=>qc(k.id,Bt,Ze),onMouseDown:Ze=>qc(k.id,Bt,Ze)},`m-${Bt}`)}),G&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:z,y:Z,width:it,height:I,fill:"none",stroke:k.color,strokeWidth:j,strokeDasharray:`${6*de*N} ${4*de*N}`,opacity:.8,style:{pointerEvents:"none"}}),St.map(({cx:vt,cy:Bt,handle:Vt})=>T.jsx("rect",{x:vt-kl*N,y:Bt-kl*N,width:kl*2*N,height:kl*2*N,fill:"white",stroke:k.color,strokeWidth:j,style:{cursor:Et(Vt)},onPointerDown:me=>$c(k.id,Vt,me),onMouseDown:me=>$c(k.id,Vt,me)},`bbox-${Vt}`))]}),G&&T.jsx("g",{transform:`translate(${Ct.cx}, ${Ct.cy})`,style:{cursor:"move"},onPointerDown:vt=>Hl(k.id,vt),onMouseDown:vt=>Hl(k.id,vt),children:T.jsx(Nd,{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(pr,1e-4),nt=yt===k.id,z=or(k),Z=[_,N,j],ut=Math.min(...Z.map(Se=>Se.x)),ot=Math.min(...Z.map(Se=>Se.y)),it=Math.max(...Z.map(Se=>Se.x)),I=Math.max(...Z.map(Se=>Se.y)),Ct=it-ut,It=I-ot,St=Td({minX:ut,minY:ot,maxX:it,maxY:I},X.w,X.h,G),Et=[{cx:ut,cy:ot,handle:"nw"},{cx:ut+Ct/2,cy:ot,handle:"n"},{cx:it,cy:ot,handle:"ne"},{cx:it,cy:ot+It/2,handle:"e"},{cx:it,cy:I,handle:"se"},{cx:ut+Ct/2,cy:I,handle:"s"},{cx:ut,cy:I,handle:"sw"},{cx:ut,cy:ot+It/2,handle:"w"}],vt=Xy(Et,Z,G),Bt=Se=>Se==="n"||Se==="s"?"ns-resize":Se==="e"||Se==="w"?"ew-resize":Se==="nw"||Se==="se"?"nwse-resize":"nesw-resize",Vt=lk(j,N),me=Math.atan2(Vt.y,Vt.x),se=12*de*G,Ee=Math.PI/7,Ze=N.x-Math.cos(me-Ee)*se,En=N.y-Math.sin(me-Ee)*se,fe=N.x-Math.cos(me+Ee)*se,Xe=N.y-Math.sin(me+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:Se=>{nt&&xc(k.id,Se)},onMouseDown:Se=>{nt&&xc(k.id,Se)},onClick:Se=>{if(Se.stopPropagation(),ue.current){ue.current=!1;return}tt(Tn=>Tn===k.id?null:k.id),wt(k.id)}}),T.jsx("path",{d:`M ${N.x} ${N.y} L ${Ze} ${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:ot,width:Ct,height:It,fill:"none",stroke:k.color,strokeWidth:1.5*de*G,strokeDasharray:`${6*de*G} ${4*de*G}`,opacity:.8,style:{pointerEvents:"none"}}),vt.map(({cx:Se,cy:Tn,handle:$t})=>T.jsx("rect",{x:Se-kl*G,y:Tn-kl*G,width:kl*2*G,height:kl*2*G,fill:"white",stroke:k.color,strokeWidth:1.5*de*G,style:{cursor:Bt($t)},onPointerDown:Le=>$a(k.id,$t,Le),onMouseDown:Le=>$a(k.id,$t,Le)},`arrow-bbox-${$t}`)),T.jsx("g",{transform:`translate(${St.cx}, ${St.cy})`,style:{cursor:"move"},onPointerDown:Se=>vc(k.id,Se),onMouseDown:Se=>vc(k.id,Se),children:T.jsx(Nd,{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:Se=>Js(k.id,"start",Se),onMouseDown:Se=>Js(k.id,"start",Se)}),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:Se=>Js(k.id,"end",Se),onMouseDown:Se=>Js(k.id,"end",Se)}),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:Se=>Js(k.id,"control",Se),onMouseDown:Se=>Js(k.id,"control",Se)})]})]},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(pr,1e-4),Z=yt===k.id,ut=or(k),ot=_+j/2,it=N+G/2,I=nt*Math.PI/180,Ct=Math.cos(I),It=Math.sin(I),St=(Vt,me)=>({cx:ot+Vt*Ct-me*It,cy:it+Vt*It+me*Ct}),Et=[{...St(-j/2,-G/2),handle:"nw"},{...St(0,-G/2),handle:"n"},{...St(j/2,-G/2),handle:"ne"},{...St(j/2,0),handle:"e"},{...St(j/2,G/2),handle:"se"},{...St(0,G/2),handle:"s"},{...St(-j/2,G/2),handle:"sw"},{...St(-j/2,0),handle:"w"}],vt=Td({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))},X.w,X.h,z),Bt=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} ${ot} ${it})`,children:T.jsx("rect",{x:_,y:N,width:j,height:G,fill:ay(k.color,k.fillStyle),stroke:k.color,strokeWidth:(Z?3:2.5)*de*ut,strokeDasharray:Vu(k)?Fm(ut):void 0,style:Z?{cursor:"grab"}:void 0,onPointerDown:Vt=>{Z&&(Vt.stopPropagation(),mc(k.id,Vt))},onMouseDown:Vt=>{Z&&(Vt.stopPropagation(),mc(k.id,Vt))},onClick:Vt=>{if(Vt.stopPropagation(),ue.current){ue.current=!1;return}tt(me=>me===k.id?null:k.id),wt(k.id)}})}),Z&&Et.map(({cx:Vt,cy:me,handle:se})=>T.jsx("circle",{cx:Vt,cy:me,r:Wy*z,fill:k.color,stroke:"white",strokeWidth:1.5*de*z,style:{cursor:Bt(se)},onPointerDown:Ee=>fl(k.id,se,Ee),onMouseDown:Ee=>fl(k.id,se,Ee)},se)),Z&&T.jsx("g",{transform:`translate(${vt.cx}, ${vt.cy})`,style:{cursor:"move"},onPointerDown:Vt=>yc(k.id,Vt),onMouseDown:Vt=>yc(k.id,Vt),children:T.jsx(Nd,{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(pr,1e-4),Z=yt===k.id,ut=or(k),ot=nt*Math.PI/180,it=Math.cos(ot),I=Math.sin(ot),Ct=(vt,Bt)=>({cx:_+vt*it-Bt*I,cy:N+vt*I+Bt*it}),It=[{...Ct(-j,-G),handle:"nw"},{...Ct(0,-G),handle:"n"},{...Ct(j,-G),handle:"ne"},{...Ct(j,0),handle:"e"},{...Ct(j,G),handle:"se"},{...Ct(0,G),handle:"s"},{...Ct(-j,G),handle:"sw"},{...Ct(-j,0),handle:"w"}],St=Td({minX:Math.min(...It.map(vt=>vt.cx)),minY:Math.min(...It.map(vt=>vt.cy)),maxX:Math.max(...It.map(vt=>vt.cx)),maxY:Math.max(...It.map(vt=>vt.cy))},X.w,X.h,z),Et=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} ${_} ${N})`,children:T.jsx("ellipse",{cx:_,cy:N,rx:j,ry:G,fill:ay(k.color,k.fillStyle),stroke:k.color,strokeWidth:(Z?3:2.5)*de*ut,strokeDasharray:Vu(k)?Fm(ut):void 0,style:Z?{cursor:"grab"}:void 0,onPointerDown:vt=>{Z&&(vt.stopPropagation(),zo(k.id,vt))},onMouseDown:vt=>{Z&&(vt.stopPropagation(),zo(k.id,vt))},onClick:vt=>{if(vt.stopPropagation(),ue.current){ue.current=!1;return}tt(Bt=>Bt===k.id?null:k.id),wt(k.id)}})}),Z&&It.map(({cx:vt,cy:Bt,handle:Vt})=>T.jsx("circle",{cx:vt,cy:Bt,r:Wy*z,fill:k.color,stroke:"white",strokeWidth:1.5*de*z,style:{cursor:Et(Vt)},onPointerDown:me=>Fc(k.id,Vt,me),onMouseDown:me=>Fc(k.id,Vt,me)},Vt)),Z&&T.jsx("g",{transform:`translate(${St.cx}, ${St.cy})`,style:{cursor:"move"},onPointerDown:vt=>Uc(k.id,vt),onMouseDown:vt=>Uc(k.id,vt),children:T.jsx(Nd,{color:k.color,scale:z})})]},k.id+"-ellipse")}),st.filter(k=>k.id===w.id&&k.anchor.type==="text").map(k=>{const _=Y===k.id||yt===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,Z=k.textItalic?"italic":"normal",ut=k.textFontSize??Us,{x:ot,y:it,width:I,height:Ct}=k.anchor,It=1/Math.max(pr,1e-4),St=or(k);return T.jsxs("g",{children:[k.anchor.point&&T.jsx("circle",{cx:k.anchor.point.x,cy:k.anchor.point.y,r:Fh*St,fill:k.color,stroke:"white",strokeWidth:Xm*St,style:{cursor:"grab"},onPointerDown:Et=>ls(k.id,Et),onMouseDown:Et=>ls(k.id,Et)}),T.jsx("foreignObject",{x:ot,y:it,width:I,height:Ct,onPointerDown:Et=>{if(tt(k.id),wt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),Yr(k.id);return}ql(k.id,Et)},onMouseDown:Et=>{if(tt(k.id),wt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),Yr(k.id);return}ql(k.id,Et)},children:T.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",ref:N?Et=>{Qi.current=Et}:void 0,"data-text-pin-id":k.id,contentEditable:N,suppressContentEditableWarning:!0,onContextMenu:Et=>Et.preventDefault(),onPointerDown:Et=>{if(tt(k.id),wt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),Yr(k.id);return}if(!N){ql(k.id,Et);return}Et.stopPropagation()},onMouseDown:Et=>{if(tt(k.id),wt(k.id),Et.detail>=2){Et.preventDefault(),Et.stopPropagation(),Yr(k.id);return}if(!N){ql(k.id,Et);return}Et.stopPropagation()},onDoubleClick:Et=>{Et.preventDefault(),Et.stopPropagation(),tt(k.id),wt(k.id),Yr(k.id)},onBlur:()=>{N&&(ea(k.id),Yr(Et=>Et===k.id?null:Et))},onInput:Et=>{if(!N)return;const vt=Et.currentTarget,Bt=vt.innerHTML,Vt=xi(Bt,{fontSize:k.textFontSize??Us,bold:k.textBold??!1,italic:k.textItalic??!1}),me=vt.closest("foreignObject");me&&(me.setAttribute("width",String(Vt.width)),me.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:Fw,padding:`0 ${p2}px`,boxSizing:"border-box",fontFamily:Gn,fontSize:ut,lineHeight:1.4,fontWeight:z,fontStyle:Z,textDecoration:nt||"none",outline:"none",cursor:N?"text":"move",userSelect:"text"},...N?{}:{dangerouslySetInnerHTML:{__html:Zs(k.description)}}})}),_&&!N&&(()=>{const Et=5*It;return[{cx:ot,cy:it,key:"nw",cursor:"nwse-resize"},{cx:ot+I,cy:it,key:"ne",cursor:"nesw-resize"},{cx:ot+I,cy:it+Ct,key:"se",cursor:"nwse-resize"},{cx:ot,cy:it+Ct,key:"sw",cursor:"nesw-resize"}].map(Bt=>T.jsx("circle",{cx:Bt.cx,cy:Bt.cy,r:Et,fill:k.color,stroke:"#ffffff",strokeWidth:1.2*It,style:{cursor:Bt.cursor},onPointerDown:Vt=>cs(k.id,Bt.key,Vt),onMouseDown:Vt=>cs(k.id,Bt.key,Vt)},`${k.id}-text-resize-${Bt.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,Z=Y===k.id||yt===k.id,ut=1/Math.max(pr,1e-4),ot=5*de*ut,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(l8,{x:_,y:N,width:j,height:G,mode:nt,strength:z,source:zr??$i,imageSize:X}),T.jsx("rect",{x:_,y:N,width:j,height:G,fill:"rgba(0,0,0,0.001)",style:{cursor:"grab"},onPointerDown:I=>Yc(k.id,I),onMouseDown:I=>Yc(k.id,I),onClick:I=>{if(I.stopPropagation(),ue.current){ue.current=!1;return}tt(k.id),wt(k.id)}}),Z&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:_,y:N,width:j,height:G,fill:"none",stroke:Ju,strokeWidth:1.5*de*ut,strokeDasharray:`${5*de*ut} ${3*de*ut}`,pointerEvents:"none"}),it.map(I=>T.jsx("circle",{cx:I.cx,cy:I.cy,r:ot,fill:Ju,stroke:"#fff",strokeWidth:1.2*de*ut,style:{cursor:I.cursor},onPointerDown:Ct=>wc(k.id,I.id,Ct),onMouseDown:Ct=>wc(k.id,I.id,Ct)},`${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=Y===k.id||yt===k.id,Z=1/Math.max(pr,1e-4),ut=5*de*Z,ot=[{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:it=>as(k.id,it),onMouseDown:it=>as(k.id,it),onClick:it=>{if(it.stopPropagation(),ue.current){ue.current=!1;return}tt(k.id),wt(k.id)}}),z&&T.jsxs(T.Fragment,{children:[T.jsx("rect",{x:_,y:N,width:j,height:G,fill:"none",stroke:Ju,strokeWidth:1.5*de*Z,strokeDasharray:`${5*de*Z} ${3*de*Z}`,pointerEvents:"none"}),ot.map(it=>T.jsx("circle",{cx:it.cx,cy:it.cy,r:ut,fill:Ju,stroke:"#fff",strokeWidth:1.2*de*Z,style:{cursor:it.cursor},onPointerDown:I=>Ya(k.id,it.id,I),onMouseDown:I=>Ya(k.id,it.id,I)},`${k.id}-img-${it.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(pr,1e-4),z=yt===k.id,Z=or(k),ut=G*Math.PI/180,ot=Math.cos(ut),it=Math.sin(ut),I=(qe,rr)=>({cx:_+qe*ot-rr*it,cy:N+qe*it+rr*ot}),Ct=[{...I(0,-j),handle:"n"},{...I(j,0),handle:"e"},{...I(0,j),handle:"s"},{...I(-j,0),handle:"w"}],It=d5(j),St=qe=>qe==="n"||qe==="s"?"ns-resize":"ew-resize",Et=14*de,vt=4*de,Bt=7*de,Vt=6*de,me=Bt*2+Et*Ml.length+vt*Math.max(0,Ml.length-1),se=Vt*2+Et,Ee=10*de,Ze=_-me/2,En=Math.max(0,Math.min(Ze,X.w-me)),Xe=N<X.h/2?N+j+Ee:N-j-Ee-se,Se=Math.max(0,Math.min(Xe,X.h-se)),Tn=24*de,$t=6*de,Le=En+me+$t,Be=En-Tn-$t,Fe=Le+Tn<=X.w?Le:Be>=0?Be:Math.max(0,Math.min(Le,X.w-Tn)),Ae=Math.max(0,Math.min(Se+se/2-Tn/2,X.h-Tn)),_n=Td({minX:_-j,minY:N-j,maxX:_+j,maxY:N+j},X.w,X.h,nt,[{x:En,y:Se,w:me,h:se},{x:Fe,y:Ae,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(),ya(k.id,qe))},onMouseDown:qe=>{z&&(qe.stopPropagation(),ya(k.id,qe))},onClick:qe=>{if(qe.stopPropagation(),ue.current){ue.current=!1;return}tt(rr=>rr===k.id?null:k.id),wt(k.id)}}),T.jsx("path",{d:Q_(_,N,j),fill:"none",stroke:k.color,strokeWidth:(z?Km*1.35:Km)*Z,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&&Ct.map(({cx:qe,cy:rr,handle:lr})=>T.jsx("circle",{cx:qe,cy:rr,r:Wy*nt,fill:k.color,stroke:"white",strokeWidth:1.5*de*nt,style:{cursor:St(lr)},onPointerDown:xr=>bc(k.id,lr,xr),onMouseDown:xr=>bc(k.id,lr,xr)},lr)),z&&T.jsx("g",{transform:`translate(${_n.cx}, ${_n.cy})`,style:{cursor:"move"},onPointerDown:qe=>ro(k.id,qe),onMouseDown:qe=>ro(k.id,qe),children:T.jsx(Nd,{color:k.color,scale:nt})}),z&&T.jsx("foreignObject",{x:En,y:Se,width:me,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:me,height:se,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Vt}px ${Bt}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:`${vt}px`},children:Ml.map(qe=>T.jsx("button",{type:"button",title:`Колір ${qe}`,onClick:()=>ba(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:Ae,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:()=>us(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:`${$n} 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(vz,{pin:k,fontFamily:Gn,justCreated:mi.current===k.id,position:_,imageSize:X,active:yt===k.id,isSelected:yt===k.id||Y===k.id,onUpdateDescription:dl,onUpdateImage:Ii,onClearImage:N=>{te(),lt(j=>j.map(G=>G.id===N?{...G,image:null,imageAspect:null}:G))},onDragStart:Dr,onResizeStart:bi,onActivate:N=>{tt(N),wt(N)},onUpdateColor:ba,onUpdateStrokeStyle:kf,onUpdateFillStyle:Sc,strokeWidthScale:or(k),onUpdateStrokeWidthScale:Wc,onContextMenu:ke,controlsLayer:ei,onToggleDescPos:xa,onToggleTheme:N=>{te(),lt(j=>j.map(G=>G.id===N?{...G,theme:G.theme==="light"?"dark":"light"}:G))},onHide:N=>Vl(N,!0),onAddLinked:ji(k)?Os:void 0,onDelete:us,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 Z=(nt.textFontSize??Us)+j;return Z=Math.max(10,Z),{...nt,textFontSize:Z}}))}},k.id+"-card"):null})]},w.id+"-z")),st.filter(w=>w.anchor.type==="text"&&(Y===w.id||yt===w.id)).map(w=>{const k=oc.w,_=oc.h,N=4*cn,j=Math.max(0,Math.min(w.anchor.x,X.w-k)),G=w.anchor.y+w.anchor.height/2,nt=X.h/2,Z=G<nt?w.anchor.y+w.anchor.height+N:w.anchor.y-_-N,ut=Math.max(0,Math.min(Z,X.h-_)),ot=Ss===w.id,it=ut,I=_,Ct=32*cn,It=6*cn,St=j+k+It,Et=j-Ct-It,vt=St+Ct<=X.w?St:Et>=0?Et:Math.max(0,Math.min(St,X.w-Ct)),Bt=168*cn,Vt=132*cn,me=Math.max(0,Math.min(j+k-Bt,X.w-Bt)),se=Math.max(0,ut-Vt-6*cn),Ee=fe=>{te(),lt(Xe=>Xe.map(Se=>Se.id===w.id?{...Se,textColor:fe}:Se))},Ze=fe=>{te(),lt(Xe=>Xe.map(Se=>Se.id===w.id?{...Se,textBackgroundColor:fe}:Se)),Dl(null)},En=fe=>{te(),lt(Xe=>Xe.map(Se=>{if(Se.id!==w.id||Se.anchor.type!=="text")return Se;const Tn={...Se,...fe},$t=Se.anchor,Le=xi(Tn.description||"",{fontSize:Tn.textFontSize??Us,bold:Tn.textBold??!1,italic:Tn.textItalic??!1}),Be=Math.max(0,X.w-Le.width),Fe=Math.max(0,X.h-Le.height);return{...Tn,anchor:{...$t,width:Le.width,height:Le.height,x:Math.max(0,Math.min($t.x,Be)),y:Math.max(0,Math.min($t.y,Fe))}}}))};return T.jsxs("g",{children:[T.jsx("foreignObject",{x:j,y:it,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*cn,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*cn,padding:`${8*cn}px ${10*cn}px`,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7*cn},children:[w.anchor.point&&(()=>{const fe=or(w),Xe=(fe-Rc)/(Kf-Rc)*100;return T.jsxs(T.Fragment,{children:[T.jsxs("div",{style:{display:"flex",gap:Vy,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[T.jsx("i",{className:`${$n} bi-record-circle`,style:ck,"aria-hidden":!0}),Ml.map(Se=>T.jsx("button",{type:"button",title:`Колір точки ${Se}`,onClick:()=>ba(w.id,Se),style:{width:Um,height:Um,borderRadius:"50%",background:Se,border:w.color===Se?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},`${w.id}-pointc-${Se}`))]}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Vy},children:[T.jsx("input",{type:"range",className:"tyts-range",min:Rc,max:Kf,step:a5,value:fe,"aria-label":"Розмір точки",title:"Розмір точки",onChange:Se=>Wc(w.id,Number(Se.target.value)),style:{flex:1,minWidth:0,"--tyts-range-accent":w.color,"--tyts-range-fill":`${Xe}%`}}),T.jsxs("span",{style:{color:"#aaa",fontSize:11*cn,minWidth:30*cn,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:["×",c5(fe)]})]})]})})(),T.jsxs("div",{style:{display:"flex",gap:Vy,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[T.jsx("i",{className:`${$n} bi-type`,style:ck,"aria-hidden":!0}),Ml.map(fe=>T.jsx("button",{type:"button",onClick:()=>Ee(fe),style:{width:Um,height:Um,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*cn,alignItems:"center",justifyContent:"space-between",position:"relative",flexWrap:"nowrap"},children:[T.jsx("button",{type:"button",style:{...Lf,fontWeight:700},onClick:()=>{ta(w.id,"bold")||En({textBold:!(w.textBold??!1)})},children:"B"}),T.jsx("button",{type:"button",style:{...Lf,fontStyle:"italic"},onClick:()=>{ta(w.id,"italic")||En({textItalic:!(w.textItalic??!1)})},children:"I"}),T.jsx("button",{type:"button",style:{...Lf,textDecoration:"underline"},onClick:()=>{ta(w.id,"underline")||En({textUnderline:!(w.textUnderline??!1)})},children:"U"}),T.jsx("button",{type:"button",style:{...Lf,textDecoration:"line-through"},onClick:()=>{ta(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 Se={...Xe,textFontSize:Math.max(10,(Xe.textFontSize??Us)-2)},Tn=Xe.anchor,$t=xi(Se.description||"",{fontSize:Se.textFontSize??Us,bold:Se.textBold??!1,italic:Se.textItalic??!1}),Le=Math.max(0,X.w-$t.width),Be=Math.max(0,X.h-$t.height);return{...Se,anchor:{...Tn,width:$t.width,height:$t.height,x:Math.max(0,Math.min(Tn.x,Le)),y:Math.max(0,Math.min(Tn.y,Be))}}}))},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 Se={...Xe,textFontSize:(Xe.textFontSize??Us)+2},Tn=Xe.anchor,$t=xi(Se.description||"",{fontSize:Se.textFontSize??Us,bold:Se.textBold??!1,italic:Se.textItalic??!1}),Le=Math.max(0,X.w-$t.width),Be=Math.max(0,X.h-$t.height);return{...Se,anchor:{...Tn,width:$t.width,height:$t.height,x:Math.max(0,Math.min(Tn.x,Le)),y:Math.max(0,Math.min(Tn.y,Be))}}}))},children:"A+"}),T.jsx("div",{"data-text-bg-picker":"true",style:{position:"relative"},children:T.jsxs("button",{type:"button",onClick:()=>Dl(fe=>fe===w.id?null:w.id),style:{...Lf,minWidth:42*cn,justifyContent:"space-between",gap:6*cn,padding:`0 ${7*cn}px`,color:"#e8e8e8"},title:"Колір фону тексту",children:[T.jsx("span",{style:{width:18*cn,height:18*cn,borderRadius:3*cn,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*cn,fontWeight:700},children:"A"}),T.jsx("i",{className:`${$n} bi-chevron-down`,style:{fontSize:11*cn},"aria-hidden":!0})]})})]})]})})},`${w.id}-text-tools`),ot&&T.jsx("foreignObject",{x:me,y:se,width:Bt,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*cn,padding:8*cn,boxSizing:"border-box",display:"grid",gridTemplateColumns:`repeat(4, ${30*cn}px)`,gap:6*cn},children:[T.jsx("button",{type:"button",onClick:()=>Ze(null),style:{gridColumn:"1 / -1",height:24*cn,borderRadius:5*cn,border:"1px solid rgba(255,255,255,0.22)",background:"rgba(255,255,255,0.06)",color:"#ddd",cursor:"pointer",fontSize:12*cn},children:"Без фону"}),Ml.map(fe=>T.jsx("button",{type:"button",onClick:()=>Ze(fe),style:{width:30*cn,height:24*cn,borderRadius:5*cn,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:vt,y:Math.max(0,Math.min(ut+_/2-Ct/2,X.h-Ct)),width:Ct,height:Ct,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:()=>us(w.id),style:{width:Ct,height:Ct,background:"rgba(20, 20, 32, 0.95)",border:"1px solid rgba(230,57,70,0.7)",color:"#ff6b6b",cursor:"pointer",borderRadius:"50%",fontSize:16*cn,padding:`${3*cn}px`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:T.jsx("i",{className:`${$n} bi-trash`,style:{fontSize:ir},"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||yt!==w.id&&Y!==w.id)return null;const k=zt[w.id];if(!k)return null;const _=ny(w,st);if(!_)return null;const N=Array.isArray(w.leaderPoints)?w.leaderPoints:[],j=x2(_,k,N),G=1/Math.max(pr,1e-4),nt=5*de*G,z=3.5*de*G;return T.jsxs("g",{children:[q_(j).map((Z,ut)=>T.jsx("circle",{cx:Z.x,cy:Z.y,r:z,fill:"rgba(255,255,255,0.8)",stroke:w.color,strokeWidth:1.2*de*G,style:{cursor:"crosshair"},onPointerDown:ot=>wf(w.id,ut,Z,ot),onMouseDown:ot=>wf(w.id,ut,Z,ot),children:T.jsx("title",{children:"Потягніть, щоб зламати лінію"})},`${w.id}-leader-mid-${ut}`)),N.map((Z,ut)=>T.jsx("circle",{cx:Z.x,cy:Z.y,r:nt,fill:w.color,stroke:"#fff",strokeWidth:1.5*de*G,style:{cursor:"grab"},onPointerDown:ot=>vf(w.id,ut,ot),onMouseDown:ot=>vf(w.id,ut,ot),onDoubleClick:ot=>ad(w.id,ut,ot),children:T.jsx("title",{children:"Подвійний клік — прибрати злам"})},`${w.id}-leader-pt-${ut}`))]},w.id+"-leader-handles")}),st.filter(w=>w.anchor.type==="redact"&&(Y===w.id||yt===w.id)).map(w=>{const{x:k,y:_,width:N,height:j,mode:G,strength:nt}=w.anchor,z=250*cn,Z=8*cn,ut=24*cn,ot=7*cn,it=12*cn,I=Z*2+ut+(G==="fill"?0:ot+it),Ct=8*cn,It=Math.max(0,Math.min(k+N/2-z/2,X.w-z)),St=_<X.h/2,Et=Math.max(0,Math.min(St?_+j+Ct:_-Ct-I,X.h-I)),vt=32*cn,Bt=6*cn,Vt=It+z+Bt,me=It-vt-Bt,se=Vt+vt<=X.w?Vt:me>=0?me:Math.max(0,Math.min(Vt,X.w-vt)),Ee=Math.max(0,Math.min(Et+I/2-vt/2,X.h-vt)),Ze=[{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:ot,padding:`${Z}px ${10*cn}px`,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*cn,fontFamily:Gn},children:[T.jsx("div",{style:{display:"flex",gap:6*cn},children:Ze.map(fe=>T.jsxs("button",{type:"button",title:fe.label,onClick:()=>ss(w.id,{mode:fe.id}),style:{flex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4*cn,height:24*cn,borderRadius:6*cn,cursor:"pointer",fontFamily:"inherit",fontSize:11*cn,background:G===fe.id?"rgba(255,255,255,0.14)":"rgba(255,255,255,0.06)",border:`1px solid ${G===fe.id?Ju:"rgba(255,255,255,0.18)"}`,color:G===fe.id?"#fff":"#bbb"},children:[T.jsx("i",{className:`${$n} ${fe.icon}`,style:{fontSize:11*cn},"aria-hidden":!0}),fe.label]},fe.id))}),G!=="fill"&&T.jsx("input",{type:"range",className:"tyts-range",min:0,max:1,step:n_,value:nt,"aria-label":"Сила ефекту",title:"Сила ефекту",onChange:fe=>ss(w.id,{strength:Number(fe.target.value)}),style:{width:"100%",height:it,minWidth:0,"--tyts-range-accent":Ju,"--tyts-range-thumb":`${it}px`,"--tyts-range-track":`${4*cn}px`,"--tyts-range-fill":`${En}%`}})]})}),T.jsx("foreignObject",{x:se,y:Ee,width:vt,height:vt,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:()=>us(w.id),style:{width:vt,height:vt,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*cn}px`},children:T.jsx("i",{className:`${$n} bi-trash`,style:{fontSize:Math.round(12*cn)},"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"||Y===w.id||yt===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(),Vl(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(PB,{onFile:Xs,highlight:zl,warning:D}),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:["Знайдено збережену чернетку від"," ",Dd(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:{...xB,flex:1},children:[T.jsxs("span",{title:`полотно: ${X.w} × ${X.h}px`,children:["полотно: ",X.w," × ",X.h,"px"]}),Lt&&T.jsxs("span",{title:`оригінал: ${Lt.w} × ${Lt.h}px`,style:{marginLeft:16},children:["оригінал: ",Lt.w," × ",Lt.h,"px"]}),Y&&(()=>{const w=zt[Y];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:ht,display:"inline-flex",alignItems:"center",gap:5,marginLeft:16,verticalAlign:"bottom"},children:[T.jsx("i",{className:`${$n} ${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(),Ao(!0),Da(!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(),Da(k=>!k),Ao(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Показати список гарячих клавіш",children:"Гарячі клавіші"}),T.jsxs("span",{children:["v",HN]})]}),vs&&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:()=>Da(!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(hk,{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(hk,{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:Kn,onChange:w=>Xo(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:()=>ye(w)},{key:"duplicate",label:"Дублювати",shortcut:"objectDuplicate",enabled:!0,run:()=>Ye(w)}]:[],{key:"paste",label:"Вставити сюди",shortcut:"objectPaste",enabled:ne,run:()=>Ln(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:Z=>Z.stopPropagation(),onContextMenu:Z=>Z.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:Gn,fontSize:13},children:[_.map(({key:Z,label:ut,shortcut:ot,enabled:it,run:I})=>T.jsxs("button",{type:"button",role:"menuitem",disabled:!it,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:it?"#ddd":"rgba(255,255,255,0.28)",cursor:it?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:Ct=>{it&&(Ct.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:Ct=>{Ct.currentTarget.style.background="transparent"},children:[T.jsx("span",{children:ut}),T.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:hn(oe[ot],{isMac:b})})]},Z)),w&&T.jsx("div",{style:{height:1,margin:"4px 6px",background:"rgba(255,255,255,0.12)"}}),w&&k.map(({move:Z,label:ut,shortcut:ot})=>{const it=V_(st,w,Z);return T.jsxs("button",{type:"button",role:"menuitem",disabled:!it,onClick:()=>{Va(w,Z),Ht(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:it?"#ddd":"rgba(255,255,255,0.28)",cursor:it?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:I=>{it&&(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:hn(oe[ot],{isMac:b})})]},Z)})]})})(),T.jsx("input",{ref:Sn,type:"file",accept:XN,style:{display:"none"},onChange:w=>{const k=w.target.files?.[0];w.target.value="",k&&(bo(k),Eo(!1))}}),T.jsx(m_,{open:Go,fontId:Ei.fontId,fontFamily:Gn,strokeWidthScale:pi,onClose:()=>Ao(!1),onFontIdChange:ui,onStrokeWidthScaleChange:Ti})]})});function RB({corner:e}){const i=e==="nw"||e==="sw"?12:32,s=e==="nw"||e==="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 hk({shortcut:e,isMac:t}){const[n,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:n?"rgba(255,255,255,0.08)":"transparent",transition:"background 0.15s"},children:[T.jsx("span",{style:{color:"rgba(255,255,255,0.85)"},children:e.label}),T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:Ai(e,{isMac:t}).map(i=>T.jsx(Ql,{children:i},i))})]})}function pk({canUndo:e,canRedo:t,onUndo:n,onRedo:r,isMac:i}){return T.jsxs(T.Fragment,{children:[T.jsx(Sr,{title:`Відмінити (${hn(oe.undo,{isMac:i})})`,tooltip:`Відмінити останню точку або переміщення (${hn(oe.undo,{isMac:i})})`,onClick:n,disabled:!e,children:T.jsx("i",{className:`${$n} bi-arrow-counterclockwise`,style:{fontSize:ir},"aria-hidden":!0})}),T.jsx(Sr,{title:`Повернути (${hn(oe.redo,{isMac:i})})`,tooltip:`Повернути скасовану дію (${hn(oe.redo,{isMac:i})})`,onClick:r,disabled:!t,children:T.jsx("i",{className:`${$n} bi-arrow-clockwise`,style:{fontSize:ir},"aria-hidden":!0})})]})}function Sr({children:e,onClick:t,active:n,accent:r,primary:i,title:s,tooltip:l,disabled:c,hotkeyParts:f,showHotkeyBadge:d,success:p}){const[y,b]=U.useState(!1),[g,C]=U.useState(!1),M=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),L=typeof window<"u"&&window.innerWidth<(M?1040:1320),D=l!=null&&l!=="",H=g&&!c,V=i?H?"rgb(30, 90, 180)":"rgb(0, 102, 204)":null,W=r?H?"rgb(210, 50, 60)":"rgb(230, 57, 70)":null,gt=!!p&&!c;return T.jsxs("span",{style:{position:"relative",display:"inline-block"},onMouseEnter:()=>{b(!0),C(!0)},onMouseLeave:()=>{b(!1),C(!1)},children:[T.jsx("button",{onClick:t,disabled:c,title:D?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:M?40:30,boxSizing:"border-box",background:V??W??(n?"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:gt?"1px solid #2ecc71":`1px solid ${V??W??(n?"transparent":"rgba(255,255,255,0.08)")}`,borderRadius:5,color:c?"rgba(255,255,255,0.55)":gt?"#2ecc71":i||r||n?"#fff":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:M?L?"7px 10px":"8px 14px":L?"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:L?6:8},children:[e,d&&f&&f.length>0&&T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:f.map(_t=>T.jsx(Ql,{title:`Гаряча клавіша: ${_t}`,children:_t},_t))})]})}),D&&y&&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 OB({children:e,onMainClick:t,onMenuClick:n,menuOpen:r,disabled:i,mainTitle:s,mainTooltip:l,menuTitle:c,menuTooltip:f,hotkeyParts:d,showHotkeyBadge:p}){const[y,b]=U.useState(!1),[g,C]=U.useState(!1),[M,L]=U.useState(!1),[D,H]=U.useState(!1),V=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),W=typeof window<"u"&&window.innerWidth<(V?1040:1320),gt=V?40:30,_t=V?W?7:8:W?4:5,kt=V?W?10:14:W?8:12,xt="rgba(255,255,255,0.06)",rt="rgba(255,255,255,0.12)",jt="linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))",J=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 ${J}`,borderRadius:5,overflow:"hidden",background:xt},children:[T.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{b(!0),L(!0)},onMouseLeave:()=>{b(!1),L(!1)},children:[T.jsx("button",{type:"button",onClick:t,disabled:i,title:l?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:gt,boxSizing:"border-box",background:y&&!i?rt:"transparent",border:"none",borderRadius:0,color:i?"rgba(255,255,255,0.55)":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:`${_t}px ${kt}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:[e,p&&d&&d.length>0&&T.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:d.map(X=>T.jsx(Ql,{title:`Гаряча клавіша: ${X}`,children:X},X))})]})}),l&&M&&T.jsx("span",{role:"tooltip",style:ct,children:l})]}),T.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{C(!0),H(!0)},onMouseLeave:()=>{C(!1),H(!1)},children:[T.jsx("button",{type:"button",onClick:n,disabled:i,"aria-expanded":!!r,"aria-haspopup":"dialog",title:f?void 0:c,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:gt,minWidth:V?32:26,boxSizing:"border-box",background:r?jt:g&&!i?rt:"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:ir-2},"aria-hidden":!0})}),f&&D&&T.jsx("span",{role:"tooltip",style:ct,children:f})]})]})}function PB({onFile:e,highlight:t=!1,warning:n=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(!Q2(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:`${$n} 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:Qd()}).map(f=>T.jsx(Ql,{title:zd(),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:"Обрати файл"}),n&&T.jsx("p",{style:{marginTop:14,marginBottom:0,color:"#E63946",fontSize:13,lineHeight:1.5},children:n}),T.jsx("input",{ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:e})]})}H6.createRoot(document.getElementById("root")).render(T.jsx(U.StrictMode,{children:T.jsx(DB,{mode:"embed"})}));export{$r as _,IB as c,mk as g};