From 4d60d67f04016963eea35d1e344f17c228566ea3 Mon Sep 17 00:00:00 2001 From: Rizky Date: Sat, 24 Feb 2024 16:19:53 +0700 Subject: [PATCH] wip fix --- app/srv/core/main.js | 103 ++++++----- app/web/package.json | 1 + app/web/src/base/load/api/api-proxy.tsx | 10 +- app/web/src/base/load/proxy.ts | 48 +++-- app/web/src/nova/ed/logic/ed-global.ts | 6 + .../src/nova/ed/panel/file/file-browser.tsx | 130 ++++++++++---- app/web/src/nova/ed/panel/file/file-list.tsx | 170 +++++++++++++----- .../src/nova/ed/panel/file/file-preview.tsx | 136 ++++++++++++++ app/web/src/nova/ed/panel/file/file-top.tsx | 60 ++++++- app/web/src/nova/ed/panel/file/file-tree.tsx | 13 +- app/web/src/nova/ed/panel/file/file-upload.ts | 61 ++++++- app/web/src/utils/ui/context-menu.tsx | 2 +- bun.lockb | Bin 270736 -> 273296 bytes 13 files changed, 582 insertions(+), 158 deletions(-) create mode 100644 app/web/src/nova/ed/panel/file/file-preview.tsx diff --git a/app/srv/core/main.js b/app/srv/core/main.js index 461f2e45..c0d78058 100644 --- a/app/srv/core/main.js +++ b/app/srv/core/main.js @@ -1,50 +1,55 @@ -var zy=Object.create;var xB=Object.defineProperty;var Py=Object.getOwnPropertyDescriptor;var _y=Object.getOwnPropertyNames;var Xy=Object.getPrototypeOf,Ty=Object.prototype.hasOwnProperty;var de=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Zy=(e,t,A,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _y(t))!Ty.call(e,n)&&n!==A&&xB(e,n,{get:()=>t[n],enumerable:!(i=Py(t,n))||i.enumerable});return e};var R=(e,t,A)=>(A=e!=null?zy(Xy(e)):{},Zy(t||!e||!e.__esModule?xB(A,"default",{value:e,enumerable:!0}):A,e));var bB=de(W=>{"use strict";var Dr=Symbol.for("react.element"),Wy=Symbol.for("react.portal"),jy=Symbol.for("react.fragment"),$y=Symbol.for("react.strict_mode"),ew=Symbol.for("react.profiler"),tw=Symbol.for("react.provider"),Aw=Symbol.for("react.context"),iw=Symbol.for("react.forward_ref"),nw=Symbol.for("react.suspense"),rw=Symbol.for("react.memo"),ow=Symbol.for("react.lazy"),GB=Symbol.iterator;function sw(e){return e===null||typeof e!="object"?null:(e=GB&&e[GB]||e["@@iterator"],typeof e=="function"?e:null)}var vB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},JB=Object.assign,qB={};function hn(e,t,A){this.props=e,this.context=t,this.refs=qB,this.updater=A||vB}hn.prototype.isReactComponent={};hn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};hn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function RB(){}RB.prototype=hn.prototype;function Ic(e,t,A){this.props=e,this.context=t,this.refs=qB,this.updater=A||vB}var ac=Ic.prototype=new RB;ac.constructor=Ic;JB(ac,hn.prototype);ac.isPureReactComponent=!0;var HB=Array.isArray,KB=Object.prototype.hasOwnProperty,cc={current:null},LB={key:!0,ref:!0,__self:!0,__source:!0};function OB(e,t,A){var i,n={},r=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(r=""+t.key),t)KB.call(t,i)&&!LB.hasOwnProperty(i)&&(n[i]=t[i]);var s=arguments.length-2;if(s===1)n.children=A;else if(1{"use strict";YB.exports=bB()});var $B=de(ge=>{"use strict";function fc(e,t){var A=e.length;e.push(t);e:for(;0>>1,n=e[i];if(0>>1;ifs(s,A))Ifs(a,s)?(e[i]=a,e[I]=A,i=I):(e[i]=s,e[o]=A,i=o);else if(Ifs(a,A))e[i]=a,e[I]=A,i=I;else break e}}return t}function fs(e,t){var A=e.sortIndex-t.sortIndex;return A!==0?A:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(VB=performance,ge.unstable_now=function(){return VB.now()}):(lc=Date,zB=lc.now(),ge.unstable_now=function(){return lc.now()-zB});var VB,lc,zB,sA=[],TA=[],lw=1,xt=null,Te=3,Cs=!1,xi=!1,Sr=!1,XB=typeof setTimeout=="function"?setTimeout:null,TB=typeof clearTimeout=="function"?clearTimeout:null,PB=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function dc(e){for(var t=zt(TA);t!==null;){if(t.callback===null)Qs(TA);else if(t.startTime<=e)Qs(TA),t.sortIndex=t.expirationTime,fc(sA,t);else break;t=zt(TA)}}function Qc(e){if(Sr=!1,dc(e),!xi)if(zt(sA)!==null)xi=!0,hc(Cc);else{var t=zt(TA);t!==null&&pc(Qc,t.startTime-e)}}function Cc(e,t){xi=!1,Sr&&(Sr=!1,TB(Ur),Ur=-1),Cs=!0;var A=Te;try{for(dc(t),xt=zt(sA);xt!==null&&(!(xt.expirationTime>t)||e&&!jB());){var i=xt.callback;if(typeof i=="function"){xt.callback=null,Te=xt.priorityLevel;var n=i(xt.expirationTime<=t);t=ge.unstable_now(),typeof n=="function"?xt.callback=n:xt===zt(sA)&&Qs(sA),dc(t)}else Qs(sA);xt=zt(sA)}if(xt!==null)var r=!0;else{var o=zt(TA);o!==null&&pc(Qc,o.startTime-t),r=!1}return r}finally{xt=null,Te=A,Cs=!1}}var hs=!1,ds=null,Ur=-1,ZB=5,WB=-1;function jB(){return!(ge.unstable_now()-WBe||125i?(e.sortIndex=A,fc(TA,e),zt(sA)===null&&e===zt(TA)&&(Sr?(TB(Ur),Ur=-1):Sr=!0,pc(Qc,A-i))):(e.sortIndex=n,fc(sA,e),xi||Cs||(xi=!0,hc(Cc))),e};ge.unstable_shouldYield=jB;ge.unstable_wrapCallback=function(e){var t=Te;return function(){var A=Te;Te=t;try{return e.apply(this,arguments)}finally{Te=A}}}});var tf=de((FN,ef)=>{"use strict";ef.exports=$B()});var IC=de(Ut=>{"use strict";var ad=Ye(),kt=tf();function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,A=1;A"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yc=Object.prototype.hasOwnProperty,uw=/^[: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]*$/,Af={},nf={};function Bw(e){return Yc.call(nf,e)?!0:Yc.call(Af,e)?!1:uw.test(e)?nf[e]=!0:(Af[e]=!0,!1)}function fw(e,t,A,i){if(A!==null&&A.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return i?!1:A!==null?!A.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function dw(e,t,A,i){if(t===null||typeof t>"u"||fw(e,t,A,i))return!0;if(i)return!1;if(A!==null)switch(A.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function rt(e,t,A,i,n,r,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=n,this.mustUseProperty=A,this.propertyName=e,this.type=t,this.sanitizeURL=r,this.removeEmptyString=o}var Pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pe[e]=new rt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pe[t]=new rt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pe[e]=new rt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pe[e]=new rt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Pe[e]=new rt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Pe[e]=new rt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Pe[e]=new rt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Pe[e]=new rt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Pe[e]=new rt(e,5,!1,e.toLowerCase(),null,!1,!1)});var vg=/[\-:]([a-z])/g;function Jg(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vg,Jg);Pe[t]=new rt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vg,Jg);Pe[t]=new rt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vg,Jg);Pe[t]=new rt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Pe[e]=new rt(e,1,!1,e.toLowerCase(),null,!1,!1)});Pe.xlinkHref=new rt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Pe[e]=new rt(e,1,!1,e.toLowerCase(),null,!0,!0)});function qg(e,t,A,i){var n=Pe.hasOwnProperty(t)?Pe[t]:null;(n!==null?n.type!==0:i||!(2()=>(t||e((t={exports:{}}).exports,t),t.exports),J0=(e,t)=>{for(var A in t)zc(e,A,{get:t[A],enumerable:!0})},q0=(e,t,A,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M0(t))!R0.call(e,n)&&n!==A&&zc(e,n,{get:()=>t[n],enumerable:!(i=H0(t,n))||i.enumerable});return e};var K=(e,t,A)=>(A=e!=null?G0(v0(e)):{},q0(t||!e||!e.__esModule?zc(A,"default",{value:e,enumerable:!0}):A,e));var XB=Qe($=>{"use strict";var Lr=Symbol.for("react.element"),K0=Symbol.for("react.portal"),b0=Symbol.for("react.fragment"),O0=Symbol.for("react.strict_mode"),L0=Symbol.for("react.profiler"),Y0=Symbol.for("react.provider"),P0=Symbol.for("react.context"),V0=Symbol.for("react.forward_ref"),z0=Symbol.for("react.suspense"),T0=Symbol.for("react.memo"),_0=Symbol.for("react.lazy"),KB=Symbol.iterator;function X0(e){return e===null||typeof e!="object"?null:(e=KB&&e[KB]||e["@@iterator"],typeof e=="function"?e:null)}var LB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},YB=Object.assign,PB={};function Nn(e,t,A){this.props=e,this.context=t,this.refs=PB,this.updater=A||LB}Nn.prototype.isReactComponent={};Nn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Nn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function VB(){}VB.prototype=Nn.prototype;function _c(e,t,A){this.props=e,this.context=t,this.refs=PB,this.updater=A||LB}var Xc=_c.prototype=new VB;Xc.constructor=_c;YB(Xc,Nn.prototype);Xc.isPureReactComponent=!0;var bB=Array.isArray,zB=Object.prototype.hasOwnProperty,Zc={current:null},TB={key:!0,ref:!0,__self:!0,__source:!0};function _B(e,t,A){var i,n={},r=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(r=""+t.key),t)zB.call(t,i)&&!TB.hasOwnProperty(i)&&(n[i]=t[i]);var s=arguments.length-2;if(s===1)n.children=A;else if(1{"use strict";ZB.exports=XB()});var od=Qe(ue=>{"use strict";function tl(e,t){var A=e.length;e.push(t);e:for(;0>>1,n=e[i];if(0>>1;ibs(s,A))abs(I,s)?(e[i]=I,e[a]=A,i=a):(e[i]=s,e[o]=A,i=o);else if(abs(I,A))e[i]=I,e[a]=A,i=a;else break e}}return t}function bs(e,t){var A=e.sortIndex-t.sortIndex;return A!==0?A:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(WB=performance,ue.unstable_now=function(){return WB.now()}):(jc=Date,jB=jc.now(),ue.unstable_now=function(){return jc.now()-jB});var WB,jc,jB,uA=[],ii=[],eF=1,Rt=null,je=3,Ys=!1,Li=!1,Pr=!1,td=typeof setTimeout=="function"?setTimeout:null,Ad=typeof clearTimeout=="function"?clearTimeout:null,$B=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Al(e){for(var t=Wt(ii);t!==null;){if(t.callback===null)Ls(ii);else if(t.startTime<=e)Ls(ii),t.sortIndex=t.expirationTime,tl(uA,t);else break;t=Wt(ii)}}function il(e){if(Pr=!1,Al(e),!Li)if(Wt(uA)!==null)Li=!0,rl(nl);else{var t=Wt(ii);t!==null&&ol(il,t.startTime-e)}}function nl(e,t){Li=!1,Pr&&(Pr=!1,Ad(Vr),Vr=-1),Ys=!0;var A=je;try{for(Al(t),Rt=Wt(uA);Rt!==null&&(!(Rt.expirationTime>t)||e&&!rd());){var i=Rt.callback;if(typeof i=="function"){Rt.callback=null,je=Rt.priorityLevel;var n=i(Rt.expirationTime<=t);t=ue.unstable_now(),typeof n=="function"?Rt.callback=n:Rt===Wt(uA)&&Ls(uA),Al(t)}else Ls(uA);Rt=Wt(uA)}if(Rt!==null)var r=!0;else{var o=Wt(ii);o!==null&&ol(il,o.startTime-t),r=!1}return r}finally{Rt=null,je=A,Ys=!1}}var Ps=!1,Os=null,Vr=-1,id=5,nd=-1;function rd(){return!(ue.unstable_now()-nde||125i?(e.sortIndex=A,tl(ii,e),Wt(uA)===null&&e===Wt(ii)&&(Pr?(Ad(Vr),Vr=-1):Pr=!0,ol(il,A-i))):(e.sortIndex=n,tl(uA,e),Li||Ys||(Li=!0,rl(nl))),e};ue.unstable_shouldYield=rd;ue.unstable_wrapCallback=function(e){var t=je;return function(){var A=je;je=t;try{return e.apply(this,arguments)}finally{je=A}}}});var ad=Qe((uH,sd)=>{"use strict";sd.exports=od()});var fh=Qe(Mt=>{"use strict";var BC=ze(),Gt=ad();function x(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,A=1;A"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ul=Object.prototype.hasOwnProperty,tF=/^[: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]*$/,Id={},cd={};function AF(e){return Ul.call(cd,e)?!0:Ul.call(Id,e)?!1:tF.test(e)?cd[e]=!0:(Id[e]=!0,!1)}function iF(e,t,A,i){if(A!==null&&A.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return i?!1:A!==null?!A.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function nF(e,t,A,i){if(t===null||typeof t>"u"||iF(e,t,A,i))return!0;if(i)return!1;if(A!==null)switch(A.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function at(e,t,A,i,n,r,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=n,this.mustUseProperty=A,this.propertyName=e,this.type=t,this.sanitizeURL=r,this.removeEmptyString=o}var Xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Xe[e]=new at(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Xe[t]=new at(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Xe[e]=new at(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Xe[e]=new at(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Xe[e]=new at(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Xe[e]=new at(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Xe[e]=new at(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Xe[e]=new at(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Xe[e]=new at(e,5,!1,e.toLowerCase(),null,!1,!1)});var Eg=/[\-:]([a-z])/g;function mg(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Eg,mg);Xe[t]=new at(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Eg,mg);Xe[t]=new at(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Eg,mg);Xe[t]=new at(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Xe[e]=new at(e,1,!1,e.toLowerCase(),null,!1,!1)});Xe.xlinkHref=new at("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Xe[e]=new at(e,1,!1,e.toLowerCase(),null,!0,!0)});function yg(e,t,A,i){var n=Xe.hasOwnProperty(t)?Xe[t]:null;(n!==null?n.type!==0:i||!(2s||n[o]!==r[s]){var I=` -`+n[o].replace(" at new "," at ");return e.displayName&&I.includes("")&&(I=I.replace("",e.displayName)),I}while(1<=o&&0<=s);break}}}finally{mc=!1,Error.prepareStackTrace=A}return(e=e?e.displayName||e.name:"")?Rr(e):""}function Qw(e){switch(e.tag){case 5:return Rr(e.type);case 16:return Rr("Lazy");case 13:return Rr("Suspense");case 19:return Rr("SuspenseList");case 0:case 2:case 15:return e=yc(e.type,!1),e;case 11:return e=yc(e.type.render,!1),e;case 1:return e=yc(e.type,!0),e;default:return""}}function _c(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yn:return"Fragment";case mn:return"Portal";case Vc:return"Profiler";case Rg:return"StrictMode";case zc:return"Suspense";case Pc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ld:return(e.displayName||"Context")+".Consumer";case gd:return(e._context.displayName||"Context")+".Provider";case Kg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Lg:return t=e.displayName||null,t!==null?t:_c(e.type)||"Memo";case WA:t=e._payload,e=e._init;try{return _c(e(t))}catch{}}return null}function Cw(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return _c(t);case 8:return t===Rg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function gi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hw(e){var t=Bd(e)?"checked":"value",A=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof A<"u"&&typeof A.get=="function"&&typeof A.set=="function"){var n=A.get,r=A.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(o){i=""+o,r.call(this,o)}}),Object.defineProperty(e,t,{enumerable:A.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Es(e){e._valueTracker||(e._valueTracker=hw(e))}function fd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var A=t.getValue(),i="";return e&&(i=Bd(e)?e.checked?"true":"false":e.value),e=i,e!==A?(t.setValue(e),!0):!1}function Ts(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Xc(e,t){var A=t.checked;return we({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:A??e._wrapperState.initialChecked})}function of(e,t){var A=t.defaultValue==null?"":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;A=gi(t.value!=null?t.value:A),e._wrapperState={initialChecked:i,initialValue:A,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function dd(e,t){t=t.checked,t!=null&&qg(e,"checked",t,!1)}function Tc(e,t){dd(e,t);var A=gi(t.value),i=t.type;if(A!=null)i==="number"?(A===0&&e.value===""||e.value!=A)&&(e.value=""+A):e.value!==""+A&&(e.value=""+A);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Zc(e,t.type,A):t.hasOwnProperty("defaultValue")&&Zc(e,t.type,gi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function sf(e,t,A){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!(i!=="submit"&&i!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,A||t===e.value||(e.value=t),e.defaultValue=t}A=e.name,A!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,A!==""&&(e.name=A)}function Zc(e,t,A){(t!=="number"||Ts(e.ownerDocument)!==e)&&(A==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+A&&(e.defaultValue=""+A))}var Kr=Array.isArray;function Mn(e,t,A,i){if(e=e.options,t){t={};for(var n=0;n"+t.valueOf().toString()+"",t=ms.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jr(e,t){if(t){var A=e.firstChild;if(A&&A===e.lastChild&&A.nodeType===3){A.nodeValue=t;return}}e.textContent=t}var br={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pw=["Webkit","ms","Moz","O"];Object.keys(br).forEach(function(e){pw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),br[t]=br[e]})});function pd(e,t,A){return t==null||typeof t=="boolean"||t===""?"":A||typeof t!="number"||t===0||br.hasOwnProperty(e)&&br[e]?(""+t).trim():t+"px"}function Ed(e,t){e=e.style;for(var A in t)if(t.hasOwnProperty(A)){var i=A.indexOf("--")===0,n=pd(A,t[A],i);A==="float"&&(A="cssFloat"),i?e.setProperty(A,n):e[A]=n}}var Ew=we({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $c(e,t){if(t){if(Ew[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function eg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 tg=null;function Og(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ag=null,vn=null,Jn=null;function cf(e){if(e=Qo(e)){if(typeof Ag!="function")throw Error(N(280));var t=e.stateNode;t&&(t=yI(t),Ag(e.stateNode,e.type,t))}}function md(e){vn?Jn?Jn.push(e):Jn=[e]:vn=e}function yd(){if(vn){var e=vn,t=Jn;if(Jn=vn=null,cf(e),t)for(e=0;e>>=0,e===0?32:31-(Gw(e)/Hw|0)|0}var ys=64,ws=4194304;function Lr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function $s(e,t){var A=e.pendingLanes;if(A===0)return 0;var i=0,n=e.suspendedLanes,r=e.pingedLanes,o=A&268435455;if(o!==0){var s=o&~n;s!==0?i=Lr(s):(r&=o,r!==0&&(i=Lr(r)))}else o=A&~n,o!==0?i=Lr(o):r!==0&&(i=Lr(r));if(i===0)return 0;if(t!==0&&t!==i&&!(t&n)&&(n=i&-i,r=t&-t,n>=r||n===16&&(r&4194240)!==0))return t;if(i&4&&(i|=A&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0A;A++)t.push(e);return t}function Bo(e,t,A){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Zt(t),e[t]=A}function qw(e,t){var A=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=Vr),hf=" ",pf=!1;function Yd(e,t){switch(e){case"keyup":return g0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wn=!1;function u0(e,t){switch(e){case"compositionend":return Vd(t);case"keypress":return t.which!==32?null:(pf=!0,hf);case"textInput":return e=t.data,e===hf&&pf?null:e;default:return null}}function B0(e,t){if(wn)return e==="compositionend"||!Tg&&Yd(e,t)?(e=Od(),Ls=Pg=ti=null,wn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:A,offset:t-e};e=i}e:{for(;A;){if(A.nextSibling){A=A.nextSibling;break e}A=A.parentNode}A=void 0}A=yf(A)}}function Xd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Td(){for(var e=window,t=Ts();t instanceof e.HTMLIFrameElement;){try{var A=typeof t.contentWindow.location.href=="string"}catch{A=!1}if(A)e=t.contentWindow;else break;t=Ts(e.document)}return t}function Zg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function y0(e){var t=Td(),A=e.focusedElem,i=e.selectionRange;if(t!==A&&A&&A.ownerDocument&&Xd(A.ownerDocument.documentElement,A)){if(i!==null&&Zg(A)){if(t=i.start,e=i.end,e===void 0&&(e=t),"selectionStart"in A)A.selectionStart=t,A.selectionEnd=Math.min(e,A.value.length);else if(e=(t=A.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var n=A.textContent.length,r=Math.min(i.start,n);i=i.end===void 0?r:Math.min(i.end,n),!e.extend&&r>i&&(n=i,i=r,r=n),n=wf(A,r);var o=wf(A,i);n&&o&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(n.node,n.offset),e.removeAllRanges(),r>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=A;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A=document.documentMode,Fn=null,Ig=null,Pr=null,ag=!1;function Ff(e,t,A){var i=A.window===A?A.document:A.nodeType===9?A:A.ownerDocument;ag||Fn==null||Fn!==Ts(i)||(i=Fn,"selectionStart"in i&&Zg(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Pr&&no(Pr,i)||(Pr=i,i=AI(Ig,"onSelect"),0Sn||(e.current=fg[Sn],fg[Sn]=null,Sn--)}function le(e,t){Sn++,fg[Sn]=e.current,e.current=t}var li={},$e=Bi(li),ut=Bi(!1),Ki=li;function On(e,t){var A=e.type.contextTypes;if(!A)return li;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var n={},r;for(r in A)n[r]=t[r];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function Bt(e){return e=e.childContextTypes,e!=null}function nI(){Ce(ut),Ce($e)}function Mf(e,t,A){if($e.current!==li)throw Error(N(168));le($e,t),le(ut,A)}function nQ(e,t,A){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!="function")return A;i=i.getChildContext();for(var n in i)if(!(n in t))throw Error(N(108,Cw(e)||"Unknown",n));return we({},A,i)}function rI(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||li,Ki=$e.current,le($e,e),le(ut,ut.current),!0}function vf(e,t,A){var i=e.stateNode;if(!i)throw Error(N(169));A?(e=nQ(e,t,Ki),i.__reactInternalMemoizedMergedChildContext=e,Ce(ut),Ce($e),le($e,e)):Ce(ut),le(ut,A)}var SA=null,wI=!1,Mc=!1;function rQ(e){SA===null?SA=[e]:SA.push(e)}function H0(e){wI=!0,rQ(e)}function fi(){if(!Mc&&SA!==null){Mc=!0;var e=0,t=se;try{var A=SA;for(se=1;e>=o,n-=o,UA=1<<32-Zt(t)+n|A<S?(K=D,D=null):K=D.sibling;var q=l(d,D,Q[S],y);if(q===null){D===null&&(D=K);break}e&&D&&q.alternate===null&&t(d,D),f=r(q,f,S),w===null?F=q:w.sibling=q,w=q,D=K}if(S===Q.length)return A(d,D),pe&&Gi(d,S),F;if(D===null){for(;SS?(K=D,D=null):K=D.sibling;var T=l(d,D,q.value,y);if(T===null){D===null&&(D=K);break}e&&D&&T.alternate===null&&t(d,D),f=r(T,f,S),w===null?F=T:w.sibling=T,w=T,D=K}if(q.done)return A(d,D),pe&&Gi(d,S),F;if(D===null){for(;!q.done;S++,q=Q.next())q=u(d,q.value,y),q!==null&&(f=r(q,f,S),w===null?F=q:w.sibling=q,w=q);return pe&&Gi(d,S),F}for(D=i(d,D);!q.done;S++,q=Q.next())q=g(D,d,S,q.value,y),q!==null&&(e&&q.alternate!==null&&D.delete(q.key===null?S:q.key),f=r(q,f,S),w===null?F=q:w.sibling=q,w=q);return e&&D.forEach(function(Ue){return t(d,Ue)}),pe&&Gi(d,S),F}function U(d,f,Q,y){if(typeof Q=="object"&&Q!==null&&Q.type===yn&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case ps:e:{for(var F=Q.key,w=f;w!==null;){if(w.key===F){if(F=Q.type,F===yn){if(w.tag===7){A(d,w.sibling),f=n(w,Q.props.children),f.return=d,d=f;break e}}else if(w.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===WA&&bf(F)===w.type){A(d,w.sibling),f=n(w,Q.props),f.ref=Mr(d,w,Q),f.return=d,d=f;break e}A(d,w);break}else t(d,w);w=w.sibling}Q.type===yn?(f=Ri(Q.props.children,d.mode,y,Q.key),f.return=d,d=f):(y=Xs(Q.type,Q.key,Q.props,null,d.mode,y),y.ref=Mr(d,f,Q),y.return=d,d=y)}return o(d);case mn:e:{for(w=Q.key;f!==null;){if(f.key===w)if(f.tag===4&&f.stateNode.containerInfo===Q.containerInfo&&f.stateNode.implementation===Q.implementation){A(d,f.sibling),f=n(f,Q.children||[]),f.return=d,d=f;break e}else{A(d,f);break}else t(d,f);f=f.sibling}f=bc(Q,d.mode,y),f.return=d,d=f}return o(d);case WA:return w=Q._init,U(d,f,w(Q._payload),y)}if(Kr(Q))return B(d,f,Q,y);if(Nr(Q))return h(d,f,Q,y);vs(d,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"?(Q=""+Q,f!==null&&f.tag===6?(A(d,f.sibling),f=n(f,Q),f.return=d,d=f):(A(d,f),f=Oc(Q,d.mode,y),f.return=d,d=f),o(d)):A(d,f)}return U}var Yn=uQ(!0),BQ=uQ(!1),Co={},lA=Bi(Co),Io=Bi(Co),ao=Bi(Co);function Ji(e){if(e===Co)throw Error(N(174));return e}function rl(e,t){switch(le(ao,t),le(Io,e),le(lA,Co),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:jc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=jc(t,e)}Ce(lA),le(lA,t)}function Vn(){Ce(lA),Ce(Io),Ce(ao)}function fQ(e){Ji(ao.current);var t=Ji(lA.current),A=jc(t,e.type);t!==A&&(le(Io,e),le(lA,A))}function ol(e){Io.current===e&&(Ce(lA),Ce(Io))}var me=Bi(0);function gI(e){for(var t=e;t!==null;){if(t.tag===13){var A=t.memoizedState;if(A!==null&&(A=A.dehydrated,A===null||A.data==="$?"||A.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var vc=[];function sl(){for(var e=0;eA?A:4,e(!0);var i=Jc.transition;Jc.transition={};try{e(!1),t()}finally{se=A,Jc.transition=i}}function xQ(){return qt().memoizedState}function q0(e,t,A){var i=ai(e);if(A={lane:i,action:A,hasEagerState:!1,eagerState:null,next:null},GQ(e))HQ(t,A);else if(A=aQ(e,t,A,i),A!==null){var n=nt();Wt(A,e,i,n),MQ(A,t,i)}}function R0(e,t,A){var i=ai(e),n={lane:i,action:A,hasEagerState:!1,eagerState:null,next:null};if(GQ(e))HQ(t,n);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var o=t.lastRenderedState,s=r(o,A);if(n.hasEagerState=!0,n.eagerState=s,jt(s,o)){var I=t.interleaved;I===null?(n.next=n,il(t)):(n.next=I.next,I.next=n),t.interleaved=n;return}}catch{}finally{}A=aQ(e,t,n,i),A!==null&&(n=nt(),Wt(A,e,i,n),MQ(A,t,i))}}function GQ(e){var t=e.alternate;return e===ye||t!==null&&t===ye}function HQ(e,t){_r=lI=!0;var A=e.pending;A===null?t.next=t:(t.next=A.next,A.next=t),e.pending=t}function MQ(e,t,A){if(A&4194240){var i=t.lanes;i&=e.pendingLanes,A|=i,t.lanes=A,Yg(e,A)}}var uI={readContext:Jt,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},K0={readContext:Jt,useCallback:function(e,t){return aA().memoizedState=[e,t===void 0?null:t],e},useContext:Jt,useEffect:Vf,useImperativeHandle:function(e,t,A){return A=A!=null?A.concat([e]):null,Vs(4194308,4,DQ.bind(null,t,e),A)},useLayoutEffect:function(e,t){return Vs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vs(4,2,e,t)},useMemo:function(e,t){var A=aA();return t=t===void 0?null:t,e=e(),A.memoizedState=[e,t],e},useReducer:function(e,t,A){var i=aA();return t=A!==void 0?A(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=q0.bind(null,ye,e),[i.memoizedState,e]},useRef:function(e){var t=aA();return e={current:e},t.memoizedState=e},useState:Yf,useDebugValue:ll,useDeferredValue:function(e){return aA().memoizedState=e},useTransition:function(){var e=Yf(!1),t=e[0];return e=J0.bind(null,e[1]),aA().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,A){var i=ye,n=aA();if(pe){if(A===void 0)throw Error(N(407));A=A()}else{if(A=t(),qe===null)throw Error(N(349));Oi&30||CQ(i,t,A)}n.memoizedState=A;var r={value:A,getSnapshot:t};return n.queue=r,Vf(pQ.bind(null,i,r,e),[e]),i.flags|=2048,lo(9,hQ.bind(null,i,r,A,t),void 0,null),A},useId:function(){var e=aA(),t=qe.identifierPrefix;if(pe){var A=NA,i=UA;A=(i&~(1<<32-Zt(i)-1)).toString(32)+A,t=":"+t+"R"+A,A=co++,0s||n[o]!==r[s]){var a=` +`+n[o].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=s);break}}}finally{al=!1,Error.prepareStackTrace=A}return(e=e?e.displayName||e.name:"")?eo(e):""}function rF(e){switch(e.tag){case 5:return eo(e.type);case 16:return eo("Lazy");case 13:return eo("Suspense");case 19:return eo("SuspenseList");case 0:case 2:case 15:return e=Il(e.type,!1),e;case 11:return e=Il(e.type.render,!1),e;case 1:return e=Il(e.type,!0),e;default:return""}}function Hl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Mn:return"Fragment";case Hn:return"Portal";case Nl:return"Profiler";case wg:return"StrictMode";case xl:return"Suspense";case Gl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case QC:return(e.displayName||"Context")+".Consumer";case CC:return(e._context.displayName||"Context")+".Provider";case Fg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Dg:return t=e.displayName||null,t!==null?t:Hl(e.type)||"Memo";case ri:t=e._payload,e=e._init;try{return Hl(e(t))}catch{}}return null}function oF(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Hl(t);case 8:return t===wg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function hi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function sF(e){var t=pC(e)?"checked":"value",A=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof A<"u"&&typeof A.get=="function"&&typeof A.set=="function"){var n=A.get,r=A.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(o){i=""+o,r.call(this,o)}}),Object.defineProperty(e,t,{enumerable:A.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function zs(e){e._valueTracker||(e._valueTracker=sF(e))}function EC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var A=t.getValue(),i="";return e&&(i=pC(e)?e.checked?"true":"false":e.value),e=i,e!==A?(t.setValue(e),!0):!1}function pa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ml(e,t){var A=t.checked;return De({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:A??e._wrapperState.initialChecked})}function gd(e,t){var A=t.defaultValue==null?"":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;A=hi(t.value!=null?t.value:A),e._wrapperState={initialChecked:i,initialValue:A,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function mC(e,t){t=t.checked,t!=null&&yg(e,"checked",t,!1)}function vl(e,t){mC(e,t);var A=hi(t.value),i=t.type;if(A!=null)i==="number"?(A===0&&e.value===""||e.value!=A)&&(e.value=""+A):e.value!==""+A&&(e.value=""+A);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Rl(e,t.type,A):t.hasOwnProperty("defaultValue")&&Rl(e,t.type,hi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ud(e,t,A){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!(i!=="submit"&&i!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,A||t===e.value||(e.value=t),e.defaultValue=t}A=e.name,A!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,A!==""&&(e.name=A)}function Rl(e,t,A){(t!=="number"||pa(e.ownerDocument)!==e)&&(A==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+A&&(e.defaultValue=""+A))}var to=Array.isArray;function Vn(e,t,A,i){if(e=e.options,t){t={};for(var n=0;n"+t.valueOf().toString()+"",t=Ts.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function fo(e,t){if(t){var A=e.firstChild;if(A&&A===e.lastChild&&A.nodeType===3){A.nodeValue=t;return}}e.textContent=t}var no={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},aF=["Webkit","ms","Moz","O"];Object.keys(no).forEach(function(e){aF.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),no[t]=no[e]})});function DC(e,t,A){return t==null||typeof t=="boolean"||t===""?"":A||typeof t!="number"||t===0||no.hasOwnProperty(e)&&no[e]?(""+t).trim():t+"px"}function kC(e,t){e=e.style;for(var A in t)if(t.hasOwnProperty(A)){var i=A.indexOf("--")===0,n=DC(A,t[A],i);A==="float"&&(A="cssFloat"),i?e.setProperty(A,n):e[A]=n}}var IF=De({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Kl(e,t){if(t){if(IF[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(x(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(x(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(x(61))}if(t.style!=null&&typeof t.style!="object")throw Error(x(62))}}function bl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Ol=null;function kg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ll=null,zn=null,Tn=null;function dd(e){if(e=Ho(e)){if(typeof Ll!="function")throw Error(x(280));var t=e.stateNode;t&&(t=_a(t),Ll(e.stateNode,e.type,t))}}function SC(e){zn?Tn?Tn.push(e):Tn=[e]:zn=e}function UC(){if(zn){var e=zn,t=Tn;if(Tn=zn=null,dd(e),t)for(e=0;e>>=0,e===0?32:31-(pF(e)/EF|0)|0}var _s=64,Xs=4194304;function Ao(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function wa(e,t){var A=e.pendingLanes;if(A===0)return 0;var i=0,n=e.suspendedLanes,r=e.pingedLanes,o=A&268435455;if(o!==0){var s=o&~n;s!==0?i=Ao(s):(r&=o,r!==0&&(i=Ao(r)))}else o=A&~n,o!==0?i=Ao(o):r!==0&&(i=Ao(r));if(i===0)return 0;if(t!==0&&t!==i&&!(t&n)&&(n=i&-i,r=t&-t,n>=r||n===16&&(r&4194240)!==0))return t;if(i&4&&(i|=A&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0A;A++)t.push(e);return t}function xo(e,t,A){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-AA(t),e[t]=A}function FF(e,t){var A=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=oo),Fd=" ",Dd=!1;function XC(e,t){switch(e){case"keyup":return $F.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ZC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vn=!1;function tD(e,t){switch(e){case"compositionend":return ZC(t);case"keypress":return t.which!==32?null:(Dd=!0,Fd);case"textInput":return e=t.data,e===Fd&&Dd?null:e;default:return null}}function AD(e,t){if(vn)return e==="compositionend"||!vg&&XC(e,t)?(e=TC(),la=Gg=Ii=null,vn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:A,offset:t-e};e=i}e:{for(;A;){if(A.nextSibling){A=A.nextSibling;break e}A=A.parentNode}A=void 0}A=Ud(A)}}function eQ(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?eQ(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function tQ(){for(var e=window,t=pa();t instanceof e.HTMLIFrameElement;){try{var A=typeof t.contentWindow.location.href=="string"}catch{A=!1}if(A)e=t.contentWindow;else break;t=pa(e.document)}return t}function Rg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function lD(e){var t=tQ(),A=e.focusedElem,i=e.selectionRange;if(t!==A&&A&&A.ownerDocument&&eQ(A.ownerDocument.documentElement,A)){if(i!==null&&Rg(A)){if(t=i.start,e=i.end,e===void 0&&(e=t),"selectionStart"in A)A.selectionStart=t,A.selectionEnd=Math.min(e,A.value.length);else if(e=(t=A.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var n=A.textContent.length,r=Math.min(i.start,n);i=i.end===void 0?r:Math.min(i.end,n),!e.extend&&r>i&&(n=i,i=r,r=n),n=Nd(A,r);var o=Nd(A,i);n&&o&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(n.node,n.offset),e.removeAllRanges(),r>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=A;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A=document.documentMode,Rn=null,_l=null,ao=null,Xl=!1;function xd(e,t,A){var i=A.window===A?A.document:A.nodeType===9?A:A.ownerDocument;Xl||Rn==null||Rn!==pa(i)||(i=Rn,"selectionStart"in i&&Rg(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ao&&Eo(ao,i)||(ao=i,i=ka(_l,"onSelect"),0Kn||(e.current=tg[Kn],tg[Kn]=null,Kn--)}function fe(e,t){Kn++,tg[Kn]=e.current,e.current=t}var pi={},At=mi(pi),Qt=mi(!1),Zi=pi;function jn(e,t){var A=e.type.contextTypes;if(!A)return pi;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var n={},r;for(r in A)n[r]=t[r];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function ht(e){return e=e.childContextTypes,e!=null}function Ua(){pe(Qt),pe(At)}function bd(e,t,A){if(At.current!==pi)throw Error(x(168));fe(At,t),fe(Qt,A)}function cQ(e,t,A){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!="function")return A;i=i.getChildContext();for(var n in i)if(!(n in t))throw Error(x(108,oF(e)||"Unknown",n));return De({},A,i)}function Na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pi,Zi=At.current,fe(At,e),fe(Qt,Qt.current),!0}function Od(e,t,A){var i=e.stateNode;if(!i)throw Error(x(169));A?(e=cQ(e,t,Zi),i.__reactInternalMemoizedMergedChildContext=e,pe(Qt),pe(At),fe(At,e)):pe(Qt),fe(Qt,A)}var vA=null,Xa=!1,pl=!1;function lQ(e){vA===null?vA=[e]:vA.push(e)}function ED(e){Xa=!0,lQ(e)}function yi(){if(!pl&&vA!==null){pl=!0;var e=0,t=Ie;try{var A=vA;for(Ie=1;e>=o,n-=o,RA=1<<32-AA(t)+n|A<N?(b=S,S=null):b=S.sibling;var q=u(d,S,C[N],y);if(q===null){S===null&&(S=b);break}e&&S&&q.alternate===null&&t(d,S),B=r(q,B,N),F===null?D=q:F.sibling=q,F=q,S=b}if(N===C.length)return A(d,S),me&&Yi(d,N),D;if(S===null){for(;NN?(b=S,S=null):b=S.sibling;var Z=u(d,S,q.value,y);if(Z===null){S===null&&(S=b);break}e&&S&&Z.alternate===null&&t(d,S),B=r(Z,B,N),F===null?D=Z:F.sibling=Z,F=Z,S=b}if(q.done)return A(d,S),me&&Yi(d,N),D;if(S===null){for(;!q.done;N++,q=C.next())q=l(d,q.value,y),q!==null&&(B=r(q,B,N),F===null?D=q:F.sibling=q,F=q);return me&&Yi(d,N),D}for(S=i(d,S);!q.done;N++,q=C.next())q=g(S,d,N,q.value,y),q!==null&&(e&&q.alternate!==null&&S.delete(q.key===null?N:q.key),B=r(q,B,N),F===null?D=q:F.sibling=q,F=q);return e&&S.forEach(function(xe){return t(d,xe)}),me&&Yi(d,N),D}function k(d,B,C,y){if(typeof C=="object"&&C!==null&&C.type===Mn&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case Vs:e:{for(var D=C.key,F=B;F!==null;){if(F.key===D){if(D=C.type,D===Mn){if(F.tag===7){A(d,F.sibling),B=n(F,C.props.children),B.return=d,d=B;break e}}else if(F.elementType===D||typeof D=="object"&&D!==null&&D.$$typeof===ri&&_d(D)===F.type){A(d,F.sibling),B=n(F,C.props),B.ref=Zr(d,F,C),B.return=d,d=B;break e}A(d,F);break}else t(d,F);F=F.sibling}C.type===Mn?(B=Xi(C.props.children,d.mode,y,C.key),B.return=d,d=B):(y=ha(C.type,C.key,C.props,null,d.mode,y),y.ref=Zr(d,B,C),y.return=d,d=y)}return o(d);case Hn:e:{for(F=C.key;B!==null;){if(B.key===F)if(B.tag===4&&B.stateNode.containerInfo===C.containerInfo&&B.stateNode.implementation===C.implementation){A(d,B.sibling),B=n(B,C.children||[]),B.return=d,d=B;break e}else{A(d,B);break}else t(d,B);B=B.sibling}B=Sl(C,d.mode,y),B.return=d,d=B}return o(d);case ri:return F=C._init,k(d,B,F(C._payload),y)}if(to(C))return f(d,B,C,y);if(zr(C))return Q(d,B,C,y);oa(d,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,B!==null&&B.tag===6?(A(d,B.sibling),B=n(B,C),B.return=d,d=B):(A(d,B),B=kl(C,d.mode,y),B.return=d,d=B),o(d)):A(d,B)}return k}var er=hQ(!0),pQ=hQ(!1),Mo={},QA=mi(Mo),Fo=mi(Mo),Do=mi(Mo);function Ti(e){if(e===Mo)throw Error(x(174));return e}function Vg(e,t){switch(fe(Do,t),fe(Fo,e),fe(QA,Mo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ql(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ql(t,e)}pe(QA),fe(QA,t)}function tr(){pe(QA),pe(Fo),pe(Do)}function EQ(e){Ti(Do.current);var t=Ti(QA.current),A=ql(t,e.type);t!==A&&(fe(Fo,e),fe(QA,A))}function zg(e){Fo.current===e&&(pe(QA),pe(Fo))}var we=mi(0);function Ra(e){for(var t=e;t!==null;){if(t.tag===13){var A=t.memoizedState;if(A!==null&&(A=A.dehydrated,A===null||A.data==="$?"||A.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var El=[];function Tg(){for(var e=0;eA?A:4,e(!0);var i=ml.transition;ml.transition={};try{e(!1),t()}finally{Ie=A,ml.transition=i}}function JQ(){return Lt().memoizedState}function FD(e,t,A){var i=Ci(e);if(A={lane:i,action:A,hasEagerState:!1,eagerState:null,next:null},qQ(e))KQ(t,A);else if(A=BQ(e,t,A,i),A!==null){var n=st();iA(A,e,i,n),bQ(A,t,i)}}function DD(e,t,A){var i=Ci(e),n={lane:i,action:A,hasEagerState:!1,eagerState:null,next:null};if(qQ(e))KQ(t,n);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var o=t.lastRenderedState,s=r(o,A);if(n.hasEagerState=!0,n.eagerState=s,nA(s,o)){var a=t.interleaved;a===null?(n.next=n,Yg(t)):(n.next=a.next,a.next=n),t.interleaved=n;return}}catch{}finally{}A=BQ(e,t,n,i),A!==null&&(n=st(),iA(A,e,i,n),bQ(A,t,i))}}function qQ(e){var t=e.alternate;return e===Fe||t!==null&&t===Fe}function KQ(e,t){Io=Ja=!0;var A=e.pending;A===null?t.next=t:(t.next=A.next,A.next=t),e.pending=t}function bQ(e,t,A){if(A&4194240){var i=t.lanes;i&=e.pendingLanes,A|=i,t.lanes=A,Ug(e,A)}}var qa={readContext:Ot,useCallback:$e,useContext:$e,useEffect:$e,useImperativeHandle:$e,useInsertionEffect:$e,useLayoutEffect:$e,useMemo:$e,useReducer:$e,useRef:$e,useState:$e,useDebugValue:$e,useDeferredValue:$e,useTransition:$e,useMutableSource:$e,useSyncExternalStore:$e,useId:$e,unstable_isNewReconciler:!1},kD={readContext:Ot,useCallback:function(e,t){return BA().memoizedState=[e,t===void 0?null:t],e},useContext:Ot,useEffect:Zd,useImperativeHandle:function(e,t,A){return A=A!=null?A.concat([e]):null,Ba(4194308,4,GQ.bind(null,t,e),A)},useLayoutEffect:function(e,t){return Ba(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ba(4,2,e,t)},useMemo:function(e,t){var A=BA();return t=t===void 0?null:t,e=e(),A.memoizedState=[e,t],e},useReducer:function(e,t,A){var i=BA();return t=A!==void 0?A(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=FD.bind(null,Fe,e),[i.memoizedState,e]},useRef:function(e){var t=BA();return e={current:e},t.memoizedState=e},useState:Xd,useDebugValue:jg,useDeferredValue:function(e){return BA().memoizedState=e},useTransition:function(){var e=Xd(!1),t=e[0];return e=wD.bind(null,e[1]),BA().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,A){var i=Fe,n=BA();if(me){if(A===void 0)throw Error(x(407));A=A()}else{if(A=t(),be===null)throw Error(x(349));ji&30||wQ(i,t,A)}n.memoizedState=A;var r={value:A,getSnapshot:t};return n.queue=r,Zd(DQ.bind(null,i,r,e),[e]),i.flags|=2048,Uo(9,FQ.bind(null,i,r,A,t),void 0,null),A},useId:function(){var e=BA(),t=be.identifierPrefix;if(me){var A=JA,i=RA;A=(i&~(1<<32-AA(i)-1)).toString(32)+A,t=":"+t+"R"+A,A=ko++,0<\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=o.createElement(A,{is:i.is}):(e=o.createElement(A),A==="select"&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,A),e[cA]=t,e[so]=i,YQ(e,t,!1,!1),t.stateNode=e;e:{switch(o=eg(A,i),A){case"dialog":Qe("cancel",e),Qe("close",e),n=i;break;case"iframe":case"object":case"embed":Qe("load",e),n=i;break;case"video":case"audio":for(n=0;nPn&&(t.flags|=128,i=!0,vr(r,!1),t.lanes=4194304)}else{if(!i)if(e=gI(o),e!==null){if(t.flags|=128,i=!0,A=e.updateQueue,A!==null&&(t.updateQueue=A,t.flags|=4),vr(r,!0),r.tail===null&&r.tailMode==="hidden"&&!o.alternate&&!pe)return We(t),null}else 2*ke()-r.renderingStartTime>Pn&&A!==1073741824&&(t.flags|=128,i=!0,vr(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(A=r.last,A!==null?A.sibling=o:t.child=o,r.last=o)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=ke(),t.sibling=null,A=me.current,le(me,i?A&1|2:A&1),t):(We(t),null);case 22:case 23:return Cl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?wt&1073741824&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function _0(e,t){switch(jg(t),t.tag){case 1:return Bt(t.type)&&nI(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vn(),Ce(ut),Ce($e),sl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ol(t),null;case 13:if(Ce(me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));bn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ce(me),null;case 4:return Vn(),null;case 10:return Al(t.type._context),null;case 22:case 23:return Cl(),null;case 24:return null;default:return null}}var qs=!1,je=!1,X0=typeof WeakSet=="function"?WeakSet:Set,v=null;function Gn(e,t){var A=e.ref;if(A!==null)if(typeof A=="function")try{A(null)}catch(i){De(e,t,i)}else A.current=null}function kg(e,t,A){try{A()}catch(i){De(e,t,i)}}var $f=!1;function T0(e,t){if(cg=eI,e=Td(),Zg(e)){if("selectionStart"in e)var A={start:e.selectionStart,end:e.selectionEnd};else e:{A=(A=e.ownerDocument)&&A.defaultView||window;var i=A.getSelection&&A.getSelection();if(i&&i.rangeCount!==0){A=i.anchorNode;var n=i.anchorOffset,r=i.focusNode;i=i.focusOffset;try{A.nodeType,r.nodeType}catch{A=null;break e}var o=0,s=-1,I=-1,a=0,c=0,u=e,l=null;t:for(;;){for(var g;u!==A||n!==0&&u.nodeType!==3||(s=o+n),u!==r||i!==0&&u.nodeType!==3||(I=o+i),u.nodeType===3&&(o+=u.nodeValue.length),(g=u.firstChild)!==null;)l=u,u=g;for(;;){if(u===e)break t;if(l===A&&++a===n&&(s=o),l===r&&++c===i&&(I=o),(g=u.nextSibling)!==null)break;u=l,l=u.parentNode}u=g}A=s===-1||I===-1?null:{start:s,end:I}}else A=null}A=A||{start:0,end:0}}else A=null;for(gg={focusedElem:e,selectionRange:A},eI=!1,v=t;v!==null;)if(t=v,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,v=e;else for(;v!==null;){t=v;try{var B=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(B!==null){var h=B.memoizedProps,U=B.memoizedState,d=t.stateNode,f=d.getSnapshotBeforeUpdate(t.elementType===t.type?h:_t(t.type,h),U);d.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var Q=t.stateNode.containerInfo;Q.nodeType===1?Q.textContent="":Q.nodeType===9&&Q.documentElement&&Q.removeChild(Q.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(y){De(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,v=e;break}v=t.return}return B=$f,$f=!1,B}function Xr(e,t,A){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var n=i=i.next;do{if((n.tag&e)===e){var r=n.destroy;n.destroy=void 0,r!==void 0&&kg(t,A,r)}n=n.next}while(n!==i)}}function kI(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var A=t=t.next;do{if((A.tag&e)===e){var i=A.create;A.destroy=i()}A=A.next}while(A!==t)}}function Sg(e){var t=e.ref;if(t!==null){var A=e.stateNode;switch(e.tag){case 5:e=A;break;default:e=A}typeof t=="function"?t(e):t.current=e}}function PQ(e){var t=e.alternate;t!==null&&(e.alternate=null,PQ(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[cA],delete t[so],delete t[Bg],delete t[x0],delete t[G0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _Q(e){return e.tag===5||e.tag===3||e.tag===4}function ed(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_Q(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ug(e,t,A){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?A.nodeType===8?A.parentNode.insertBefore(e,t):A.insertBefore(e,t):(A.nodeType===8?(t=A.parentNode,t.insertBefore(e,A)):(t=A,t.appendChild(e)),A=A._reactRootContainer,A!=null||t.onclick!==null||(t.onclick=iI));else if(i!==4&&(e=e.child,e!==null))for(Ug(e,t,A),e=e.sibling;e!==null;)Ug(e,t,A),e=e.sibling}function Ng(e,t,A){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?A.insertBefore(e,t):A.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(Ng(e,t,A),e=e.sibling;e!==null;)Ng(e,t,A),e=e.sibling}var Ve=null,Xt=!1;function ZA(e,t,A){for(A=A.child;A!==null;)XQ(e,t,A),A=A.sibling}function XQ(e,t,A){if(gA&&typeof gA.onCommitFiberUnmount=="function")try{gA.onCommitFiberUnmount(hI,A)}catch{}switch(A.tag){case 5:je||Gn(A,t);case 6:var i=Ve,n=Xt;Ve=null,ZA(e,t,A),Ve=i,Xt=n,Ve!==null&&(Xt?(e=Ve,A=A.stateNode,e.nodeType===8?e.parentNode.removeChild(A):e.removeChild(A)):Ve.removeChild(A.stateNode));break;case 18:Ve!==null&&(Xt?(e=Ve,A=A.stateNode,e.nodeType===8?Hc(e.parentNode,A):e.nodeType===1&&Hc(e,A),Ao(e)):Hc(Ve,A.stateNode));break;case 4:i=Ve,n=Xt,Ve=A.stateNode.containerInfo,Xt=!0,ZA(e,t,A),Ve=i,Xt=n;break;case 0:case 11:case 14:case 15:if(!je&&(i=A.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){n=i=i.next;do{var r=n,o=r.destroy;r=r.tag,o!==void 0&&(r&2||r&4)&&kg(A,t,o),n=n.next}while(n!==i)}ZA(e,t,A);break;case 1:if(!je&&(Gn(A,t),i=A.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=A.memoizedProps,i.state=A.memoizedState,i.componentWillUnmount()}catch(s){De(A,t,s)}ZA(e,t,A);break;case 21:ZA(e,t,A);break;case 22:A.mode&1?(je=(i=je)||A.memoizedState!==null,ZA(e,t,A),je=i):ZA(e,t,A);break;default:ZA(e,t,A)}}function td(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var A=e.stateNode;A===null&&(A=e.stateNode=new X0),t.forEach(function(i){var n=nF.bind(null,e,i);A.has(i)||(A.add(i),i.then(n,n))})}}function Pt(e,t){var A=t.deletions;if(A!==null)for(var i=0;in&&(n=o),i&=~r}if(i=n,i=ke()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*W0(i/1960))-i,10e?16:e,Ai===null)var i=!1;else{if(e=Ai,Ai=null,dI=0,ie&6)throw Error(N(331));var n=ie;for(ie|=4,v=e.current;v!==null;){var r=v,o=r.child;if(v.flags&16){var s=r.deletions;if(s!==null){for(var I=0;Ike()-dl?qi(e,0):fl|=A),ft(e,t)}function AC(e,t){t===0&&(e.mode&1?(t=ws,ws<<=1,!(ws&130023424)&&(ws=4194304)):t=1);var A=nt();e=MA(e,t),e!==null&&(Bo(e,t,A),ft(e,A))}function iF(e){var t=e.memoizedState,A=0;t!==null&&(A=t.retryLane),AC(e,A)}function nF(e,t){var A=0;switch(e.tag){case 13:var i=e.stateNode,n=e.memoizedState;n!==null&&(A=n.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(N(314))}i!==null&&i.delete(t),AC(e,A)}var iC;iC=function(e,t,A){if(e!==null)if(e.memoizedProps!==t.pendingProps||ut.current)lt=!0;else{if(!(e.lanes&A)&&!(t.flags&128))return lt=!1,z0(e,t,A);lt=!!(e.flags&131072)}else lt=!1,pe&&t.flags&1048576&&oQ(t,sI,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;zs(e,t),e=t.pendingProps;var n=On(t,$e.current);Rn(t,A),n=al(null,t,i,e,n,A);var r=cl();return t.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Bt(i)?(r=!0,rI(t)):r=!1,t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,nl(t),n.updater=FI,t.stateNode=n,n._reactInternals=t,pg(t,i,e,A),t=yg(null,t,i,!0,r,A)):(t.tag=0,pe&&r&&Wg(t),it(null,t,n,A),t=t.child),t;case 16:i=t.elementType;e:{switch(zs(e,t),e=t.pendingProps,n=i._init,i=n(i._payload),t.type=i,n=t.tag=oF(i),e=_t(i,e),n){case 0:t=mg(null,t,i,e,A);break e;case 1:t=Zf(null,t,i,e,A);break e;case 11:t=Xf(null,t,i,e,A);break e;case 14:t=Tf(null,t,i,_t(i.type,e),A);break e}throw Error(N(306,i,""))}return t;case 0:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:_t(i,n),mg(e,t,i,n,A);case 1:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:_t(i,n),Zf(e,t,i,n,A);case 3:e:{if(LQ(t),e===null)throw Error(N(387));i=t.pendingProps,r=t.memoizedState,n=r.element,cQ(e,t),cI(t,i,null,A);var o=t.memoizedState;if(i=o.element,r.isDehydrated)if(r={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){n=zn(Error(N(423)),t),t=Wf(e,t,i,A,n);break e}else if(i!==n){n=zn(Error(N(424)),t),t=Wf(e,t,i,A,n);break e}else for(Ft=oi(t.stateNode.containerInfo.firstChild),Dt=t,pe=!0,Tt=null,A=BQ(t,null,i,A),t.child=A;A;)A.flags=A.flags&-3|4096,A=A.sibling;else{if(bn(),i===n){t=vA(e,t,A);break e}it(e,t,i,A)}t=t.child}return t;case 5:return fQ(t),e===null&&Qg(t),i=t.type,n=t.pendingProps,r=e!==null?e.memoizedProps:null,o=n.children,lg(i,n)?o=null:r!==null&&lg(i,r)&&(t.flags|=32),KQ(e,t),it(e,t,o,A),t.child;case 6:return e===null&&Qg(t),null;case 13:return OQ(e,t,A);case 4:return rl(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Yn(t,null,i,A):it(e,t,i,A),t.child;case 11:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:_t(i,n),Xf(e,t,i,n,A);case 7:return it(e,t,t.pendingProps,A),t.child;case 8:return it(e,t,t.pendingProps.children,A),t.child;case 12:return it(e,t,t.pendingProps.children,A),t.child;case 10:e:{if(i=t.type._context,n=t.pendingProps,r=t.memoizedProps,o=n.value,le(II,i._currentValue),i._currentValue=o,r!==null)if(jt(r.value,o)){if(r.children===n.children&&!ut.current){t=vA(e,t,A);break e}}else for(r=t.child,r!==null&&(r.return=t);r!==null;){var s=r.dependencies;if(s!==null){o=r.child;for(var I=s.firstContext;I!==null;){if(I.context===i){if(r.tag===1){I=xA(-1,A&-A),I.tag=2;var a=r.updateQueue;if(a!==null){a=a.shared;var c=a.pending;c===null?I.next=I:(I.next=c.next,c.next=I),a.pending=I}}r.lanes|=A,I=r.alternate,I!==null&&(I.lanes|=A),Cg(r.return,A,t),s.lanes|=A;break}I=I.next}}else if(r.tag===10)o=r.type===t.type?null:r.child;else if(r.tag===18){if(o=r.return,o===null)throw Error(N(341));o.lanes|=A,s=o.alternate,s!==null&&(s.lanes|=A),Cg(o,A,t),o=r.sibling}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===t){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}it(e,t,n.children,A),t=t.child}return t;case 9:return n=t.type,i=t.pendingProps.children,Rn(t,A),n=Jt(n),i=i(n),t.flags|=1,it(e,t,i,A),t.child;case 14:return i=t.type,n=_t(i,t.pendingProps),n=_t(i.type,n),Tf(e,t,i,n,A);case 15:return qQ(e,t,t.type,t.pendingProps,A);case 17:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:_t(i,n),zs(e,t),t.tag=1,Bt(i)?(e=!0,rI(t)):e=!1,Rn(t,A),lQ(t,i,n),pg(t,i,n,A),yg(null,t,i,!0,e,A);case 19:return bQ(e,t,A);case 22:return RQ(e,t,A)}throw Error(N(156,t.tag))};function nC(e,t){return Nd(e,t)}function rF(e,t,A,i){this.tag=e,this.key=A,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mt(e,t,A,i){return new rF(e,t,A,i)}function pl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function oF(e){if(typeof e=="function")return pl(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Kg)return 11;if(e===Lg)return 14}return 2}function ci(e,t){var A=e.alternate;return A===null?(A=Mt(e.tag,t,e.key,e.mode),A.elementType=e.elementType,A.type=e.type,A.stateNode=e.stateNode,A.alternate=e,e.alternate=A):(A.pendingProps=t,A.type=e.type,A.flags=0,A.subtreeFlags=0,A.deletions=null),A.flags=e.flags&14680064,A.childLanes=e.childLanes,A.lanes=e.lanes,A.child=e.child,A.memoizedProps=e.memoizedProps,A.memoizedState=e.memoizedState,A.updateQueue=e.updateQueue,t=e.dependencies,A.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},A.sibling=e.sibling,A.index=e.index,A.ref=e.ref,A}function Xs(e,t,A,i,n,r){var o=2;if(i=e,typeof e=="function")pl(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case yn:return Ri(A.children,n,r,t);case Rg:o=8,n|=8;break;case Vc:return e=Mt(12,A,t,n|2),e.elementType=Vc,e.lanes=r,e;case zc:return e=Mt(13,A,t,n),e.elementType=zc,e.lanes=r,e;case Pc:return e=Mt(19,A,t,n),e.elementType=Pc,e.lanes=r,e;case ud:return UI(A,n,r,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case gd:o=10;break e;case ld:o=9;break e;case Kg:o=11;break e;case Lg:o=14;break e;case WA:o=16,i=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Mt(o,A,t,n),t.elementType=e,t.type=i,t.lanes=r,t}function Ri(e,t,A,i){return e=Mt(7,e,i,t),e.lanes=A,e}function UI(e,t,A,i){return e=Mt(22,e,i,t),e.elementType=ud,e.lanes=A,e.stateNode={isHidden:!1},e}function Oc(e,t,A){return e=Mt(6,e,null,t),e.lanes=A,e}function bc(e,t,A){return t=Mt(4,e.children!==null?e.children:[],e.key,t),t.lanes=A,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sF(e,t,A,i,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fc(0),this.expirationTimes=Fc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fc(0),this.identifierPrefix=i,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function El(e,t,A,i,n,r,o,s,I){return e=new sF(e,t,A,s,I),t===1?(t=1,r===!0&&(t|=8)):t=0,r=Mt(3,null,null,t),e.current=r,r.stateNode=e,r.memoizedState={element:i,isDehydrated:A,cache:null,transitions:null,pendingSuspenseBoundaries:null},nl(r),e}function IF(e,t,A){var i=3{"use strict";function aC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(aC)}catch(e){console.error(e)}}aC(),cC.exports=IC()});var lC=de(Dl=>{"use strict";var gC=Fl();Dl.createRoot=gC.createRoot,Dl.hydrateRoot=gC.hydrateRoot;var SN});var CC=de(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.output=ot.exists=ot.hash=ot.bytes=ot.bool=ot.number=void 0;function MI(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}ot.number=MI;function BC(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}ot.bool=BC;function BF(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function kl(e,...t){if(!BF(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}ot.bytes=kl;function fC(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");MI(e.outputLen),MI(e.blockLen)}ot.hash=fC;function dC(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}ot.exists=dC;function QC(e,t){kl(e);let A=t.outputLen;if(e.length{"use strict";Object.defineProperty(b,"__esModule",{value:!0});b.add5L=b.add5H=b.add4H=b.add4L=b.add3H=b.add3L=b.add=b.rotlBL=b.rotlBH=b.rotlSL=b.rotlSH=b.rotr32L=b.rotr32H=b.rotrBL=b.rotrBH=b.rotrSL=b.rotrSH=b.shrSL=b.shrSH=b.toBig=b.split=b.fromBig=void 0;var vI=BigInt(2**32-1),Sl=BigInt(32);function Ul(e,t=!1){return t?{h:Number(e&vI),l:Number(e>>Sl&vI)}:{h:Number(e>>Sl&vI)|0,l:Number(e&vI)|0}}b.fromBig=Ul;function hC(e,t=!1){let A=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;nBigInt(e>>>0)<>>0);b.toBig=pC;var EC=(e,t,A)=>e>>>A;b.shrSH=EC;var mC=(e,t,A)=>e<<32-A|t>>>A;b.shrSL=mC;var yC=(e,t,A)=>e>>>A|t<<32-A;b.rotrSH=yC;var wC=(e,t,A)=>e<<32-A|t>>>A;b.rotrSL=wC;var FC=(e,t,A)=>e<<64-A|t>>>A-32;b.rotrBH=FC;var DC=(e,t,A)=>e>>>A-32|t<<64-A;b.rotrBL=DC;var kC=(e,t)=>t;b.rotr32H=kC;var SC=(e,t)=>e;b.rotr32L=SC;var UC=(e,t,A)=>e<>>32-A;b.rotlSH=UC;var NC=(e,t,A)=>t<>>32-A;b.rotlSL=NC;var xC=(e,t,A)=>t<>>64-A;b.rotlBH=xC;var GC=(e,t,A)=>e<>>64-A;b.rotlBL=GC;function HC(e,t,A,i){let n=(t>>>0)+(i>>>0);return{h:e+A+(n/2**32|0)|0,l:n|0}}b.add=HC;var MC=(e,t,A)=>(e>>>0)+(t>>>0)+(A>>>0);b.add3L=MC;var vC=(e,t,A,i)=>t+A+i+(e/2**32|0)|0;b.add3H=vC;var JC=(e,t,A,i)=>(e>>>0)+(t>>>0)+(A>>>0)+(i>>>0);b.add4L=JC;var qC=(e,t,A,i,n)=>t+A+i+n+(e/2**32|0)|0;b.add4H=qC;var RC=(e,t,A,i,n)=>(e>>>0)+(t>>>0)+(A>>>0)+(i>>>0)+(n>>>0);b.add5L=RC;var KC=(e,t,A,i,n,r)=>t+A+i+n+r+(e/2**32|0)|0;b.add5H=KC;var dF={fromBig:Ul,split:hC,toBig:pC,shrSH:EC,shrSL:mC,rotrSH:yC,rotrSL:wC,rotrBH:FC,rotrBL:DC,rotr32H:kC,rotr32L:SC,rotlSH:UC,rotlSL:NC,rotlBH:xC,rotlBL:GC,add:HC,add3L:MC,add3H:vC,add4L:JC,add4H:qC,add5H:KC,add5L:RC};b.default=dF});var OC=de(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.crypto=void 0;JI.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var VC=de(_=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0});_.randomBytes=_.wrapXOFConstructorWithOpts=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;var Nl=OC(),QF=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);_.u8=QF;var CF=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));_.u32=CF;function Gl(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}var hF=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);_.createView=hF;var pF=(e,t)=>e<<32-t|e>>>t;_.rotr=pF;_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_.isLE)throw new Error("Non little-endian hardware is not supported");var EF=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function mF(e){if(!Gl(e))throw new Error("Uint8Array expected");let t="";for(let A=0;A=qA._0&&e<=qA._9)return e-qA._0;if(e>=qA._A&&e<=qA._F)return e-(qA._A-10);if(e>=qA._a&&e<=qA._f)return e-(qA._a-10)}function yF(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,A=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(A);for(let n=0,r=0;n{};_.nextTick=wF;async function FF(e,t,A){let i=Date.now();for(let n=0;n=0&&re().update(qI(i)).digest(),A=e();return t.outputLen=A.outputLen,t.blockLen=A.blockLen,t.create=()=>e(),t}_.wrapConstructor=UF;function NF(e){let t=(i,n)=>e(n).update(qI(i)).digest(),A=e({});return t.outputLen=A.outputLen,t.blockLen=A.blockLen,t.create=i=>e(i),t}_.wrapConstructorWithOpts=NF;function xF(e){let t=(i,n)=>e(n).update(qI(i)).digest(),A=e({});return t.outputLen=A.outputLen,t.blockLen=A.blockLen,t.create=i=>e(i),t}_.wrapXOFConstructorWithOpts=xF;function GF(e=32){if(Nl.crypto&&typeof Nl.crypto.getRandomValues=="function")return Nl.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=GF});var Hl=de(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.shake256=ue.shake128=ue.keccak_512=ue.keccak_384=ue.keccak_256=ue.keccak_224=ue.sha3_512=ue.sha3_384=ue.sha3_256=ue.sha3_224=ue.Keccak=ue.keccakP=void 0;var Zn=CC(),Eo=LC(),po=VC(),[_C,XC,TC]=[[],[],[]],HF=BigInt(0),ho=BigInt(1),MF=BigInt(2),vF=BigInt(7),JF=BigInt(256),qF=BigInt(113);for(let e=0,t=ho,A=1,i=0;e<24;e++){[A,i]=[i,(2*A+3*i)%5],_C.push(2*(5*i+A)),XC.push((e+1)*(e+2)/2%64);let n=HF;for(let r=0;r<7;r++)t=(t<>vF)*qF)%JF,t&MF&&(n^=ho<<(ho<A>32?(0,Eo.rotlBH)(e,t,A):(0,Eo.rotlSH)(e,t,A),PC=(e,t,A)=>A>32?(0,Eo.rotlBL)(e,t,A):(0,Eo.rotlSL)(e,t,A);function ZC(e,t=24){let A=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let o=0;o<10;o++)A[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){let s=(o+8)%10,I=(o+2)%10,a=A[I],c=A[I+1],u=zC(a,c,1)^A[s],l=PC(a,c,1)^A[s+1];for(let g=0;g<50;g+=10)e[o+g]^=u,e[o+g+1]^=l}let n=e[2],r=e[3];for(let o=0;o<24;o++){let s=XC[o],I=zC(n,r,s),a=PC(n,r,s),c=_C[o];n=e[c],r=e[c+1],e[c]=I,e[c+1]=a}for(let o=0;o<50;o+=10){for(let s=0;s<10;s++)A[s]=e[o+s];for(let s=0;s<10;s++)e[o+s]^=~A[(s+2)%10]&A[(s+4)%10]}e[0]^=RF[i],e[1]^=KF[i]}A.fill(0)}ue.keccakP=ZC;var mo=class e extends po.Hash{constructor(t,A,i,n=!1,r=24){if(super(),this.blockLen=t,this.suffix=A,this.outputLen=i,this.enableXOF=n,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Zn.number)(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,po.u32)(this.state)}keccak(){ZC(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){(0,Zn.exists)(this);let{blockLen:A,state:i}=this;t=(0,po.toBytes)(t);let n=t.length;for(let r=0;r=i&&this.keccak();let o=Math.min(i-this.posOut,r-n);t.set(A.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,Zn.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,Zn.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:A,suffix:i,outputLen:n,rounds:r,enableXOF:o}=this;return t||(t=new e(A,i,n,o,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=i,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};ue.Keccak=mo;var Qi=(e,t,A)=>(0,po.wrapConstructor)(()=>new mo(t,e,A));ue.sha3_224=Qi(6,144,224/8);ue.sha3_256=Qi(6,136,256/8);ue.sha3_384=Qi(6,104,384/8);ue.sha3_512=Qi(6,72,512/8);ue.keccak_224=Qi(1,144,224/8);ue.keccak_256=Qi(1,136,256/8);ue.keccak_384=Qi(1,104,384/8);ue.keccak_512=Qi(1,72,512/8);var WC=(e,t,A)=>(0,po.wrapXOFConstructorWithOpts)((i={})=>new mo(t,e,i.dkLen===void 0?A:i.dkLen,!0));ue.shake128=WC(31,168,128/8);ue.shake256=WC(31,136,256/8)});var rh=de((KN,Ci)=>{var{sha3_512:LF}=Hl(),$C=24,yo=32,Ml=(e=4,t=Math.random)=>{let A="";for(;A.lengtheh(LF(e)).toString(36).slice(1),jC=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),OF=e=>jC[Math.floor(e()*jC.length)],Ah=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{}}={})=>{let t=Object.keys(e).toString(),A=t.length?t+Ml(yo):Ml(yo);return th(A).substring(0,yo)},ih=e=>()=>e++,bF=476782367,nh=({random:e=Math.random,counter:t=ih(Math.floor(e()*bF)),length:A=$C,fingerprint:i=Ah()}={})=>function(){let r=OF(e),o=Date.now().toString(36),s=t().toString(36),I=Ml(A,e),a=`${o+I+s+i}`;return`${r+th(a).substring(1,A)}`},YF=nh(),VF=(e,{minLength:t=2,maxLength:A=yo}={})=>{let i=e.length,n=/^[0-9a-z]+$/;try{if(typeof e=="string"&&i>=t&&i<=A&&n.test(e))return!0}finally{}return!1};Ci.exports.getConstants=()=>({defaultLength:$C,bigLength:yo});Ci.exports.init=nh;Ci.exports.createId=YF;Ci.exports.bufToBigInt=eh;Ci.exports.createCounter=ih;Ci.exports.createFingerprint=Ah;Ci.exports.isCuid=VF});var oh=de((LN,wo)=>{var{createId:zF,init:PF,getConstants:_F,isCuid:XF}=rh();wo.exports.createId=zF;wo.exports.init=PF;wo.exports.getConstants=_F;wo.exports.isCuid=XF});var Ih=de(Jl=>{"use strict";var TF=Symbol.for("react.fragment");Jl.Fragment=TF;Jl.jsxDEV=void 0});var ch=de((VN,ah)=>{"use strict";ah.exports=Ih()});var lh=de(RI=>{"use strict";var ZF=Ye(),WF=Symbol.for("react.element"),jF=Symbol.for("react.fragment"),$F=Object.prototype.hasOwnProperty,eD=ZF.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tD={key:!0,ref:!0,__self:!0,__source:!0};function gh(e,t,A){var i,n={},r=null,o=null;A!==void 0&&(r=""+A),t.key!==void 0&&(r=""+t.key),t.ref!==void 0&&(o=t.ref);for(i in t)$F.call(t,i)&&!tD.hasOwnProperty(i)&&(n[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)n[i]===void 0&&(n[i]=t[i]);return{$$typeof:WF,type:e,key:r,ref:o,props:n,_owner:eD.current}}RI.Fragment=jF;RI.jsx=gh;RI.jsxs=gh});var Ie=de((PN,uh)=>{"use strict";uh.exports=lh()});var YE=de((ju,bE)=>{"use strict";var{hasOwnProperty:Ga}=Object.prototype,ln=Wu();ln.configure=Wu;ln.stringify=ln;ln.default=ln;ju.stringify=ln;ju.configure=Wu;bE.exports=ln;var aU=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function Si(e){return e.length<5e3&&!aU.test(e)?`"${e}"`:JSON.stringify(e)}function Tu(e){if(e.length>200)return e.sort();for(let t=1;tA;)e[i]=e[i-1],i--;e[i]=A}return e}var cU=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Zu(e){return cU.call(e)!==void 0&&e.length!==0}function KE(e,t,A){e.length= 1`)}return A===void 0?1/0:A}function gn(e){return e===1?"1 item":`${e} items`}function lU(e){let t=new Set;for(let A of e)(typeof A=="string"||typeof A=="number")&&t.add(String(A));return t}function uU(e){if(Ga.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return A=>{let i=`Object can not safely be stringified. Received type ${typeof A}`;throw typeof A!="function"&&(i+=` (${A.toString()})`),new Error(i)}}}function Wu(e){e={...e};let t=uU(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let A=gU(e),i=LE(e,"bigint"),n=LE(e,"deterministic"),r=OE(e,"maximumDepth"),o=OE(e,"maximumBreadth");function s(l,g,B,h,U,d){let f=g[l];switch(typeof f=="object"&&f!==null&&typeof f.toJSON=="function"&&(f=f.toJSON(l)),f=h.call(g,l,f),typeof f){case"string":return Si(f);case"object":{if(f===null)return"null";if(B.indexOf(f)!==-1)return A;let Q="",y=",",F=d;if(Array.isArray(f)){if(f.length===0)return"[]";if(r<\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=o.createElement(A,{is:i.is}):(e=o.createElement(A),A==="select"&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,A),e[dA]=t,e[wo]=i,XQ(e,t,!1,!1),t.stateNode=e;e:{switch(o=bl(A,i),A){case"dialog":he("cancel",e),he("close",e),n=i;break;case"iframe":case"object":case"embed":he("load",e),n=i;break;case"video":case"audio":for(n=0;nir&&(t.flags|=128,i=!0,Wr(r,!1),t.lanes=4194304)}else{if(!i)if(e=Ra(o),e!==null){if(t.flags|=128,i=!0,A=e.updateQueue,A!==null&&(t.updateQueue=A,t.flags|=4),Wr(r,!0),r.tail===null&&r.tailMode==="hidden"&&!o.alternate&&!me)return et(t),null}else 2*Ue()-r.renderingStartTime>ir&&A!==1073741824&&(t.flags|=128,i=!0,Wr(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(A=r.last,A!==null?A.sibling=o:t.child=o,r.last=o)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=Ue(),t.sibling=null,A=we.current,fe(we,i?A&1|2:A&1),t):(et(t),null);case 22:case 23:return nu(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Ut&1073741824&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),null;case 24:return null;case 25:return null}throw Error(x(156,t.tag))}function vD(e,t){switch(qg(t),t.tag){case 1:return ht(t.type)&&Ua(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tr(),pe(Qt),pe(At),Tg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return zg(t),null;case 13:if(pe(we),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(x(340));$n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pe(we),null;case 4:return tr(),null;case 10:return Lg(t.type._context),null;case 22:case 23:return nu(),null;case 24:return null;default:return null}}var aa=!1,tt=!1,RD=typeof WeakSet=="function"?WeakSet:Set,R=null;function Yn(e,t){var A=e.ref;if(A!==null)if(typeof A=="function")try{A(null)}catch(i){Se(e,t,i)}else A.current=null}function ug(e,t,A){try{A()}catch(i){Se(e,t,i)}}var rC=!1;function JD(e,t){if(Zl=Fa,e=tQ(),Rg(e)){if("selectionStart"in e)var A={start:e.selectionStart,end:e.selectionEnd};else e:{A=(A=e.ownerDocument)&&A.defaultView||window;var i=A.getSelection&&A.getSelection();if(i&&i.rangeCount!==0){A=i.anchorNode;var n=i.anchorOffset,r=i.focusNode;i=i.focusOffset;try{A.nodeType,r.nodeType}catch{A=null;break e}var o=0,s=-1,a=-1,I=0,c=0,l=e,u=null;t:for(;;){for(var g;l!==A||n!==0&&l.nodeType!==3||(s=o+n),l!==r||i!==0&&l.nodeType!==3||(a=o+i),l.nodeType===3&&(o+=l.nodeValue.length),(g=l.firstChild)!==null;)u=l,l=g;for(;;){if(l===e)break t;if(u===A&&++I===n&&(s=o),u===r&&++c===i&&(a=o),(g=l.nextSibling)!==null)break;l=u,u=l.parentNode}l=g}A=s===-1||a===-1?null:{start:s,end:a}}else A=null}A=A||{start:0,end:0}}else A=null;for(Wl={focusedElem:e,selectionRange:A},Fa=!1,R=t;R!==null;)if(t=R,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,R=e;else for(;R!==null;){t=R;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var Q=f.memoizedProps,k=f.memoizedState,d=t.stateNode,B=d.getSnapshotBeforeUpdate(t.elementType===t.type?Q:$t(t.type,Q),k);d.__reactInternalSnapshotBeforeUpdate=B}break;case 3:var C=t.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(x(163))}}catch(y){Se(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,R=e;break}R=t.return}return f=rC,rC=!1,f}function co(e,t,A){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var n=i=i.next;do{if((n.tag&e)===e){var r=n.destroy;n.destroy=void 0,r!==void 0&&ug(t,A,r)}n=n.next}while(n!==i)}}function ja(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var A=t=t.next;do{if((A.tag&e)===e){var i=A.create;A.destroy=i()}A=A.next}while(A!==t)}}function fg(e){var t=e.ref;if(t!==null){var A=e.stateNode;switch(e.tag){case 5:e=A;break;default:e=A}typeof t=="function"?t(e):t.current=e}}function jQ(e){var t=e.alternate;t!==null&&(e.alternate=null,jQ(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[dA],delete t[wo],delete t[eg],delete t[hD],delete t[pD])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function $Q(e){return e.tag===5||e.tag===3||e.tag===4}function oC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$Q(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bg(e,t,A){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?A.nodeType===8?A.parentNode.insertBefore(e,t):A.insertBefore(e,t):(A.nodeType===8?(t=A.parentNode,t.insertBefore(e,A)):(t=A,t.appendChild(e)),A=A._reactRootContainer,A!=null||t.onclick!==null||(t.onclick=Sa));else if(i!==4&&(e=e.child,e!==null))for(Bg(e,t,A),e=e.sibling;e!==null;)Bg(e,t,A),e=e.sibling}function dg(e,t,A){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?A.insertBefore(e,t):A.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(dg(e,t,A),e=e.sibling;e!==null;)dg(e,t,A),e=e.sibling}var Te=null,eA=!1;function ni(e,t,A){for(A=A.child;A!==null;)eh(e,t,A),A=A.sibling}function eh(e,t,A){if(CA&&typeof CA.onCommitFiberUnmount=="function")try{CA.onCommitFiberUnmount(Pa,A)}catch{}switch(A.tag){case 5:tt||Yn(A,t);case 6:var i=Te,n=eA;Te=null,ni(e,t,A),Te=i,eA=n,Te!==null&&(eA?(e=Te,A=A.stateNode,e.nodeType===8?e.parentNode.removeChild(A):e.removeChild(A)):Te.removeChild(A.stateNode));break;case 18:Te!==null&&(eA?(e=Te,A=A.stateNode,e.nodeType===8?hl(e.parentNode,A):e.nodeType===1&&hl(e,A),ho(e)):hl(Te,A.stateNode));break;case 4:i=Te,n=eA,Te=A.stateNode.containerInfo,eA=!0,ni(e,t,A),Te=i,eA=n;break;case 0:case 11:case 14:case 15:if(!tt&&(i=A.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){n=i=i.next;do{var r=n,o=r.destroy;r=r.tag,o!==void 0&&(r&2||r&4)&&ug(A,t,o),n=n.next}while(n!==i)}ni(e,t,A);break;case 1:if(!tt&&(Yn(A,t),i=A.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=A.memoizedProps,i.state=A.memoizedState,i.componentWillUnmount()}catch(s){Se(A,t,s)}ni(e,t,A);break;case 21:ni(e,t,A);break;case 22:A.mode&1?(tt=(i=tt)||A.memoizedState!==null,ni(e,t,A),tt=i):ni(e,t,A);break;default:ni(e,t,A)}}function sC(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var A=e.stateNode;A===null&&(A=e.stateNode=new RD),t.forEach(function(i){var n=zD.bind(null,e,i);A.has(i)||(A.add(i),i.then(n,n))})}}function jt(e,t){var A=t.deletions;if(A!==null)for(var i=0;in&&(n=o),i&=~r}if(i=n,i=Ue()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*KD(i/1960))-i,10e?16:e,ci===null)var i=!1;else{if(e=ci,ci=null,Oa=0,re&6)throw Error(x(331));var n=re;for(re|=4,R=e.current;R!==null;){var r=R,o=r.child;if(R.flags&16){var s=r.deletions;if(s!==null){for(var a=0;aUe()-Au?_i(e,0):tu|=A),pt(e,t)}function ah(e,t){t===0&&(e.mode&1?(t=Xs,Xs<<=1,!(Xs&130023424)&&(Xs=4194304)):t=1);var A=st();e=OA(e,t),e!==null&&(xo(e,t,A),pt(e,A))}function VD(e){var t=e.memoizedState,A=0;t!==null&&(A=t.retryLane),ah(e,A)}function zD(e,t){var A=0;switch(e.tag){case 13:var i=e.stateNode,n=e.memoizedState;n!==null&&(A=n.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(x(314))}i!==null&&i.delete(t),ah(e,A)}var Ih;Ih=function(e,t,A){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)Ct=!0;else{if(!(e.lanes&A)&&!(t.flags&128))return Ct=!1,HD(e,t,A);Ct=!!(e.flags&131072)}else Ct=!1,me&&t.flags&1048576&&gQ(t,Ga,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;da(e,t),e=t.pendingProps;var n=jn(t,At.current);Xn(t,A),n=Xg(null,t,i,e,n,A);var r=Zg();return t.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ht(i)?(r=!0,Na(t)):r=!1,t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,Pg(t),n.updater=Za,t.stateNode=n,n._reactInternals=t,og(t,i,e,A),t=Ig(null,t,i,!0,r,A)):(t.tag=0,me&&r&&Jg(t),ot(null,t,n,A),t=t.child),t;case 16:i=t.elementType;e:{switch(da(e,t),e=t.pendingProps,n=i._init,i=n(i._payload),t.type=i,n=t.tag=_D(i),e=$t(i,e),n){case 0:t=ag(null,t,i,e,A);break e;case 1:t=AC(null,t,i,e,A);break e;case 11:t=eC(null,t,i,e,A);break e;case 14:t=tC(null,t,i,$t(i.type,e),A);break e}throw Error(x(306,i,""))}return t;case 0:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:$t(i,n),ag(e,t,i,n,A);case 1:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:$t(i,n),AC(e,t,i,n,A);case 3:e:{if(zQ(t),e===null)throw Error(x(387));i=t.pendingProps,r=t.memoizedState,n=r.element,dQ(e,t),va(t,i,null,A);var o=t.memoizedState;if(i=o.element,r.isDehydrated)if(r={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){n=Ar(Error(x(423)),t),t=iC(e,t,i,A,n);break e}else if(i!==n){n=Ar(Error(x(424)),t),t=iC(e,t,i,A,n);break e}else for(Nt=fi(t.stateNode.containerInfo.firstChild),xt=t,me=!0,tA=null,A=pQ(t,null,i,A),t.child=A;A;)A.flags=A.flags&-3|4096,A=A.sibling;else{if($n(),i===n){t=LA(e,t,A);break e}ot(e,t,i,A)}t=t.child}return t;case 5:return EQ(t),e===null&&ig(t),i=t.type,n=t.pendingProps,r=e!==null?e.memoizedProps:null,o=n.children,jl(i,n)?o=null:r!==null&&jl(i,r)&&(t.flags|=32),VQ(e,t),ot(e,t,o,A),t.child;case 6:return e===null&&ig(t),null;case 13:return TQ(e,t,A);case 4:return Vg(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=er(t,null,i,A):ot(e,t,i,A),t.child;case 11:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:$t(i,n),eC(e,t,i,n,A);case 7:return ot(e,t,t.pendingProps,A),t.child;case 8:return ot(e,t,t.pendingProps.children,A),t.child;case 12:return ot(e,t,t.pendingProps.children,A),t.child;case 10:e:{if(i=t.type._context,n=t.pendingProps,r=t.memoizedProps,o=n.value,fe(Ha,i._currentValue),i._currentValue=o,r!==null)if(nA(r.value,o)){if(r.children===n.children&&!Qt.current){t=LA(e,t,A);break e}}else for(r=t.child,r!==null&&(r.return=t);r!==null;){var s=r.dependencies;if(s!==null){o=r.child;for(var a=s.firstContext;a!==null;){if(a.context===i){if(r.tag===1){a=qA(-1,A&-A),a.tag=2;var I=r.updateQueue;if(I!==null){I=I.shared;var c=I.pending;c===null?a.next=a:(a.next=c.next,c.next=a),I.pending=a}}r.lanes|=A,a=r.alternate,a!==null&&(a.lanes|=A),ng(r.return,A,t),s.lanes|=A;break}a=a.next}}else if(r.tag===10)o=r.type===t.type?null:r.child;else if(r.tag===18){if(o=r.return,o===null)throw Error(x(341));o.lanes|=A,s=o.alternate,s!==null&&(s.lanes|=A),ng(o,A,t),o=r.sibling}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===t){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}ot(e,t,n.children,A),t=t.child}return t;case 9:return n=t.type,i=t.pendingProps.children,Xn(t,A),n=Ot(n),i=i(n),t.flags|=1,ot(e,t,i,A),t.child;case 14:return i=t.type,n=$t(i,t.pendingProps),n=$t(i.type,n),tC(e,t,i,n,A);case 15:return YQ(e,t,t.type,t.pendingProps,A);case 17:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:$t(i,n),da(e,t),t.tag=1,ht(i)?(e=!0,Na(t)):e=!1,Xn(t,A),QQ(t,i,n),og(t,i,n,A),Ig(null,t,i,!0,e,A);case 19:return _Q(e,t,A);case 22:return PQ(e,t,A)}throw Error(x(156,t.tag))};function ch(e,t){return RC(e,t)}function TD(e,t,A,i){this.tag=e,this.key=A,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(e,t,A,i){return new TD(e,t,A,i)}function ou(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _D(e){if(typeof e=="function")return ou(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fg)return 11;if(e===Dg)return 14}return 2}function Qi(e,t){var A=e.alternate;return A===null?(A=Kt(e.tag,t,e.key,e.mode),A.elementType=e.elementType,A.type=e.type,A.stateNode=e.stateNode,A.alternate=e,e.alternate=A):(A.pendingProps=t,A.type=e.type,A.flags=0,A.subtreeFlags=0,A.deletions=null),A.flags=e.flags&14680064,A.childLanes=e.childLanes,A.lanes=e.lanes,A.child=e.child,A.memoizedProps=e.memoizedProps,A.memoizedState=e.memoizedState,A.updateQueue=e.updateQueue,t=e.dependencies,A.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},A.sibling=e.sibling,A.index=e.index,A.ref=e.ref,A}function ha(e,t,A,i,n,r){var o=2;if(i=e,typeof e=="function")ou(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Mn:return Xi(A.children,n,r,t);case wg:o=8,n|=8;break;case Nl:return e=Kt(12,A,t,n|2),e.elementType=Nl,e.lanes=r,e;case xl:return e=Kt(13,A,t,n),e.elementType=xl,e.lanes=r,e;case Gl:return e=Kt(19,A,t,n),e.elementType=Gl,e.lanes=r,e;case hC:return eI(A,n,r,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case CC:o=10;break e;case QC:o=9;break e;case Fg:o=11;break e;case Dg:o=14;break e;case ri:o=16,i=null;break e}throw Error(x(130,e==null?e:typeof e,""))}return t=Kt(o,A,t,n),t.elementType=e,t.type=i,t.lanes=r,t}function Xi(e,t,A,i){return e=Kt(7,e,i,t),e.lanes=A,e}function eI(e,t,A,i){return e=Kt(22,e,i,t),e.elementType=hC,e.lanes=A,e.stateNode={isHidden:!1},e}function kl(e,t,A){return e=Kt(6,e,null,t),e.lanes=A,e}function Sl(e,t,A){return t=Kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=A,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function XD(e,t,A,i,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ll(0),this.expirationTimes=ll(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ll(0),this.identifierPrefix=i,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function su(e,t,A,i,n,r,o,s,a){return e=new XD(e,t,A,s,a),t===1?(t=1,r===!0&&(t|=8)):t=0,r=Kt(3,null,null,t),e.current=r,r.stateNode=e,r.memoizedState={element:i,isDehydrated:A,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pg(r),e}function ZD(e,t,A){var i=3{"use strict";function Bh(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Bh)}catch(e){console.error(e)}}Bh(),dh.exports=fh()});var Qh=Qe(gu=>{"use strict";var Ch=lu();gu.createRoot=Ch.createRoot,gu.hydrateRoot=Ch.hydrateRoot;var dH});var wh=Qe(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.output=It.exists=It.hash=It.bytes=It.bool=It.number=void 0;function rI(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}It.number=rI;function ph(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}It.bool=ph;function Ak(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function uu(e,...t){if(!Ak(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}It.bytes=uu;function Eh(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");rI(e.outputLen),rI(e.blockLen)}It.hash=Eh;function mh(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}It.exists=mh;function yh(e,t){uu(e);let A=t.outputLen;if(e.length{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.add5L=P.add5H=P.add4H=P.add4L=P.add3H=P.add3L=P.add=P.rotlBL=P.rotlBH=P.rotlSL=P.rotlSH=P.rotr32L=P.rotr32H=P.rotrBL=P.rotrBH=P.rotrSL=P.rotrSH=P.shrSL=P.shrSH=P.toBig=P.split=P.fromBig=void 0;var oI=BigInt(2**32-1),fu=BigInt(32);function Bu(e,t=!1){return t?{h:Number(e&oI),l:Number(e>>fu&oI)}:{h:Number(e>>fu&oI)|0,l:Number(e&oI)|0}}P.fromBig=Bu;function Fh(e,t=!1){let A=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;nBigInt(e>>>0)<>>0);P.toBig=Dh;var kh=(e,t,A)=>e>>>A;P.shrSH=kh;var Sh=(e,t,A)=>e<<32-A|t>>>A;P.shrSL=Sh;var Uh=(e,t,A)=>e>>>A|t<<32-A;P.rotrSH=Uh;var Nh=(e,t,A)=>e<<32-A|t>>>A;P.rotrSL=Nh;var xh=(e,t,A)=>e<<64-A|t>>>A-32;P.rotrBH=xh;var Gh=(e,t,A)=>e>>>A-32|t<<64-A;P.rotrBL=Gh;var Hh=(e,t)=>t;P.rotr32H=Hh;var Mh=(e,t)=>e;P.rotr32L=Mh;var vh=(e,t,A)=>e<>>32-A;P.rotlSH=vh;var Rh=(e,t,A)=>t<>>32-A;P.rotlSL=Rh;var Jh=(e,t,A)=>t<>>64-A;P.rotlBH=Jh;var qh=(e,t,A)=>e<>>64-A;P.rotlBL=qh;function Kh(e,t,A,i){let n=(t>>>0)+(i>>>0);return{h:e+A+(n/2**32|0)|0,l:n|0}}P.add=Kh;var bh=(e,t,A)=>(e>>>0)+(t>>>0)+(A>>>0);P.add3L=bh;var Oh=(e,t,A,i)=>t+A+i+(e/2**32|0)|0;P.add3H=Oh;var Lh=(e,t,A,i)=>(e>>>0)+(t>>>0)+(A>>>0)+(i>>>0);P.add4L=Lh;var Yh=(e,t,A,i,n)=>t+A+i+n+(e/2**32|0)|0;P.add4H=Yh;var Ph=(e,t,A,i,n)=>(e>>>0)+(t>>>0)+(A>>>0)+(i>>>0)+(n>>>0);P.add5L=Ph;var Vh=(e,t,A,i,n,r)=>t+A+i+n+r+(e/2**32|0)|0;P.add5H=Vh;var nk={fromBig:Bu,split:Fh,toBig:Dh,shrSH:kh,shrSL:Sh,rotrSH:Uh,rotrSL:Nh,rotrBH:xh,rotrBL:Gh,rotr32H:Hh,rotr32L:Mh,rotlSH:vh,rotlSL:Rh,rotlBH:Jh,rotlBL:qh,add:Kh,add3L:bh,add3H:Oh,add4L:Lh,add4H:Yh,add5H:Vh,add5L:Ph};P.default=nk});var Th=Qe(sI=>{"use strict";Object.defineProperty(sI,"__esModule",{value:!0});sI.crypto=void 0;sI.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var Zh=Qe(_=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0});_.randomBytes=_.wrapXOFConstructorWithOpts=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;var du=Th(),rk=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);_.u8=rk;var ok=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));_.u32=ok;function Qu(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}var sk=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);_.createView=sk;var ak=(e,t)=>e<<32-t|e>>>t;_.rotr=ak;_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_.isLE)throw new Error("Non little-endian hardware is not supported");var Ik=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ck(e){if(!Qu(e))throw new Error("Uint8Array expected");let t="";for(let A=0;A=PA._0&&e<=PA._9)return e-PA._0;if(e>=PA._A&&e<=PA._F)return e-(PA._A-10);if(e>=PA._a&&e<=PA._f)return e-(PA._a-10)}function lk(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,A=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(A);for(let n=0,r=0;n{};_.nextTick=gk;async function uk(e,t,A){let i=Date.now();for(let n=0;n=0&&re().update(aI(i)).digest(),A=e();return t.outputLen=A.outputLen,t.blockLen=A.blockLen,t.create=()=>e(),t}_.wrapConstructor=Ck;function Qk(e){let t=(i,n)=>e(n).update(aI(i)).digest(),A=e({});return t.outputLen=A.outputLen,t.blockLen=A.blockLen,t.create=i=>e(i),t}_.wrapConstructorWithOpts=Qk;function hk(e){let t=(i,n)=>e(n).update(aI(i)).digest(),A=e({});return t.outputLen=A.outputLen,t.blockLen=A.blockLen,t.create=i=>e(i),t}_.wrapXOFConstructorWithOpts=hk;function pk(e=32){if(du.crypto&&typeof du.crypto.getRandomValues=="function")return du.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=pk});var hu=Qe(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.shake256=Be.shake128=Be.keccak_512=Be.keccak_384=Be.keccak_256=Be.keccak_224=Be.sha3_512=Be.sha3_384=Be.sha3_256=Be.sha3_224=Be.Keccak=Be.keccakP=void 0;var sr=wh(),Jo=zh(),Ro=Zh(),[$h,ep,tp]=[[],[],[]],Ek=BigInt(0),vo=BigInt(1),mk=BigInt(2),yk=BigInt(7),wk=BigInt(256),Fk=BigInt(113);for(let e=0,t=vo,A=1,i=0;e<24;e++){[A,i]=[i,(2*A+3*i)%5],$h.push(2*(5*i+A)),ep.push((e+1)*(e+2)/2%64);let n=Ek;for(let r=0;r<7;r++)t=(t<>yk)*Fk)%wk,t&mk&&(n^=vo<<(vo<A>32?(0,Jo.rotlBH)(e,t,A):(0,Jo.rotlSH)(e,t,A),jh=(e,t,A)=>A>32?(0,Jo.rotlBL)(e,t,A):(0,Jo.rotlSL)(e,t,A);function Ap(e,t=24){let A=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let o=0;o<10;o++)A[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){let s=(o+8)%10,a=(o+2)%10,I=A[a],c=A[a+1],l=Wh(I,c,1)^A[s],u=jh(I,c,1)^A[s+1];for(let g=0;g<50;g+=10)e[o+g]^=l,e[o+g+1]^=u}let n=e[2],r=e[3];for(let o=0;o<24;o++){let s=ep[o],a=Wh(n,r,s),I=jh(n,r,s),c=$h[o];n=e[c],r=e[c+1],e[c]=a,e[c+1]=I}for(let o=0;o<50;o+=10){for(let s=0;s<10;s++)A[s]=e[o+s];for(let s=0;s<10;s++)e[o+s]^=~A[(s+2)%10]&A[(s+4)%10]}e[0]^=Dk[i],e[1]^=kk[i]}A.fill(0)}Be.keccakP=Ap;var qo=class e extends Ro.Hash{constructor(t,A,i,n=!1,r=24){if(super(),this.blockLen=t,this.suffix=A,this.outputLen=i,this.enableXOF=n,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,sr.number)(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Ro.u32)(this.state)}keccak(){Ap(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){(0,sr.exists)(this);let{blockLen:A,state:i}=this;t=(0,Ro.toBytes)(t);let n=t.length;for(let r=0;r=i&&this.keccak();let o=Math.min(i-this.posOut,r-n);t.set(A.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,sr.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,sr.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:A,suffix:i,outputLen:n,rounds:r,enableXOF:o}=this;return t||(t=new e(A,i,n,o,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=i,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};Be.Keccak=qo;var Fi=(e,t,A)=>(0,Ro.wrapConstructor)(()=>new qo(t,e,A));Be.sha3_224=Fi(6,144,224/8);Be.sha3_256=Fi(6,136,256/8);Be.sha3_384=Fi(6,104,384/8);Be.sha3_512=Fi(6,72,512/8);Be.keccak_224=Fi(1,144,224/8);Be.keccak_256=Fi(1,136,256/8);Be.keccak_384=Fi(1,104,384/8);Be.keccak_512=Fi(1,72,512/8);var ip=(e,t,A)=>(0,Ro.wrapXOFConstructorWithOpts)((i={})=>new qo(t,e,i.dkLen===void 0?A:i.dkLen,!0));Be.shake128=ip(31,168,128/8);Be.shake256=ip(31,136,256/8)});var lp=Qe((kH,Di)=>{var{sha3_512:Sk}=hu(),rp=24,Ko=32,pu=(e=4,t=Math.random)=>{let A="";for(;A.lengthop(Sk(e)).toString(36).slice(1),np=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),Uk=e=>np[Math.floor(e()*np.length)],ap=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{}}={})=>{let t=Object.keys(e).toString(),A=t.length?t+pu(Ko):pu(Ko);return sp(A).substring(0,Ko)},Ip=e=>()=>e++,Nk=476782367,cp=({random:e=Math.random,counter:t=Ip(Math.floor(e()*Nk)),length:A=rp,fingerprint:i=ap()}={})=>function(){let r=Uk(e),o=Date.now().toString(36),s=t().toString(36),a=pu(A,e),I=`${o+a+s+i}`;return`${r+sp(I).substring(1,A)}`},xk=cp(),Gk=(e,{minLength:t=2,maxLength:A=Ko}={})=>{let i=e.length,n=/^[0-9a-z]+$/;try{if(typeof e=="string"&&i>=t&&i<=A&&n.test(e))return!0}finally{}return!1};Di.exports.getConstants=()=>({defaultLength:rp,bigLength:Ko});Di.exports.init=cp;Di.exports.createId=xk;Di.exports.bufToBigInt=op;Di.exports.createCounter=Ip;Di.exports.createFingerprint=ap;Di.exports.isCuid=Gk});var gp=Qe((SH,bo)=>{var{createId:Hk,init:Mk,getConstants:vk,isCuid:Rk}=lp();bo.exports.createId=Hk;bo.exports.init=Mk;bo.exports.getConstants=vk;bo.exports.isCuid=Rk});var fp=Qe(mu=>{"use strict";var Jk=Symbol.for("react.fragment");mu.Fragment=Jk;mu.jsxDEV=void 0});var dp=Qe((GH,Bp)=>{"use strict";Bp.exports=fp()});var Qp=Qe(II=>{"use strict";var qk=ze(),Kk=Symbol.for("react.element"),bk=Symbol.for("react.fragment"),Ok=Object.prototype.hasOwnProperty,Lk=qk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Yk={key:!0,ref:!0,__self:!0,__source:!0};function Cp(e,t,A){var i,n={},r=null,o=null;A!==void 0&&(r=""+A),t.key!==void 0&&(r=""+t.key),t.ref!==void 0&&(o=t.ref);for(i in t)Ok.call(t,i)&&!Yk.hasOwnProperty(i)&&(n[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)n[i]===void 0&&(n[i]=t[i]);return{$$typeof:Kk,type:e,key:r,ref:o,props:n,_owner:Lk.current}}II.Fragment=bk;II.jsx=Cp;II.jsxs=Cp});var ce=Qe((MH,hp)=>{"use strict";hp.exports=Qp()});var Xm=Qe((Kf,_m)=>{"use strict";var{hasOwnProperty:ic}=Object.prototype,yn=qf();yn.configure=qf;yn.stringify=yn;yn.default=yn;Kf.stringify=yn;Kf.configure=qf;_m.exports=yn;var WN=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function Ri(e){return e.length<5e3&&!WN.test(e)?`"${e}"`:JSON.stringify(e)}function Rf(e){if(e.length>200)return e.sort();for(let t=1;tA;)e[i]=e[i-1],i--;e[i]=A}return e}var jN=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Jf(e){return jN.call(e)!==void 0&&e.length!==0}function Vm(e,t,A){e.length= 1`)}return A===void 0?1/0:A}function mn(e){return e===1?"1 item":`${e} items`}function e3(e){let t=new Set;for(let A of e)(typeof A=="string"||typeof A=="number")&&t.add(String(A));return t}function t3(e){if(ic.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return A=>{let i=`Object can not safely be stringified. Received type ${typeof A}`;throw typeof A!="function"&&(i+=` (${A.toString()})`),new Error(i)}}}function qf(e){e={...e};let t=t3(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let A=$N(e),i=zm(e,"bigint"),n=zm(e,"deterministic"),r=Tm(e,"maximumDepth"),o=Tm(e,"maximumBreadth");function s(u,g,f,Q,k,d){let B=g[u];switch(typeof B=="object"&&B!==null&&typeof B.toJSON=="function"&&(B=B.toJSON(u)),B=Q.call(g,u,B),typeof B){case"string":return Ri(B);case"object":{if(B===null)return"null";if(f.indexOf(B)!==-1)return A;let C="",y=",",D=d;if(Array.isArray(B)){if(B.length===0)return"[]";if(ro){let m=f.length-o-1;Q+=`${y}"... ${gn(m)} not stringified"`}return U!==""&&(Q+=` -${F}`),B.pop(),`[${Q}]`}let w=Object.keys(f),D=w.length;if(D===0)return"{}";if(ro){let T=D-o;Q+=`${K}"...":${S}"${gn(T)} not stringified"`,K=y}return U!==""&&K.length>1&&(Q=` -${d}${Q} -${F}`),B.pop(),`{${Q}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(f);default:return t?t(f):void 0}}function I(l,g,B,h,U,d){switch(typeof g=="object"&&g!==null&&typeof g.toJSON=="function"&&(g=g.toJSON(l)),typeof g){case"string":return Si(g);case"object":{if(g===null)return"null";if(B.indexOf(g)!==-1)return A;let f=d,Q="",y=",";if(Array.isArray(g)){if(g.length===0)return"[]";if(ro){let m=B.length-o-1;C+=`${y}"... ${mn(m)} not stringified"`}return k!==""&&(C+=` +${D}`),f.pop(),`[${C}]`}let F=Object.keys(B),S=F.length;if(S===0)return"{}";if(ro){let Z=S-o;C+=`${b}"...":${N}"${mn(Z)} not stringified"`,b=y}return k!==""&&b.length>1&&(C=` +${d}${C} +${D}`),f.pop(),`{${C}}`}case"number":return isFinite(B)?String(B):t?t(B):"null";case"boolean":return B===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(B);default:return t?t(B):void 0}}function a(u,g,f,Q,k,d){switch(typeof g=="object"&&g!==null&&typeof g.toJSON=="function"&&(g=g.toJSON(u)),typeof g){case"string":return Ri(g);case"object":{if(g===null)return"null";if(f.indexOf(g)!==-1)return A;let B=d,C="",y=",";if(Array.isArray(g)){if(g.length===0)return"[]";if(ro){let q=g.length-o-1;Q+=`${y}"... ${gn(q)} not stringified"`}return U!==""&&(Q+=` -${f}`),B.pop(),`[${Q}]`}B.push(g);let F="";U!==""&&(d+=U,y=`, -${d}`,F=" ");let w="";for(let D of h){let S=I(D,g[D],B,h,U,d);S!==void 0&&(Q+=`${w}${Si(D)}:${F}${S}`,w=y)}return U!==""&&w.length>1&&(Q=` -${d}${Q} -${f}`),B.pop(),`{${Q}}`}case"number":return isFinite(g)?String(g):t?t(g):"null";case"boolean":return g===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(g);default:return t?t(g):void 0}}function a(l,g,B,h,U){switch(typeof g){case"string":return Si(g);case"object":{if(g===null)return"null";if(typeof g.toJSON=="function"){if(g=g.toJSON(l),typeof g!="object")return a(l,g,B,h,U);if(g===null)return"null"}if(B.indexOf(g)!==-1)return A;let d=U;if(Array.isArray(g)){if(g.length===0)return"[]";if(ro){let ct=g.length-o-1;S+=`${K}"... ${gn(ct)} not stringified"`}return S+=` -${d}`,B.pop(),`[${S}]`}let f=Object.keys(g),Q=f.length;if(Q===0)return"{}";if(ro){let S=Q-o;F+=`${w}"...": "${gn(S)} not stringified"`,w=y}return w!==""&&(F=` -${U}${F} -${d}`),B.pop(),`{${F}}`}case"number":return isFinite(g)?String(g):t?t(g):"null";case"boolean":return g===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(g);default:return t?t(g):void 0}}function c(l,g,B){switch(typeof g){case"string":return Si(g);case"object":{if(g===null)return"null";if(typeof g.toJSON=="function"){if(g=g.toJSON(l),typeof g!="object")return c(l,g,B);if(g===null)return"null"}if(B.indexOf(g)!==-1)return A;let h="";if(Array.isArray(g)){if(g.length===0)return"[]";if(ro){let D=g.length-o-1;h+=`,"... ${gn(D)} not stringified"`}return B.pop(),`[${h}]`}let U=Object.keys(g),d=U.length;if(d===0)return"{}";if(ro){let y=d-o;h+=`${f}"...":"${gn(y)} not stringified"`}return B.pop(),`{${h}}`}case"number":return isFinite(g)?String(g):t?t(g):"null";case"boolean":return g===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(g);default:return t?t(g):void 0}}function u(l,g,B){if(arguments.length>1){let h="";if(typeof B=="number"?h=" ".repeat(Math.min(B,10)):typeof B=="string"&&(h=B.slice(0,10)),g!=null){if(typeof g=="function")return s("",{"":l},[],g,h,"");if(Array.isArray(g))return I("",l,[],lU(g),h,"")}if(h.length!==0)return a("",l,[],h,"")}return c("",l,[])}return u}});var sm=de((kH,Ui)=>{var{sha3_512:yU}=Hl(),tm=24,is=32,AB=(e=4,t=Math.random)=>{let A="";for(;A.lengthAm(yU(e)).toString(36).slice(1),em=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),wU=e=>em[Math.floor(e()*em.length)],nm=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let A=Object.keys(e).toString(),i=A.length?A+AB(is,t):AB(is,t);return im(i).substring(0,is)},rm=e=>()=>e++,FU=476782367,om=({random:e=Math.random,counter:t=rm(Math.floor(e()*FU)),length:A=tm,fingerprint:i=nm({random:e})}={})=>function(){let r=wU(e),o=Date.now().toString(36),s=t().toString(36),I=AB(A,e),a=`${o+I+s+i}`;return`${r+im(a).substring(1,A)}`},DU=om(),kU=(e,{minLength:t=2,maxLength:A=is}={})=>{let i=e.length,n=/^[0-9a-z]+$/;try{if(typeof e=="string"&&i>=t&&i<=A&&n.test(e))return!0}finally{}return!1};Ui.exports.getConstants=()=>({defaultLength:tm,bigLength:is});Ui.exports.init=om;Ui.exports.createId=DU;Ui.exports.bufToBigInt=Am;Ui.exports.createCounter=rm;Ui.exports.createFingerprint=nm;Ui.exports.isCuid=kU});var Ma=de((SH,ns)=>{var{createId:SU,init:UU,getConstants:NU,isCuid:xU}=sm();ns.exports.createId=SU;ns.exports.init=UU;ns.exports.getConstants=NU;ns.exports.isCuid=xU});var Gm=de((BM,xm)=>{var MU=1/0,vU="[object Symbol]",JU=/^\s+|\s+$/g,oB="\\ud800-\\udfff",pm="\\u0300-\\u036f\\ufe20-\\ufe23",Em="\\u20d0-\\u20f0",mm="\\ufe0e\\ufe0f",qU="["+oB+"]",nB="["+pm+Em+"]",rB="\\ud83c[\\udffb-\\udfff]",RU="(?:"+nB+"|"+rB+")",ym="[^"+oB+"]",wm="(?:\\ud83c[\\udde6-\\uddff]){2}",Fm="[\\ud800-\\udbff][\\udc00-\\udfff]",Dm="\\u200d",km=RU+"?",Sm="["+mm+"]?",KU="(?:"+Dm+"(?:"+[ym,wm,Fm].join("|")+")"+Sm+km+")*",LU=Sm+km+KU,OU="(?:"+[ym+nB+"?",nB,wm,Fm,qU].join("|")+")",bU=RegExp(rB+"(?="+rB+")|"+OU+LU,"g"),YU=RegExp("["+Dm+oB+pm+Em+mm+"]"),VU=typeof global=="object"&&global&&global.Object===Object&&global,zU=typeof self=="object"&&self&&self.Object===Object&&self,PU=VU||zU||Function("return this")();function _U(e){return e.split("")}function XU(e,t,A,i){for(var n=e.length,r=A+(i?1:-1);i?r--:++r-1;);return A}function WU(e,t){for(var A=e.length;A--&&Um(t,e[A],0)>-1;);return A}function jU(e){return YU.test(e)}function dm(e){return jU(e)?$U(e):_U(e)}function $U(e){return e.match(bU)||[]}var e3=Object.prototype,t3=e3.toString,Qm=PU.Symbol,Cm=Qm?Qm.prototype:void 0,hm=Cm?Cm.toString:void 0;function A3(e,t,A){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),A=A>n?n:A,A<0&&(A+=n),n=t>A?0:A-t>>>0,t>>>=0;for(var r=Array(n);++i=i?e:A3(e,t,A)}function n3(e){return!!e&&typeof e=="object"}function r3(e){return typeof e=="symbol"||n3(e)&&t3.call(e)==vU}function o3(e){return e==null?"":Nm(e)}function s3(e,t,A){if(e=o3(e),e&&(A||t===void 0))return e.replace(JU,"");if(!e||!(t=Nm(t)))return e;var i=dm(e),n=dm(t),r=ZU(i,n),o=WU(i,n)+1;return i3(i,r,o).join("")}xm.exports=s3});var qm=de((mM,Jm)=>{"use strict";function c3(e,t){for(;e.length{var p3="Expected a function",ty="__lodash_hash_undefined__",Ay=1/0,E3="[object Function]",m3="[object GeneratorFunction]",y3="[object Symbol]",w3=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F3=/^\w*$/,D3=/^\./,k3=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,S3=/[\\^$.*+?()[\]{}|]/g,U3=/\\(\\)?/g,N3=/^\[object .+?Constructor\]$/,x3=typeof global=="object"&&global&&global.Object===Object&&global,G3=typeof self=="object"&&self&&self.Object===Object&&self,gB=x3||G3||Function("return this")();function H3(e,t){return e?.[t]}function M3(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var v3=Array.prototype,J3=Function.prototype,iy=Object.prototype,cB=gB["__core-js_shared__"],Wm=function(){var e=/[^.]+$/.exec(cB&&cB.keys&&cB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ny=J3.toString,lB=iy.hasOwnProperty,ry=iy.toString,q3=RegExp("^"+ny.call(lB).replace(S3,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jm=gB.Symbol,R3=v3.splice,K3=oy(gB,"Map"),os=oy(Object,"create"),$m=jm?jm.prototype:void 0,ey=$m?$m.toString:void 0;function fn(e){var t=-1,A=e?e.length:0;for(this.clear();++t-1}function T3(e,t){var A=this.__data__,i=Xa(A,e);return i<0?A.push([e,t]):A[i][1]=t,this}pr.prototype.clear=z3;pr.prototype.delete=P3;pr.prototype.get=_3;pr.prototype.has=X3;pr.prototype.set=T3;function dn(e){var t=-1,A=e?e.length:0;for(this.clear();++t{(function(e,t){"use strict";var A="1.0.37",i="",n="?",r="function",o="undefined",s="object",I="string",a="major",c="model",u="name",l="type",g="vendor",B="version",h="architecture",U="console",d="mobile",f="tablet",Q="smarttv",y="wearable",F="embedded",w=500,D="Amazon",S="Apple",K="ASUS",q="BlackBerry",T="Browser",Ue="Chrome",ct="Edge",m="Firefox",J="Google",H="Huawei",k="LG",x="Microsoft",z="Motorola",L="Opera",O="Samsung",re="Sharp",Ae="Sony",Xe="Xiaomi",Yt="Zebra",Vt="Facebook",FB="Chromium OS",DB="Mac OS",by=function($,oe){var P={};for(var ce in $)oe[ce]&&oe[ce].length%2===0?P[ce]=oe[ce].concat($[ce]):P[ce]=$[ce];return P},cs=function($){for(var oe={},P=0;P<$.length;P++)oe[$[P].toUpperCase()]=$[P];return oe},kB=function($,oe){return typeof $===I?wr(oe).indexOf(wr($))!==-1:!1},wr=function($){return $.toLowerCase()},Yy=function($){return typeof $===I?$.replace(/[^\d\.]/g,i).split(".")[0]:t},nc=function($,oe){if(typeof $===I)return $=$.replace(/^\s\s*/,i),typeof oe===o?$:$.substring(0,w)},Fr=function($,oe){for(var P=0,ce,XA,rA,ne,V,oA;P0?ne.length===2?typeof ne[1]==r?this[ne[0]]=ne[1].call(this,oA):this[ne[0]]=ne[1]:ne.length===3?typeof ne[1]===r&&!(ne[1].exec&&ne[1].test)?this[ne[0]]=oA?ne[1].call(this,oA,ne[2]):t:this[ne[0]]=oA?oA.replace(ne[1],ne[2]):t:ne.length===4&&(this[ne[0]]=oA?ne[3].call(this,oA.replace(ne[1],ne[2])):t):this[ne]=oA||t;P+=2}},rc=function($,oe){for(var P in oe)if(typeof oe[P]===s&&oe[P].length>0){for(var ce=0;ce2&&(V[c]="iPad",V[l]=f),V},this.getEngine=function(){var V={};return V[u]=t,V[B]=t,Fr.call(V,ce,rA.engine),V},this.getOS=function(){var V={};return V[u]=t,V[B]=t,Fr.call(V,ce,rA.os),ne&&!V[u]&&XA&&XA.platform!="Unknown"&&(V[u]=XA.platform.replace(/chrome os/i,FB).replace(/macos/i,DB)),V},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ce},this.setUA=function(V){return ce=typeof V===I&&V.length>w?nc(V,w):V,this},this.setUA(ce),this};yt.VERSION=A,yt.BROWSER=cs([u,B,a]),yt.CPU=cs([h]),yt.DEVICE=cs([c,g,l,U,d,Q,f,y,F]),yt.ENGINE=yt.OS=cs([u,B]),typeof as!==o?(typeof Ac!==o&&Ac.exports&&(as=Ac.exports=yt),as.UAParser=yt):typeof define===r&&define.amd?define(function(){return yt}):typeof e!==o&&(e.UAParser=yt);var Cn=typeof e!==o&&(e.jQuery||e.Zepto);if(Cn&&!Cn.ua){var gs=new yt;Cn.ua=gs.getResult(),Cn.ua.get=function(){return gs.getUA()},Cn.ua.set=function($){gs.setUA($);var oe=gs.getResult();for(var P in oe)Cn.ua[P]=oe[P]}}})(typeof window=="object"?window:as)});var Ly=R(lC());var Tn=R(Ye()),di=(e,t,A)=>{let[,i]=(0,Tn.useState)({}),r=(0,Tn.useRef)({data:e,deps:A||[],promisedKeys:new Set,ready:!1,_loading:{}}).current;if((0,Tn.useEffect)(()=>{r.ready=!0,t&&t({init:!0})},[]),r.ready===!1){r._loading={};for(let[o,s]of Object.entries(e))if(!r.promisedKeys.has(o)){let I=s;typeof I=="object"&&I instanceof Promise&&(r._loading[o]=!0,r.promisedKeys.add(o),r.data[o]=null,I.then(a=>{r.data[o]=a,r._loading[o]=!1,r.data.render()}))}r.data.render=()=>{r.ready&&i({})}}else if(r.deps.length>0&&A){for(let[o,s]of Object.entries(A))if(r.deps[o]!==s){r.deps[o]=s,t&&setTimeout(()=>{t({init:!1})});break}}return r.data};var uC=(e,t)=>new Promise(async A=>{if(typeof e=="function"){let i=null;if(t&&(i=setTimeout(A,t)),await e()){clearTimeout(i),A();return}let n=0,r=setInterval(async()=>{await e()&&(i&&clearTimeout(i),clearInterval(r),A()),n>100&&clearInterval(r)},10)}else typeof e=="number"&&setTimeout(()=>{A()},e)});var uF=R(Ye());var sh=R(oh()),RA=R(Ye()),vl=(0,RA.createContext)({global:{},render:()=>{}});var hi=(e,t,A)=>{let i=window;i.globalValueID||(i.globalValueID=new WeakMap);let n=typeof t=="string"?t:A;n||(i.globalValueID.has(e)||i.globalValueID.set(e,(0,sh.createId)()),n=i.globalValueID.get(e)||""),n||(n="GLOBAL_DEFAULT");let r=(0,RA.useContext)(vl),{global:o,render:s}=r;o[n]||(o[n]=e),(0,RA.useEffect)(()=>{let a=null;if(typeof t=="function")try{a=t()}catch(c){console.log(c)}return()=>{typeof a=="function"?a():a instanceof Promise&&a.then(c=>{typeof c=="function"&&c()})}},[]);let I=o[n];return I?I.render=a=>{a&&(o[n]=void 0),(0,RA.startTransition)(s)}:console.log(e,n),I},uA=e=>{if(e==null||typeof e!="object")return e;if(e instanceof Date){var t=new Date;return t.setTime(e.getTime()),t}if(e instanceof Array)return e.map(n=>uA(n));var A={};for(var i in e)typeof e[i]=="object"?A[i]=uA(e[i]):A[i]=e[i];return A};var ex=R(Ye());var ql=R(Ye()),Bh=R(Fl()),fh=R(ch()),dh=R(Ie()),Qh=()=>{let e=typeof window=="object"?window:globalThis;e.React=ql.default,e.ReactDOM=Bh.default,e.JSXRuntime=dh.default,e.JSXDevRuntime=fh.default,e.Fragment=ql.default.Fragment};var AD={data:""},hh=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||AD,ph=e=>{let t=hh(e),A=t.data;return t.data="",A},iD=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,nD=/\/\*[^]*?\*\/| +/g,Ch=/\n+/g,Pi=(e,t)=>{let A="",i="",n="";for(let r in e){let o=e[r];r[0]=="@"?r[1]=="i"?A=r+" "+o+";":i+=r[1]=="f"?Pi(o,r):r+"{"+Pi(o,r[1]=="k"?"":t)+"}":typeof o=="object"?i+=Pi(o,t?t.replace(/([^,])+/g,s=>r.replace(/(^:.*)|([^,])+/g,I=>/&/.test(I)?I.replace(/&/g,s):s?s+" "+I:I)):r):o!=null&&(r=/^--/.test(r)?r:r.replace(/[A-Z]/g,"-$&").toLowerCase(),n+=Pi.p?Pi.p(r,o):r+":"+o+";")}return A+(t&&n?t+"{"+n+"}":n)+i},KA={},Eh=e=>{if(typeof e=="object"){let t="";for(let A in e)t+=A+Eh(e[A]);return t}return e},rD=(e,t,A,i,n)=>{let r=Eh(e),o=KA[r]||(KA[r]=(I=>{let a=0,c=11;for(;a>>0;return"go"+c})(r));if(!KA[o]){let I=r!==e?e:(a=>{let c,u,l=[{}];for(;c=iD.exec(a.replace(nD,""));)c[4]?l.shift():c[3]?(u=c[3].replace(Ch," ").trim(),l.unshift(l[0][u]=l[0][u]||{})):l[0][c[1]]=c[2].replace(Ch," ").trim();return l[0]})(e);KA[o]=Pi(n?{["@keyframes "+o]:I}:I,A?"":"."+o)}let s=A&&KA.g?KA.g:null;return A&&(KA.g=KA[o]),((I,a,c,u)=>{u?a.data=a.data.replace(u,I):a.data.indexOf(I)===-1&&(a.data=c?I+a.data:a.data+I)})(KA[o],t,i,s),o},oD=(e,t,A)=>e.reduce((i,n,r)=>{let o=t[r];if(o&&o.call){let s=o(A),I=s&&s.props&&s.props.className||/^go/.test(s)&&s;o=I?"."+I:s&&typeof s=="object"?s.props?"":Pi(s,""):s===!1?"":s}return i+n+(o??"")},"");function KI(e){let t=this||{},A=e.call?e(t.p):e;return rD(A.unshift?A.raw?oD(A,[].slice.call(arguments,1),t.p):A.reduce((i,n)=>Object.assign(i,n&&n.call?n(t.p):n),{}):A,hh(t.target),t.g,t.o,t.k)}var XN=KI.bind({g:1}),TN=KI.bind({k:1});var mh=async(e=!0)=>{let t=typeof window=="object"?window:globalThis;e&&await uC(()=>t.__SRV_URL__),t.prasiContext={global:{},render(){}};let A=window.location,i=A.protocol.indexOf("http")===0?A.hostname:"localhost",n=A.protocol!="https:"||/localhost|127.0.0.1|0.0.0.0/.test(i)?"http":"https";if(t.__SRV_URL__){t.serverurl=t.__SRV_URL__;let o=new URL(t.serverurl);(o.hostname==="localhost"||o.hostname==="127.0.0.1")&&(o.hostname=A.hostname,o.pathname=o.pathname==="/"?"":o.pathname,t.serverurl=o.toString(),t.serverurl.endsWith("/")&&(t.serverurl=t.serverurl.substring(0,t.serverurl.length-1)))}let r=A.port;t.baseurl=n+"://"+i+(r?":"+r:"")+"/",t.basepath||(t.basepath="/"),t.css=KI,t.extractCss=ph,t.pathname=A.pathname,t.cx=(...o)=>{let s=[];return o.filter(I=>I?(typeof I=="string"&&I.trim(),!0):!1).forEach(I=>{if(Array.isArray(I))for(let a of I)typeof a=="string"&&a.trim()&&s.push(a.trim());else s.push(I.trim())}),s.join(" ")},t.navigate=o=>{let s=o;if(typeof t.navigateOverride=="function"&&(s=t.navigateOverride(o),!s))return null;history.pushState({prevUrl:window.location.href},"",s),t.pathname=o,t.prasiContext&&t.prasiContext.render&&t.prasiContext.render()},typeof window=="object"&&window.addEventListener("popstate",()=>{let o=navigator.serviceWorker.controller;if(o&&o.postMessage({type:"add-cache",url:A.href}),t.preventPopRender){t.preventPopRender=!1;return}t.prasiContext&&t.prasiContext.render&&(t.pathname=A.pathname,t.prasiContext.render())})};var Ry=R(Ye());var Fo=R(Ie()),Rl=({children:e,back:t})=>(0,Fo.jsxs)("div",{className:"flex items-center justify-center w-full h-full fixed inset-0 flex-col",children:[(0,Fo.jsx)("div",{children:e}),(0,Fo.jsxs)("div",{className:"border mt-2 rounded-md p-2 cursor-pointer",onClick:t||(()=>{history.back()}),children:[" ","Go Back"]})]});var wh=R(Ye());var et=R(Ie()),yh=window,_i=({children:e,className:t,show:A,backdrop:i,note:n,alt:r})=>{let o=di({icon:(0,et.jsx)("div",{className:"px-4 py-1",children:"Loading..."}),value:.111,ival:null},()=>{});return(0,wh.useEffect)(()=>(o.ival=setInterval(()=>{o.value+=.1333,o.value>=1.3&&(o.value=0),o.render()},200),yh.loadingIcon&&(o.icon=(0,et.jsx)("img",{alt:"loading",src:yh.loadingIcon,className:css` +${d}`);let S=Math.min(g.length,o),N=0;for(;No){let q=g.length-o-1;C+=`${y}"... ${mn(q)} not stringified"`}return k!==""&&(C+=` +${B}`),f.pop(),`[${C}]`}f.push(g);let D="";k!==""&&(d+=k,y=`, +${d}`,D=" ");let F="";for(let S of Q){let N=a(S,g[S],f,Q,k,d);N!==void 0&&(C+=`${F}${Ri(S)}:${D}${N}`,F=y)}return k!==""&&F.length>1&&(C=` +${d}${C} +${B}`),f.pop(),`{${C}}`}case"number":return isFinite(g)?String(g):t?t(g):"null";case"boolean":return g===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(g);default:return t?t(g):void 0}}function I(u,g,f,Q,k){switch(typeof g){case"string":return Ri(g);case"object":{if(g===null)return"null";if(typeof g.toJSON=="function"){if(g=g.toJSON(u),typeof g!="object")return I(u,g,f,Q,k);if(g===null)return"null"}if(f.indexOf(g)!==-1)return A;let d=k;if(Array.isArray(g)){if(g.length===0)return"[]";if(ro){let Bt=g.length-o-1;N+=`${b}"... ${mn(Bt)} not stringified"`}return N+=` +${d}`,f.pop(),`[${N}]`}let B=Object.keys(g),C=B.length;if(C===0)return"{}";if(ro){let N=C-o;D+=`${F}"...": "${mn(N)} not stringified"`,F=y}return F!==""&&(D=` +${k}${D} +${d}`),f.pop(),`{${D}}`}case"number":return isFinite(g)?String(g):t?t(g):"null";case"boolean":return g===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(g);default:return t?t(g):void 0}}function c(u,g,f){switch(typeof g){case"string":return Ri(g);case"object":{if(g===null)return"null";if(typeof g.toJSON=="function"){if(g=g.toJSON(u),typeof g!="object")return c(u,g,f);if(g===null)return"null"}if(f.indexOf(g)!==-1)return A;let Q="";if(Array.isArray(g)){if(g.length===0)return"[]";if(ro){let S=g.length-o-1;Q+=`,"... ${mn(S)} not stringified"`}return f.pop(),`[${Q}]`}let k=Object.keys(g),d=k.length;if(d===0)return"{}";if(ro){let y=d-o;Q+=`${B}"...":"${mn(y)} not stringified"`}return f.pop(),`{${Q}}`}case"number":return isFinite(g)?String(g):t?t(g):"null";case"boolean":return g===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(g);default:return t?t(g):void 0}}function l(u,g,f){if(arguments.length>1){let Q="";if(typeof f=="number"?Q=" ".repeat(Math.min(f,10)):typeof f=="string"&&(Q=f.slice(0,10)),g!=null){if(typeof g=="function")return s("",{"":u},[],g,Q,"");if(Array.isArray(g))return a("",u,[],e3(g),Q,"")}if(Q.length!==0)return I("",u,[],Q,"")}return c("",u,[])}return l}});var uy=Qe((fR,Ji)=>{var{sha3_512:l3}=hu(),sy=24,hs=32,Yf=(e=4,t=Math.random)=>{let A="";for(;A.lengthay(l3(e)).toString(36).slice(1),oy=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),g3=e=>oy[Math.floor(e()*oy.length)],cy=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let A=Object.keys(e).toString(),i=A.length?A+Yf(hs,t):Yf(hs,t);return Iy(i).substring(0,hs)},ly=e=>()=>e++,u3=476782367,gy=({random:e=Math.random,counter:t=ly(Math.floor(e()*u3)),length:A=sy,fingerprint:i=cy({random:e})}={})=>function(){let r=g3(e),o=Date.now().toString(36),s=t().toString(36),a=Yf(A,e),I=`${o+a+s+i}`;return`${r+Iy(I).substring(1,A)}`},f3=gy(),B3=(e,{minLength:t=2,maxLength:A=hs}={})=>{let i=e.length,n=/^[0-9a-z]+$/;try{if(typeof e=="string"&&i>=t&&i<=A&&n.test(e))return!0}finally{}return!1};Ji.exports.getConstants=()=>({defaultLength:sy,bigLength:hs});Ji.exports.init=gy;Ji.exports.createId=f3;Ji.exports.bufToBigInt=ay;Ji.exports.createCounter=ly;Ji.exports.createFingerprint=cy;Ji.exports.isCuid=B3});var rc=Qe((BR,ps)=>{var{createId:d3,init:C3,getConstants:Q3,isCuid:h3}=uy();ps.exports.createId=d3;ps.exports.init=C3;ps.exports.getConstants=Q3;ps.exports.isCuid=h3});var hw=Qe((_1,Qw)=>{var mx=1/0,yx="[object Symbol]",wx=/^\s+|\s+$/g,fB="\\ud800-\\udfff",sw="\\u0300-\\u036f\\ufe20-\\ufe23",aw="\\u20d0-\\u20f0",Iw="\\ufe0e\\ufe0f",Fx="["+fB+"]",gB="["+sw+aw+"]",uB="\\ud83c[\\udffb-\\udfff]",Dx="(?:"+gB+"|"+uB+")",cw="[^"+fB+"]",lw="(?:\\ud83c[\\udde6-\\uddff]){2}",gw="[\\ud800-\\udbff][\\udc00-\\udfff]",uw="\\u200d",fw=Dx+"?",Bw="["+Iw+"]?",kx="(?:"+uw+"(?:"+[cw,lw,gw].join("|")+")"+Bw+fw+")*",Sx=Bw+fw+kx,Ux="(?:"+[cw+gB+"?",gB,lw,gw,Fx].join("|")+")",Nx=RegExp(uB+"(?="+uB+")|"+Ux+Sx,"g"),xx=RegExp("["+uw+fB+sw+aw+Iw+"]"),Gx=typeof global=="object"&&global&&global.Object===Object&&global,Hx=typeof self=="object"&&self&&self.Object===Object&&self,Mx=Gx||Hx||Function("return this")();function vx(e){return e.split("")}function Rx(e,t,A,i){for(var n=e.length,r=A+(i?1:-1);i?r--:++r-1;);return A}function Kx(e,t){for(var A=e.length;A--&&dw(t,e[A],0)>-1;);return A}function bx(e){return xx.test(e)}function iw(e){return bx(e)?Ox(e):vx(e)}function Ox(e){return e.match(Nx)||[]}var Lx=Object.prototype,Yx=Lx.toString,nw=Mx.Symbol,rw=nw?nw.prototype:void 0,ow=rw?rw.toString:void 0;function Px(e,t,A){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),A=A>n?n:A,A<0&&(A+=n),n=t>A?0:A-t>>>0,t>>>=0;for(var r=Array(n);++i=i?e:Px(e,t,A)}function zx(e){return!!e&&typeof e=="object"}function Tx(e){return typeof e=="symbol"||zx(e)&&Yx.call(e)==yx}function _x(e){return e==null?"":Cw(e)}function Xx(e,t,A){if(e=_x(e),e&&(A||t===void 0))return e.replace(wx,"");if(!e||!(t=Cw(t)))return e;var i=iw(e),n=iw(t),r=qx(i,n),o=Kx(i,n)+1;return Vx(i,r,o).join("")}Qw.exports=Xx});var ww=Qe((Aq,yw)=>{"use strict";function jx(e,t){for(;e.length{var aG="Expected a function",Lw="__lodash_hash_undefined__",Yw=1/0,IG="[object Function]",cG="[object GeneratorFunction]",lG="[object Symbol]",gG=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,uG=/^\w*$/,fG=/^\./,BG=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dG=/[\\^$.*+?()[\]{}|]/g,CG=/\\(\\)?/g,QG=/^\[object .+?Constructor\]$/,hG=typeof global=="object"&&global&&global.Object===Object&&global,pG=typeof self=="object"&&self&&self.Object===Object&&self,hB=hG||pG||Function("return this")();function EG(e,t){return e?.[t]}function mG(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var yG=Array.prototype,wG=Function.prototype,Pw=Object.prototype,QB=hB["__core-js_shared__"],qw=function(){var e=/[^.]+$/.exec(QB&&QB.keys&&QB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Vw=wG.toString,pB=Pw.hasOwnProperty,zw=Pw.toString,FG=RegExp("^"+Vw.call(pB).replace(dG,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kw=hB.Symbol,DG=yG.splice,kG=Tw(hB,"Map"),xs=Tw(Object,"create"),bw=Kw?Kw.prototype:void 0,Ow=bw?bw.toString:void 0;function Dn(e){var t=-1,A=e?e.length:0;for(this.clear();++t-1}function JG(e,t){var A=this.__data__,i=Hc(A,e);return i<0?A.push([e,t]):A[i][1]=t,this}Rr.prototype.clear=HG;Rr.prototype.delete=MG;Rr.prototype.get=vG;Rr.prototype.has=RG;Rr.prototype.set=JG;function kn(e){var t=-1,A=e?e.length:0;for(this.clear();++t{(function(e,t){"use strict";var A="1.0.37",i="",n="?",r="function",o="undefined",s="object",a="string",I="major",c="model",l="name",u="type",g="vendor",f="version",Q="architecture",k="console",d="mobile",B="tablet",C="smarttv",y="wearable",D="embedded",F=500,S="Amazon",N="Apple",b="ASUS",q="BlackBerry",Z="Browser",xe="Chrome",Bt="Edge",m="Firefox",J="Google",M="Huawei",U="LG",G="Microsoft",z="Motorola",O="Opera",L="Samsung",se="Sharp",ne="Sony",We="Xiaomi",Xt="Zebra",Zt="Facebook",HB="Chromium OS",MB="Mac OS",U0=function(te,ae){var T={};for(var ge in te)ae[ge]&&ae[ge].length%2===0?T[ge]=ae[ge].concat(te[ge]):T[ge]=te[ge];return T},vs=function(te){for(var ae={},T=0;T0?oe.length===2?typeof oe[1]==r?this[oe[0]]=oe[1].call(this,gA):this[oe[0]]=oe[1]:oe.length===3?typeof oe[1]===r&&!(oe[1].exec&&oe[1].test)?this[oe[0]]=gA?oe[1].call(this,gA,oe[2]):t:this[oe[0]]=gA?gA.replace(oe[1],oe[2]):t:oe.length===4&&(this[oe[0]]=gA?oe[3].call(this,gA.replace(oe[1],oe[2])):t):this[oe]=gA||t;T+=2}},Pc=function(te,ae){for(var T in ae)if(typeof ae[T]===s&&ae[T].length>0){for(var ge=0;ge2&&(V[c]="iPad",V[u]=B),V},this.getEngine=function(){var V={};return V[l]=t,V[f]=t,Or.call(V,ge,lA.engine),V},this.getOS=function(){var V={};return V[l]=t,V[f]=t,Or.call(V,ge,lA.os),oe&&!V[l]&&Ai&&Ai.platform!="Unknown"&&(V[l]=Ai.platform.replace(/chrome os/i,HB).replace(/macos/i,MB)),V},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ge},this.setUA=function(V){return ge=typeof V===a&&V.length>F?Yc(V,F):V,this},this.setUA(ge),this};St.VERSION=A,St.BROWSER=vs([l,f,I]),St.CPU=vs([Q]),St.DEVICE=vs([c,g,u,k,d,C,B,y,D]),St.ENGINE=St.OS=vs([l,f]),typeof Ms!==o?(typeof Oc!==o&&Oc.exports&&(Ms=Oc.exports=St),Ms.UAParser=St):typeof define===r&&define.amd?define(function(){return St}):typeof e!==o&&(e.UAParser=St);var Un=typeof e!==o&&(e.jQuery||e.Zepto);if(Un&&!Un.ua){var Rs=new St;Un.ua=Rs.getResult(),Un.ua.get=function(){return Rs.getUA()},Un.ua.set=function(te){Rs.setUA(te);var ae=Rs.getResult();for(var T in ae)Un.ua[T]=ae[T]}}})(typeof window=="object"?window:Ms)});var k0=K(Qh());var or=K(ze()),wi=(e,t,A)=>{let[,i]=(0,or.useState)({}),r=(0,or.useRef)({data:e,deps:A||[],promisedKeys:new Set,ready:!1,_loading:{}}).current;if((0,or.useEffect)(()=>{r.ready=!0,t&&t({init:!0})},[]),r.ready===!1){r._loading={};for(let[o,s]of Object.entries(e))if(!r.promisedKeys.has(o)){let a=s;typeof a=="object"&&a instanceof Promise&&(r._loading[o]=!0,r.promisedKeys.add(o),r.data[o]=null,a.then(I=>{r.data[o]=I,r._loading[o]=!1,r.data.render()}))}r.data.render=()=>{r.ready&&i({})}}else if(r.deps.length>0&&A){for(let[o,s]of Object.entries(A))if(r.deps[o]!==s){r.deps[o]=s,t&&setTimeout(()=>{t({init:!1})});break}}return r.data};var hh=(e,t)=>new Promise(async A=>{if(typeof e=="function"){let i=null;if(t&&(i=setTimeout(A,t)),await e()){clearTimeout(i),A();return}let n=0,r=setInterval(async()=>{await e()&&(i&&clearTimeout(i),clearInterval(r),A()),n>100&&clearInterval(r)},10)}else typeof e=="number"&&setTimeout(()=>{A()},e)});var tk=K(ze());var up=K(gp()),VA=K(ze()),Eu=(0,VA.createContext)({global:{},render:()=>{}});var ki=(e,t,A)=>{let i=window;i.globalValueID||(i.globalValueID=new WeakMap);let n=typeof t=="string"?t:A;n||(i.globalValueID.has(e)||i.globalValueID.set(e,(0,up.createId)()),n=i.globalValueID.get(e)||""),n||(n="GLOBAL_DEFAULT");let r=(0,VA.useContext)(Eu),{global:o,render:s}=r;o[n]||(o[n]=e),(0,VA.useEffect)(()=>{let I=null;if(typeof t=="function")try{I=t()}catch(c){console.log(c)}return()=>{typeof I=="function"?I():I instanceof Promise&&I.then(c=>{typeof c=="function"&&c()})}},[]);let a=o[n];return a?a.render=I=>{I&&(o[n]=void 0),(0,VA.startTransition)(s)}:console.log(e,n),a},hA=e=>{if(e==null||typeof e!="object")return e;if(e instanceof Date){var t=new Date;return t.setTime(e.getTime()),t}if(e instanceof Array)return e.map(n=>hA(n));var A={};for(var i in e)typeof e[i]=="object"?A[i]=hA(e[i]):A[i]=e[i];return A};var LH=K(ze());var yu=K(ze()),pp=K(lu()),Ep=K(dp()),mp=K(ce()),yp=()=>{let e=typeof window=="object"?window:globalThis;e.React=yu.default,e.ReactDOM=pp.default,e.JSXRuntime=mp.default,e.JSXDevRuntime=Ep.default,e.Fragment=yu.default.Fragment};var Pk={data:""},Fp=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||Pk,Dp=e=>{let t=Fp(e),A=t.data;return t.data="",A},Vk=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,zk=/\/\*[^]*?\*\/| +/g,wp=/\n+/g,nn=(e,t)=>{let A="",i="",n="";for(let r in e){let o=e[r];r[0]=="@"?r[1]=="i"?A=r+" "+o+";":i+=r[1]=="f"?nn(o,r):r+"{"+nn(o,r[1]=="k"?"":t)+"}":typeof o=="object"?i+=nn(o,t?t.replace(/([^,])+/g,s=>r.replace(/(^:.*)|([^,])+/g,a=>/&/.test(a)?a.replace(/&/g,s):s?s+" "+a:a)):r):o!=null&&(r=/^--/.test(r)?r:r.replace(/[A-Z]/g,"-$&").toLowerCase(),n+=nn.p?nn.p(r,o):r+":"+o+";")}return A+(t&&n?t+"{"+n+"}":n)+i},zA={},kp=e=>{if(typeof e=="object"){let t="";for(let A in e)t+=A+kp(e[A]);return t}return e},Tk=(e,t,A,i,n)=>{let r=kp(e),o=zA[r]||(zA[r]=(a=>{let I=0,c=11;for(;I>>0;return"go"+c})(r));if(!zA[o]){let a=r!==e?e:(I=>{let c,l,u=[{}];for(;c=Vk.exec(I.replace(zk,""));)c[4]?u.shift():c[3]?(l=c[3].replace(wp," ").trim(),u.unshift(u[0][l]=u[0][l]||{})):u[0][c[1]]=c[2].replace(wp," ").trim();return u[0]})(e);zA[o]=nn(n?{["@keyframes "+o]:a}:a,A?"":"."+o)}let s=A&&zA.g?zA.g:null;return A&&(zA.g=zA[o]),((a,I,c,l)=>{l?I.data=I.data.replace(l,a):I.data.indexOf(a)===-1&&(I.data=c?a+I.data:I.data+a)})(zA[o],t,i,s),o},_k=(e,t,A)=>e.reduce((i,n,r)=>{let o=t[r];if(o&&o.call){let s=o(A),a=s&&s.props&&s.props.className||/^go/.test(s)&&s;o=a?"."+a:s&&typeof s=="object"?s.props?"":nn(s,""):s===!1?"":s}return i+n+(o??"")},"");function cI(e){let t=this||{},A=e.call?e(t.p):e;return Tk(A.unshift?A.raw?_k(A,[].slice.call(arguments,1),t.p):A.reduce((i,n)=>Object.assign(i,n&&n.call?n(t.p):n),{}):A,Fp(t.target),t.g,t.o,t.k)}var RH=cI.bind({g:1}),JH=cI.bind({k:1});var Sp=async(e=!0)=>{let t=typeof window=="object"?window:globalThis;e&&await hh(()=>t.__SRV_URL__),t.prasiContext={global:{},render(){}};let A=window.location,i=A.protocol.indexOf("http")===0?A.hostname:"localhost",n=A.protocol!="https:"||/localhost|127.0.0.1|0.0.0.0/.test(i)?"http":"https";if(t.__SRV_URL__){t.serverurl=t.__SRV_URL__;let o=new URL(t.serverurl);(o.hostname==="localhost"||o.hostname==="127.0.0.1")&&(o.hostname=A.hostname,o.pathname=o.pathname==="/"?"":o.pathname,t.serverurl=o.toString(),t.serverurl.endsWith("/")&&(t.serverurl=t.serverurl.substring(0,t.serverurl.length-1)))}let r=A.port;t.baseurl=n+"://"+i+(r?":"+r:"")+"/",t.basepath||(t.basepath="/"),t.css=cI,t.extractCss=Dp,t.pathname=A.pathname,t.cx=(...o)=>{let s=[];return o.filter(a=>a?(typeof a=="string"&&a.trim(),!0):!1).forEach(a=>{if(Array.isArray(a))for(let I of a)typeof I=="string"&&I.trim()&&s.push(I.trim());else s.push(a.trim())}),s.join(" ")},t.navigate=o=>{let s=o;if(typeof t.navigateOverride=="function"&&(s=t.navigateOverride(o),!s))return null;history.pushState({prevUrl:window.location.href},"",s),t.pathname=o,t.prasiContext&&t.prasiContext.render&&t.prasiContext.render()},typeof window=="object"&&window.addEventListener("popstate",()=>{let o=navigator.serviceWorker.controller;if(o&&o.postMessage({type:"add-cache",url:A.href}),t.preventPopRender){t.preventPopRender=!1;return}t.prasiContext&&t.prasiContext.render&&(t.pathname=A.pathname,t.prasiContext.render())})};var F0=K(ze());var Oo=K(ce()),wu=({children:e,back:t})=>(0,Oo.jsxs)("div",{className:"flex items-center justify-center w-full h-full fixed inset-0 flex-col",children:[(0,Oo.jsx)("div",{children:e}),(0,Oo.jsxs)("div",{className:"border mt-2 rounded-md p-2 cursor-pointer",onClick:t||(()=>{history.back()}),children:[" ","Go Back"]})]});var Np=K(ze());var it=K(ce()),Up=window,rn=({children:e,className:t,show:A,backdrop:i,note:n,alt:r})=>{let o=wi({icon:(0,it.jsx)("div",{className:"px-4 py-1",children:"Loading..."}),value:.111,ival:null},()=>{});return(0,Np.useEffect)(()=>(o.ival=setInterval(()=>{o.value+=.1333,o.value>=1.3&&(o.value=0),o.render()},200),Up.loadingIcon&&(o.icon=(0,it.jsx)("img",{alt:"loading",src:Up.loadingIcon,className:css` width: 42px; height: 42px; - `}),o.render()),()=>{clearInterval(o.ival)}),[]),(0,et.jsxs)(et.Fragment,{children:[i!==!1&&(0,et.jsx)("div",{className:cx("flex items-center z-40 bg-white pointer-events-none","w-full h-full fixed transition-all duration-1000",typeof A<"u"?A?"opacity-50":"opacity-0":"opacity-50"),onContextMenuCapture:s=>{s.preventDefault()}}),e?(0,et.jsx)("div",{onContextMenuCapture:s=>{s.preventDefault()},className:cx("flex flex-1 items-center justify-center z-40 transition-all",t||(i!==!1?"w-full h-full fixed":""),typeof A<"u"?A?"":"hidden":""),children:(0,et.jsx)("div",{className:"flex items-center justify-center flex-col space-y-3 bg-white p-4 rounded-lg select-none",children:(0,et.jsx)("div",{className:"text-sm",children:e})})}):(0,et.jsx)("div",{className:cx("flex flex-1 items-center justify-center z-40 pointer-events-none transition-all",t||(i!==!1?"w-full h-full fixed":""),typeof A<"u"?A?"":"hidden":""),children:(0,et.jsxs)("div",{className:cx("w-1/6 flex flex-col items-center justify-center",css` + `}),o.render()),()=>{clearInterval(o.ival)}),[]),(0,it.jsxs)(it.Fragment,{children:[i!==!1&&(0,it.jsx)("div",{className:cx("flex items-center z-40 bg-white pointer-events-none","w-full h-full fixed transition-all duration-1000",typeof A<"u"?A?"opacity-50":"opacity-0":"opacity-50"),onContextMenuCapture:s=>{s.preventDefault()}}),e?(0,it.jsx)("div",{onContextMenuCapture:s=>{s.preventDefault()},className:cx("flex flex-1 items-center justify-center z-40 transition-all",t||(i!==!1?"w-full h-full fixed":""),typeof A<"u"?A?"":"hidden":""),children:(0,it.jsx)("div",{className:"flex items-center justify-center flex-col space-y-3 bg-white p-4 rounded-lg select-none",children:(0,it.jsx)("div",{className:"text-sm",children:e})})}):(0,it.jsx)("div",{className:cx("flex flex-1 items-center justify-center z-40 pointer-events-none transition-all",t||(i!==!1?"w-full h-full fixed":""),typeof A<"u"?A?"":"hidden":""),children:(0,it.jsxs)("div",{className:cx("w-1/6 flex flex-col items-center justify-center",css` min-width: 30px; .pr-outer { background: rgba(0, 0, 0, 0.1) !important; } - `),children:[(0,et.jsx)("div",{className:"text-[10px] text-slate-400 whitespace-nowrap",children:n}),(0,et.jsx)("div",{className:"pr-outer w-full h-[3px] flex items-stretch rounded-sm overflow-hidden",children:(0,et.jsx)("div",{className:cx("bg-blue-800 transition-all duration-200 rounded-sm w-full",css` + `),children:[(0,it.jsx)("div",{className:"text-[10px] text-slate-400 whitespace-nowrap",children:n}),(0,it.jsx)("div",{className:"pr-outer w-full h-[3px] flex items-stretch rounded-sm overflow-hidden",children:(0,it.jsx)("div",{className:cx("bg-blue-800 transition-all duration-200 rounded-sm w-full",css` transform: translate(${-100+o.value*200}%); - `)})}),r]})})]})};var st=null;var Ll=class extends Error{constructor(t){super(t),this.name="DecompressionError"}},Xi=0,Kl=null,LI=null;function Fh(e,t,A){let i;if(A){let r=t;i=e.malloc_u8(r);let o=new Uint8Array(e.memory.buffer,i,r);try{A(o)}catch(s){throw e.free_u8(i,r),s}return Xi=r,i}if(typeof t=="string"){let r=Xi=function(s){let I=0,a=0,c=0,u=s.length;for(;I>>0;st.free_u8(A,Xi);let n=st.buffer()>>>0;return new Uint8Array(st.memory.buffer,n,i)}function dt(e,t){Dh(st);let A=Fh(st,e,t),i=st.gzip_decompress(A,Xi)>>>0;if(st.free_u8(A,Xi),i===4294967295){let r=st.error_message(),o=st.error_message_len(),s=new Uint8Array(st.memory.buffer,r,o),I=new TextDecoder().decode(s);throw new Ll(I)}let n=st.buffer()>>>0;return new Uint8Array(st.memory.buffer,n,i)}function Dh(e){if(!e)throw new Error("WASM not initialized")}var It=()=>new Map,OI=e=>{let t=It();return e.forEach((A,i)=>{t.set(i,A)}),t},BA=(e,t,A)=>{let i=e.get(t);return i===void 0&&e.set(t,i=A()),i},kh=(e,t)=>{let A=[];for(let[i,n]of e)A.push(t(n,i));return A},Sh=(e,t)=>{for(let[A,i]of e)if(t(i,A))return!0;return!1};var LA=()=>new Set;var bI=e=>e[e.length-1];var Uh=(e,t)=>{for(let A=0;A{this.off(t,i),A(...n)};this.on(t,i)}off(t,A){let i=this._observers.get(t);i!==void 0&&(i.delete(A),i.size===0&&this._observers.delete(t))}emit(t,A){return fA((this._observers.get(t)||It()).values()).forEach(i=>i(...A))}destroy(){this._observers=It()}};var Rt=Math.floor;var Wn=Math.abs;var VI=(e,t)=>ee>t?e:t,hx=Number.isNaN;var zI=e=>e!==0?e<0:1/e<0;var Vl=Number.MAX_SAFE_INTEGER,px=Number.MIN_SAFE_INTEGER,Ex=1<<31;var Nh=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Rt(e)===e),mx=Number.isNaN,yx=Number.parseInt;var sD=String.fromCharCode,wx=String.fromCodePoint,Fx=sD(65535),ID=e=>e.toLowerCase(),aD=/^\s*/g,cD=e=>e.replace(aD,""),gD=/([A-Z])/g,zl=(e,t)=>cD(e.replace(gD,A=>`${t}${ID(A)}`));var lD=e=>{let t=unescape(encodeURIComponent(e)),A=t.length,i=new Uint8Array(A);for(let n=0;n$n.encode(e),Gh=$n?uD:lD;var jn=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});jn&&jn.decode(new Uint8Array).length===1&&(jn=null);var Ti=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},So=()=>new Ti;var BD=e=>{let t=e.cpos;for(let A=0;A{let t=new Uint8Array(BD(e)),A=0;for(let i=0;i{let A=e.cbuf.length;A-e.cpos{let A=e.cbuf.length;e.cpos===A&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(A*2),e.cpos=0),e.cbuf[e.cpos++]=t};var XI=Re;var Z=(e,t)=>{for(;t>127;)Re(e,128|127&t),t=Rt(t/128);Re(e,127&t)},TI=(e,t)=>{let A=zI(t);for(A&&(t=-t),Re(e,(t>63?128:0)|(A?64:0)|63&t),t=Rt(t/64);t>0;)Re(e,(t>127?128:0)|127&t),t=Rt(t/128)},_l=new Uint8Array(3e4),dD=_l.length/3,QD=(e,t)=>{if(t.length{let A=unescape(encodeURIComponent(t)),i=A.length;Z(e,i);for(let n=0;n{let A=e.cbuf.length,i=e.cpos,n=VI(A-i,t.length),r=t.length-n;e.cbuf.set(t.subarray(0,n),i),e.cpos+=n,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(OA(A*2,r)),e.cbuf.set(t.subarray(n)),e.cpos=r)},Qt=(e,t)=>{Z(e,t.byteLength),Uo(e,t)},Xl=(e,t)=>{fD(e,t);let A=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,A},hD=(e,t)=>Xl(e,4).setFloat32(0,t,!1),pD=(e,t)=>Xl(e,8).setFloat64(0,t,!1),ED=(e,t)=>Xl(e,8).setBigInt64(0,t,!1);var Mh=new DataView(new ArrayBuffer(4)),mD=e=>(Mh.setFloat32(0,e),Mh.getFloat32(0)===e),tr=(e,t)=>{switch(typeof t){case"string":Re(e,119),Zi(e,t);break;case"number":Nh(t)&&Wn(t)<=2147483647?(Re(e,125),TI(e,t)):mD(t)?(Re(e,124),hD(e,t)):(Re(e,123),pD(e,t));break;case"bigint":Re(e,122),ED(e,t);break;case"object":if(t===null)Re(e,126);else if(bl(t)){Re(e,117),Z(e,t.length);for(let A=0;A0&&Z(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}};var vh=e=>{e.count>0&&(TI(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Z(e.encoder,e.count-2))},Wi=class{constructor(){this.encoder=new Ti,this.s=0,this.count=0}write(t){this.s===t?this.count++:(vh(this),this.count=1,this.s=t)}toUint8Array(){return vh(this),eA(this.encoder)}};var Jh=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);TI(e.encoder,t),e.count>1&&Z(e.encoder,e.count-2)}},Ar=class{constructor(){this.encoder=new Ti,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(Jh(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return Jh(this),eA(this.encoder)}},_I=class{constructor(){this.sarr=[],this.s="",this.lensE=new Wi}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){let t=new Ti;return this.sarr.push(this.s),this.s="",Zi(t,this.sarr.join("")),Uo(t,this.lensE.toUint8Array()),eA(t)}};var dA=e=>new Error(e),tA=()=>{throw dA("Method unimplemented")},AA=()=>{throw dA("Unexpected case")};var Rh=dA("Unexpected end of array"),Kh=dA("Integer out of Range"),ir=class{constructor(t){this.arr=t,this.pos=0}},tn=e=>new ir(e),Lh=e=>e.pos!==e.arr.length;var wD=(e,t)=>{let A=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,A},Ct=e=>wD(e,X(e));var ji=e=>e.arr[e.pos++];var X=e=>{let t=0,A=1,i=e.arr.length;for(;e.posVl)throw Kh}throw Rh},WI=e=>{let t=e.arr[e.pos++],A=t&63,i=64,n=(t&64)>0?-1:1;if(!(t&128))return n*A;let r=e.arr.length;for(;e.posVl)throw Kh}throw Rh};var FD=e=>{let t=X(e);if(t===0)return"";{let A=String.fromCodePoint(ji(e));if(--t<100)for(;t--;)A+=String.fromCodePoint(ji(e));else for(;t>0;){let i=t<1e4?t:1e4,n=e.arr.subarray(e.pos,e.pos+i);e.pos+=i,A+=String.fromCodePoint.apply(null,n),t-=i}return decodeURIComponent(escape(A))}},DD=e=>jn.decode(Ct(e)),$i=jn?DD:FD;var Tl=(e,t)=>{let A=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,A},kD=e=>Tl(e,4).getFloat32(0,!1),SD=e=>Tl(e,8).getFloat64(0,!1),UD=e=>Tl(e,8).getBigInt64(0,!1);var ND=[e=>{},e=>null,WI,kD,SD,UD,e=>!1,e=>!0,$i,e=>{let t=X(e),A={};for(let i=0;i{let t=X(e),A=[];for(let i=0;iND[127-ji(e)](e),No=class extends ir{constructor(t,A){super(t),this.reader=A,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Lh(this)?this.count=X(this)+1:this.count=-1),this.count--,this.s}};var en=class extends ir{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=WI(this);let t=zI(this.s);this.count=1,t&&(this.s=-this.s,this.count=X(this)+2)}return this.count--,this.s}};var rr=class extends ir{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let t=WI(this),A=t&1;this.diff=Rt(t/2),this.count=1,A&&(this.count=X(this)+2)}return this.s+=this.diff,this.count--,this.s}},ZI=class{constructor(t){this.decoder=new en(t),this.str=$i(this.decoder),this.spos=0}read(){let t=this.spos+this.decoder.read(),A=this.str.slice(this.spos,t);return this.spos=t,A}};var Sx=crypto.subtle,Oh=crypto.getRandomValues.bind(crypto);var Zl=()=>Oh(new Uint32Array(1))[0];var GD="10000000-1000-4000-8000"+-1e11,bh=()=>GD.replace(/[018]/g,e=>(e^Zl()&15>>e/4).toString(16));var Yh=Date.now;var Wl=e=>new Promise(e);var xx=Promise.all.bind(Promise);var jl=e=>e===void 0?null:e;var $l=class{constructor(){this.map=new Map}setItem(t,A){this.map.set(t,A)}getItem(t){return this.map.get(t)}},Vh=new $l,qD=!0;try{typeof localStorage<"u"&&localStorage&&(Vh=localStorage,qD=!1)}catch{}var zh=Vh;var _h=Object.assign,KD=Object.keys,Xh=(e,t)=>{for(let A in e)t(e[A],A)};var Ph=e=>KD(e).length;var Th=e=>{for(let t in e)return!1;return!0},LD=(e,t)=>{for(let A in e)if(!t(e[A],A))return!1;return!0},OD=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Zh=(e,t)=>e===t||Ph(e)===Ph(t)&&LD(e,(A,i)=>(A!==void 0||OD(t,i))&&t[i]===A);var xo=(e,t,A=0)=>{try{for(;Ae;var jh=(e,t)=>t.includes(e);var Go=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";var Gx=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,QA,YD=[],VD=()=>{if(QA===void 0)if(Go){QA=It();let e=process.argv,t=null;for(let A=0;A{if(e.length!==0){let[t,A]=e.split("=");QA.set(`--${zl(t,"-")}`,A),QA.set(`-${zl(t,"-")}`,A)}})):QA=It();return QA},eu=e=>VD().has(e);var tu=e=>Go?jl(process.env[e.toUpperCase()]):jl(zh.getItem(e));var zD=e=>eu("--"+e)||tu(e)!==null,Hx=zD("production"),ep=Go&&jh(process.env.FORCE_COLOR,["true","1","2"]),tp=!eu("no-colors")&&(!Go||process.stdout.isTTY||ep)&&(!Go||eu("color")||ep||tu("COLORTERM")!==null||(tu("TERM")||"").includes("color"));var _D=e=>new Uint8Array(e);var Ap=e=>{let t=_D(e.byteLength);return t.set(e),t};var Au=class{constructor(t,A){this.left=t,this.right=A}},CA=(e,t)=>new Au(e,t);var An=typeof document<"u"?document:{};var Mx=typeof DOMParser<"u"?new DOMParser:null;var ip=e=>kh(e,(t,A)=>`${A}:${t};`).join("");var vx=An.ELEMENT_NODE,Jx=An.TEXT_NODE,qx=An.CDATA_SECTION_NODE,Rx=An.COMMENT_NODE,Kx=An.DOCUMENT_NODE,Lx=An.DOCUMENT_TYPE_NODE,Ox=An.DOCUMENT_FRAGMENT_NODE;var hA=Symbol;var Ho=hA(),Mo=hA(),iu=hA(),nu=hA(),ru=hA(),vo=hA(),ou=hA(),Jo=hA(),su=hA(),np=e=>{let t=[],A=[],i=0;for(;i{let t=[],A=[],i=It(),n=[],r=0;for(;r0||I.length>0?(t.push("%c"+o),A.push(I)):t.push(o)}else break}for(r>0&&(n=A,n.unshift(t.join("")));r{console.log(...tk(e)),Ak.forEach(t=>t.print(e))};var Ak=LA();var op=e=>({[Symbol.iterator](){return this},next:e}),sp=(e,t)=>op(()=>{let A;do A=e.next();while(!A.done&&!t(A.value));return A}),jI=(e,t)=>op(()=>{let{done:A,value:i}=e.next();return{done:A,value:A?void 0:t(i)}});var Ro=class{constructor(t,A){this.clock=t,this.len=A}},nn=class{constructor(){this.clients=new Map}},Ep=(e,t,A)=>t.clients.forEach((i,n)=>{let r=e.doc.store.clients.get(n);for(let o=0;o{let A=0,i=e.length-1;for(;A<=i;){let n=Rt((A+i)/2),r=e[n],o=r.clock;if(o<=t){if(t{let A=e.clients.get(t.client);return A!==void 0&&sk(A,t.clock)!==null},Fu=e=>{e.clients.forEach(t=>{t.sort((n,r)=>n.clock-r.clock);let A,i;for(A=1,i=1;A=r.clock?n.len=OA(n.len,r.clock+r.len-n.clock):(i{let t=new nn;for(let A=0;A{if(!t.clients.has(n)){let r=i.slice();for(let o=A+1;o{BA(e.clients,t,()=>[]).push(new Ro(A,i))},yp=()=>new nn,ak=e=>{let t=yp();return e.clients.forEach((A,i)=>{let n=[];for(let r=0;r0&&t.clients.set(i,n)}),t},cr=(e,t)=>{Z(e.restEncoder,t.clients.size),fA(t.clients.entries()).sort((A,i)=>i[0]-A[0]).forEach(([A,i])=>{e.resetDsCurVal(),Z(e.restEncoder,A);let n=i.length;Z(e.restEncoder,n);for(let r=0;r{let t=new nn,A=X(e.restDecoder);for(let i=0;i0){let o=BA(t.clients,n,()=>[]);for(let s=0;s{let i=new nn,n=X(e.restDecoder);for(let r=0;r0){let r=new bA;return Z(r.restEncoder,0),cr(r,i),r.toUint8Array()}return null};var wp=Zl,Ko=class e extends YI{constructor({guid:t=bh(),collectionid:A=null,gc:i=!0,gcFilter:n=()=>!0,meta:r=null,autoLoad:o=!1,shouldLoad:s=!0}={}){super(),this.gc=i,this.gcFilter=n,this.clientID=wp(),this.guid=t,this.collectionid=A,this.share=new Map,this.store=new aa,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=s,this.autoLoad=o,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Wl(a=>{this.on("load",()=>{this.isLoaded=!0,a(this)})});let I=()=>Wl(a=>{let c=u=>{(u===void 0||u===!0)&&(this.off("sync",c),a())};this.on("sync",c)});this.on("sync",a=>{a===!1&&this.isSynced&&(this.whenSynced=I()),this.isSynced=a===void 0||a===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[])}),this.whenSynced=I()}load(){let t=this._item;t!==null&&!this.shouldLoad&&Be(t.parent.doc,A=>{A.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(fA(this.subdocs).map(t=>t.guid))}transact(t,A=null){return Be(this,t,A)}get(t,A=He){let i=BA(this.share,t,()=>{let r=new A;return r._integrate(this,null),r}),n=i.constructor;if(A!==He&&n!==A)if(n===He){let r=new A;r._map=i._map,i._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=r}),r._start=i._start;for(let o=r._start;o!==null;o=o.right)o.parent=r;return r._length=i._length,this.share.set(t,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return i}getArray(t=""){return this.get(t,ua)}getText(t=""){return this.get(t,Po)}getMap(t=""){return this.get(t,Vo)}getXmlFragment(t=""){return this.get(t,Ir)}toJSON(){let t={};return this.share.forEach((A,i)=>{t[i]=A.toJSON()}),t}destroy(){fA(this.subdocs).forEach(A=>A.destroy());let t=this._item;if(t!==null){this._item=null;let A=t.content;A.doc=new e({guid:this.guid,...A.opts,shouldLoad:!1}),A.doc._item=t,Be(t.parent.doc,i=>{let n=A.doc;t.deleted||i.subdocsAdded.add(n),i.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(t,A){super.on(t,A)}off(t,A){super.off(t,A)}},ra=class{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return X(this.restDecoder)}readDsLen(){return X(this.restDecoder)}},oa=class extends ra{readLeftID(){return ee(X(this.restDecoder),X(this.restDecoder))}readRightID(){return ee(X(this.restDecoder),X(this.restDecoder))}readClient(){return X(this.restDecoder)}readInfo(){return ji(this.restDecoder)}readString(){return $i(this.restDecoder)}readParentInfo(){return X(this.restDecoder)===1}readTypeRef(){return X(this.restDecoder)}readLen(){return X(this.restDecoder)}readAny(){return nr(this.restDecoder)}readBuf(){return Ap(Ct(this.restDecoder))}readJSON(){return JSON.parse($i(this.restDecoder))}readKey(){return $i(this.restDecoder)}},cu=class{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=X(this.restDecoder),this.dsCurrVal}readDsLen(){let t=X(this.restDecoder)+1;return this.dsCurrVal+=t,t}},wi=class extends cu{constructor(t){super(t),this.keys=[],X(t),this.keyClockDecoder=new rr(Ct(t)),this.clientDecoder=new en(Ct(t)),this.leftClockDecoder=new rr(Ct(t)),this.rightClockDecoder=new rr(Ct(t)),this.infoDecoder=new No(Ct(t),ji),this.stringDecoder=new ZI(Ct(t)),this.parentInfoDecoder=new No(Ct(t),ji),this.typeRefDecoder=new en(Ct(t)),this.lenDecoder=new en(Ct(t))}readLeftID(){return new yi(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new yi(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return nr(this.restDecoder)}readBuf(){return Ct(this.restDecoder)}readJSON(){return nr(this.restDecoder)}readKey(){let t=this.keyClockDecoder.read();if(t{i=OA(i,t[0].id.clock);let n=pA(t,i);Z(e.restEncoder,t.length-n),e.writeClient(A),Z(e.restEncoder,i);let r=t[n];r.write(e,i-r.id.clock);for(let o=n+1;o{let i=new Map;A.forEach((n,r)=>{Ke(t,r)>n&&i.set(r,n)}),Qa(t).forEach((n,r)=>{A.has(r)||i.set(r,0)}),Z(e.restEncoder,i.size),fA(i.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{ck(e,t.clients.get(n),n,r)})},gk=(e,t)=>{let A=It(),i=X(e.restDecoder);for(let n=0;n{let i=[],n=fA(A.keys()).sort((g,B)=>g-B);if(n.length===0)return null;let r=()=>{if(n.length===0)return null;let g=A.get(n[n.length-1]);for(;g.refs.length===g.i;)if(n.pop(),n.length>0)g=A.get(n[n.length-1]);else return null;return g},o=r();if(o===null)return null;let s=new aa,I=new Map,a=(g,B)=>{let h=I.get(g);(h==null||h>B)&&I.set(g,B)},c=o.refs[o.i++],u=new Map,l=()=>{for(let g of i){let B=g.id.client,h=A.get(B);h?(h.i--,s.clients.set(B,h.refs.slice(h.i)),A.delete(B),h.i=0,h.refs=[]):s.clients.set(B,[g]),n=n.filter(U=>U!==B)}i.length=0};for(;;){if(c.constructor!==pt){let B=BA(u,c.id.client,()=>Ke(t,c.id.client))-c.id.clock;if(B<0)i.push(c),a(c.id.client,c.id.clock-1),l();else{let h=c.getMissing(e,t);if(h!==null){i.push(c);let U=A.get(h)||{refs:[],i:0};if(U.refs.length===U.i)a(h,Ke(t,h)),l();else{c=U.refs[U.i++];continue}}else(B===0||B0)c=i.pop();else if(o!==null&&o.i0){let g=new bA;return ku(g,s,new Map),Z(g.restEncoder,0),{missing:I,update:g.toUint8Array()}}return null},uk=(e,t)=>ku(e,t.doc.store,t.beforeState),Bk=(e,t,A,i=new wi(e))=>Be(t,n=>{n.local=!1;let r=!1,o=n.doc,s=o.store,I=gk(i,o),a=lk(n,s,I),c=s.pendingStructs;if(c){for(let[l,g]of c.missing)if(gg)&&c.missing.set(l,g)}c.update=ca([c.update,a.update])}}else s.pendingStructs=a;let u=cp(i,n,s);if(s.pendingDs){let l=new wi(tn(s.pendingDs));X(l.restDecoder);let g=cp(l,n,s);u&&g?s.pendingDs=ca([u,g]):s.pendingDs=u||g}else s.pendingDs=u;if(r){let l=s.pendingStructs.update;s.pendingStructs=null,Fp(n.doc,l)}},A,!1);var Fp=(e,t,A,i=wi)=>{let n=tn(t);Bk(n,e,A,new i(n))},Dp=(e,t,A)=>Fp(e,t,A,oa),fk=(e,t,A=new Map)=>{ku(e,t.store,A),cr(e,ak(t.store))},dk=(e,t=new Uint8Array([0]),A=new bA)=>{let i=Sp(t);fk(A,e,i);let n=[A.toUint8Array()];if(e.store.pendingDs&&n.push(e.store.pendingDs),e.store.pendingStructs&&n.push(Uk(e.store.pendingStructs.update,t)),n.length>1){if(A.constructor===rn)return kk(n.map((r,o)=>o===0?r:xk(r)));if(A.constructor===bA)return ca(n)}return n[0]},kp=(e,t)=>dk(e,t,new rn),Qk=e=>{let t=new Map,A=X(e.restDecoder);for(let i=0;iQk(new ra(tn(e))),Up=(e,t)=>(Z(e.restEncoder,t.size),fA(t.entries()).sort((A,i)=>i[0]-A[0]).forEach(([A,i])=>{Z(e.restEncoder,A),Z(e.restEncoder,i)}),e),Ck=(e,t)=>Up(e,Qa(t.store)),hk=(e,t=new Ia)=>(e instanceof Map?Up(t,e):Ck(t,e),t.toUint8Array()),Np=e=>hk(e,new sa),gu=class{constructor(){this.l=[]}},gp=()=>new gu,lp=(e,t)=>e.l.push(t),up=(e,t)=>{let A=e.l,i=A.length;e.l=A.filter(n=>t!==n),i===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},xp=(e,t,A)=>xo(e.l,[t,A]),yi=class{constructor(t,A){this.client=t,this.clock=A}},$I=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,ee=(e,t)=>new yi(e,t);var pk=e=>{for(let[t,A]of e.doc.share.entries())if(A===e)return t;throw AA()};var lu=class{constructor(t,A){this.ds=t,this.sv=A}};var Ek=(e,t)=>new lu(e,t),tG=Ek(yp(),new Map);var or=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!mp(t.ds,e.id),uu=(e,t)=>{let A=BA(e.meta,uu,LA),i=e.doc.store;A.has(t)||(t.sv.forEach((n,r)=>{n{}),A.add(t))};var aa=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},Qa=e=>{let t=new Map;return e.clients.forEach((A,i)=>{let n=A[A.length-1];t.set(i,n.id.clock+n.length)}),t},Ke=(e,t)=>{let A=e.clients.get(t);if(A===void 0)return 0;let i=A[A.length-1];return i.id.clock+i.length},Gp=(e,t)=>{let A=e.clients.get(t.id.client);if(A===void 0)A=[],e.clients.set(t.id.client,A);else{let i=A[A.length-1];if(i.id.clock+i.length!==t.id.clock)throw AA()}A.push(t)},pA=(e,t)=>{let A=0,i=e.length-1,n=e[i],r=n.id.clock;if(r===t)return i;let o=Rt(t/(r+n.length-1)*i);for(;A<=i;){if(n=e[o],r=n.id.clock,r<=t){if(t{let A=e.clients.get(t.client);return A[pA(A,t.clock)]},Iu=mk,Bu=(e,t,A)=>{let i=pA(t,A),n=t[i];return n.id.clock{let A=e.doc.store.clients.get(t.client);return A[Bu(e,A,t.clock)]},Bp=(e,t,A)=>{let i=t.clients.get(A.client),n=pA(i,A.clock),r=i[n];return A.clock!==r.id.clock+r.length-1&&r.constructor!==ht&&i.splice(n+1,0,da(e,r,A.clock-r.id.clock+1)),r},yk=(e,t,A)=>{let i=e.clients.get(t.id.client);i[pA(i,t.id.clock)]=A},Hp=(e,t,A,i,n)=>{if(i===0)return;let r=A+i,o=Bu(e,t,A),s;do s=t[o++],rt.deleteSet.clients.size===0&&!Sh(t.afterState,(A,i)=>t.beforeState.get(i)!==A)?!1:(Fu(t.deleteSet),uk(e,t),cr(e,t.deleteSet),!0),dp=(e,t,A)=>{let i=t._item;(i===null||i.id.clock<(e.beforeState.get(i.id.client)||0)&&!i.deleted)&&BA(e.changed,t,LA).add(A)},Aa=(e,t)=>{let A=e[t],i=e[t-1],n=t;for(;n>0;A=i,i=e[--n-1]){if(i.deleted===A.deleted&&i.constructor===A.constructor&&i.mergeWith(A)){A instanceof Le&&A.parentSub!==null&&A.parent._map.get(A.parentSub)===A&&A.parent._map.set(A.parentSub,i);continue}break}let r=t-n;return r&&e.splice(t+1-r,r),r},wk=(e,t,A)=>{for(let[i,n]of e.clients.entries()){let r=t.clients.get(i);for(let o=n.length-1;o>=0;o--){let s=n[o],I=s.clock+s.len;for(let a=pA(r,s.clock),c=r[a];a{e.clients.forEach((A,i)=>{let n=t.clients.get(i);for(let r=A.length-1;r>=0;r--){let o=A[r],s=VI(n.length-1,1+pA(n,o.clock+o.len-1));for(let I=s,a=n[I];I>0&&a.id.clock>=o.clock;a=n[I])I-=1+Aa(n,I)}})};var Mp=(e,t)=>{if(ts.push(()=>{(a._item===null||!a._item.deleted)&&a._callObserver(A,I)})),s.push(()=>{A.changedParentTypes.forEach((I,a)=>{a._dEH.l.length>0&&(a._item===null||!a._item.deleted)&&(I=I.filter(c=>c.target._item===null||!c.target._item.deleted),I.forEach(c=>{c.currentTarget=a,c._path=null}),I.sort((c,u)=>c.path.length-u.path.length),xp(a._dEH,I,A))})}),s.push(()=>i.emit("afterTransaction",[A,i])),xo(s,[]),A._needFormattingCleanup&&bk(A)}finally{i.gc&&wk(r,n,i.gcFilter),Fk(r,n),A.afterState.forEach((c,u)=>{let l=A.beforeState.get(u)||0;if(l!==c){let g=n.clients.get(u),B=OA(pA(g,l),1);for(let h=g.length-1;h>=B;)h-=1+Aa(g,h)}});for(let c=o.length-1;c>=0;c--){let{client:u,clock:l}=o[c].id,g=n.clients.get(u),B=pA(g,l);B+11||B>0&&Aa(g,B)}if(!A.local&&A.afterState.get(i.clientID)!==A.beforeState.get(i.clientID)&&(rp(Jo,Ho,"[yjs] ",Mo,vo,"Changed the client-id because another client seems to be using it."),i.clientID=wp()),i.emit("afterTransactionCleanup",[A,i]),i._observers.has("update")){let c=new rn;fp(c,A)&&i.emit("update",[c.toUint8Array(),A.origin,i,A])}if(i._observers.has("updateV2")){let c=new bA;fp(c,A)&&i.emit("updateV2",[c.toUint8Array(),A.origin,i,A])}let{subdocsAdded:s,subdocsLoaded:I,subdocsRemoved:a}=A;(s.size>0||a.size>0||I.size>0)&&(s.forEach(c=>{c.clientID=i.clientID,c.collectionid==null&&(c.collectionid=i.collectionid),i.subdocs.add(c)}),a.forEach(c=>i.subdocs.delete(c)),i.emit("subdocs",[{loaded:I,added:s,removed:a},i,A]),a.forEach(c=>c.destroy())),e.length<=t+1?(i._transactionCleanups=[],i.emit("afterAllTransactions",[i,e])):Mp(e,t+1)}}},Be=(e,t,A=null,i=!0)=>{let n=e._transactionCleanups,r=!1,o=null;e._transaction===null&&(r=!0,e._transaction=new fu(e,A,i),n.push(e._transaction),n.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(r){let s=e._transaction===n[0];e._transaction=null,s&&Mp(n,0)}}return o};function*Dk(e){let t=X(e.restDecoder);for(let A=0;Aca(e,oa,rn);var Sk=(e,t)=>{if(e.constructor===ht){let{client:A,clock:i}=e.id;return new ht(ee(A,i+t),e.length-t)}else if(e.constructor===pt){let{client:A,clock:i}=e.id;return new pt(ee(A,i+t),e.length-t)}else{let A=e,{client:i,clock:n}=A.id;return new Le(ee(i,n+t),null,ee(i,n+t-1),null,A.rightOrigin,A.parent,A.parentSub,A.content.splice(t))}},ca=(e,t=wi,A=bA)=>{if(e.length===1)return e[0];let i=e.map(c=>new t(tn(c))),n=i.map(c=>new Lo(c,!0)),r=null,o=new A,s=new Oo(o);for(;n=n.filter(l=>l.curr!==null),n.sort((l,g)=>{if(l.curr.id.client===g.curr.id.client){let B=l.curr.id.clock-g.curr.id.clock;return B===0?l.curr.constructor===g.curr.constructor?0:l.curr.constructor===pt?1:-1:B}else return g.curr.id.client-l.curr.id.client}),n.length!==0;){let c=n[0],u=c.curr.id.client;if(r!==null){let l=c.curr,g=!1;for(;l!==null&&l.id.clock+l.length<=r.struct.id.clock+r.struct.length&&l.id.client>=r.struct.id.client;)l=c.next(),g=!0;if(l===null||l.id.client!==u||g&&l.id.clock>r.struct.id.clock+r.struct.length)continue;if(u!==r.struct.id.client)Ei(s,r.struct,r.offset),r={struct:l,offset:0},c.next();else if(r.struct.id.clock+r.struct.length0&&(r.struct.constructor===pt?r.struct.length-=B:l=Sk(l,B)),r.struct.mergeWith(l)||(Ei(s,r.struct,r.offset),r={struct:l,offset:0},c.next())}}else r={struct:c.curr,offset:0},c.next();for(let l=c.curr;l!==null&&l.id.client===u&&l.id.clock===r.struct.id.clock+r.struct.length&&l.constructor!==pt;l=c.next())Ei(s,r.struct,r.offset),r={struct:l,offset:0}}r!==null&&(Ei(s,r.struct,r.offset),r=null),Su(s);let I=i.map(c=>Du(c)),a=Ik(I);return cr(o,a),o.toUint8Array()},Uk=(e,t,A=wi,i=bA)=>{let n=Sp(t),r=new i,o=new Oo(r),s=new A(tn(e)),I=new Lo(s,!1);for(;I.curr;){let c=I.curr,u=c.id.client,l=n.get(u)||0;if(I.curr.constructor===pt){I.next();continue}if(c.id.clock+c.length>l)for(Ei(o,c,OA(l-c.id.clock,0)),I.next();I.curr&&I.curr.id.client===u;)Ei(o,I.curr,0),I.next();else for(;I.curr&&I.curr.id.client===u&&I.curr.id.clock+I.curr.length<=l;)I.next()}Su(o);let a=Du(s);return cr(r,a),r.toUint8Array()};var vp=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:eA(e.encoder.restEncoder)}),e.encoder.restEncoder=So(),e.written=0)},Ei=(e,t,A)=>{e.written>0&&e.currClient!==t.id.client&&vp(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),Z(e.encoder.restEncoder,t.id.clock+A)),t.write(e.encoder,A),e.written++},Su=e=>{vp(e);let t=e.encoder.restEncoder;Z(t,e.clientStructs.length);for(let A=0;A{let n=new A(tn(e)),r=new Lo(n,!1),o=new i,s=new Oo(o);for(let a=r.curr;a!==null;a=r.next())Ei(s,t(a),0);Su(s);let I=Du(n);return cr(o,I),o.toUint8Array()};var xk=e=>Nk(e,Wh,wi,rn),Qp="You must not compute changes after the event-handler fired.",sr=class{constructor(t,A){this.target=t,this.currentTarget=t,this.transaction=A,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Gk(this.currentTarget,this.target))}deletes(t){return mp(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw dA(Qp);let t=new Map,A=this.target;this.transaction.changed.get(A).forEach(n=>{if(n!==null){let r=A._map.get(n),o,s;if(this.adds(r)){let I=r.left;for(;I!==null&&this.adds(I);)I=I.left;if(this.deletes(r))if(I!==null&&this.deletes(I))o="delete",s=bI(I.content.getContent());else return;else I!==null&&this.deletes(I)?(o="update",s=bI(I.content.getContent())):(o="add",s=void 0)}else if(this.deletes(r))o="delete",s=bI(r.content.getContent());else return;t.set(n,{action:o,oldValue:s})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw dA(Qp);let A=this.target,i=LA(),n=LA(),r=[];if(t={added:i,deleted:n,delta:r,keys:this.keys},this.transaction.changed.get(A).has(null)){let s=null,I=()=>{s&&r.push(s)};for(let a=A._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((s===null||s.delete===void 0)&&(I(),s={delete:0}),s.delete+=a.length,n.add(a)):this.adds(a)?((s===null||s.insert===void 0)&&(I(),s={insert:[]}),s.insert=s.insert.concat(a.content.getContent()),i.add(a)):((s===null||s.retain===void 0)&&(I(),s={retain:0}),s.retain+=a.length);s!==null&&s.retain===void 0&&I()}this._changes=t}return t}},Gk=(e,t)=>{let A=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)A.unshift(t._item.parentSub);else{let i=0,n=t._item.parent._start;for(;n!==t._item&&n!==null;)n.deleted||i++,n=n.right;A.unshift(i)}t=t._item.parent}return A},Jp=80,Uu=0,du=class{constructor(t,A){t.marker=!0,this.p=t,this.index=A,this.timestamp=Uu++}},Hk=e=>{e.timestamp=Uu++},qp=(e,t,A)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=A,e.timestamp=Uu++},Mk=(e,t,A)=>{if(e.length>=Jp){let i=e.reduce((n,r)=>n.timestamp{if(e._start===null||t===0||e._searchMarker===null)return null;let A=e._searchMarker.length===0?null:e._searchMarker.reduce((r,o)=>Wn(t-r.index)t;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);for(;i.left!==null&&i.left.id.client===i.id.client&&i.left.id.clock+i.left.length===i.id.clock;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);return A!==null&&Wn(A.index-n){for(let i=e.length-1;i>=0;i--){let n=e[i];if(A>0){let r=n.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(n.index-=r.length);if(r===null||r.marker===!0){e.splice(i,1);continue}n.p=r,r.marker=!0}(t0&&t===n.index)&&(n.index=OA(t,n.index+A))}};var ha=(e,t,A)=>{let i=e,n=t.changedParentTypes;for(;BA(n,e,()=>[]).push(A),e._item!==null;)e=e._item.parent;xp(i._eH,A,t)},He=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=gp(),this._dEH=gp(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,A){this.doc=t,this._item=A}_copy(){throw tA()}clone(){throw tA()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,A){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){lp(this._eH,t)}observeDeep(t){lp(this._dEH,t)}unobserve(t){up(this._eH,t)}unobserveDeep(t){up(this._dEH,t)}toJSON(){}},Rp=(e,t,A)=>{t<0&&(t=e._length+t),A<0&&(A=e._length+A);let i=A-t,n=[],r=e._start;for(;r!==null&&i>0;){if(r.countable&&!r.deleted){let o=r.content.getContent();if(o.length<=t)t-=o.length;else{for(let s=t;s0;s++)n.push(o[s]),i--;t=0}}r=r.right}return n},Kp=e=>{let t=[],A=e._start;for(;A!==null;){if(A.countable&&!A.deleted){let i=A.content.getContent();for(let n=0;n{let A=0,i=e._start;for(;i!==null;){if(i.countable&&!i.deleted){let n=i.content.getContent();for(let r=0;r{let A=[];return Yo(e,(i,n)=>{A.push(t(i,n,e))}),A},vk=e=>{let t=e._start,A=null,i=0;return{[Symbol.iterator](){return this},next:()=>{if(A===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};A=t.content.getContent(),i=0,t=t.right}let n=A[i++];return A.length<=i&&(A=null),{done:!1,value:n}}}},Op=(e,t)=>{let A=Ca(e,t),i=e._start;for(A!==null&&(i=A.p,t-=A.index);i!==null;i=i.right)if(!i.deleted&&i.countable){if(t{let n=A,r=e.doc,o=r.clientID,s=r.store,I=A===null?t._start:A.right,a=[],c=()=>{a.length>0&&(n=new Le(ee(o,Ke(s,o)),n,n&&n.lastId,I,I&&I.id,t,null,new ar(a)),n.integrate(e,0),a=[])};i.forEach(u=>{if(u===null)a.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:a.push(u);break;default:switch(c(),u.constructor){case Uint8Array:case ArrayBuffer:n=new Le(ee(o,Ke(s,o)),n,n&&n.lastId,I,I&&I.id,t,null,new Xo(new Uint8Array(u))),n.integrate(e,0);break;case Ko:n=new Le(ee(o,Ke(s,o)),n,n&&n.lastId,I,I&&I.id,t,null,new To(u)),n.integrate(e,0);break;default:if(u instanceof He)n=new Le(ee(o,Ke(s,o)),n,n&&n.lastId,I,I&&I.id,t,null,new VA(u)),n.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},bp=()=>dA("Length exceeded!"),Yp=(e,t,A,i)=>{if(A>t._length)throw bp();if(A===0)return t._searchMarker&&bo(t._searchMarker,A,i.length),ga(e,t,null,i);let n=A,r=Ca(t,A),o=t._start;for(r!==null&&(o=r.p,A-=r.index,A===0&&(o=o.prev,A+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(A<=o.length){A{let n=(t._searchMarker||[]).reduce((r,o)=>o.index>r.index?o:r,{index:0,p:t._start}).p;if(n)for(;n.right;)n=n.right;return ga(e,t,n,A)},Vp=(e,t,A,i)=>{if(i===0)return;let n=A,r=i,o=Ca(t,A),s=t._start;for(o!==null&&(s=o.p,A-=o.index);s!==null&&A>0;s=s.right)!s.deleted&&s.countable&&(A0&&s!==null;)s.deleted||(i0)throw bp();t._searchMarker&&bo(t._searchMarker,n,-r+i)},la=(e,t,A)=>{let i=t._map.get(A);i!==void 0&&i.delete(e)},Nu=(e,t,A,i)=>{let n=t._map.get(A)||null,r=e.doc,o=r.clientID,s;if(i==null)s=new ar([i]);else switch(i.constructor){case Number:case Object:case Boolean:case Array:case String:s=new ar([i]);break;case Uint8Array:s=new Xo(i);break;case Ko:s=new To(i);break;default:if(i instanceof He)s=new VA(i);else throw new Error("Unexpected content type")}new Le(ee(o,Ke(r.store,o)),n,n&&n.lastId,null,null,t,A,s).integrate(e,0)},xu=(e,t)=>{let A=e._map.get(t);return A!==void 0&&!A.deleted?A.content.getContent()[A.length-1]:void 0},zp=e=>{let t={};return e._map.forEach((A,i)=>{A.deleted||(t[i]=A.content.getContent()[A.length-1])}),t},Pp=(e,t)=>{let A=e._map.get(t);return A!==void 0&&!A.deleted};var qk=(e,t)=>{let A={};return e._map.forEach((i,n)=>{let r=i;for(;r!==null&&(!t.sv.has(r.id.client)||r.id.clock>=(t.sv.get(r.id.client)||0));)r=r.left;r!==null&&or(r,t)&&(A[n]=r.content.getContent()[r.length-1])}),A},ea=e=>sp(e.entries(),t=>!t[1].deleted),Qu=class extends sr{constructor(t,A){super(t,A),this._transaction=A}},ua=class e extends He{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let A=new e;return A.push(t),A}_integrate(t,A){super._integrate(t,A),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(A=>A instanceof He?A.clone():A)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(t,A){super._callObserver(t,A),ha(this,t,new Qu(this,t))}insert(t,A){this.doc!==null?Be(this.doc,i=>{Yp(i,this,t,A)}):this._prelimContent.splice(t,0,...A)}push(t){this.doc!==null?Be(this.doc,A=>{Jk(A,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,A=1){this.doc!==null?Be(this.doc,i=>{Vp(i,this,t,A)}):this._prelimContent.splice(t,A)}get(t){return Op(this,t)}toArray(){return Kp(this)}slice(t=0,A=this.length){return Rp(this,t,A)}toJSON(){return this.map(t=>t instanceof He?t.toJSON():t)}map(t){return Lp(this,t)}forEach(t){Yo(this,t)}[Symbol.iterator](){return vk(this)}_write(t){t.writeTypeRef(nS)}},Rk=e=>new ua,Cu=class extends sr{constructor(t,A,i){super(t,A),this.keysChanged=i}},Vo=class e extends He{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,A){super._integrate(t,A),this._prelimContent.forEach((i,n)=>{this.set(n,i)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((A,i)=>{t.set(i,A instanceof He?A.clone():A)}),t}_callObserver(t,A){ha(this,t,new Cu(this,t,A))}toJSON(){let t={};return this._map.forEach((A,i)=>{if(!A.deleted){let n=A.content.getContent()[A.length-1];t[i]=n instanceof He?n.toJSON():n}}),t}get size(){return[...ea(this._map)].length}keys(){return jI(ea(this._map),t=>t[0])}values(){return jI(ea(this._map),t=>t[1].content.getContent()[t[1].length-1])}entries(){return jI(ea(this._map),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this._map.forEach((A,i)=>{A.deleted||t(A.content.getContent()[A.length-1],i,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?Be(this.doc,A=>{la(A,this,t)}):this._prelimContent.delete(t)}set(t,A){return this.doc!==null?Be(this.doc,i=>{Nu(i,this,t,A)}):this._prelimContent.set(t,A),A}get(t){return xu(this,t)}has(t){return Pp(this,t)}clear(){this.doc!==null?Be(this.doc,t=>{this.forEach(function(A,i,n){la(t,n,i)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(rS)}},Kk=e=>new Vo,mi=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&Zh(e,t),zo=class{constructor(t,A,i,n){this.left=t,this.right=A,this.index=i,this.currentAttributes=n}forward(){switch(this.right===null&&AA(),this.right.content.constructor){case Me:this.right.deleted||gr(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}},Cp=(e,t,A)=>{for(;t.right!==null&&A>0;){switch(t.right.content.constructor){case Me:t.right.deleted||gr(t.currentAttributes,t.right.content);break;default:t.right.deleted||(A{let i=new Map,n=Ca(t,A);if(n){let r=new zo(n.p.left,n.p,n.index,i);return Cp(e,r,A-n.index)}else{let r=new zo(null,t._start,0,i);return Cp(e,r,A)}},_p=(e,t,A,i)=>{for(;A.right!==null&&(A.right.deleted===!0||A.right.content.constructor===Me&&mi(i.get(A.right.content.key),A.right.content.value));)A.right.deleted||i.delete(A.right.content.key),A.forward();let n=e.doc,r=n.clientID;i.forEach((o,s)=>{let I=A.left,a=A.right,c=new Le(ee(r,Ke(n.store,r)),I,I&&I.lastId,a,a&&a.id,t,null,new Me(s,o));c.integrate(e,0),A.right=c,A.forward()})},gr=(e,t)=>{let{key:A,value:i}=t;i===null?e.delete(A):e.set(A,i)},Xp=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Me&&mi(t[e.right.content.key]||null,e.right.content.value)))break;e.forward()}},Tp=(e,t,A,i)=>{let n=e.doc,r=n.clientID,o=new Map;for(let s in i){let I=i[s],a=A.currentAttributes.get(s)||null;if(!mi(a,I)){o.set(s,a);let{left:c,right:u}=A;A.right=new Le(ee(r,Ke(n.store,r)),c,c&&c.lastId,u,u&&u.id,t,null,new Me(s,I)),A.right.integrate(e,0),A.forward()}}return o},au=(e,t,A,i,n)=>{A.currentAttributes.forEach((l,g)=>{n[g]===void 0&&(n[g]=null)});let r=e.doc,o=r.clientID;Xp(A,n);let s=Tp(e,t,A,n),I=i.constructor===String?new YA(i):i instanceof He?new VA(i):new on(i),{left:a,right:c,index:u}=A;t._searchMarker&&bo(t._searchMarker,A.index,I.getLength()),c=new Le(ee(o,Ke(r.store,o)),a,a&&a.lastId,c,c&&c.id,t,null,I),c.integrate(e,0),A.right=c,A.index=u,A.forward(),_p(e,t,A,s)},hp=(e,t,A,i,n)=>{let r=e.doc,o=r.clientID;Xp(A,n);let s=Tp(e,t,A,n);e:for(;A.right!==null&&(i>0||s.size>0&&(A.right.deleted||A.right.content.constructor===Me));){if(!A.right.deleted)switch(A.right.content.constructor){case Me:{let{key:I,value:a}=A.right.content,c=n[I];if(c!==void 0){if(mi(c,a))s.delete(I);else{if(i===0)break e;s.set(I,a)}A.right.delete(e)}else A.currentAttributes.set(I,a);break}default:i0){let I="";for(;i>0;i--)I+=` -`;A.right=new Le(ee(o,Ke(r.store,o)),A.left,A.left&&A.left.lastId,A.right,A.right&&A.right.id,t,null,new YA(I)),A.right.integrate(e,0),A.forward()}_p(e,t,A,s)},Zp=(e,t,A,i,n)=>{let r=t,o=It();for(;r&&(!r.countable||r.deleted);){if(!r.deleted&&r.content.constructor===Me){let a=r.content;o.set(a.key,a)}r=r.right}let s=0,I=!1;for(;t!==r;){if(A===t&&(I=!0),!t.deleted){let a=t.content;switch(a.constructor){case Me:{let{key:c,value:u}=a,l=i.get(c)||null;(o.get(c)!==a||l===u)&&(t.delete(e),s++,!I&&(n.get(c)||null)===u&&l!==u&&(l===null?n.delete(c):n.set(c,l))),!I&&!t.deleted&&gr(n,a);break}}}t=t.right}return s},Lk=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let A=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Me){let i=t.content.key;A.has(i)?t.delete(e):A.add(i)}t=t.left}},Ok=e=>{let t=0;return Be(e.doc,A=>{let i=e._start,n=e._start,r=It(),o=OI(r);for(;n;){if(n.deleted===!1)switch(n.content.constructor){case Me:gr(o,n.content);break;default:t+=Zp(A,i,n,r,o),r=OI(o),i=n;break}n=n.right}}),t},bk=e=>{let t=new Set,A=e.doc;for(let[i,n]of e.afterState.entries()){let r=e.beforeState.get(i)||0;n!==r&&Hp(e,A.store.clients.get(i),r,n,o=>{!o.deleted&&o.content.constructor===Me&&o.constructor!==ht&&t.add(o.parent)})}Be(A,i=>{Ep(e,e.deleteSet,n=>{if(n instanceof ht||!n.parent._hasFormatting||t.has(n.parent))return;let r=n.parent;n.content.constructor===Me?t.add(r):Lk(i,n)});for(let n of t)Ok(n)})},pp=(e,t,A)=>{let i=A,n=OI(t.currentAttributes),r=t.right;for(;A>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case VA:case on:case YA:A{n===null?this.childListChanged=!0:this.keysChanged.add(n)})}get changes(){if(this._changes===null){let t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){let t=this.target.doc,A=[];Be(t,i=>{let n=new Map,r=new Map,o=this.target._start,s=null,I={},a="",c=0,u=0,l=()=>{if(s!==null){let g=null;switch(s){case"delete":u>0&&(g={delete:u}),u=0;break;case"insert":(typeof a=="object"||a.length>0)&&(g={insert:a},n.size>0&&(g.attributes={},n.forEach((B,h)=>{B!==null&&(g.attributes[h]=B)}))),a="";break;case"retain":c>0&&(g={retain:c},Th(I)||(g.attributes=_h({},I))),c=0;break}g&&A.push(g),s=null}};for(;o!==null;){switch(o.content.constructor){case VA:case on:this.adds(o)?this.deletes(o)||(l(),s="insert",a=o.content.getContent()[0],l()):this.deletes(o)?(s!=="delete"&&(l(),s="delete"),u+=1):o.deleted||(s!=="retain"&&(l(),s="retain"),c+=1);break;case YA:this.adds(o)?this.deletes(o)||(s!=="insert"&&(l(),s="insert"),a+=o.content.str):this.deletes(o)?(s!=="delete"&&(l(),s="delete"),u+=o.length):o.deleted||(s!=="retain"&&(l(),s="retain"),c+=o.length);break;case Me:{let{key:g,value:B}=o.content;if(this.adds(o)){if(!this.deletes(o)){let h=n.get(g)||null;mi(h,B)?B!==null&&o.delete(i):(s==="retain"&&l(),mi(B,r.get(g)||null)?delete I[g]:I[g]=B)}}else if(this.deletes(o)){r.set(g,B);let h=n.get(g)||null;mi(h,B)||(s==="retain"&&l(),I[g]=h)}else if(!o.deleted){r.set(g,B);let h=I[g];h!==void 0&&(mi(h,B)?h!==null&&o.delete(i):(s==="retain"&&l(),B===null?delete I[g]:I[g]=B))}o.deleted||(s==="insert"&&l(),gr(n,o.content));break}}o=o.right}for(l();A.length>0;){let g=A[A.length-1];if(g.retain!==void 0&&g.attributes===void 0)A.pop();else break}}),this._delta=A}return this._delta}},Po=class e extends He{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(t,A){super._integrate(t,A);try{this._pending.forEach(i=>i())}catch(i){console.error(i)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(t,A){super._callObserver(t,A);let i=new hu(this,t,A);ha(this,t,i),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){let t="",A=this._start;for(;A!==null;)!A.deleted&&A.countable&&A.content.constructor===YA&&(t+=A.content.str),A=A.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:A=!0}={}){this.doc!==null?Be(this.doc,i=>{let n=new zo(null,this._start,0,new Map);for(let r=0;r0)&&au(i,this,n,s,o.attributes||{})}else o.retain!==void 0?hp(i,this,n,o.retain,o.attributes||{}):o.delete!==void 0&&pp(i,n,o.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,A,i){let n=[],r=new Map,o=this.doc,s="",I=this._start;function a(){if(s.length>0){let u={},l=!1;r.forEach((B,h)=>{l=!0,u[h]=B});let g={insert:s};l&&(g.attributes=u),n.push(g),s=""}}let c=()=>{for(;I!==null;){if(or(I,t)||A!==void 0&&or(I,A))switch(I.content.constructor){case YA:{let u=r.get("ychange");t!==void 0&&!or(I,t)?(u===void 0||u.user!==I.id.client||u.type!=="removed")&&(a(),r.set("ychange",i?i("removed",I.id):{type:"removed"})):A!==void 0&&!or(I,A)?(u===void 0||u.user!==I.id.client||u.type!=="added")&&(a(),r.set("ychange",i?i("added",I.id):{type:"added"})):u!==void 0&&(a(),r.delete("ychange")),s+=I.content.str;break}case VA:case on:{a();let u={insert:I.content.getContent()[0]};if(r.size>0){let l={};u.attributes=l,r.forEach((g,B)=>{l[B]=g})}n.push(u);break}case Me:or(I,t)&&(a(),gr(r,I.content));break}I=I.right}a()};return t||A?Be(o,u=>{t&&uu(u,t),A&&uu(u,A),c()},"cleanup"):c(),n}insert(t,A,i){if(A.length<=0)return;let n=this.doc;n!==null?Be(n,r=>{let o=ta(r,this,t);i||(i={},o.currentAttributes.forEach((s,I)=>{i[I]=s})),au(r,this,o,A,i)}):this._pending.push(()=>this.insert(t,A,i))}insertEmbed(t,A,i={}){let n=this.doc;n!==null?Be(n,r=>{let o=ta(r,this,t);au(r,this,o,A,i)}):this._pending.push(()=>this.insertEmbed(t,A,i))}delete(t,A){if(A===0)return;let i=this.doc;i!==null?Be(i,n=>{pp(n,ta(n,this,t),A)}):this._pending.push(()=>this.delete(t,A))}format(t,A,i){if(A===0)return;let n=this.doc;n!==null?Be(n,r=>{let o=ta(r,this,t);o.right!==null&&hp(r,this,o,A,i)}):this._pending.push(()=>this.format(t,A,i))}removeAttribute(t){this.doc!==null?Be(this.doc,A=>{la(A,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,A){this.doc!==null?Be(this.doc,i=>{Nu(i,this,t,A)}):this._pending.push(()=>this.setAttribute(t,A))}getAttribute(t){return xu(this,t)}getAttributes(){return zp(this)}_write(t){t.writeTypeRef(oS)}},Yk=e=>new Po,qo=class{constructor(t,A=()=>!0){this._filter=A,this._root=t,this._currentNode=t._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let t=this._currentNode,A=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(A)))do if(A=t.content.type,!t.deleted&&(A.constructor===Ba||A.constructor===Ir)&&A._start!==null)t=A._start;else for(;t!==null;)if(t.right!==null){t=t.right;break}else t.parent===this._root?t=null:t=t.parent._item;while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}},Ir=class e extends He{constructor(){super(),this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,A){super._integrate(t,A),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(A=>A instanceof He?A.clone():A)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new qo(this,t)}querySelector(t){t=t.toUpperCase();let i=new qo(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t).next();return i.done?null:i.value}querySelectorAll(t){return t=t.toUpperCase(),fA(new qo(this,A=>A.nodeName&&A.nodeName.toUpperCase()===t))}_callObserver(t,A){ha(this,t,new pu(this,A,t))}toString(){return Lp(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,A={},i){let n=t.createDocumentFragment();return i!==void 0&&i._createAssociation(n,this),Yo(this,r=>{n.insertBefore(r.toDOM(t,A,i),null)}),n}insert(t,A){this.doc!==null?Be(this.doc,i=>{Yp(i,this,t,A)}):this._prelimContent.splice(t,0,...A)}insertAfter(t,A){if(this.doc!==null)Be(this.doc,i=>{let n=t&&t instanceof He?t._item:t;ga(i,this,n,A)});else{let i=this._prelimContent,n=t===null?0:i.findIndex(r=>r===t)+1;if(n===0&&t!==null)throw dA("Reference item not found");i.splice(n,0,...A)}}delete(t,A=1){this.doc!==null?Be(this.doc,i=>{Vp(i,this,t,A)}):this._prelimContent.splice(t,A)}toArray(){return Kp(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return Op(this,t)}slice(t=0,A=this.length){return Rp(this,t,A)}forEach(t){Yo(this,t)}_write(t){t.writeTypeRef(IS)}},Vk=e=>new Ir,Ba=class e extends Ir{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,A){super._integrate(t,A),this._prelimAttrs.forEach((i,n)=>{this.setAttribute(n,i)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName),A=this.getAttributes();return Xh(A,(i,n)=>{typeof i=="string"&&t.setAttribute(n,i)}),t.insert(0,this.toArray().map(i=>i instanceof He?i.clone():i)),t}toString(){let t=this.getAttributes(),A=[],i=[];for(let s in t)i.push(s);i.sort();let n=i.length;for(let s=0;s0?" "+A.join(" "):"";return`<${r}${o}>${super.toString()}`}removeAttribute(t){this.doc!==null?Be(this.doc,A=>{la(A,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,A){this.doc!==null?Be(this.doc,i=>{Nu(i,this,t,A)}):this._prelimAttrs.set(t,A)}getAttribute(t){return xu(this,t)}hasAttribute(t){return Pp(this,t)}getAttributes(t){return t?qk(this,t):zp(this)}toDOM(t=document,A={},i){let n=t.createElement(this.nodeName),r=this.getAttributes();for(let o in r){let s=r[o];typeof s=="string"&&n.setAttribute(o,s)}return Yo(this,o=>{n.appendChild(o.toDOM(t,A,i))}),i!==void 0&&i._createAssociation(n,this),n}_write(t){t.writeTypeRef(sS),t.writeKey(this.nodeName)}},zk=e=>new Ba(e.readKey()),pu=class extends sr{constructor(t,A,i){super(t,i),this.childListChanged=!1,this.attributesChanged=new Set,A.forEach(n=>{n===null?this.childListChanged=!0:this.attributesChanged.add(n)})}},Eu=class e extends Vo{constructor(t){super(),this.hookName=t}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((A,i)=>{t.set(i,A)}),t}toDOM(t=document,A={},i){let n=A[this.hookName],r;return n!==void 0?r=n.createDom(this):r=document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),i!==void 0&&i._createAssociation(r,this),r}_write(t){t.writeTypeRef(aS),t.writeKey(this.hookName)}},Pk=e=>new Eu(e.readKey()),mu=class e extends Po{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(t=document,A,i){let n=t.createTextNode(this.toString());return i!==void 0&&i._createAssociation(n,this),n}toString(){return this.toDelta().map(t=>{let A=[];for(let n in t.attributes){let r=[];for(let o in t.attributes[n])r.push({key:o,value:t.attributes[n][o]});r.sort((o,s)=>o.keyn.nodeName=0;n--)i+=``;return i}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(cS)}},_k=e=>new mu,_o=class{constructor(t,A){this.id=t,this.length=A}get deleted(){throw tA()}mergeWith(t){return!1}write(t,A,i){throw tA()}integrate(t,A){throw tA()}},Xk=0,ht=class extends _o{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){A>0&&(this.id.clock+=A,this.length-=A),Gp(t.doc.store,this)}write(t,A){t.writeInfo(Xk),t.writeLen(this.length-A)}getMissing(t,A){return null}},Xo=class e{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(t){throw tA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeBuf(this.content)}getRef(){return 3}},Tk=e=>new Xo(e.readBuf()),fa=class e{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let A=new e(this.len-t);return this.len=t,A}mergeWith(t){return this.len+=t.len,!0}integrate(t,A){na(t.deleteSet,A.id.client,A.id.clock,this.len),A.markDeleted()}delete(t){}gc(t){}write(t,A){t.writeLen(this.len-A)}getRef(){return 1}},Zk=e=>new fa(e.readLen()),Wp=(e,t)=>new Ko({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),To=class e{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;let A={};this.opts=A,t.gc||(A.gc=!1),t.autoLoad&&(A.autoLoad=!0),t.meta!==null&&(A.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(Wp(this.doc.guid,this.opts))}splice(t){throw tA()}mergeWith(t){return!1}integrate(t,A){this.doc._item=A,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,A){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},Wk=e=>new To(Wp(e.readString(),e.readAny())),on=class e{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(t){throw tA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeJSON(this.embed)}getRef(){return 5}},jk=e=>new on(e.readJSON()),Me=class e{constructor(t,A){this.key=t,this.value=A}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(t){throw tA()}mergeWith(t){return!1}integrate(t,A){let i=A.parent;i._searchMarker=null,i._hasFormatting=!0}delete(t){}gc(t){}write(t,A){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},$k=e=>new Me(e.readKey(),e.readJSON()),yu=class e{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let A=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),A}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){let i=this.arr.length;t.writeLen(i-A);for(let n=A;n{let t=e.readLen(),A=[];for(let i=0;i{let t=e.readLen(),A=[];for(let i=0;i=55296&&i<=56319&&(this.str=this.str.slice(0,t-1)+"\uFFFD",A.str="\uFFFD"+A.str.slice(1)),A}mergeWith(t){return this.str+=t.str,!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeString(A===0?this.str:this.str.slice(A))}getRef(){return 4}},AS=e=>new YA(e.readString()),iS=[Rk,Kk,Yk,zk,Vk,Pk,_k],nS=0,rS=1,oS=2,sS=3,IS=4,aS=5,cS=6,VA=class e{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(t){throw tA()}mergeWith(t){return!1}integrate(t,A){this.type._integrate(t.doc,A)}delete(t){let A=this.type._start;for(;A!==null;)A.deleted?A.id.clock<(t.beforeState.get(A.id.client)||0)&&t._mergeStructs.push(A):A.delete(t),A=A.right;this.type._map.forEach(i=>{i.deleted?i.id.clock<(t.beforeState.get(i.id.client)||0)&&t._mergeStructs.push(i):i.delete(t)}),t.changed.delete(this.type)}gc(t){let A=this.type._start;for(;A!==null;)A.gc(t,!0),A=A.right;this.type._start=null,this.type._map.forEach(i=>{for(;i!==null;)i.gc(t,!0),i=i.left}),this.type._map=new Map}write(t,A){this.type._write(t)}getRef(){return 7}},gS=e=>new VA(iS[e.readTypeRef()](e));var da=(e,t,A)=>{let{client:i,clock:n}=t.id,r=new Le(ee(i,n+A),t,ee(i,n+A-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(A));return t.deleted&&r.markDeleted(),t.keep&&(r.keep=!0),t.redone!==null&&(r.redone=ee(t.redone.client,t.redone.clock+A)),t.right=r,r.right!==null&&(r.right.left=r),e._mergeStructs.push(r),r.parentSub!==null&&r.right===null&&r.parent._map.set(r.parentSub,r),t.length=A,r};var Le=class e extends _o{constructor(t,A,i,n,r,o,s,I){super(t,I.getLength()),this.origin=i,this.left=A,this.right=n,this.rightOrigin=r,this.parent=o,this.parentSub=s,this.redone=null,this.content=I,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,A){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ke(A,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ke(A,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===yi&&this.id.client!==this.parent.client&&this.parent.clock>=Ke(A,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Bp(t,A,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Fi(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===ht||this.right&&this.right.constructor===ht)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===yi){let i=Iu(A,this.parent);i.constructor===ht?this.parent=null:this.parent=i.content.type}return null}integrate(t,A){if(A>0&&(this.id.clock+=A,this.left=Bp(t,t.doc.store,ee(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(A),this.length-=A),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let i=this.left,n;if(i!==null)n=i.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,o=new Set;for(;n!==null&&n!==this.right;){if(o.add(n),r.add(n),$I(this.origin,n.origin)){if(n.id.client{i.p===t&&(i.p=this,!this.deleted&&this.countable&&(i.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let A=this.parent;this.countable&&this.parentSub===null&&(A._length-=this.length),this.markDeleted(),na(t.deleteSet,this.id.client,this.id.clock,this.length),dp(t,A,this.parentSub),this.content.delete(t)}}gc(t,A){if(!this.deleted)throw AA();this.content.gc(t),A?yk(t,this,new ht(this.id,this.length)):this.content=new fa(this.length)}write(t,A){let i=A>0?ee(this.id.client,this.id.clock+A-1):this.origin,n=this.rightOrigin,r=this.parentSub,o=this.content.getRef()&31|(i===null?0:128)|(n===null?0:64)|(r===null?0:32);if(t.writeInfo(o),i!==null&&t.writeLeftID(i),n!==null&&t.writeRightID(n),i===null&&n===null){let s=this.parent;if(s._item!==void 0){let I=s._item;if(I===null){let a=pk(s);t.writeParentInfo(!0),t.writeString(a)}else t.writeParentInfo(!1),t.writeLeftID(I.id)}else s.constructor===String?(t.writeParentInfo(!0),t.writeString(s)):s.constructor===yi?(t.writeParentInfo(!1),t.writeLeftID(s)):AA();r!==null&&t.writeString(r)}this.content.write(t,A)}},jp=(e,t)=>lS[t&31](e),lS=[()=>{AA()},Zk,eS,Tk,AS,jk,$k,gS,tS,Wk,()=>{AA()}],uS=10,pt=class extends _o{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){AA()}write(t,A){t.writeInfo(uS),Z(t.restEncoder,this.length-A)}getMissing(t,A){return null}},$p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},eE="__ $YJS$ __";$p[eE]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");$p[eE]=!0;var pa={proxies:new WeakMap,traps:new WeakMap},tE=(e,t,A)=>e.get(t)||e.set(t,new A).get(t),AE=e=>e.join(),iE=(e,t,A,i,n)=>{tE(tE(pa.traps,e,WeakMap),t,Map).set(AE(A),i),pa.proxies.set(i,n)},Gu=(e,t,A)=>{var i,n;return pa.proxies.get((n=(i=pa.traps.get(e))===null||i===void 0?void 0:i.get(t))===null||n===void 0?void 0:n.get(AE(A)))};var fS=Symbol("default"),dS=Object.keys(Object.getOwnPropertyDescriptors(Reflect)),QS=["get","has","set","defineProperty","deleteProperty","getOwnPropertyDescriptor"],CS=(e,t)=>{let A,i,n,r,o,s,I,a;switch(e){case"get":[A,i,r]=t;break;case"set":[A,i,n,r]=t;break;case"deleteProperty":case"defineProperty":[A,s]=t;break;case"has":case"getOwnPropertyDescriptor":[A,i]=t;break;case"apply":[A,I,o]=t;break;case"construct":[A,o]=t;break;case"setPrototypeOf":[A,a]=t;break;default:[A]=t}return{target:A,name:i,receiver:r,val:n,args:o,descriptor:s,thisValue:I,prototype:a}},hS=(e,t)=>{let{trapName:A,handler:i,traps:n,root:r,path:o}=e,{target:s,name:I,val:a,receiver:c,args:u,descriptor:l,thisValue:g,prototype:B}=CS(A,t),h=QS.includes(A)?I:void 0;return{parameters:t,target:s,name:I,val:a,args:u,descriptor:l,receiver:c,thisValue:g,prototype:B,trapName:A,traps:n,path:o,handler:i,key:h,newValue:A==="set"?a:void 0,root:r,get proxy(){return Gu(r,s,o)},get value(){return h&&s[h]},DEFAULT:fS,PROXY:nE.bind({root:r,handler:i,path:[...o,h]})}},pS=function(...e){let{trapName:t,handler:A}=this,i=hS(this,e),{PROXY:n,DEFAULT:r}=i,o=A(i);return o===n?n(i.value):o===r?Reflect[t](...e):o},ES=(e,t,A)=>dS.reduce((i,n)=>(i[n]=pS.bind({trapName:n,handler:e,traps:i,root:t,path:A}),i),{}),mS=e=>{if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Deep proxy could be applied to objects and functions only")},yS=({DEFAULT:e})=>e,nE=function(e,t,A,i){mS(e);let n=Object.assign({},this),r=t||n.handler||yS,o=A||n.path||[],s=n.root||i||e,I=Gu(s,e,o);if(I)return I;let a=ES(r,s,o),c=new Proxy(e,a);return iE(s,e,o,a,c),c},rE=class{constructor(e,t,A,i){return nE(e,t,A,i)}};function jo(e,t,A,i){function n(r){return r instanceof A?r:new A(function(o){o(r)})}return new(A||(A=Promise))(function(r,o){function s(c){try{a(i.next(c))}catch(u){o(u)}}function I(c){try{a(i.throw(c))}catch(u){o(u)}}function a(c){c.done?r(c.value):n(c.value).then(s,I)}a((i=i.apply(e,t||[])).next())})}var he=class{constructor(){this.mutex=Promise.resolve()}lock(){let t=()=>{};return this.mutex=this.mutex.then(()=>new Promise(t)),new Promise(A=>{t=A})}dispatch(t){return jo(this,void 0,void 0,function*(){let A=yield this.lock();try{return yield Promise.resolve(t())}finally{A()}})}},Hu;function wS(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global}var Ju=wS(),Mu=(Hu=Ju.Buffer)!==null&&Hu!==void 0?Hu:null,FS=Ju.TextEncoder?new Ju.TextEncoder:null;function lE(e,t){return(e&15)+(e>>6|e>>3&8)<<4|(t&15)+(t>>6|t>>3&8)}function DS(e,t){let A=t.length>>1;for(let i=0;i>>4;e[i++]=r>9?r+oE:r+sE,r=t[n]&15,e[i++]=r>9?r+oE:r+sE}return String.fromCharCode.apply(null,e)}var aE=Mu!==null?e=>{if(typeof e=="string"){let t=Mu.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(Mu.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if(typeof e=="string")return FS.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},cE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wo=new Uint8Array(256);for(let e=0;e>4,n+=1,i[n]=(s&15)<<4|I>>2,n+=1,i[n]=(I&3)<<6|a&63,n+=1}return i}var Ea=16*1024,Zo=4,NS=new he,vu=new Map;function xS(e,t){return jo(this,void 0,void 0,function*(){let A=null,i=null,n=!1;if(typeof WebAssembly>"u")throw new Error("WebAssembly is not supported in this environment!");let r=(w,D=0)=>{i.set(w,D)},o=()=>i,s=()=>A.exports,I=w=>{A.exports.Hash_SetMemorySize(w);let D=A.exports.Hash_GetBuffer(),S=A.exports.memory.buffer;i=new Uint8Array(S,D,w)},a=()=>new DataView(A.exports.memory.buffer).getUint32(A.exports.STATE_SIZE,!0),c=NS.dispatch(()=>jo(this,void 0,void 0,function*(){if(!vu.has(e.name)){let D=US(e.data),S=WebAssembly.compile(D);vu.set(e.name,S)}let w=yield vu.get(e.name);A=yield WebAssembly.instantiate(w,{})})),u=()=>jo(this,void 0,void 0,function*(){A||(yield c);let w=A.exports.Hash_GetBuffer(),D=A.exports.memory.buffer;i=new Uint8Array(D,w,Ea)}),l=(w=null)=>{n=!0,A.exports.Hash_Init(w)},g=w=>{let D=0;for(;D{if(!n)throw new Error("update() called before init()");let D=aE(w);g(D)},h=new Uint8Array(t*2),U=(w,D=null)=>{if(!n)throw new Error("digest() called before init()");return n=!1,A.exports.Hash_Final(D),w==="binary"?i.slice(0,t):IE(h,i,t)},d=()=>{if(!n)throw new Error("save() can only be called after init() and before digest()");let w=A.exports.Hash_GetState(),D=a(),S=A.exports.memory.buffer,K=new Uint8Array(S,w,D),q=new Uint8Array(Zo+D);return DS(q,e.hash),q.set(K,Zo),q},f=w=>{if(!(w instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");let D=A.exports.Hash_GetState(),S=a(),K=Zo+S,q=A.exports.memory.buffer;if(w.length!==K)throw new Error(`Bad state length (expected ${K} bytes, got ${w.length})`);if(!kS(e.hash,w.subarray(0,Zo)))throw new Error("This state was written by an incompatible hash implementation");let T=w.subarray(Zo);new Uint8Array(q,D,S).set(T),n=!0},Q=w=>typeof w=="string"?w.length!0;break;case"blake2b":case"blake2s":y=(w,D)=>D<=512&&Q(w);break;case"blake3":y=(w,D)=>D===0&&Q(w);break;case"xxhash64":case"xxhash3":case"xxhash128":y=()=>!1;break}let F=(w,D=null,S=null)=>{if(!y(w,D))return l(D),B(w),U("hex",S);let K=aE(w);return i.set(K),A.exports.Hash_Calculate(K.length,D,S),IE(h,i,t)};return yield u(),{getMemory:o,writeMemory:r,getExports:s,setMemorySize:I,init:l,update:B,digest:U,save:d,load:f,calculate:F,hashLength:t}})}function GS(e,t,A){return jo(this,void 0,void 0,function*(){let i=yield e.lock(),n=yield xS(t,A);return i(),n})}var aG=new he;var cG=new he;var gG=new DataView(new ArrayBuffer(4));var lG=new he;var uG=new he;var BG=new he;var fG=new he;var dG=new he;var QG=new he;var CG=new he;var hG=new he;var pG=new he;var EG=new he;var mG=new he;var yG=new he;var wG=new he;var HS="xxhash32",MS="AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwcGAAEBAgADBQQBAQICBg4CfwFBsIkFC38AQYAICwdwCAZtZW1vcnkCAA5IYXNoX0dldEJ1ZmZlcgAACUhhc2hfSW5pdAABC0hhc2hfVXBkYXRlAAIKSGFzaF9GaW5hbAADDUhhc2hfR2V0U3RhdGUABA5IYXNoX0NhbGN1bGF0ZQAFClNUQVRFX1NJWkUDAQqxEAYFAEGACQtNAEEAQgA3A6iJAUEAIAA2AoiJAUEAIABBz4yijgZqNgKMiQFBACAAQfeUr694ajYChIkBQQAgAEGoiI2hAmo2AoCJAUEAQQA2AqCJAQu4CAEHfwJAIABFDQBBAEEAKQOoiQEgAK18NwOoiQECQEEAKAKgiQEiASAAakEPSw0AAkACQCAAQQNxIgINAEGACSEDIAAhBAwBCyAAQXxxIQRBgAkhAwNAQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAy0AADoAACADQQFqIQMgAkF/aiICDQALCyAAQQRJDQEDQEEAQQAoAqCJASICQQFqNgKgiQEgAkGQiQFqIAMtAAA6AAAgA0EBai0AACECQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAjoAACADQQJqLQAAIQJBAEEAKAKgiQEiBUEBajYCoIkBIAVBkIkBaiACOgAAIANBA2otAAAhAkEAQQAoAqCJASIFQQFqNgKgiQEgBUGQiQFqIAI6AAAgA0EEaiEDIARBfGoiBA0ADAILCyAAQfAIaiEGAkACQCABDQBBACgCjIkBIQJBACgCiIkBIQVBACgChIkBIQRBACgCgIkBIQFBgAkhAwwBC0GACSEDAkAgAUEPSw0AQYAJIQMCQAJAQQAgAWtBA3EiBA0AIAEhBQwBCyABIQIDQEEAIAJBAWoiBTYCoIkBIAJBkIkBaiADLQAAOgAAIANBAWohAyAFIQIgBEF/aiIEDQALCyABQXNqQQNJDQBBACEEA0AgAyAEaiIBLQAAIQdBACAFIARqIgJBAWo2AqCJASACQZCJAWogBzoAACABQQFqLQAAIQdBACACQQJqNgKgiQEgAkGRiQFqIAc6AAAgAUECai0AACEHQQAgAkEDajYCoIkBIAJBkokBaiAHOgAAIAFBA2otAAAhAUEAIAJBBGo2AqCJASACQZOJAWogAToAACAFIARBBGoiBGpBEEcNAAsgAyAEaiEDC0EAQQAoApCJAUH3lK+veGxBACgCgIkBakENd0Gx893xeWwiATYCgIkBQQBBACgClIkBQfeUr694bEEAKAKEiQFqQQ13QbHz3fF5bCIENgKEiQFBAEEAKAKYiQFB95Svr3hsQQAoAoiJAWpBDXdBsfPd8XlsIgU2AoiJAUEAQQAoApyJAUH3lK+veGxBACgCjIkBakENd0Gx893xeWwiAjYCjIkBCyAAQYAJaiEAAkAgAyAGSw0AA0AgAygCAEH3lK+veGwgAWpBDXdBsfPd8XlsIQEgA0EMaigCAEH3lK+veGwgAmpBDXdBsfPd8XlsIQIgA0EIaigCAEH3lK+veGwgBWpBDXdBsfPd8XlsIQUgA0EEaigCAEH3lK+veGwgBGpBDXdBsfPd8XlsIQQgA0EQaiIDIAZNDQALC0EAIAI2AoyJAUEAIAU2AoiJAUEAIAQ2AoSJAUEAIAE2AoCJAUEAIAAgA2s2AqCJASAAIANGDQBBACECA0AgAkGQiQFqIAMgAmotAAA6AAAgAkEBaiICQQAoAqCJAUkNAAsLC6QDAgF+Bn9BACkDqIkBIgCnIQECQAJAIABCEFQNAEEAKAKEiQFBB3dBACgCgIkBQQF3akEAKAKIiQFBDHdqQQAoAoyJAUESd2ohAgwBC0EAKAKIiQFBsc/ZsgFqIQILIAIgAWohAkGQiQEhAwJAQQAoAqCJASIEQZCJAWoiBUGUiQFJDQBBkIkBIQEDQCABKAIAQb3cypV8bCACakERd0Gv1tO+AmwhAiABQQhqIQYgAUEEaiIDIQEgBiAFTQ0ACwsCQCADIAVGDQAgBEGPiQFqIQYCQAJAIAQgA2tBAXENACADIQEMAQsgA0EBaiEBIAMtAABBsc/ZsgFsIAJqQQt3QbHz3fF5bCECCyAGIANGDQADQCABQQFqLQAAQbHP2bIBbCABLQAAQbHP2bIBbCACakELd0Gx893xeWxqQQt3QbHz3fF5bCECIAFBAmoiASAFRw0ACwtBACACQQ92IAJzQfeUr694bCIBQQ12IAFzQb3cypV8bCIBQRB2IAFzIgJBGHQgAkGA/gNxQQh0ciABQQh2QYD+A3EgAUEYdnJyrTcDgAkLBgBBgIkBC/MDAgF+BH9BAEIANwOoiQFBACABNgKIiQFBACABQc+Moo4GajYCjIkBQQAgAUH3lK+veGo2AoSJAUEAIAFBqIiNoQJqNgKAiQFBAEEANgKgiQEgABACQQApA6iJASICpyEBAkACQCACQhBUDQBBACgChIkBQQd3QQAoAoCJAUEBd2pBACgCiIkBQQx3akEAKAKMiQFBEndqIQAMAQtBACgCiIkBQbHP2bIBaiEACyAAIAFqIQBBkIkBIQMCQEEAKAKgiQEiBEGQiQFqIgVBlIkBSQ0AQZCJASEBA0AgASgCAEG93MqVfGwgAGpBEXdBr9bTvgJsIQAgAUEIaiEGIAFBBGoiAyEBIAYgBU0NAAsLAkAgAyAFRg0AIARBj4kBaiEGAkACQCAEIANrQQFxDQAgAyEBDAELIANBAWohASADLQAAQbHP2bIBbCAAakELd0Gx893xeWwhAAsgBiADRg0AA0AgAUEBai0AAEGxz9myAWwgAS0AAEGxz9myAWwgAGpBC3dBsfPd8XlsakELd0Gx893xeWwhACABQQJqIgEgBUcNAAsLQQAgAEEPdiAAc0H3lK+veGwiAUENdiABc0G93MqVfGwiAUEQdiABcyIAQRh0IABBgP4DcUEIdHIgAUEIdkGA/gNxIAFBGHZycq03A4AJCwsLAQBBgAgLBDAAAAA=",vS="9e3a00cd",JS={name:HS,data:MS,hash:vS},qS=new he,ma=null;function gE(e){return!Number.isInteger(e)||e<0||e>4294967295?new Error("Seed must be a valid 32-bit long unsigned integer."):null}function ya(e,t=0){if(gE(t))return Promise.reject(gE(t));if(ma===null)return GS(qS,JS,4).then(A=>(ma=A,ma.calculate(e,t)));try{let A=ma.calculate(e,t);return Promise.resolve(A)}catch(A){return Promise.reject(A)}}var FG=new he;var DG=new ArrayBuffer(8);var kG=new he;var SG=new ArrayBuffer(8);var UG=new he;var NG=new ArrayBuffer(8);var xG=new he;var GG=new he;var HG=new he;function Ru(e){return new Promise((t,A)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>A(e.error)})}function sn(e,t){let A=indexedDB.open(e);A.onupgradeneeded=()=>A.result.createObjectStore(t);let i=Ru(A);return(n,r)=>i.then(o=>r(o.transaction(t,n).objectStore(t)))}var qu;function uE(){return qu||(qu=sn("keyval-store","keyval")),qu}function EA(e,t=uE()){return t("readonly",A=>Ru(A.get(e)))}function mA(e,t,A=uE()){return A("readwrite",i=>(i.put(t,e),Ru(i.transaction)))}var Lu;try{Lu=new TextDecoder}catch{}var G,Ot,C=0;var FE=[],Ou=FE,bu=0,Ee={},te,Di,Lt=0,yA=0,be,zA,Et=[],j,BE={useRecords:!1,mapsAsObjects:!0},$o=class{},Vu=new $o;Vu.name="MessagePack 0xC1";var ki=!1,DE=2,fE,dE,QE;try{new Function("")}catch{DE=1/0}var an=class e{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,A){if(G)return NE(()=>(Fa(),this?this.unpack(t,A):e.prototype.unpack.call(BE,t,A)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof A=="object"?(Ot=A.end||t.length,C=A.start||0):(C=0,Ot=A>-1?A:t.length),bu=0,yA=0,Di=null,Ou=FE,be=null,G=t;try{j=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw G=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof e){if(Ee=this,this.structures)return te=this.structures,wa(A);(!te||te.length>0)&&(te=[])}else Ee=BE,(!te||te.length>0)&&(te=[]);return wa(A)}unpackMultiple(t,A){let i,n=0;try{ki=!0;let r=t.length,o=this?this.unpack(t,r):ka.unpack(t,r);if(A){if(A(o,n,C)===!1)return;for(;Ci.slice(0)));for(let i=0,n=t.length;i=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in A||[])if(i>=0){let n=t[i],r=A[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,A){return this.unpack(t,A)}};function wa(e){try{if(!Ee.trusted&&!ki){let A=te.sharedLength||0;A=32&&fE?(t=fE(G,C,Ot,Ee),G=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),C=Ot):t=Se(),be&&(C=be.postBundlePosition,be=null),ki&&(te.restoreStructures=null),C==Ot)te&&te.restoreStructures&&CE(),te=null,G=null,zA&&(zA=null);else{if(C>Ot)throw new Error("Unexpected end of MessagePack data");if(!ki){let A;try{A=JSON.stringify(t,(i,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(i){A="(JSON view not available "+i+")"}throw new Error("Data read, but end of buffer not reached "+A)}}return t}catch(t){throw te&&te.restoreStructures&&CE(),Fa(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||C>Ot)&&(t.incomplete=!0),t}}function CE(){for(let e in te.restoreStructures)te[e]=te.restoreStructures[e];te.restoreStructures=null}function Se(){let e=G[C++];if(e<160)if(e<128){if(e<64)return e;{let t=te[e&63]||Ee.getStructures&&kE()[e&63];return t?(t.read||(t.read=zu(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,Ee.mapsAsObjects){let t={};for(let A=0;A=C)return Di.slice(C-Lt,(C+=t)-Lt);if(yA==0&&Ot<140){let A=t<16?Pu(t):SE(t);if(A!=null)return A}return Yu(t)}else{let t;switch(e){case 192:return null;case 193:return be?(t=Se(),t>0?be[1].slice(be.position1,be.position1+=t):be[0].slice(be.position0,be.position0-=t)):Vu;case 194:return!1;case 195:return!0;case 196:if(t=G[C++],t===void 0)throw new Error("Unexpected end of buffer");return Ku(t);case 197:return t=j.getUint16(C),C+=2,Ku(t);case 198:return t=j.getUint32(C),C+=4,Ku(t);case 199:return In(G[C++]);case 200:return t=j.getUint16(C),C+=2,In(t);case 201:return t=j.getUint32(C),C+=4,In(t);case 202:if(t=j.getFloat32(C),Ee.useFloat32>2){let A=Da[(G[C]&127)<<1|G[C+1]>>7];return C+=4,(A*t+(t>0?.5:-.5)>>0)/A}return C+=4,t;case 203:return t=j.getFloat64(C),C+=8,t;case 204:return G[C++];case 205:return t=j.getUint16(C),C+=2,t;case 206:return t=j.getUint32(C),C+=4,t;case 207:return Ee.int64AsType==="number"?(t=j.getUint32(C)*4294967296,t+=j.getUint32(C+4)):Ee.int64AsType==="string"?t=j.getBigUint64(C).toString():Ee.int64AsType==="auto"?(t=j.getBigUint64(C),t<=BigInt(2)<=BigInt(-2)<=C?Di.slice(C-Lt,(C+=t)-Lt):KS(t);case 218:return t=j.getUint16(C),C+=2,yA>=C?Di.slice(C-Lt,(C+=t)-Lt):LS(t);case 219:return t=j.getUint32(C),C+=4,yA>=C?Di.slice(C-Lt,(C+=t)-Lt):OS(t);case 220:return t=j.getUint16(C),C+=2,pE(t);case 221:return t=j.getUint32(C),C+=4,pE(t);case 222:return t=j.getUint16(C),C+=2,EE(t);case 223:return t=j.getUint32(C),C+=4,EE(t);default:if(e>=224)return e-256;if(e===void 0){let A=new Error("Unexpected end of MessagePack data");throw A.incomplete=!0,A}throw new Error("Unknown MessagePack token "+e)}}}var RS=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function zu(e,t){function A(){if(A.count++>DE){let n=e.read=new Function("r","return function(){return "+(Ee.freezeData?"Object.freeze":"")+"({"+e.map(r=>r==="__proto__"?"__proto_:r()":RS.test(r)?r+":r()":"["+JSON.stringify(r)+"]:r()").join(",")+"})}")(Se);return e.highByte===0&&(e.read=hE(t,e.read)),n()}let i={};for(let n=0,r=e.length;nfunction(){let A=G[C++];if(A===0)return t();let i=e<32?-(e+(A<<5)):e+(A<<5),n=te[i]||kE()[i];if(!n)throw new Error("Record id is not defined for "+i);return n.read||(n.read=zu(n,e)),n.read()};function kE(){let e=NE(()=>(G=null,Ee.getStructures()));return te=Ee._mergeStructures(e,te)}var Yu=es,KS=es,LS=es,OS=es;function es(e){let t;if(e<16&&(t=Pu(e)))return t;if(e>64&&Lu)return Lu.decode(G.subarray(C,C+=e));let A=C+e,i=[];for(t="";C65535&&(I-=65536,i.push(I>>>10&1023|55296),I=56320|I&1023),i.push(I)}else i.push(n);i.length>=4096&&(t+=Oe.apply(String,i),i.length=0)}return i.length>0&&(t+=Oe.apply(String,i)),t}function pE(e){let t=new Array(e);for(let A=0;A0){C=t;return}A[i]=n}return Oe.apply(String,A)}function Pu(e){if(e<4)if(e<2){if(e===0)return"";{let t=G[C++];if((t&128)>1){C-=1;return}return Oe(t)}}else{let t=G[C++],A=G[C++];if((t&128)>0||(A&128)>0){C-=2;return}if(e<3)return Oe(t,A);let i=G[C++];if((i&128)>0){C-=3;return}return Oe(t,A,i)}else{let t=G[C++],A=G[C++],i=G[C++],n=G[C++];if((t&128)>0||(A&128)>0||(i&128)>0||(n&128)>0){C-=4;return}if(e<6){if(e===4)return Oe(t,A,i,n);{let r=G[C++];if((r&128)>0){C-=5;return}return Oe(t,A,i,n,r)}}else if(e<8){let r=G[C++],o=G[C++];if((r&128)>0||(o&128)>0){C-=6;return}if(e<7)return Oe(t,A,i,n,r,o);let s=G[C++];if((s&128)>0){C-=7;return}return Oe(t,A,i,n,r,o,s)}else{let r=G[C++],o=G[C++],s=G[C++],I=G[C++];if((r&128)>0||(o&128)>0||(s&128)>0||(I&128)>0){C-=8;return}if(e<10){if(e===8)return Oe(t,A,i,n,r,o,s,I);{let a=G[C++];if((a&128)>0){C-=9;return}return Oe(t,A,i,n,r,o,s,I,a)}}else if(e<12){let a=G[C++],c=G[C++];if((a&128)>0||(c&128)>0){C-=10;return}if(e<11)return Oe(t,A,i,n,r,o,s,I,a,c);let u=G[C++];if((u&128)>0){C-=11;return}return Oe(t,A,i,n,r,o,s,I,a,c,u)}else{let a=G[C++],c=G[C++],u=G[C++],l=G[C++];if((a&128)>0||(c&128)>0||(u&128)>0||(l&128)>0){C-=12;return}if(e<14){if(e===12)return Oe(t,A,i,n,r,o,s,I,a,c,u,l);{let g=G[C++];if((g&128)>0){C-=13;return}return Oe(t,A,i,n,r,o,s,I,a,c,u,l,g)}}else{let g=G[C++],B=G[C++];if((g&128)>0||(B&128)>0){C-=14;return}if(e<15)return Oe(t,A,i,n,r,o,s,I,a,c,u,l,g,B);let h=G[C++];if((h&128)>0){C-=15;return}return Oe(t,A,i,n,r,o,s,I,a,c,u,l,g,B,h)}}}}}function mE(){let e=G[C++],t;if(e<192)t=e-160;else switch(e){case 217:t=G[C++];break;case 218:t=j.getUint16(C),C+=2;break;case 219:t=j.getUint32(C),C+=4;break;default:throw new Error("Expected string")}return es(t)}function Ku(e){return Ee.copyBuffers?Uint8Array.prototype.slice.call(G,C,C+=e):G.subarray(C,C+=e)}function In(e){let t=G[C++];if(Et[t]){let A;return Et[t](G.subarray(C,A=C+=e),i=>{C=i;try{return Se()}finally{C=A}})}else throw new Error("Unknown extension type "+t)}var yE=new Array(4096);function UE(){let e=G[C++];if(e>=160&&e<192){if(e=e-160,yA>=C)return Di.slice(C-Lt,(C+=e)-Lt);if(!(yA==0&&Ot<180))return Yu(e)}else return C--,Se().toString();let t=(e<<5^(e>1?j.getUint16(C):e>0?G[C]:0))&4095,A=yE[t],i=C,n=C+e-3,r,o=0;if(A&&A.bytes==e){for(;i{let A=Se().map(r=>r.toString()),i=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,A.highByte=t);let n=te[e];return n&&(n.isShared||ki)&&((te.restoreStructures||(te.restoreStructures=[]))[e]=n),te[e]=A,A.read=zu(A,i),A.read()};Et[0]=()=>{};Et[0].noBuffer=!0;Et[66]=e=>{let t=e.length,A=BigInt(e[0]&128?e[0]-256:e[0]);for(let i=1;i{let e=Se();return(bS[e[0]]||Error)(e[1])};Et[105]=e=>{let t=j.getUint32(C-4);zA||(zA=new Map);let A=G[C],i;A>=144&&A<160||A==220||A==221?i=[]:i={};let n={target:i};zA.set(t,n);let r=Se();return n.used?Object.assign(i,r):(n.target=r,r)};Et[112]=e=>{let t=j.getUint32(C-4),A=zA.get(t);return A.used=!0,A.target};Et[115]=()=>new Set(Se());var _u=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),YS=typeof globalThis=="object"?globalThis:window;Et[116]=e=>{let t=e[0],A=_u[t];if(!A)throw new Error("Could not find typed array for code "+t);return new YS[A](Uint8Array.prototype.slice.call(e,1).buffer)};Et[120]=()=>{let e=Se();return new RegExp(e[0],e[1])};var VS=[];Et[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],A=C;return C+=t-e.length,be=VS,be=[mE(),mE()],be.position0=0,be.position1=0,be.postBundlePosition=C,C=A,Se()};Et[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function NE(e){QE&&QE();let t=Ot,A=C,i=bu,n=Lt,r=yA,o=Di,s=Ou,I=zA,a=be,c=new Uint8Array(G.slice(0,Ot)),u=te,l=te.slice(0,te.length),g=Ee,B=ki,h=e();return Ot=t,C=A,bu=i,Lt=n,yA=r,Di=o,Ou=s,zA=I,be=a,G=c,ki=B,te=u,te.splice(0,te.length,...l),Ee=g,j=new DataView(G.buffer,G.byteOffset,G.byteLength),h}function Fa(){G=null,zA=null,te=null}var Da=new Array(147);for(let e=0;e<256;e++)Da[e]=+("1e"+Math.floor(45.15-e*.30103));var ka=new an({useRecords:!1}),zS=ka.unpack,PS=ka.unpackMultiple,_S=ka.unpack,Sa={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},XS=new Float32Array(1),JG=new Uint8Array(XS.buffer,0,4);var Na;try{Na=new TextEncoder}catch{}var Xu,vE,xa=typeof Buffer<"u",Ua=xa?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,JE=xa?Buffer:Uint8Array,xE=xa?4294967296:2144337920,E,ts,ae,p=0,at,Fe=null,TS,ZS=21760,WS=/[\u0080-\uFFFF]/,lr=Symbol("record-id"),cn=class extends an{constructor(t){super(t),this.offset=0;let A,i,n,r,o,s=JE.prototype.utf8Write?function(m,J){return E.utf8Write(m,J,4294967295)}:Na&&Na.encodeInto?function(m,J){return Na.encodeInto(m,E.subarray(J)).written}:!1,I=this;t||(t={});let a=t&&t.sequential,c=t.structures||t.saveStructures,u=t.maxSharedStructures;if(u==null&&(u=c?32:0),u>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let l=t.maxOwnStructures;l==null&&(l=c?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let g=u>32||l+u>64,B=u+64,h=u+l+64;if(h>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let U=[],d=0,f=0;this.pack=this.encode=function(m,J){if(E||(E=new Ua(8192),ae=E.dataView||(E.dataView=new DataView(E.buffer,0,8192)),p=0),at=E.length-10,at-p<2048?(E=new Ua(E.length),ae=E.dataView||(E.dataView=new DataView(E.buffer,0,E.length)),at=E.length-10,p=0):p=p+7&2147483640,i=p,J&IU&&(p+=J&255),o=I.structuredClone?new Map:null,I.bundleStrings&&typeof m!="string"?(Fe=[],Fe.size=1/0):Fe=null,r=I.structures,r){r.uninitialized&&(r=I._mergeStructures(I.getStructures()));let k=r.sharedLength||0;if(k>u)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let x=0;xre.offset>Ae.offset?1:-1),z=x.length,L=-1;for(;k&&z>0;){let re=x[--z].offset+i;rek.position+i?L>=0&&(L+=6):(L>=0&&(ae.setUint32(k.position+i,ae.getUint32(k.position+i)+L),L=-1),k=k.previous,z++)}L>=0&&k&&ae.setUint32(k.position+i,ae.getUint32(k.position+i)+L),p+=x.length*6,p>at&&q(p),I.offset=p;let O=$S(E.subarray(i,p),x);return o=null,O}return I.offset=p,J&RE?(E.start=i,E.end=p,E):E.subarray(i,p)}catch(k){throw H=k,k}finally{if(r&&(Q(),n&&I.saveStructures)){let k=r.sharedLength||0,x=E.subarray(i,p),z=eU(r,I);if(!H)return I.saveStructures(z,z.isCompatible)===!1?I.pack(m,J):(I.lastNamedStructuresLength=k,x)}J&sU&&(p=i)}};let Q=()=>{f<10&&f++;let m=r.sharedLength||0;if(r.length>m&&!a&&(r.length=m),d>1e4)r.transitions=null,f=0,d=0,U.length>0&&(U=[]);else if(U.length>0&&!a){for(let J=0,H=U.length;J{var J=m.length;J<16?E[p++]=144|J:J<65536?(E[p++]=220,E[p++]=J>>8,E[p++]=J&255):(E[p++]=221,ae.setUint32(p,J),p+=4);for(let H=0;H{p>at&&(E=q(p));var J=typeof m,H;if(J==="string"){let k=m.length;if(Fe&&k>=4&&k<4096){if((Fe.size+=k)>ZS){let O,re=(Fe[0]?Fe[0].length*3+Fe[1].length:0)+10;p+re>at&&(E=q(p+re));let Ae;Fe.position?(Ae=Fe,E[p]=200,p+=3,E[p++]=98,O=p-i,p+=4,ME(i,F,0),ae.setUint16(O+i-3,p-i-O)):(E[p++]=214,E[p++]=98,O=p-i,p+=4),Fe=["",""],Fe.previous=Ae,Fe.size=0,Fe.position=O}let L=WS.test(m);Fe[L?0:1]+=m,E[p++]=193,F(L?-k:k);return}let x;k<32?x=1:k<256?x=2:k<65536?x=3:x=5;let z=k*3;if(p+z>at&&(E=q(p+z)),k<64||!s){let L,O,re,Ae=p+x;for(L=0;L>6|192,E[Ae++]=O&63|128):(O&64512)===55296&&((re=m.charCodeAt(L+1))&64512)===56320?(O=65536+((O&1023)<<10)+(re&1023),L++,E[Ae++]=O>>18|240,E[Ae++]=O>>12&63|128,E[Ae++]=O>>6&63|128,E[Ae++]=O&63|128):(E[Ae++]=O>>12|224,E[Ae++]=O>>6&63|128,E[Ae++]=O&63|128);H=Ae-p-x}else H=s(m,p+x);H<32?E[p++]=160|H:H<256?(x<2&&E.copyWithin(p+2,p+1,p+1+H),E[p++]=217,E[p++]=H):H<65536?(x<3&&E.copyWithin(p+3,p+2,p+2+H),E[p++]=218,E[p++]=H>>8,E[p++]=H&255):(x<5&&E.copyWithin(p+5,p+3,p+3+H),E[p++]=219,ae.setUint32(p,H),p+=4),p+=H}else if(J==="number")if(m>>>0===m)m<32||m<128&&this.useRecords===!1||m<64&&!this.randomAccessStructure?E[p++]=m:m<256?(E[p++]=204,E[p++]=m):m<65536?(E[p++]=205,E[p++]=m>>8,E[p++]=m&255):(E[p++]=206,ae.setUint32(p,m),p+=4);else if(m>>0===m)m>=-32?E[p++]=256+m:m>=-128?(E[p++]=208,E[p++]=m+256):m>=-32768?(E[p++]=209,ae.setInt16(p,m),p+=2):(E[p++]=210,ae.setInt32(p,m),p+=4);else{let k;if((k=this.useFloat32)>0&&m<4294967296&&m>=-2147483648){E[p++]=202,ae.setFloat32(p,m);let x;if(k<4||(x=m*Da[(E[p]&127)<<1|E[p+1]>>7])>>0===x){p+=4;return}else p--}E[p++]=203,ae.setFloat64(p,m),p+=8}else if(J==="object"||J==="function")if(!m)E[p++]=192;else{if(o){let x=o.get(m);if(x){if(!x.id){let z=o.idsToInsert||(o.idsToInsert=[]);x.id=z.push(x)}E[p++]=214,E[p++]=112,ae.setUint32(p,x.id),p+=4;return}else o.set(m,{offset:p-i})}let k=m.constructor;if(k===Object)K(m,!0);else if(k===Array)y(m);else if(k===Map)if(this.mapAsEmptyObject)E[p++]=128;else{H=m.size,H<16?E[p++]=128|H:H<65536?(E[p++]=222,E[p++]=H>>8,E[p++]=H&255):(E[p++]=223,ae.setUint32(p,H),p+=4);for(let[x,z]of m)F(x),F(z)}else{for(let x=0,z=Xu.length;x(E=re,re=null,p+=Vt,p>at&&q(p),{target:E,targetView:ae,position:p-Vt}),F)}finally{re&&(E=re,ae=Ae,p=Xe,at=E.length-10)}Yt&&(Yt.length+p>at&&q(Yt.length+p),p=jS(Yt,E,p,O.type));return}}if(Array.isArray(m))y(m);else{if(m.toJSON){let x=m.toJSON();if(x!==m)return F(x)}if(J==="function")return F(this.writeFunction&&this.writeFunction(m));K(m,!m.hasOwnProperty)}}}else if(J==="boolean")E[p++]=m?195:194;else if(J==="bigint"){if(m=-(BigInt(1)<0)E[p++]=207,ae.setBigUint64(p,m);else if(this.largeBigIntToFloat)E[p++]=203,ae.setFloat64(p,Number(m));else if(this.useBigIntExtension&&m<2n**1023n&&m>-(2n**1023n)){E[p++]=199,p++,E[p++]=66;let k=[],x;do{let z=m&0xffn;x=(z&0x80n)===(m<0n?0x80n:0n),k.push(z),m>>=8n}while(!((m===0n||m===-1n)&&x));E[p-2]=k.length;for(let z=k.length;z>0;)E[p++]=Number(k[--z]);return}else throw new RangeError(m+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64");p+=8}else if(J==="undefined")this.encodeUndefinedAsNil?E[p++]=192:(E[p++]=212,E[p++]=0,E[p++]=0);else throw new Error("Unknown type: "+J)},w=this.variableMapSize||this.coercibleKeyAsNumber?m=>{let J=Object.keys(m),H=J.length;H<16?E[p++]=128|H:H<65536?(E[p++]=222,E[p++]=H>>8,E[p++]=H&255):(E[p++]=223,ae.setUint32(p,H),p+=4);let k;if(this.coercibleKeyAsNumber)for(let x=0;x{E[p++]=222;let H=p-i;p+=2;let k=0;for(let x in m)(J||m.hasOwnProperty(x))&&(F(x),F(m[x]),k++);E[H+++i]=k>>8,E[H+i]=k&255},D=this.useRecords===!1?w:t.progressiveRecords&&!g?(m,J)=>{let H,k=r.transitions||(r.transitions=Object.create(null)),x=p++-i,z;for(let L in m)if(J||m.hasOwnProperty(L)){if(H=k[L],H)k=H;else{let O=Object.keys(m),re=k;k=r.transitions;let Ae=0;for(let Xe=0,Yt=O.length;Xe{let H,k=r.transitions||(r.transitions=Object.create(null)),x=0;for(let L in m)(J||m.hasOwnProperty(L))&&(H=k[L],H||(H=k[L]=Object.create(null),x++),k=H);let z=k[lr];z?z>=96&&g?(E[p++]=((z-=96)&31)+96,E[p++]=z>>5):E[p++]=z:T(k,k.__keys__||Object.keys(m),x);for(let L in m)(J||m.hasOwnProperty(L))&&F(m[L])},S=typeof this.useRecords=="function"&&this.useRecords,K=S?(m,J)=>{S(m)?D(m,J):w(m,J)}:D,q=m=>{let J;if(m>16777216){if(m-i>xE)throw new Error("Packed buffer would be larger than maximum buffer size");J=Math.min(xE,Math.round(Math.max((m-i)*(m>67108864?1.25:2),4194304)/4096)*4096)}else J=(Math.max(m-i<<2,E.length-1)>>12)+1<<12;let H=new Ua(J);return ae=H.dataView||(H.dataView=new DataView(H.buffer,0,J)),m=Math.min(m,E.length),E.copy?E.copy(H,0,i,m):H.set(E.slice(i,m)),p-=i,i=0,at=H.length-10,E=H},T=(m,J,H)=>{let k=r.nextId;k||(k=64),k=h&&(k=B),r.nextId=k+1);let x=J.highByte=k>=96&&g?k-96>>5:-1;m[lr]=k,m.__keys__=J,r[k-64]=J,k=0?(E[p++]=(k&31)+96,E[p++]=x):E[p++]=k):(x>=0?(E[p++]=213,E[p++]=114,E[p++]=(k&31)+96,E[p++]=x):(E[p++]=212,E[p++]=114,E[p++]=k),H&&(d+=f*H),U.length>=l&&(U.shift()[lr]=0),U.push(m),F(J))},Ue=(m,J,H,k)=>{let x=E,z=p,L=at,O=i;E=ts,p=0,i=0,E||(ts=E=new Ua(8192)),at=E.length-10,T(m,J,k),ts=E;let re=p;if(E=x,p=z,at=L,i=O,re>1){let Ae=p+re-1;Ae>at&&q(Ae);let Xe=H+i;E.copyWithin(Xe+re,Xe+1,p),E.set(ts.slice(0,re),Xe),p=Ae}else E[H+i]=ts[0]},ct=(m,J)=>{let H=TS(m,E,i,p,r,q,(k,x,z)=>{if(z)return n=!0;p=x;let L=E;return F(k),Q(),L!==E?{position:p,targetView:ae,target:E}:p},this);if(H===0)return K(m,!0);p=H}}useBuffer(t){E=t,ae=new DataView(E.buffer,E.byteOffset,E.byteLength),p=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};vE=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,$o];Xu=[{pack(e,t,A){let i=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&i>=0&&i<4294967296){let{target:n,targetView:r,position:o}=t(6);n[o++]=214,n[o++]=255,r.setUint32(o,i)}else if(i>0&&i<4294967296){let{target:n,targetView:r,position:o}=t(10);n[o++]=215,n[o++]=255,r.setUint32(o,e.getMilliseconds()*4e6+(i/1e3/4294967296>>0)),r.setUint32(o+4,i)}else if(isNaN(i)){if(this.onInvalidDate)return t(0),A(this.onInvalidDate());let{target:n,targetView:r,position:o}=t(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:r,position:o}=t(15);n[o++]=199,n[o++]=12,n[o++]=255,r.setUint32(o,e.getMilliseconds()*1e6),r.setBigInt64(o+4,BigInt(Math.floor(i)))}}},{pack(e,t,A){if(this.setAsEmptyObject)return t(0),A({});let i=Array.from(e),{target:n,position:r}=t(this.moreTypes?3:0);this.moreTypes&&(n[r++]=212,n[r++]=115,n[r++]=0),A(i)}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=101,i[n++]=0),A([e.name,e.message])}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=120,i[n++]=0),A([e.source,e.flags])}},{pack(e,t){this.moreTypes?GE(e,16,t):HE(xa?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let A=e.constructor;A!==JE&&this.moreTypes?GE(e,_u.indexOf(A.name),t):HE(e,t)}},{pack(e,t){let{target:A,position:i}=t(1);A[i]=193}}];function GE(e,t,A,i){let n=e.byteLength;if(n+1<256){var{target:r,position:o}=A(4+n);r[o++]=199,r[o++]=n+1}else if(n+1<65536){var{target:r,position:o}=A(5+n);r[o++]=200,r[o++]=n+1>>8,r[o++]=n+1&255}else{var{target:r,position:o,targetView:s}=A(7+n);r[o++]=201,s.setUint32(o,n+1),o+=4}r[o++]=116,r[o++]=t,r.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function HE(e,t){let A=e.byteLength;var i,n;if(A<256){var{target:i,position:n}=t(A+2);i[n++]=196,i[n++]=A}else if(A<65536){var{target:i,position:n}=t(A+3);i[n++]=197,i[n++]=A>>8,i[n++]=A&255}else{var{target:i,position:n,targetView:r}=t(A+5);i[n++]=198,r.setUint32(n,A),n+=4}i.set(e,n)}function jS(e,t,A,i){let n=e.length;switch(n){case 1:t[A++]=212;break;case 2:t[A++]=213;break;case 4:t[A++]=214;break;case 8:t[A++]=215;break;case 16:t[A++]=216;break;default:n<256?(t[A++]=199,t[A++]=n):n<65536?(t[A++]=200,t[A++]=n>>8,t[A++]=n&255):(t[A++]=201,t[A++]=n>>24,t[A++]=n>>16&255,t[A++]=n>>8&255,t[A++]=n&255)}return t[A++]=i,t.set(e,A),A+=n,A}function $S(e,t){let A,i=t.length*6,n=e.length-i;for(;A=t.pop();){let r=A.offset,o=A.id;e.copyWithin(r+i,r,n),i-=6;let s=r+i;e[s++]=214,e[s++]=105,e[s++]=o>>24,e[s++]=o>>16&255,e[s++]=o>>8&255,e[s++]=o&255,n=r}return e}function ME(e,t,A){if(Fe.length>0){ae.setUint32(Fe.position+e,p+A-Fe.position-e),Fe.stringsPosition=p-e;let i=Fe;Fe=null,t(i[0]),t(i[1])}}function eU(e,t){return e.isCompatible=A=>{let i=!A||(t.lastNamedStructuresLength||0)===A.length;return i||t._mergeStructures(A),i},e}var qE=new cn({useRecords:!1}),tU=qE.pack,AU=qE.pack;var{NEVER:iU,ALWAYS:nU,DECIMAL_ROUND:rU,DECIMAL_FIT:oU}=Sa,RE=512,sU=1024,IU=2048;var $u=R(YE(),1),iH=$u.default.configure,VE=$u.default;var zE={site:{list:"0",group:"1",load:"2",update:"3"},comp:{new:"4",list:"5",group:"6",load:"7"},page:{list:"8",load:"9",cache:"10"},yjs:{um:"11",sv_local:"12",diff_local:"13",sv_remote:"14"},client:{info:"15"},code:{load:"16",edit:"17",action:"18"}},PE={0:"site.list",1:"site.group",2:"site.load",3:"site.update",4:"comp.new",5:"comp.list",6:"comp.group",7:"comp.load",8:"page.list",9:"page.load",10:"page.cache",11:"yjs.um",12:"yjs.sv_local",13:"yjs.diff_local",14:"yjs.sv_remote",15:"client.info",16:"code.load",17:"code.edit",18:"code.action"};var fe=window;var _E=e=>sn(`prasi-user-${e}`,"default");var XE=new cn({structuredClone:!0}),As={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3};fe.debug=new Proxy({},{get(e,t,A){if(t==="off")return As.debug=!1,localStorage.removeItem("prasi-ws-debug"),console.clear(),["WS DEBUG: Deactivated"];if(t==="on")return As.debug=!0,localStorage.setItem("prasi-ws-debug","1"),console.clear(),["WS DEBUG: Activated"]}});var wA={ws:null,client_id:"",idb:null,event:null},eB={action:{pending:{}}},TE=(e,t)=>{let A=XE.pack(t);As.debug&&console.log("%c\u2B06","color:blue",WE(A.length,0),t),e.send(A)},ZE=async e=>{let{user_id:t,site_id:A,page_id:i,events:n}=e;return wA.idb=_E(t),await BU({user_id:t,site_id:A,page_id:i},n),new rE(zE,({target:r,trapName:o,value:s,key:I,DEFAULT:a,PROXY:c})=>{if(o==="set")throw new TypeError("target is immutable");return typeof s=="string"?(...u)=>new Promise(l=>{CU({code:s,resolve:l,args:u})}):o==="get"&&typeof s=="object"&&s!==null?c:a})},BU=(e,t)=>{let{user_id:A,page_id:i,site_id:n}=e;return wA.event=t,fe.offline?new Promise(async r=>{r();let o="editor_start",s=await QU(o);t[o]&&t[o](s)}):new Promise((r,o)=>{if(!wA.ws){let s=0,I=()=>{let a=new URL(fe.basehost||location.href);a.pathname="/sync",a.protocol=a.protocol==="http:"?"ws:":"wss:";let c=new WebSocket(`${a.protocol}//${a.host}${a.pathname}`);c.onopen=()=>{TE(c,{type:1,user_id:A,site_id:n,page_id:i}),wA.ws=c,t.opened()},c.onclose=async()=>{t.disconnected().reconnect?setTimeout(async()=>{s++,I()},s*As.reconnectTimeout):o()},c.onmessage=async u=>{let l=u.data,g=XE.unpack(Buffer.from(await l.arrayBuffer()));if(As.debug&&console.log("%c\u2B07","color:red",WE(l.size,0),g),g.type===0)wA.client_id=g.client_id,t.shakehand(g.client_id),r();else if(g.type===2){let B=g.event;t[B]&&(fU.includes(B)&&dU(B,g.data),t[B](g.data))}else if(g.type===4){let B=eB.action.pending[g.argid];if(B){B.resolve(g.val),delete eB.action.pending[g.argid];let h=wA.idb;h&&await mA(g.argid,g.val,h)}}}};I()}})},fU=["editor_start"],dU=async(e,t)=>{let A=wA.idb;if(A){let i=await ya(`ev-${e}`);await mA(i,t,A)}},QU=async e=>{let t=wA.idb;if(t){let A=await ya(`ev-${e}`);return await EA(A,t)}},CU=async e=>{let{args:t,code:A,resolve:i}=e,n=wA.ws,r=wA.idb;if(r){let o=VE(t),s=PE[A],I=await ya(`op-${s}-${o}`);if(n&&n.readyState===n.OPEN)eB.action.pending[I]={ts:Date.now(),resolve:i},TE(n,{type:3,code:A,args:t,argid:I});else{let a=await EA(I,r);i(a)}}};function WE(e,t){if(e==0)return"0 Bytes";var A=1024,i=t||2,n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(e)/Math.log(A));return parseFloat((e/Math.pow(A,r)).toFixed(i))+" "+n[r]}var ur={NORMAL:0,WILDCARD:1,PLACEHOLDER:2};function Br(e={}){let t={options:e,rootNode:$E(),staticRoutesMap:{}},A=i=>e.strictTrailingSlash?i:i.replace(/\/$/,"")||"/";if(e.routes)for(let i in e.routes)jE(t,A(i),e.routes[i]);return{ctx:t,lookup:i=>hU(t,A(i)),insert:(i,n)=>jE(t,A(i),n),remove:i=>pU(t,A(i))}}function hU(e,t){let A=e.staticRoutesMap[t];if(A)return A.data;let i=t.split("/"),n={},r=!1,o=null,s=e.rootNode,I=null;for(let a=0;a{},db:null,api:null,init_local_effect:{}},page:{history:{id:"",show:!1},root_id:"root",cur:mU,doc:null,list:{},building:!1,meta:{},entry:[],tree:[],render:()=>{}},comp:{doc:null,item:null,loaded:{},list:{},group:{}},code:{},global_prop:[],ui:{comp_editable:localStorage.getItem("prasi-comp-editable")==="yes",zoom:localStorage.zoom||"100%",side:{prop:!0},layout:{left:parseInt(localStorage.getItem("prasi-layout-left")||"250"),right:parseInt(localStorage.getItem("prasi-layout-right")||"250")},prevent_indent_hook:!1,syncing:!1,tree:{item_loading:[],search:"",search_ref:null,search_mode:{Name:!0,JS:!1,HTML:!1,CSS:!1},rename_id:"",open:{}},popup:{file:{enabled:!1,open:!0,path:"/",expanded:JSON.parse(localStorage.getItem("panel-file-expanded")||"{}"),entry:{},selected:new Set,file_renaming:"",file_ctx_menu_event:null,tree:[],tree_renaming:"",tree_ctx_path:"",tree_ctx_menu_event:null},code:{init:!1,open:!1,name:"site",log:"",loading:!1,startup_status:"init",error:!1,show_log:!1,list:{}},page:{open:null,form:null},script:{open:!1,mode:"js",lastMode:"js",type:"item",prop_kind:"",prop_name:"",on_close:()=>{},typings:{status:"ok",err_msg:""},wb_render:()=>{}},site:null,site_form:null,comp:{preview_id:"",open:null,import:!1},comp_group:null,api:{open:!1}}}};var Im=R(Ma());var am=e=>{let{item:t,item_comp:A,ids:i}=e,n=uA(A);if(cm(n,i),t.id&&(n.id=t.id),n.component){if(n.component.props&&t.component)for(let r of Object.keys(n.component.props)){let o=t.component.props[r],s=n.component.props[r];o&&(s.value=o.value,s.valueBuilt=o.valueBuilt,s.jsxCalledBy=o.jsxCalledBy,s.content=o.content)}n.component.instances=t.component?.instances,n.component.style=t.component?.style}for(let r of Object.keys(t))delete t[r];for(let[r,o]of Object.entries(n))t[r]=o},cm=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,Im.createId)()),e.id=t[e.id],e.childs)for(let A of e.childs)cm(A,t)};var gm=e=>{for(let[t,A]of Object.entries(e.item_comp.component?.props||{})){let i=uA(A),n=e.item.component?.props;n&&n[t]&&(i.value=n[t].value,i.valueBuilt=n[t].valueBuilt,n[t].content&&(i.content=n[t].content)),i&&e.each(t,i)}};var va=e=>{let t={};for(let[A,i]of Object.entries(e))if(A==="childs"){if(t.childs=[],i&&Array.isArray(i))for(let n of i)t.childs.push({id:n.id})}else t[A]=i;return t};var lm=(e,t)=>{let{item:A}=t;if(A.type==="item"&&A.component?.id&&t.parent?.item.id){let i=e.comps[A.component.id];if(e.on?.visit_component&&e.on.visit_component(A,t.root||t.item),!i)return;if(i){let n;if(e.mode==="page"?(A.component.instances||(A.component.instances={}),n=A.component.instances):n=t.parent?.root_instances,n){let o=n[A.id];n[A.id]||(n[A.id]={},o=n[A.id]),am({item:A,item_comp:i,ids:o})}let r={item:va(A),jsx_prop:t.jsx_prop,parent:{id:t.parent.item.id,comp_id:t.parent?.comp?.component?.id,instance_id:t.parent?.instance_id},instances:n};e.on?.visit&&e.on.visit(r,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[A.id]=r),gm({item:A,item_comp:i,instance:n?n[A.id]:{},each(o,s){let I=A.component?.id;s.meta?.type==="content-element"&&I&&s.content&&(s.content.name=o,Nt({...e,mode:"comp"},{item:s.content,root:t.root||s.content,is_root:!1,jsx_prop:{is_root:!0,comp_id:I,name:o},parent:{item:r.item,instance_id:A.id,comp:i,root_instances:n}}))}});for(let o of Object.values(A.childs))o.name.startsWith("jsx:")||Nt({...e,mode:"comp"},{item:o,is_root:!1,root:t.root||t.item,parent:{item:A,instance_id:A.id,root_instances:n,comp:i}})}}};var Nt=(e,t)=>{let A=t.item;if(A.type==="item"&&A.component?.id&&t.ignore_first_component!==!0){lm(e,t);return}let i={item:va(A),parent:{id:t.parent?.item.id||"root",instance_id:t.parent?.instance_id,comp_id:t.parent?.comp?.component?.id}};if(t.jsx_prop&&(i.jsx_prop=t.jsx_prop),e.on?.visit&&e.on.visit(i,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[i.item.id]=i),A.childs){for(let[n,r]of Object.entries(A.childs))if(r.id){let o={item:r,is_root:!1,root:t.root||t.item,parent:{item:i.item,instance_id:t.parent?.instance_id,comp:t.parent?.comp,root_instances:t.parent?.root_instances}};t.jsx_prop&&(o.jsx_prop={...t.jsx_prop,is_root:!1}),Nt(e,o)}}};var Ja=async(e,t,A,i)=>{let n=new Set,r={root:t};if(Nt({...e,on:{visit_component:({component:o})=>{if(o){let{id:s}=o;if(e.comps[s]||(!i||i&&!i.has(s))&&n.add(s),o?.props)for(let[I,a]of Object.entries(o.props))a.meta?.type==="content-element"&&a.content&&Nt({...e,on:{visit_component:({component:c})=>{if(c){let{id:u}=c;e.comps[u]||(!i||i&&!i.has(u))&&n.add(u)}},visit(c,u){A.visit&&A.visit(c,u,r)}},set_meta:!1,note:"init-load-comp-prop"},{item:a.content})}},visit(o,s){A.visit&&A.visit(o,s,r)}},set_meta:!1,note:"init-load-comp"},{item:t,ignore_first_component:!0}),A.done&&A.done(r),n.size>0){await A.load([...n]);let o=i;o||(o=new Set),n.forEach(s=>{o&&o.add(s)});for(let s of[...o]){let I=e.comps[s];I&&await Ja(e,I,A,o)}}};var GU=sn("prasi-cache","prasi-cache-store"),un={timeout:null,store:GU},qa=(e,t)=>{let A=[...um(t,"navigate(",")"),...um(t,"href = ",";")],i=e.page.cur.id;e.page.navs[i]||(e.page.navs[i]=new Set);for(let n of A)e.page.navs[i].add(n);clearTimeout(un.timeout),un.timeout=setTimeout(()=>{e.on_nav_loaded&&e.on_nav_loaded({urls:Array.from(e.page.navs[i])})},100)},um=(e,t,A)=>{let i=0,n=0,r=[];for(;;){let o=e.indexOf(t,i);if(n=i,o>=0){let s=e[o+t.length];if(s==='"'||s==="'"||s==="`"){let I=e.indexOf(`${s}${A}`,o+t.length+1),a=e.substring(o+t.length+1,I);i=I+2+A.length,r.push(a)}}if(n===i)break}return r};var fm=R(Ma());var Ra=()=>{let e=document.activeElement;return!!(e&&e.attributes.getNamedItem("contenteditable"))};var Bm=R(Ma()),Ka=e=>{let{m:t,root:A,mitem:i,meta:n}=e;if(t.jsx_prop&&t.parent?.instance_id){let r=n[t.parent?.instance_id];if(r&&t.jsx_prop.is_root){let o=r.item.component?.props[t.jsx_prop.name];o&&(o.content=t.item)}}if(t.parent)if(t.parent.id==="root")t.item.id===A.id&&(t.mitem=i);else{let r=n[t.parent.id];if(r.mitem)if(t.jsx_prop?.is_root===!0){let o=r.mitem.get("component")?.get("props");if(o){let s=o.get(t.jsx_prop.name);if(s){let I=s.get("content");if(!I){let a=new Y.Map;syncronize(a,{id:(0,Bm.createId)(),name:t.jsx_prop.name,type:"item",dim:{w:"full",h:"full"},childs:[],adv:{css:""}}),s.set("content",a)}I&&(t.mitem=I)}}}else r.mitem.get("childs")?.forEach(o=>{o&&o.get&&o.get("id")===t.item.id&&(t.mitem=o)});if(t.item.component?.props)for(let[o,s]of Object.entries(t.item.component.props)){let I=t.mitem?.get("component")?.get("props")?.get(o);if(!I){let a=t.mitem?.get("component")?.get("props");a&&e.new_prop_jsx(t,a,o,s)}if(s.content)if(I){let a=n[s.content.id];a&&(a.mitem=I.get("content"))}else{let a=t.mitem?.get("component")?.get("props");a&&e.new_prop_jsx(t,a,o,s)}}}};var La=(e,t,A,i)=>{if(t.parent?.id==="root")e.page.doc?.getMap("map").get("root")?.get("childs")?.forEach(n=>{n.get("id")===t.item.id&&(t.mitem=n)});else{let n=A[t.parent?.id||""];n&&n.mitem&&n.mitem.get("childs")?.forEach(r=>{r&&r.get&&r.get("id")===t.item.id&&(t.mitem=r)})}if(!t.item||!t.item.id)return console.warn("Emptry Tree Item ",t),null;if(i.find(n=>n.id===t.item.id))console.warn("Double Tree Item: ",t.item.id,t.item.name);else if(!t.parent?.comp_id)i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t});else if(t.jsx_prop)if(t.jsx_prop.is_root)t.jsx_prop.name!=="child"&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.jsx_prop.name,data:t});else{if(t.jsx_prop.name==="child"&&t.parent.instance_id){let n=A[t.parent.instance_id],r=n.item.component?.props.child.content?.id;r&&n.mitem&&A[r].item.childs.find(s=>t.item.id===s.id)&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.item.name,data:t})}t.parent.id!==t.parent.instance_id&&i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t})}};var ba=async(e,t,A)=>{if(e.comp.list[t])return;let i=new Y.Doc;Y.applyUpdate(i,dt(A));let n=i.getMap("map").get("root");if(n){e.comp.loaded[t]=n.toJSON(),typeof e.comp.list[t]?.on_update=="function"&&i.off("update",e.comp.list[t].on_update);let r=await Oa(e,i,t);if(r){let{meta:o,tree:s}=r;e.comp.list[t]?(e.comp.list[t].meta=o,e.comp.list[t].tree=s):(e.comp.list[t]={comp:{id:t,snapshot:A},doc:i,meta:o,tree:s,async on_update(I,a){if(a==="sv_remote"||a==="local")return;let c=await e.sync?.yjs.sv_local("comp",t,Buffer.from($t(I)));if(c){let u=Y.encodeStateAsUpdate(i,dt(c.sv));Y.applyUpdate(i,dt(c.diff),"local"),await e.sync?.yjs.diff_local("comp",t,Buffer.from($t(u)));let l=await Oa(e,e.comp.list[t].doc,t);if(l&&(e.comp.list[t].meta=l.meta,e.comp.list[t].tree=l.tree),e.comp.loaded[t]=i.getMap("map").get("root")?.toJSON(),Ra())return;iA(e),e.render()}}},i.on("update",e.comp.list[t].on_update))}}},Oa=async(e,t,A)=>{let i=t.getMap("map").get("root");if(!i)return;let n={},r=[],o=i.toJSON();return e.comp.loaded[A]=o,await Ja({comps:e.comp.loaded,meta:n,set_meta:!1,mode:"comp"},o,{load:async s=>{let I=s.filter(c=>!e.comp.loaded[c]),a=await e.sync?.comp.load(I,!0);if(a){let c=Object.entries(a);for(let[u,l]of c)l&&l.snapshot&&!e.comp.list[u]&&await ba(e,u,l.snapshot)}}}),Nt({comps:e.comp.loaded,meta:n,mode:"comp",on:{async visit(s){La(e,s,n,r),Ka({m:s,root:o,mitem:i,meta:n,new_prop_jsx(I,a,c,u){iB.list.push(()=>{let l=new Y.Map;u.content&&(u.content.id=(0,fm.createId)()),syncronize(l,u),a.set(c,l)})}})}},note:"load-comp-scan-meta"},{item:o,ignore_first_component:!0}),iB.list.length>0&&e.page.doc?.transact(()=>{for(let s of iB.list)s()}),e.comp.loaded[A]=o,{meta:n,tree:r,item:o}},iB={list:[]};var iA=async(e,t)=>{if(document.activeElement){let o=document.activeElement;if(o.tagName==="DIV"&&o.getAttribute("contenteditable")==="true")return}Ha.should_render_main=!0;let A=e.site.layout&&e.site.layout.id===e.page.cur.id&&t?.note==="load-layout page-init";for(let[o,s]of Object.entries(e.comp.list))if(!e.comp.loaded[o]){let a=s.doc.getMap("map").get("root")?.toJSON();a&&(e.comp.loaded[o]=a)}let i=e.page.doc?.getMap("map").get("root"),n=[];i?.get("childs")?.forEach(o=>n.push(o));let r={};e.page.tree=[];for(let o of n){let s=o.toJSON();s&&Nt({note:"tree-rebuild",comps:e.comp.loaded,meta:r,mode:"page",on:{async visit(I){A||((I.parent?.instance_id!==I.parent?.id||I.jsx_prop)&&La(e,I,r,e.page.tree),Ka({m:I,root:s,mitem:o,meta:r,new_prop_jsx(a,c,u,l){if(!c.get(u)){let g=new Y.Map;syncronize(g,l),c.set(u,g)}}}))}}},{item:s})}if(A)e.site.layout.meta=r;else{let o="root";if(e.site.layout&&e.site.layout.meta){for(let[s,I]of Object.entries(e.site.layout.meta))if(I.item.name==="content"){o=I.item.id;break}e.page.root_id=o}if(e.site.layout&&e.site.layout.id===e.page.cur.id)e.page.meta=r;else if(o!=="root"){for(let s of Object.values(r))s.parent?.id==="root"&&(s.parent.id=o);e.page.meta={...e.site.layout.meta,...r}}else e.page.meta=r}};BigInt.prototype.toJSON=function(){return"BigInt::"+this.toString()};var HU=typeof window<"u"?window:null,fr=async(e,t,A)=>{let i={...A},n=null,r=!1,o=[];if(Array.isArray(t))for(let I of t)I instanceof File&&(o.push(I),r=!0);else t instanceof File&&(r=!0,o.push(t));if(!r)n=JSON.stringify(t),i["content-type"]="aplication/json";else{let I=new FormData;for(let a of o)I.append(a.name,a);n=I,delete i["content-type"],i.enctype="multipart/form-data;"}let s=new URL(e);if(HU!==null){let I=new URL(location.href),a="";if(s.host===I.host?a=s.toString():a=`${I.protocol}//${I.host}/_proxy/${encodeURIComponent(s.toString())}`,a){let u=await(await fetch(a,t?{method:"POST",body:n,headers:i}:void 0)).text();try{return JSON.parse(u)}catch{return u}}}return null};var Hm=R(Gm());var dr=async(e,t)=>{let A=(0,Hm.default)(e,"/"),i=await fr(a3(A,"/_prasi/_")),n="";i&&i.prasi&&(n=i.prasi);let r=I3(A);if(n==="v2")await new Promise(o=>{let s=document,I=s.createElement("script");I.onload=async()=>{o()},localStorage.getItem("api-ts-"+A)||localStorage.setItem("api-ts-"+A,Date.now().toString());let a=localStorage.getItem("api-ts-"+A);t?I.src=`${r}/_prasi/load.js?url=${A}&v3&dev=1&ts=${a}`:I.src=`${r}/_prasi/load.js?url=${A}&v3&ts=${a}`,document.querySelector(`script[src="${I.src}"]`)?o():s.body.appendChild(I)});else{let o=await fetch(r+"/_prasi/api-entry");if(fe.prasiApi[A]={apiEntry:(await o.json()).srv},t){let s=await fetch(r+"/_prasi/api-types");fe.prasiApi[A].apiTypes=await s.text(),fe.prasiApi[A].prismaTypes={"prisma.d.ts":await sB(`${r}/_prasi/prisma/index.d.ts`),"runtime/index.d.ts":await sB(`${r}/_prasi/prisma/runtime/index.d.ts`),"runtime/library.d.ts":await sB(`${r}/_prasi/prisma/runtime/library.d.ts`)}}}},I3=e=>{let t=new URL(e);return`${t.protocol}//${t.host}`},a3=(e,t)=>{let A=new URL(e);return A.pathname=t,A.toString()},sB=async(e,t)=>await(await fetch(e)).text();var rs={},Qr=e=>{fe.prasiApi||(fe.prasiApi={});try{let t=new URL(e),A=`${t.protocol}//${t.host}`;return fe.prasiApi[A]||rs[A]||(rs[A]=dr(A,location.hostname.includes("prasi"))),new Proxy({},{get:(i,n)=>{if(n==="_url")return o=>{let s=new URL(A);s.pathname=o;let I=new URL(location.href),a="";return s.host===I.host?a=s.toString():a=`${I.protocol}//${I.host}/_proxy/${encodeURIComponent(s.toString())}`,a};let r=o=>function(...s){return new Promise(async(I,a)=>{try{let c=fe.prasiApi[A];if(!c&&rs&&typeof rs[A]=="object"&&(await rs[A],c=fe.prasiApi[A]),c){if(o==="_raw"){let g=s[0],B=`${A}${g}`,h=await Mm(B,s.slice(1));I(h);return}if(c.apiEntry||(c.apiEntry={}),c.apiEntry&&!c.apiEntry[o]){a(`API ${o.toString()} not found, existing API: + `)})}),r]})})]})};var ct=null;var Du=class extends Error{constructor(t){super(t),this.name="DecompressionError"}},on=0,Fu=null,lI=null;function xp(e,t,A){let i;if(A){let r=t;i=e.malloc_u8(r);let o=new Uint8Array(e.memory.buffer,i,r);try{A(o)}catch(s){throw e.free_u8(i,r),s}return on=r,i}if(typeof t=="string"){let r=on=function(s){let a=0,I=0,c=0,l=s.length;for(;a>>0;ct.free_u8(A,on);let n=ct.buffer()>>>0;return new Uint8Array(ct.memory.buffer,n,i)}function Et(e,t){Gp(ct);let A=xp(ct,e,t),i=ct.gzip_decompress(A,on)>>>0;if(ct.free_u8(A,on),i===4294967295){let r=ct.error_message(),o=ct.error_message_len(),s=new Uint8Array(ct.memory.buffer,r,o),a=new TextDecoder().decode(s);throw new Du(a)}let n=ct.buffer()>>>0;return new Uint8Array(ct.memory.buffer,n,i)}function Gp(e){if(!e)throw new Error("WASM not initialized")}var lt=()=>new Map,gI=e=>{let t=lt();return e.forEach((A,i)=>{t.set(i,A)}),t},pA=(e,t,A)=>{let i=e.get(t);return i===void 0&&e.set(t,i=A()),i},Hp=(e,t)=>{let A=[];for(let[i,n]of e)A.push(t(n,i));return A},Mp=(e,t)=>{for(let[A,i]of e)if(t(i,A))return!0;return!1};var TA=()=>new Set;var uI=e=>e[e.length-1];var vp=(e,t)=>{for(let A=0;A{this.off(t,i),A(...n)};this.on(t,i)}off(t,A){let i=this._observers.get(t);i!==void 0&&(i.delete(A),i.size===0&&this._observers.delete(t))}emit(t,A){return EA((this._observers.get(t)||lt()).values()).forEach(i=>i(...A))}destroy(){this._observers=lt()}};var Yt=Math.floor;var ar=Math.abs;var BI=(e,t)=>ee>t?e:t,oM=Number.isNaN;var dI=e=>e!==0?e<0:1/e<0;var Nu=Number.MAX_SAFE_INTEGER,sM=Number.MIN_SAFE_INTEGER,aM=1<<31;var Rp=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Yt(e)===e),IM=Number.isNaN,cM=Number.parseInt;var Xk=String.fromCharCode,lM=String.fromCodePoint,gM=Xk(65535),Zk=e=>e.toLowerCase(),Wk=/^\s*/g,jk=e=>e.replace(Wk,""),$k=/([A-Z])/g,xu=(e,t)=>jk(e.replace($k,A=>`${t}${Zk(A)}`));var eS=e=>{let t=unescape(encodeURIComponent(e)),A=t.length,i=new Uint8Array(A);for(let n=0;ncr.encode(e),qp=cr?tS:eS;var Ir=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ir&&Ir.decode(new Uint8Array).length===1&&(Ir=null);var sn=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Po=()=>new sn;var AS=e=>{let t=e.cpos;for(let A=0;A{let t=new Uint8Array(AS(e)),A=0;for(let i=0;i{let A=e.cbuf.length;A-e.cpos{let A=e.cbuf.length;e.cpos===A&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(A*2),e.cpos=0),e.cbuf[e.cpos++]=t};var hI=Oe;var W=(e,t)=>{for(;t>127;)Oe(e,128|127&t),t=Yt(t/128);Oe(e,127&t)},pI=(e,t)=>{let A=dI(t);for(A&&(t=-t),Oe(e,(t>63?128:0)|(A?64:0)|63&t),t=Yt(t/64);t>0;)Oe(e,(t>127?128:0)|127&t),t=Yt(t/128)},Hu=new Uint8Array(3e4),nS=Hu.length/3,rS=(e,t)=>{if(t.length{let A=unescape(encodeURIComponent(t)),i=A.length;W(e,i);for(let n=0;n{let A=e.cbuf.length,i=e.cpos,n=BI(A-i,t.length),r=t.length-n;e.cbuf.set(t.subarray(0,n),i),e.cpos+=n,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(_A(A*2,r)),e.cbuf.set(t.subarray(n)),e.cpos=r)},mt=(e,t)=>{W(e,t.byteLength),Vo(e,t)},Mu=(e,t)=>{iS(e,t);let A=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,A},sS=(e,t)=>Mu(e,4).setFloat32(0,t,!1),aS=(e,t)=>Mu(e,8).setFloat64(0,t,!1),IS=(e,t)=>Mu(e,8).setBigInt64(0,t,!1);var bp=new DataView(new ArrayBuffer(4)),cS=e=>(bp.setFloat32(0,e),bp.getFloat32(0)===e),gr=(e,t)=>{switch(typeof t){case"string":Oe(e,119),an(e,t);break;case"number":Rp(t)&&ar(t)<=2147483647?(Oe(e,125),pI(e,t)):cS(t)?(Oe(e,124),sS(e,t)):(Oe(e,123),aS(e,t));break;case"bigint":Oe(e,122),IS(e,t);break;case"object":if(t===null)Oe(e,126);else if(Su(t)){Oe(e,117),W(e,t.length);for(let A=0;A0&&W(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}};var Op=e=>{e.count>0&&(pI(e.encoder,e.count===1?e.s:-e.s),e.count>1&&W(e.encoder,e.count-2))},In=class{constructor(){this.encoder=new sn,this.s=0,this.count=0}write(t){this.s===t?this.count++:(Op(this),this.count=1,this.s=t)}toUint8Array(){return Op(this),oA(this.encoder)}};var Lp=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);pI(e.encoder,t),e.count>1&&W(e.encoder,e.count-2)}},ur=class{constructor(){this.encoder=new sn,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(Lp(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return Lp(this),oA(this.encoder)}},QI=class{constructor(){this.sarr=[],this.s="",this.lensE=new In}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){let t=new sn;return this.sarr.push(this.s),this.s="",an(t,this.sarr.join("")),Vo(t,this.lensE.toUint8Array()),oA(t)}};var mA=e=>new Error(e),sA=()=>{throw mA("Method unimplemented")},aA=()=>{throw mA("Unexpected case")};var Pp=mA("Unexpected end of array"),Vp=mA("Integer out of Range"),fr=class{constructor(t){this.arr=t,this.pos=0}},un=e=>new fr(e),zp=e=>e.pos!==e.arr.length;var gS=(e,t)=>{let A=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,A},yt=e=>gS(e,X(e));var cn=e=>e.arr[e.pos++];var X=e=>{let t=0,A=1,i=e.arr.length;for(;e.posNu)throw Vp}throw Pp},mI=e=>{let t=e.arr[e.pos++],A=t&63,i=64,n=(t&64)>0?-1:1;if(!(t&128))return n*A;let r=e.arr.length;for(;e.posNu)throw Vp}throw Pp};var uS=e=>{let t=X(e);if(t===0)return"";{let A=String.fromCodePoint(cn(e));if(--t<100)for(;t--;)A+=String.fromCodePoint(cn(e));else for(;t>0;){let i=t<1e4?t:1e4,n=e.arr.subarray(e.pos,e.pos+i);e.pos+=i,A+=String.fromCodePoint.apply(null,n),t-=i}return decodeURIComponent(escape(A))}},fS=e=>Ir.decode(yt(e)),ln=Ir?fS:uS;var vu=(e,t)=>{let A=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,A},BS=e=>vu(e,4).getFloat32(0,!1),dS=e=>vu(e,8).getFloat64(0,!1),CS=e=>vu(e,8).getBigInt64(0,!1);var QS=[e=>{},e=>null,mI,BS,dS,CS,e=>!1,e=>!0,ln,e=>{let t=X(e),A={};for(let i=0;i{let t=X(e),A=[];for(let i=0;iQS[127-cn(e)](e),zo=class extends fr{constructor(t,A){super(t),this.reader=A,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),zp(this)?this.count=X(this)+1:this.count=-1),this.count--,this.s}};var gn=class extends fr{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=mI(this);let t=dI(this.s);this.count=1,t&&(this.s=-this.s,this.count=X(this)+2)}return this.count--,this.s}};var dr=class extends fr{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let t=mI(this),A=t&1;this.diff=Yt(t/2),this.count=1,A&&(this.count=X(this)+2)}return this.s+=this.diff,this.count--,this.s}},EI=class{constructor(t){this.decoder=new gn(t),this.str=ln(this.decoder),this.spos=0}read(){let t=this.spos+this.decoder.read(),A=this.str.slice(this.spos,t);return this.spos=t,A}};var BM=crypto.subtle,Tp=crypto.getRandomValues.bind(crypto);var Ru=()=>Tp(new Uint32Array(1))[0];var pS="10000000-1000-4000-8000"+-1e11,_p=()=>pS.replace(/[018]/g,e=>(e^Ru()&15>>e/4).toString(16));var Xp=Date.now;var Ju=e=>new Promise(e);var QM=Promise.all.bind(Promise);var qu=e=>e===void 0?null:e;var Ku=class{constructor(){this.map=new Map}setItem(t,A){this.map.set(t,A)}getItem(t){return this.map.get(t)}},Zp=new Ku,FS=!0;try{typeof localStorage<"u"&&localStorage&&(Zp=localStorage,FS=!1)}catch{}var Wp=Zp;var $p=Object.assign,kS=Object.keys,eE=(e,t)=>{for(let A in e)t(e[A],A)};var jp=e=>kS(e).length;var tE=e=>{for(let t in e)return!1;return!0},SS=(e,t)=>{for(let A in e)if(!t(e[A],A))return!1;return!0},US=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),AE=(e,t)=>e===t||jp(e)===jp(t)&&SS(e,(A,i)=>(A!==void 0||US(t,i))&&t[i]===A);var To=(e,t,A=0)=>{try{for(;Ae;var nE=(e,t)=>t.includes(e);var _o=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";var hM=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,yA,xS=[],GS=()=>{if(yA===void 0)if(_o){yA=lt();let e=process.argv,t=null;for(let A=0;A{if(e.length!==0){let[t,A]=e.split("=");yA.set(`--${xu(t,"-")}`,A),yA.set(`-${xu(t,"-")}`,A)}})):yA=lt();return yA},bu=e=>GS().has(e);var Ou=e=>_o?qu(process.env[e.toUpperCase()]):qu(Wp.getItem(e));var HS=e=>bu("--"+e)||Ou(e)!==null,pM=HS("production"),oE=_o&&nE(process.env.FORCE_COLOR,["true","1","2"]),sE=!bu("no-colors")&&(!_o||process.stdout.isTTY||oE)&&(!_o||bu("color")||oE||Ou("COLORTERM")!==null||(Ou("TERM")||"").includes("color"));var vS=e=>new Uint8Array(e);var aE=e=>{let t=vS(e.byteLength);return t.set(e),t};var Lu=class{constructor(t,A){this.left=t,this.right=A}},wA=(e,t)=>new Lu(e,t);var fn=typeof document<"u"?document:{};var EM=typeof DOMParser<"u"?new DOMParser:null;var IE=e=>Hp(e,(t,A)=>`${A}:${t};`).join("");var mM=fn.ELEMENT_NODE,yM=fn.TEXT_NODE,wM=fn.CDATA_SECTION_NODE,FM=fn.COMMENT_NODE,DM=fn.DOCUMENT_NODE,kM=fn.DOCUMENT_TYPE_NODE,SM=fn.DOCUMENT_FRAGMENT_NODE;var FA=Symbol;var Xo=FA(),Zo=FA(),Yu=FA(),Pu=FA(),Vu=FA(),Wo=FA(),zu=FA(),jo=FA(),Tu=FA(),cE=e=>{let t=[],A=[],i=0;for(;i{let t=[],A=[],i=lt(),n=[],r=0;for(;r0||a.length>0?(t.push("%c"+o),A.push(a)):t.push(o)}else break}for(r>0&&(n=A,n.unshift(t.join("")));r{console.log(...YS(e)),PS.forEach(t=>t.print(e))};var PS=TA();var gE=e=>({[Symbol.iterator](){return this},next:e}),uE=(e,t)=>gE(()=>{let A;do A=e.next();while(!A.done&&!t(A.value));return A}),yI=(e,t)=>gE(()=>{let{done:A,value:i}=e.next();return{done:A,value:A?void 0:t(i)}});var es=class{constructor(t,A){this.clock=t,this.len=A}},Bn=class{constructor(){this.clients=new Map}},kE=(e,t,A)=>t.clients.forEach((i,n)=>{let r=e.doc.store.clients.get(n);for(let o=0;o{let A=0,i=e.length-1;for(;A<=i;){let n=Yt((A+i)/2),r=e[n],o=r.clock;if(o<=t){if(t{let A=e.clients.get(t.client);return A!==void 0&&XS(A,t.clock)!==null},gf=e=>{e.clients.forEach(t=>{t.sort((n,r)=>n.clock-r.clock);let A,i;for(A=1,i=1;A=r.clock?n.len=_A(n.len,r.clock+r.len-n.clock):(i{let t=new Bn;for(let A=0;A{if(!t.clients.has(n)){let r=i.slice();for(let o=A+1;o{pA(e.clients,t,()=>[]).push(new es(A,i))},UE=()=>new Bn,WS=e=>{let t=UE();return e.clients.forEach((A,i)=>{let n=[];for(let r=0;r0&&t.clients.set(i,n)}),t},Er=(e,t)=>{W(e.restEncoder,t.clients.size),EA(t.clients.entries()).sort((A,i)=>i[0]-A[0]).forEach(([A,i])=>{e.resetDsCurVal(),W(e.restEncoder,A);let n=i.length;W(e.restEncoder,n);for(let r=0;r{let t=new Bn,A=X(e.restDecoder);for(let i=0;i0){let o=pA(t.clients,n,()=>[]);for(let s=0;s{let i=new Bn,n=X(e.restDecoder);for(let r=0;r0){let r=new XA;return W(r.restEncoder,0),Er(r,i),r.toUint8Array()}return null};var NE=Ru,ts=class e extends fI{constructor({guid:t=_p(),collectionid:A=null,gc:i=!0,gcFilter:n=()=>!0,meta:r=null,autoLoad:o=!1,shouldLoad:s=!0}={}){super(),this.gc=i,this.gcFilter=n,this.clientID=NE(),this.guid=t,this.collectionid=A,this.share=new Map,this.store=new MI,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=s,this.autoLoad=o,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Ju(I=>{this.on("load",()=>{this.isLoaded=!0,I(this)})});let a=()=>Ju(I=>{let c=l=>{(l===void 0||l===!0)&&(this.off("sync",c),I())};this.on("sync",c)});this.on("sync",I=>{I===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=I===void 0||I===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[])}),this.whenSynced=a()}load(){let t=this._item;t!==null&&!this.shouldLoad&&de(t.parent.doc,A=>{A.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(EA(this.subdocs).map(t=>t.guid))}transact(t,A=null){return de(this,t,A)}get(t,A=Re){let i=pA(this.share,t,()=>{let r=new A;return r._integrate(this,null),r}),n=i.constructor;if(A!==Re&&n!==A)if(n===Re){let r=new A;r._map=i._map,i._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=r}),r._start=i._start;for(let o=r._start;o!==null;o=o.right)o.parent=r;return r._length=i._length,this.share.set(t,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return i}getArray(t=""){return this.get(t,qI)}getText(t=""){return this.get(t,as)}getMap(t=""){return this.get(t,os)}getXmlFragment(t=""){return this.get(t,hr)}toJSON(){let t={};return this.share.forEach((A,i)=>{t[i]=A.toJSON()}),t}destroy(){EA(this.subdocs).forEach(A=>A.destroy());let t=this._item;if(t!==null){this._item=null;let A=t.content;A.doc=new e({guid:this.guid,...A.opts,shouldLoad:!1}),A.doc._item=t,de(t.parent.doc,i=>{let n=A.doc;t.deleted||i.subdocsAdded.add(n),i.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(t,A){super.on(t,A)}off(t,A){super.off(t,A)}},NI=class{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return X(this.restDecoder)}readDsLen(){return X(this.restDecoder)}},xI=class extends NI{readLeftID(){return Ae(X(this.restDecoder),X(this.restDecoder))}readRightID(){return Ae(X(this.restDecoder),X(this.restDecoder))}readClient(){return X(this.restDecoder)}readInfo(){return cn(this.restDecoder)}readString(){return ln(this.restDecoder)}readParentInfo(){return X(this.restDecoder)===1}readTypeRef(){return X(this.restDecoder)}readLen(){return X(this.restDecoder)}readAny(){return Br(this.restDecoder)}readBuf(){return aE(yt(this.restDecoder))}readJSON(){return JSON.parse(ln(this.restDecoder))}readKey(){return ln(this.restDecoder)}},Zu=class{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=X(this.restDecoder),this.dsCurrVal}readDsLen(){let t=X(this.restDecoder)+1;return this.dsCurrVal+=t,t}},Gi=class extends Zu{constructor(t){super(t),this.keys=[],X(t),this.keyClockDecoder=new dr(yt(t)),this.clientDecoder=new gn(yt(t)),this.leftClockDecoder=new dr(yt(t)),this.rightClockDecoder=new dr(yt(t)),this.infoDecoder=new zo(yt(t),cn),this.stringDecoder=new EI(yt(t)),this.parentInfoDecoder=new zo(yt(t),cn),this.typeRefDecoder=new gn(yt(t)),this.lenDecoder=new gn(yt(t))}readLeftID(){return new xi(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new xi(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Br(this.restDecoder)}readBuf(){return yt(this.restDecoder)}readJSON(){return Br(this.restDecoder)}readKey(){let t=this.keyClockDecoder.read();if(t{i=_A(i,t[0].id.clock);let n=DA(t,i);W(e.restEncoder,t.length-n),e.writeClient(A),W(e.restEncoder,i);let r=t[n];r.write(e,i-r.id.clock);for(let o=n+1;o{let i=new Map;A.forEach((n,r)=>{Le(t,r)>n&&i.set(r,n)}),LI(t).forEach((n,r)=>{A.has(r)||i.set(r,0)}),W(e.restEncoder,i.size),EA(i.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{jS(e,t.clients.get(n),n,r)})},$S=(e,t)=>{let A=lt(),i=X(e.restDecoder);for(let n=0;n{let i=[],n=EA(A.keys()).sort((g,f)=>g-f);if(n.length===0)return null;let r=()=>{if(n.length===0)return null;let g=A.get(n[n.length-1]);for(;g.refs.length===g.i;)if(n.pop(),n.length>0)g=A.get(n[n.length-1]);else return null;return g},o=r();if(o===null)return null;let s=new MI,a=new Map,I=(g,f)=>{let Q=a.get(g);(Q==null||Q>f)&&a.set(g,f)},c=o.refs[o.i++],l=new Map,u=()=>{for(let g of i){let f=g.id.client,Q=A.get(f);Q?(Q.i--,s.clients.set(f,Q.refs.slice(Q.i)),A.delete(f),Q.i=0,Q.refs=[]):s.clients.set(f,[g]),n=n.filter(k=>k!==f)}i.length=0};for(;;){if(c.constructor!==Ft){let f=pA(l,c.id.client,()=>Le(t,c.id.client))-c.id.clock;if(f<0)i.push(c),I(c.id.client,c.id.clock-1),u();else{let Q=c.getMissing(e,t);if(Q!==null){i.push(c);let k=A.get(Q)||{refs:[],i:0};if(k.refs.length===k.i)I(Q,Le(t,Q)),u();else{c=k.refs[k.i++];continue}}else(f===0||f0)c=i.pop();else if(o!==null&&o.i0){let g=new XA;return ff(g,s,new Map),W(g.restEncoder,0),{missing:a,update:g.toUint8Array()}}return null},tU=(e,t)=>ff(e,t.doc.store,t.beforeState),AU=(e,t,A,i=new Gi(e))=>de(t,n=>{n.local=!1;let r=!1,o=n.doc,s=o.store,a=$S(i,o),I=eU(n,s,a),c=s.pendingStructs;if(c){for(let[u,g]of c.missing)if(gg)&&c.missing.set(u,g)}c.update=vI([c.update,I.update])}}else s.pendingStructs=I;let l=dE(i,n,s);if(s.pendingDs){let u=new Gi(un(s.pendingDs));X(u.restDecoder);let g=dE(u,n,s);l&&g?s.pendingDs=vI([l,g]):s.pendingDs=l||g}else s.pendingDs=l;if(r){let u=s.pendingStructs.update;s.pendingStructs=null,xE(n.doc,u)}},A,!1);var xE=(e,t,A,i=Gi)=>{let n=un(t);AU(n,e,A,new i(n))},GE=(e,t,A)=>xE(e,t,A,xI),iU=(e,t,A=new Map)=>{ff(e,t.store,A),Er(e,WS(t.store))},nU=(e,t=new Uint8Array([0]),A=new XA)=>{let i=ME(t);iU(A,e,i);let n=[A.toUint8Array()];if(e.store.pendingDs&&n.push(e.store.pendingDs),e.store.pendingStructs&&n.push(CU(e.store.pendingStructs.update,t)),n.length>1){if(A.constructor===dn)return BU(n.map((r,o)=>o===0?r:hU(r)));if(A.constructor===XA)return vI(n)}return n[0]},HE=(e,t)=>nU(e,t,new dn),rU=e=>{let t=new Map,A=X(e.restDecoder);for(let i=0;irU(new NI(un(e))),vE=(e,t)=>(W(e.restEncoder,t.size),EA(t.entries()).sort((A,i)=>i[0]-A[0]).forEach(([A,i])=>{W(e.restEncoder,A),W(e.restEncoder,i)}),e),oU=(e,t)=>vE(e,LI(t.store)),sU=(e,t=new HI)=>(e instanceof Map?vE(t,e):oU(t,e),t.toUint8Array()),RE=e=>sU(e,new GI),Wu=class{constructor(){this.l=[]}},CE=()=>new Wu,QE=(e,t)=>e.l.push(t),hE=(e,t)=>{let A=e.l,i=A.length;e.l=A.filter(n=>t!==n),i===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},JE=(e,t,A)=>To(e.l,[t,A]),xi=class{constructor(t,A){this.client=t,this.clock=A}},wI=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Ae=(e,t)=>new xi(e,t);var aU=e=>{for(let[t,A]of e.doc.share.entries())if(A===e)return t;throw aA()};var ju=class{constructor(t,A){this.ds=t,this.sv=A}};var IU=(e,t)=>new ju(e,t),LM=IU(UE(),new Map);var Cr=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!SE(t.ds,e.id),$u=(e,t)=>{let A=pA(e.meta,$u,TA),i=e.doc.store;A.has(t)||(t.sv.forEach((n,r)=>{n{}),A.add(t))};var MI=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},LI=e=>{let t=new Map;return e.clients.forEach((A,i)=>{let n=A[A.length-1];t.set(i,n.id.clock+n.length)}),t},Le=(e,t)=>{let A=e.clients.get(t);if(A===void 0)return 0;let i=A[A.length-1];return i.id.clock+i.length},qE=(e,t)=>{let A=e.clients.get(t.id.client);if(A===void 0)A=[],e.clients.set(t.id.client,A);else{let i=A[A.length-1];if(i.id.clock+i.length!==t.id.clock)throw aA()}A.push(t)},DA=(e,t)=>{let A=0,i=e.length-1,n=e[i],r=n.id.clock;if(r===t)return i;let o=Yt(t/(r+n.length-1)*i);for(;A<=i;){if(n=e[o],r=n.id.clock,r<=t){if(t{let A=e.clients.get(t.client);return A[DA(A,t.clock)]},_u=cU,ef=(e,t,A)=>{let i=DA(t,A),n=t[i];return n.id.clock{let A=e.doc.store.clients.get(t.client);return A[ef(e,A,t.clock)]},pE=(e,t,A)=>{let i=t.clients.get(A.client),n=DA(i,A.clock),r=i[n];return A.clock!==r.id.clock+r.length-1&&r.constructor!==wt&&i.splice(n+1,0,OI(e,r,A.clock-r.id.clock+1)),r},lU=(e,t,A)=>{let i=e.clients.get(t.id.client);i[DA(i,t.id.clock)]=A},KE=(e,t,A,i,n)=>{if(i===0)return;let r=A+i,o=ef(e,t,A),s;do s=t[o++],rt.deleteSet.clients.size===0&&!Mp(t.afterState,(A,i)=>t.beforeState.get(i)!==A)?!1:(gf(t.deleteSet),tU(e,t),Er(e,t.deleteSet),!0),mE=(e,t,A)=>{let i=t._item;(i===null||i.id.clock<(e.beforeState.get(i.id.client)||0)&&!i.deleted)&&pA(e.changed,t,TA).add(A)},kI=(e,t)=>{let A=e[t],i=e[t-1],n=t;for(;n>0;A=i,i=e[--n-1]){if(i.deleted===A.deleted&&i.constructor===A.constructor&&i.mergeWith(A)){A instanceof Ye&&A.parentSub!==null&&A.parent._map.get(A.parentSub)===A&&A.parent._map.set(A.parentSub,i);continue}break}let r=t-n;return r&&e.splice(t+1-r,r),r},gU=(e,t,A)=>{for(let[i,n]of e.clients.entries()){let r=t.clients.get(i);for(let o=n.length-1;o>=0;o--){let s=n[o],a=s.clock+s.len;for(let I=DA(r,s.clock),c=r[I];I{e.clients.forEach((A,i)=>{let n=t.clients.get(i);for(let r=A.length-1;r>=0;r--){let o=A[r],s=BI(n.length-1,1+DA(n,o.clock+o.len-1));for(let a=s,I=n[a];a>0&&I.id.clock>=o.clock;I=n[a])a-=1+kI(n,a)}})};var bE=(e,t)=>{if(ts.push(()=>{(I._item===null||!I._item.deleted)&&I._callObserver(A,a)})),s.push(()=>{A.changedParentTypes.forEach((a,I)=>{I._dEH.l.length>0&&(I._item===null||!I._item.deleted)&&(a=a.filter(c=>c.target._item===null||!c.target._item.deleted),a.forEach(c=>{c.currentTarget=I,c._path=null}),a.sort((c,l)=>c.path.length-l.path.length),JE(I._dEH,a,A))})}),s.push(()=>i.emit("afterTransaction",[A,i])),To(s,[]),A._needFormattingCleanup&&NU(A)}finally{i.gc&&gU(r,n,i.gcFilter),uU(r,n),A.afterState.forEach((c,l)=>{let u=A.beforeState.get(l)||0;if(u!==c){let g=n.clients.get(l),f=_A(DA(g,u),1);for(let Q=g.length-1;Q>=f;)Q-=1+kI(g,Q)}});for(let c=o.length-1;c>=0;c--){let{client:l,clock:u}=o[c].id,g=n.clients.get(l),f=DA(g,u);f+11||f>0&&kI(g,f)}if(!A.local&&A.afterState.get(i.clientID)!==A.beforeState.get(i.clientID)&&(lE(jo,Xo,"[yjs] ",Zo,Wo,"Changed the client-id because another client seems to be using it."),i.clientID=NE()),i.emit("afterTransactionCleanup",[A,i]),i._observers.has("update")){let c=new dn;EE(c,A)&&i.emit("update",[c.toUint8Array(),A.origin,i,A])}if(i._observers.has("updateV2")){let c=new XA;EE(c,A)&&i.emit("updateV2",[c.toUint8Array(),A.origin,i,A])}let{subdocsAdded:s,subdocsLoaded:a,subdocsRemoved:I}=A;(s.size>0||I.size>0||a.size>0)&&(s.forEach(c=>{c.clientID=i.clientID,c.collectionid==null&&(c.collectionid=i.collectionid),i.subdocs.add(c)}),I.forEach(c=>i.subdocs.delete(c)),i.emit("subdocs",[{loaded:a,added:s,removed:I},i,A]),I.forEach(c=>c.destroy())),e.length<=t+1?(i._transactionCleanups=[],i.emit("afterAllTransactions",[i,e])):bE(e,t+1)}}},de=(e,t,A=null,i=!0)=>{let n=e._transactionCleanups,r=!1,o=null;e._transaction===null&&(r=!0,e._transaction=new tf(e,A,i),n.push(e._transaction),n.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(r){let s=e._transaction===n[0];e._transaction=null,s&&bE(n,0)}}return o};function*fU(e){let t=X(e.restDecoder);for(let A=0;AvI(e,xI,dn);var dU=(e,t)=>{if(e.constructor===wt){let{client:A,clock:i}=e.id;return new wt(Ae(A,i+t),e.length-t)}else if(e.constructor===Ft){let{client:A,clock:i}=e.id;return new Ft(Ae(A,i+t),e.length-t)}else{let A=e,{client:i,clock:n}=A.id;return new Ye(Ae(i,n+t),null,Ae(i,n+t-1),null,A.rightOrigin,A.parent,A.parentSub,A.content.splice(t))}},vI=(e,t=Gi,A=XA)=>{if(e.length===1)return e[0];let i=e.map(c=>new t(un(c))),n=i.map(c=>new As(c,!0)),r=null,o=new A,s=new is(o);for(;n=n.filter(u=>u.curr!==null),n.sort((u,g)=>{if(u.curr.id.client===g.curr.id.client){let f=u.curr.id.clock-g.curr.id.clock;return f===0?u.curr.constructor===g.curr.constructor?0:u.curr.constructor===Ft?1:-1:f}else return g.curr.id.client-u.curr.id.client}),n.length!==0;){let c=n[0],l=c.curr.id.client;if(r!==null){let u=c.curr,g=!1;for(;u!==null&&u.id.clock+u.length<=r.struct.id.clock+r.struct.length&&u.id.client>=r.struct.id.client;)u=c.next(),g=!0;if(u===null||u.id.client!==l||g&&u.id.clock>r.struct.id.clock+r.struct.length)continue;if(l!==r.struct.id.client)Ui(s,r.struct,r.offset),r={struct:u,offset:0},c.next();else if(r.struct.id.clock+r.struct.length0&&(r.struct.constructor===Ft?r.struct.length-=f:u=dU(u,f)),r.struct.mergeWith(u)||(Ui(s,r.struct,r.offset),r={struct:u,offset:0},c.next())}}else r={struct:c.curr,offset:0},c.next();for(let u=c.curr;u!==null&&u.id.client===l&&u.id.clock===r.struct.id.clock+r.struct.length&&u.constructor!==Ft;u=c.next())Ui(s,r.struct,r.offset),r={struct:u,offset:0}}r!==null&&(Ui(s,r.struct,r.offset),r=null),Bf(s);let a=i.map(c=>uf(c)),I=ZS(a);return Er(o,I),o.toUint8Array()},CU=(e,t,A=Gi,i=XA)=>{let n=ME(t),r=new i,o=new is(r),s=new A(un(e)),a=new As(s,!1);for(;a.curr;){let c=a.curr,l=c.id.client,u=n.get(l)||0;if(a.curr.constructor===Ft){a.next();continue}if(c.id.clock+c.length>u)for(Ui(o,c,_A(u-c.id.clock,0)),a.next();a.curr&&a.curr.id.client===l;)Ui(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===l&&a.curr.id.clock+a.curr.length<=u;)a.next()}Bf(o);let I=uf(s);return Er(r,I),r.toUint8Array()};var OE=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:oA(e.encoder.restEncoder)}),e.encoder.restEncoder=Po(),e.written=0)},Ui=(e,t,A)=>{e.written>0&&e.currClient!==t.id.client&&OE(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),W(e.encoder.restEncoder,t.id.clock+A)),t.write(e.encoder,A),e.written++},Bf=e=>{OE(e);let t=e.encoder.restEncoder;W(t,e.clientStructs.length);for(let A=0;A{let n=new A(un(e)),r=new As(n,!1),o=new i,s=new is(o);for(let I=r.curr;I!==null;I=r.next())Ui(s,t(I),0);Bf(s);let a=uf(n);return Er(o,a),o.toUint8Array()};var hU=e=>QU(e,iE,Gi,dn),yE="You must not compute changes after the event-handler fired.",Qr=class{constructor(t,A){this.target=t,this.currentTarget=t,this.transaction=A,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=pU(this.currentTarget,this.target))}deletes(t){return SE(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw mA(yE);let t=new Map,A=this.target;this.transaction.changed.get(A).forEach(n=>{if(n!==null){let r=A._map.get(n),o,s;if(this.adds(r)){let a=r.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(r))if(a!==null&&this.deletes(a))o="delete",s=uI(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",s=uI(a.content.getContent())):(o="add",s=void 0)}else if(this.deletes(r))o="delete",s=uI(r.content.getContent());else return;t.set(n,{action:o,oldValue:s})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw mA(yE);let A=this.target,i=TA(),n=TA(),r=[];if(t={added:i,deleted:n,delta:r,keys:this.keys},this.transaction.changed.get(A).has(null)){let s=null,a=()=>{s&&r.push(s)};for(let I=A._start;I!==null;I=I.right)I.deleted?this.deletes(I)&&!this.adds(I)&&((s===null||s.delete===void 0)&&(a(),s={delete:0}),s.delete+=I.length,n.add(I)):this.adds(I)?((s===null||s.insert===void 0)&&(a(),s={insert:[]}),s.insert=s.insert.concat(I.content.getContent()),i.add(I)):((s===null||s.retain===void 0)&&(a(),s={retain:0}),s.retain+=I.length);s!==null&&s.retain===void 0&&a()}this._changes=t}return t}},pU=(e,t)=>{let A=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)A.unshift(t._item.parentSub);else{let i=0,n=t._item.parent._start;for(;n!==t._item&&n!==null;)n.deleted||i++,n=n.right;A.unshift(i)}t=t._item.parent}return A},LE=80,df=0,Af=class{constructor(t,A){t.marker=!0,this.p=t,this.index=A,this.timestamp=df++}},EU=e=>{e.timestamp=df++},YE=(e,t,A)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=A,e.timestamp=df++},mU=(e,t,A)=>{if(e.length>=LE){let i=e.reduce((n,r)=>n.timestamp{if(e._start===null||t===0||e._searchMarker===null)return null;let A=e._searchMarker.length===0?null:e._searchMarker.reduce((r,o)=>ar(t-r.index)t;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);for(;i.left!==null&&i.left.id.client===i.id.client&&i.left.id.clock+i.left.length===i.id.clock;)i=i.left,!i.deleted&&i.countable&&(n-=i.length);return A!==null&&ar(A.index-n){for(let i=e.length-1;i>=0;i--){let n=e[i];if(A>0){let r=n.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(n.index-=r.length);if(r===null||r.marker===!0){e.splice(i,1);continue}n.p=r,r.marker=!0}(t0&&t===n.index)&&(n.index=_A(t,n.index+A))}};var PI=(e,t,A)=>{let i=e,n=t.changedParentTypes;for(;pA(n,e,()=>[]).push(A),e._item!==null;)e=e._item.parent;JE(i._eH,A,t)},Re=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=CE(),this._dEH=CE(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,A){this.doc=t,this._item=A}_copy(){throw sA()}clone(){throw sA()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,A){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){QE(this._eH,t)}observeDeep(t){QE(this._dEH,t)}unobserve(t){hE(this._eH,t)}unobserveDeep(t){hE(this._dEH,t)}toJSON(){}},PE=(e,t,A)=>{t<0&&(t=e._length+t),A<0&&(A=e._length+A);let i=A-t,n=[],r=e._start;for(;r!==null&&i>0;){if(r.countable&&!r.deleted){let o=r.content.getContent();if(o.length<=t)t-=o.length;else{for(let s=t;s0;s++)n.push(o[s]),i--;t=0}}r=r.right}return n},VE=e=>{let t=[],A=e._start;for(;A!==null;){if(A.countable&&!A.deleted){let i=A.content.getContent();for(let n=0;n{let A=0,i=e._start;for(;i!==null;){if(i.countable&&!i.deleted){let n=i.content.getContent();for(let r=0;r{let A=[];return rs(e,(i,n)=>{A.push(t(i,n,e))}),A},yU=e=>{let t=e._start,A=null,i=0;return{[Symbol.iterator](){return this},next:()=>{if(A===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};A=t.content.getContent(),i=0,t=t.right}let n=A[i++];return A.length<=i&&(A=null),{done:!1,value:n}}}},TE=(e,t)=>{let A=YI(e,t),i=e._start;for(A!==null&&(i=A.p,t-=A.index);i!==null;i=i.right)if(!i.deleted&&i.countable){if(t{let n=A,r=e.doc,o=r.clientID,s=r.store,a=A===null?t._start:A.right,I=[],c=()=>{I.length>0&&(n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new pr(I)),n.integrate(e,0),I=[])};i.forEach(l=>{if(l===null)I.push(l);else switch(l.constructor){case Number:case Object:case Boolean:case Array:case String:I.push(l);break;default:switch(c(),l.constructor){case Uint8Array:case ArrayBuffer:n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new cs(new Uint8Array(l))),n.integrate(e,0);break;case ts:n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new ls(l)),n.integrate(e,0);break;default:if(l instanceof Re)n=new Ye(Ae(o,Le(s,o)),n,n&&n.lastId,a,a&&a.id,t,null,new WA(l)),n.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},_E=()=>mA("Length exceeded!"),XE=(e,t,A,i)=>{if(A>t._length)throw _E();if(A===0)return t._searchMarker&&ns(t._searchMarker,A,i.length),RI(e,t,null,i);let n=A,r=YI(t,A),o=t._start;for(r!==null&&(o=r.p,A-=r.index,A===0&&(o=o.prev,A+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(A<=o.length){A{let n=(t._searchMarker||[]).reduce((r,o)=>o.index>r.index?o:r,{index:0,p:t._start}).p;if(n)for(;n.right;)n=n.right;return RI(e,t,n,A)},ZE=(e,t,A,i)=>{if(i===0)return;let n=A,r=i,o=YI(t,A),s=t._start;for(o!==null&&(s=o.p,A-=o.index);s!==null&&A>0;s=s.right)!s.deleted&&s.countable&&(A0&&s!==null;)s.deleted||(i0)throw _E();t._searchMarker&&ns(t._searchMarker,n,-r+i)},JI=(e,t,A)=>{let i=t._map.get(A);i!==void 0&&i.delete(e)},Cf=(e,t,A,i)=>{let n=t._map.get(A)||null,r=e.doc,o=r.clientID,s;if(i==null)s=new pr([i]);else switch(i.constructor){case Number:case Object:case Boolean:case Array:case String:s=new pr([i]);break;case Uint8Array:s=new cs(i);break;case ts:s=new ls(i);break;default:if(i instanceof Re)s=new WA(i);else throw new Error("Unexpected content type")}new Ye(Ae(o,Le(r.store,o)),n,n&&n.lastId,null,null,t,A,s).integrate(e,0)},Qf=(e,t)=>{let A=e._map.get(t);return A!==void 0&&!A.deleted?A.content.getContent()[A.length-1]:void 0},WE=e=>{let t={};return e._map.forEach((A,i)=>{A.deleted||(t[i]=A.content.getContent()[A.length-1])}),t},jE=(e,t)=>{let A=e._map.get(t);return A!==void 0&&!A.deleted};var FU=(e,t)=>{let A={};return e._map.forEach((i,n)=>{let r=i;for(;r!==null&&(!t.sv.has(r.id.client)||r.id.clock>=(t.sv.get(r.id.client)||0));)r=r.left;r!==null&&Cr(r,t)&&(A[n]=r.content.getContent()[r.length-1])}),A},FI=e=>uE(e.entries(),t=>!t[1].deleted),nf=class extends Qr{constructor(t,A){super(t,A),this._transaction=A}},qI=class e extends Re{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let A=new e;return A.push(t),A}_integrate(t,A){super._integrate(t,A),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(A=>A instanceof Re?A.clone():A)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(t,A){super._callObserver(t,A),PI(this,t,new nf(this,t))}insert(t,A){this.doc!==null?de(this.doc,i=>{XE(i,this,t,A)}):this._prelimContent.splice(t,0,...A)}push(t){this.doc!==null?de(this.doc,A=>{wU(A,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,A=1){this.doc!==null?de(this.doc,i=>{ZE(i,this,t,A)}):this._prelimContent.splice(t,A)}get(t){return TE(this,t)}toArray(){return VE(this)}slice(t=0,A=this.length){return PE(this,t,A)}toJSON(){return this.map(t=>t instanceof Re?t.toJSON():t)}map(t){return zE(this,t)}forEach(t){rs(this,t)}[Symbol.iterator](){return yU(this)}_write(t){t.writeTypeRef(zU)}},DU=e=>new qI,rf=class extends Qr{constructor(t,A,i){super(t,A),this.keysChanged=i}},os=class e extends Re{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,A){super._integrate(t,A),this._prelimContent.forEach((i,n)=>{this.set(n,i)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((A,i)=>{t.set(i,A instanceof Re?A.clone():A)}),t}_callObserver(t,A){PI(this,t,new rf(this,t,A))}toJSON(){let t={};return this._map.forEach((A,i)=>{if(!A.deleted){let n=A.content.getContent()[A.length-1];t[i]=n instanceof Re?n.toJSON():n}}),t}get size(){return[...FI(this._map)].length}keys(){return yI(FI(this._map),t=>t[0])}values(){return yI(FI(this._map),t=>t[1].content.getContent()[t[1].length-1])}entries(){return yI(FI(this._map),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this._map.forEach((A,i)=>{A.deleted||t(A.content.getContent()[A.length-1],i,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?de(this.doc,A=>{JI(A,this,t)}):this._prelimContent.delete(t)}set(t,A){return this.doc!==null?de(this.doc,i=>{Cf(i,this,t,A)}):this._prelimContent.set(t,A),A}get(t){return Qf(this,t)}has(t){return jE(this,t)}clear(){this.doc!==null?de(this.doc,t=>{this.forEach(function(A,i,n){JI(t,n,i)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(TU)}},kU=e=>new os,Ni=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&AE(e,t),ss=class{constructor(t,A,i,n){this.left=t,this.right=A,this.index=i,this.currentAttributes=n}forward(){switch(this.right===null&&aA(),this.right.content.constructor){case Je:this.right.deleted||mr(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}},wE=(e,t,A)=>{for(;t.right!==null&&A>0;){switch(t.right.content.constructor){case Je:t.right.deleted||mr(t.currentAttributes,t.right.content);break;default:t.right.deleted||(A{let i=new Map,n=YI(t,A);if(n){let r=new ss(n.p.left,n.p,n.index,i);return wE(e,r,A-n.index)}else{let r=new ss(null,t._start,0,i);return wE(e,r,A)}},$E=(e,t,A,i)=>{for(;A.right!==null&&(A.right.deleted===!0||A.right.content.constructor===Je&&Ni(i.get(A.right.content.key),A.right.content.value));)A.right.deleted||i.delete(A.right.content.key),A.forward();let n=e.doc,r=n.clientID;i.forEach((o,s)=>{let a=A.left,I=A.right,c=new Ye(Ae(r,Le(n.store,r)),a,a&&a.lastId,I,I&&I.id,t,null,new Je(s,o));c.integrate(e,0),A.right=c,A.forward()})},mr=(e,t)=>{let{key:A,value:i}=t;i===null?e.delete(A):e.set(A,i)},em=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Je&&Ni(t[e.right.content.key]||null,e.right.content.value)))break;e.forward()}},tm=(e,t,A,i)=>{let n=e.doc,r=n.clientID,o=new Map;for(let s in i){let a=i[s],I=A.currentAttributes.get(s)||null;if(!Ni(I,a)){o.set(s,I);let{left:c,right:l}=A;A.right=new Ye(Ae(r,Le(n.store,r)),c,c&&c.lastId,l,l&&l.id,t,null,new Je(s,a)),A.right.integrate(e,0),A.forward()}}return o},Xu=(e,t,A,i,n)=>{A.currentAttributes.forEach((u,g)=>{n[g]===void 0&&(n[g]=null)});let r=e.doc,o=r.clientID;em(A,n);let s=tm(e,t,A,n),a=i.constructor===String?new ZA(i):i instanceof Re?new WA(i):new Cn(i),{left:I,right:c,index:l}=A;t._searchMarker&&ns(t._searchMarker,A.index,a.getLength()),c=new Ye(Ae(o,Le(r.store,o)),I,I&&I.lastId,c,c&&c.id,t,null,a),c.integrate(e,0),A.right=c,A.index=l,A.forward(),$E(e,t,A,s)},FE=(e,t,A,i,n)=>{let r=e.doc,o=r.clientID;em(A,n);let s=tm(e,t,A,n);e:for(;A.right!==null&&(i>0||s.size>0&&(A.right.deleted||A.right.content.constructor===Je));){if(!A.right.deleted)switch(A.right.content.constructor){case Je:{let{key:a,value:I}=A.right.content,c=n[a];if(c!==void 0){if(Ni(c,I))s.delete(a);else{if(i===0)break e;s.set(a,I)}A.right.delete(e)}else A.currentAttributes.set(a,I);break}default:i0){let a="";for(;i>0;i--)a+=` +`;A.right=new Ye(Ae(o,Le(r.store,o)),A.left,A.left&&A.left.lastId,A.right,A.right&&A.right.id,t,null,new ZA(a)),A.right.integrate(e,0),A.forward()}$E(e,t,A,s)},Am=(e,t,A,i,n)=>{let r=t,o=lt();for(;r&&(!r.countable||r.deleted);){if(!r.deleted&&r.content.constructor===Je){let I=r.content;o.set(I.key,I)}r=r.right}let s=0,a=!1;for(;t!==r;){if(A===t&&(a=!0),!t.deleted){let I=t.content;switch(I.constructor){case Je:{let{key:c,value:l}=I,u=i.get(c)||null;(o.get(c)!==I||u===l)&&(t.delete(e),s++,!a&&(n.get(c)||null)===l&&u!==l&&(u===null?n.delete(c):n.set(c,u))),!a&&!t.deleted&&mr(n,I);break}}}t=t.right}return s},SU=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let A=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Je){let i=t.content.key;A.has(i)?t.delete(e):A.add(i)}t=t.left}},UU=e=>{let t=0;return de(e.doc,A=>{let i=e._start,n=e._start,r=lt(),o=gI(r);for(;n;){if(n.deleted===!1)switch(n.content.constructor){case Je:mr(o,n.content);break;default:t+=Am(A,i,n,r,o),r=gI(o),i=n;break}n=n.right}}),t},NU=e=>{let t=new Set,A=e.doc;for(let[i,n]of e.afterState.entries()){let r=e.beforeState.get(i)||0;n!==r&&KE(e,A.store.clients.get(i),r,n,o=>{!o.deleted&&o.content.constructor===Je&&o.constructor!==wt&&t.add(o.parent)})}de(A,i=>{kE(e,e.deleteSet,n=>{if(n instanceof wt||!n.parent._hasFormatting||t.has(n.parent))return;let r=n.parent;n.content.constructor===Je?t.add(r):SU(i,n)});for(let n of t)UU(n)})},DE=(e,t,A)=>{let i=A,n=gI(t.currentAttributes),r=t.right;for(;A>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case WA:case Cn:case ZA:A{n===null?this.childListChanged=!0:this.keysChanged.add(n)})}get changes(){if(this._changes===null){let t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){let t=this.target.doc,A=[];de(t,i=>{let n=new Map,r=new Map,o=this.target._start,s=null,a={},I="",c=0,l=0,u=()=>{if(s!==null){let g=null;switch(s){case"delete":l>0&&(g={delete:l}),l=0;break;case"insert":(typeof I=="object"||I.length>0)&&(g={insert:I},n.size>0&&(g.attributes={},n.forEach((f,Q)=>{f!==null&&(g.attributes[Q]=f)}))),I="";break;case"retain":c>0&&(g={retain:c},tE(a)||(g.attributes=$p({},a))),c=0;break}g&&A.push(g),s=null}};for(;o!==null;){switch(o.content.constructor){case WA:case Cn:this.adds(o)?this.deletes(o)||(u(),s="insert",I=o.content.getContent()[0],u()):this.deletes(o)?(s!=="delete"&&(u(),s="delete"),l+=1):o.deleted||(s!=="retain"&&(u(),s="retain"),c+=1);break;case ZA:this.adds(o)?this.deletes(o)||(s!=="insert"&&(u(),s="insert"),I+=o.content.str):this.deletes(o)?(s!=="delete"&&(u(),s="delete"),l+=o.length):o.deleted||(s!=="retain"&&(u(),s="retain"),c+=o.length);break;case Je:{let{key:g,value:f}=o.content;if(this.adds(o)){if(!this.deletes(o)){let Q=n.get(g)||null;Ni(Q,f)?f!==null&&o.delete(i):(s==="retain"&&u(),Ni(f,r.get(g)||null)?delete a[g]:a[g]=f)}}else if(this.deletes(o)){r.set(g,f);let Q=n.get(g)||null;Ni(Q,f)||(s==="retain"&&u(),a[g]=Q)}else if(!o.deleted){r.set(g,f);let Q=a[g];Q!==void 0&&(Ni(Q,f)?Q!==null&&o.delete(i):(s==="retain"&&u(),f===null?delete a[g]:a[g]=f))}o.deleted||(s==="insert"&&u(),mr(n,o.content));break}}o=o.right}for(u();A.length>0;){let g=A[A.length-1];if(g.retain!==void 0&&g.attributes===void 0)A.pop();else break}}),this._delta=A}return this._delta}},as=class e extends Re{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(t,A){super._integrate(t,A);try{this._pending.forEach(i=>i())}catch(i){console.error(i)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(t,A){super._callObserver(t,A);let i=new of(this,t,A);PI(this,t,i),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){let t="",A=this._start;for(;A!==null;)!A.deleted&&A.countable&&A.content.constructor===ZA&&(t+=A.content.str),A=A.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:A=!0}={}){this.doc!==null?de(this.doc,i=>{let n=new ss(null,this._start,0,new Map);for(let r=0;r0)&&Xu(i,this,n,s,o.attributes||{})}else o.retain!==void 0?FE(i,this,n,o.retain,o.attributes||{}):o.delete!==void 0&&DE(i,n,o.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,A,i){let n=[],r=new Map,o=this.doc,s="",a=this._start;function I(){if(s.length>0){let l={},u=!1;r.forEach((f,Q)=>{u=!0,l[Q]=f});let g={insert:s};u&&(g.attributes=l),n.push(g),s=""}}let c=()=>{for(;a!==null;){if(Cr(a,t)||A!==void 0&&Cr(a,A))switch(a.content.constructor){case ZA:{let l=r.get("ychange");t!==void 0&&!Cr(a,t)?(l===void 0||l.user!==a.id.client||l.type!=="removed")&&(I(),r.set("ychange",i?i("removed",a.id):{type:"removed"})):A!==void 0&&!Cr(a,A)?(l===void 0||l.user!==a.id.client||l.type!=="added")&&(I(),r.set("ychange",i?i("added",a.id):{type:"added"})):l!==void 0&&(I(),r.delete("ychange")),s+=a.content.str;break}case WA:case Cn:{I();let l={insert:a.content.getContent()[0]};if(r.size>0){let u={};l.attributes=u,r.forEach((g,f)=>{u[f]=g})}n.push(l);break}case Je:Cr(a,t)&&(I(),mr(r,a.content));break}a=a.right}I()};return t||A?de(o,l=>{t&&$u(l,t),A&&$u(l,A),c()},"cleanup"):c(),n}insert(t,A,i){if(A.length<=0)return;let n=this.doc;n!==null?de(n,r=>{let o=DI(r,this,t);i||(i={},o.currentAttributes.forEach((s,a)=>{i[a]=s})),Xu(r,this,o,A,i)}):this._pending.push(()=>this.insert(t,A,i))}insertEmbed(t,A,i={}){let n=this.doc;n!==null?de(n,r=>{let o=DI(r,this,t);Xu(r,this,o,A,i)}):this._pending.push(()=>this.insertEmbed(t,A,i))}delete(t,A){if(A===0)return;let i=this.doc;i!==null?de(i,n=>{DE(n,DI(n,this,t),A)}):this._pending.push(()=>this.delete(t,A))}format(t,A,i){if(A===0)return;let n=this.doc;n!==null?de(n,r=>{let o=DI(r,this,t);o.right!==null&&FE(r,this,o,A,i)}):this._pending.push(()=>this.format(t,A,i))}removeAttribute(t){this.doc!==null?de(this.doc,A=>{JI(A,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,A){this.doc!==null?de(this.doc,i=>{Cf(i,this,t,A)}):this._pending.push(()=>this.setAttribute(t,A))}getAttribute(t){return Qf(this,t)}getAttributes(){return WE(this)}_write(t){t.writeTypeRef(_U)}},xU=e=>new as,$o=class{constructor(t,A=()=>!0){this._filter=A,this._root=t,this._currentNode=t._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let t=this._currentNode,A=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(A)))do if(A=t.content.type,!t.deleted&&(A.constructor===KI||A.constructor===hr)&&A._start!==null)t=A._start;else for(;t!==null;)if(t.right!==null){t=t.right;break}else t.parent===this._root?t=null:t=t.parent._item;while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}},hr=class e extends Re{constructor(){super(),this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,A){super._integrate(t,A),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(A=>A instanceof Re?A.clone():A)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new $o(this,t)}querySelector(t){t=t.toUpperCase();let i=new $o(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t).next();return i.done?null:i.value}querySelectorAll(t){return t=t.toUpperCase(),EA(new $o(this,A=>A.nodeName&&A.nodeName.toUpperCase()===t))}_callObserver(t,A){PI(this,t,new sf(this,A,t))}toString(){return zE(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,A={},i){let n=t.createDocumentFragment();return i!==void 0&&i._createAssociation(n,this),rs(this,r=>{n.insertBefore(r.toDOM(t,A,i),null)}),n}insert(t,A){this.doc!==null?de(this.doc,i=>{XE(i,this,t,A)}):this._prelimContent.splice(t,0,...A)}insertAfter(t,A){if(this.doc!==null)de(this.doc,i=>{let n=t&&t instanceof Re?t._item:t;RI(i,this,n,A)});else{let i=this._prelimContent,n=t===null?0:i.findIndex(r=>r===t)+1;if(n===0&&t!==null)throw mA("Reference item not found");i.splice(n,0,...A)}}delete(t,A=1){this.doc!==null?de(this.doc,i=>{ZE(i,this,t,A)}):this._prelimContent.splice(t,A)}toArray(){return VE(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return TE(this,t)}slice(t=0,A=this.length){return PE(this,t,A)}forEach(t){rs(this,t)}_write(t){t.writeTypeRef(ZU)}},GU=e=>new hr,KI=class e extends hr{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,A){super._integrate(t,A),this._prelimAttrs.forEach((i,n)=>{this.setAttribute(n,i)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName),A=this.getAttributes();return eE(A,(i,n)=>{typeof i=="string"&&t.setAttribute(n,i)}),t.insert(0,this.toArray().map(i=>i instanceof Re?i.clone():i)),t}toString(){let t=this.getAttributes(),A=[],i=[];for(let s in t)i.push(s);i.sort();let n=i.length;for(let s=0;s0?" "+A.join(" "):"";return`<${r}${o}>${super.toString()}`}removeAttribute(t){this.doc!==null?de(this.doc,A=>{JI(A,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,A){this.doc!==null?de(this.doc,i=>{Cf(i,this,t,A)}):this._prelimAttrs.set(t,A)}getAttribute(t){return Qf(this,t)}hasAttribute(t){return jE(this,t)}getAttributes(t){return t?FU(this,t):WE(this)}toDOM(t=document,A={},i){let n=t.createElement(this.nodeName),r=this.getAttributes();for(let o in r){let s=r[o];typeof s=="string"&&n.setAttribute(o,s)}return rs(this,o=>{n.appendChild(o.toDOM(t,A,i))}),i!==void 0&&i._createAssociation(n,this),n}_write(t){t.writeTypeRef(XU),t.writeKey(this.nodeName)}},HU=e=>new KI(e.readKey()),sf=class extends Qr{constructor(t,A,i){super(t,i),this.childListChanged=!1,this.attributesChanged=new Set,A.forEach(n=>{n===null?this.childListChanged=!0:this.attributesChanged.add(n)})}},af=class e extends os{constructor(t){super(),this.hookName=t}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((A,i)=>{t.set(i,A)}),t}toDOM(t=document,A={},i){let n=A[this.hookName],r;return n!==void 0?r=n.createDom(this):r=document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),i!==void 0&&i._createAssociation(r,this),r}_write(t){t.writeTypeRef(WU),t.writeKey(this.hookName)}},MU=e=>new af(e.readKey()),If=class e extends as{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(t=document,A,i){let n=t.createTextNode(this.toString());return i!==void 0&&i._createAssociation(n,this),n}toString(){return this.toDelta().map(t=>{let A=[];for(let n in t.attributes){let r=[];for(let o in t.attributes[n])r.push({key:o,value:t.attributes[n][o]});r.sort((o,s)=>o.keyn.nodeName=0;n--)i+=``;return i}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(jU)}},vU=e=>new If,Is=class{constructor(t,A){this.id=t,this.length=A}get deleted(){throw sA()}mergeWith(t){return!1}write(t,A,i){throw sA()}integrate(t,A){throw sA()}},RU=0,wt=class extends Is{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){A>0&&(this.id.clock+=A,this.length-=A),qE(t.doc.store,this)}write(t,A){t.writeInfo(RU),t.writeLen(this.length-A)}getMissing(t,A){return null}},cs=class e{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeBuf(this.content)}getRef(){return 3}},JU=e=>new cs(e.readBuf()),bI=class e{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let A=new e(this.len-t);return this.len=t,A}mergeWith(t){return this.len+=t.len,!0}integrate(t,A){UI(t.deleteSet,A.id.client,A.id.clock,this.len),A.markDeleted()}delete(t){}gc(t){}write(t,A){t.writeLen(this.len-A)}getRef(){return 1}},qU=e=>new bI(e.readLen()),im=(e,t)=>new ts({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),ls=class e{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;let A={};this.opts=A,t.gc||(A.gc=!1),t.autoLoad&&(A.autoLoad=!0),t.meta!==null&&(A.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(im(this.doc.guid,this.opts))}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){this.doc._item=A,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,A){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},KU=e=>new ls(im(e.readString(),e.readAny())),Cn=class e{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeJSON(this.embed)}getRef(){return 5}},bU=e=>new Cn(e.readJSON()),Je=class e{constructor(t,A){this.key=t,this.value=A}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){let i=A.parent;i._searchMarker=null,i._hasFormatting=!0}delete(t){}gc(t){}write(t,A){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},OU=e=>new Je(e.readKey(),e.readJSON()),cf=class e{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let A=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),A}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){let i=this.arr.length;t.writeLen(i-A);for(let n=A;n{let t=e.readLen(),A=[];for(let i=0;i{let t=e.readLen(),A=[];for(let i=0;i=55296&&i<=56319&&(this.str=this.str.slice(0,t-1)+"\uFFFD",A.str="\uFFFD"+A.str.slice(1)),A}mergeWith(t){return this.str+=t.str,!0}integrate(t,A){}delete(t){}gc(t){}write(t,A){t.writeString(A===0?this.str:this.str.slice(A))}getRef(){return 4}},PU=e=>new ZA(e.readString()),VU=[DU,kU,xU,HU,GU,MU,vU],zU=0,TU=1,_U=2,XU=3,ZU=4,WU=5,jU=6,WA=class e{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(t){throw sA()}mergeWith(t){return!1}integrate(t,A){this.type._integrate(t.doc,A)}delete(t){let A=this.type._start;for(;A!==null;)A.deleted?A.id.clock<(t.beforeState.get(A.id.client)||0)&&t._mergeStructs.push(A):A.delete(t),A=A.right;this.type._map.forEach(i=>{i.deleted?i.id.clock<(t.beforeState.get(i.id.client)||0)&&t._mergeStructs.push(i):i.delete(t)}),t.changed.delete(this.type)}gc(t){let A=this.type._start;for(;A!==null;)A.gc(t,!0),A=A.right;this.type._start=null,this.type._map.forEach(i=>{for(;i!==null;)i.gc(t,!0),i=i.left}),this.type._map=new Map}write(t,A){this.type._write(t)}getRef(){return 7}},$U=e=>new WA(VU[e.readTypeRef()](e));var OI=(e,t,A)=>{let{client:i,clock:n}=t.id,r=new Ye(Ae(i,n+A),t,Ae(i,n+A-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(A));return t.deleted&&r.markDeleted(),t.keep&&(r.keep=!0),t.redone!==null&&(r.redone=Ae(t.redone.client,t.redone.clock+A)),t.right=r,r.right!==null&&(r.right.left=r),e._mergeStructs.push(r),r.parentSub!==null&&r.right===null&&r.parent._map.set(r.parentSub,r),t.length=A,r};var Ye=class e extends Is{constructor(t,A,i,n,r,o,s,a){super(t,a.getLength()),this.origin=i,this.left=A,this.right=n,this.rightOrigin=r,this.parent=o,this.parentSub=s,this.redone=null,this.content=a,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,A){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Le(A,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Le(A,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===xi&&this.id.client!==this.parent.client&&this.parent.clock>=Le(A,this.parent.client))return this.parent.client;if(this.origin&&(this.left=pE(t,A,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Hi(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===wt||this.right&&this.right.constructor===wt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===xi){let i=_u(A,this.parent);i.constructor===wt?this.parent=null:this.parent=i.content.type}return null}integrate(t,A){if(A>0&&(this.id.clock+=A,this.left=pE(t,t.doc.store,Ae(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(A),this.length-=A),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let i=this.left,n;if(i!==null)n=i.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,o=new Set;for(;n!==null&&n!==this.right;){if(o.add(n),r.add(n),wI(this.origin,n.origin)){if(n.id.client{i.p===t&&(i.p=this,!this.deleted&&this.countable&&(i.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let A=this.parent;this.countable&&this.parentSub===null&&(A._length-=this.length),this.markDeleted(),UI(t.deleteSet,this.id.client,this.id.clock,this.length),mE(t,A,this.parentSub),this.content.delete(t)}}gc(t,A){if(!this.deleted)throw aA();this.content.gc(t),A?lU(t,this,new wt(this.id,this.length)):this.content=new bI(this.length)}write(t,A){let i=A>0?Ae(this.id.client,this.id.clock+A-1):this.origin,n=this.rightOrigin,r=this.parentSub,o=this.content.getRef()&31|(i===null?0:128)|(n===null?0:64)|(r===null?0:32);if(t.writeInfo(o),i!==null&&t.writeLeftID(i),n!==null&&t.writeRightID(n),i===null&&n===null){let s=this.parent;if(s._item!==void 0){let a=s._item;if(a===null){let I=aU(s);t.writeParentInfo(!0),t.writeString(I)}else t.writeParentInfo(!1),t.writeLeftID(a.id)}else s.constructor===String?(t.writeParentInfo(!0),t.writeString(s)):s.constructor===xi?(t.writeParentInfo(!1),t.writeLeftID(s)):aA();r!==null&&t.writeString(r)}this.content.write(t,A)}},nm=(e,t)=>eN[t&31](e),eN=[()=>{aA()},qU,LU,JU,PU,bU,OU,$U,YU,KU,()=>{aA()}],tN=10,Ft=class extends Is{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,A){aA()}write(t,A){t.writeInfo(tN),W(t.restEncoder,this.length-A)}getMissing(t,A){return null}},rm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},om="__ $YJS$ __";rm[om]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");rm[om]=!0;var VI={proxies:new WeakMap,traps:new WeakMap},sm=(e,t,A)=>e.get(t)||e.set(t,new A).get(t),am=e=>e.join(),Im=(e,t,A,i,n)=>{sm(sm(VI.traps,e,WeakMap),t,Map).set(am(A),i),VI.proxies.set(i,n)},hf=(e,t,A)=>{var i,n;return VI.proxies.get((n=(i=VI.traps.get(e))===null||i===void 0?void 0:i.get(t))===null||n===void 0?void 0:n.get(am(A)))};var iN=Symbol("default"),nN=Object.keys(Object.getOwnPropertyDescriptors(Reflect)),rN=["get","has","set","defineProperty","deleteProperty","getOwnPropertyDescriptor"],oN=(e,t)=>{let A,i,n,r,o,s,a,I;switch(e){case"get":[A,i,r]=t;break;case"set":[A,i,n,r]=t;break;case"deleteProperty":case"defineProperty":[A,s]=t;break;case"has":case"getOwnPropertyDescriptor":[A,i]=t;break;case"apply":[A,a,o]=t;break;case"construct":[A,o]=t;break;case"setPrototypeOf":[A,I]=t;break;default:[A]=t}return{target:A,name:i,receiver:r,val:n,args:o,descriptor:s,thisValue:a,prototype:I}},sN=(e,t)=>{let{trapName:A,handler:i,traps:n,root:r,path:o}=e,{target:s,name:a,val:I,receiver:c,args:l,descriptor:u,thisValue:g,prototype:f}=oN(A,t),Q=rN.includes(A)?a:void 0;return{parameters:t,target:s,name:a,val:I,args:l,descriptor:u,receiver:c,thisValue:g,prototype:f,trapName:A,traps:n,path:o,handler:i,key:Q,newValue:A==="set"?I:void 0,root:r,get proxy(){return hf(r,s,o)},get value(){return Q&&s[Q]},DEFAULT:iN,PROXY:cm.bind({root:r,handler:i,path:[...o,Q]})}},aN=function(...e){let{trapName:t,handler:A}=this,i=sN(this,e),{PROXY:n,DEFAULT:r}=i,o=A(i);return o===n?n(i.value):o===r?Reflect[t](...e):o},IN=(e,t,A)=>nN.reduce((i,n)=>(i[n]=aN.bind({trapName:n,handler:e,traps:i,root:t,path:A}),i),{}),cN=e=>{if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Deep proxy could be applied to objects and functions only")},lN=({DEFAULT:e})=>e,cm=function(e,t,A,i){cN(e);let n=Object.assign({},this),r=t||n.handler||lN,o=A||n.path||[],s=n.root||i||e,a=hf(s,e,o);if(a)return a;let I=IN(r,s,o),c=new Proxy(e,I);return Im(s,e,o,I,c),c},lm=class{constructor(e,t,A,i){return cm(e,t,A,i)}};function fs(e,t,A,i){function n(r){return r instanceof A?r:new A(function(o){o(r)})}return new(A||(A=Promise))(function(r,o){function s(c){try{I(i.next(c))}catch(l){o(l)}}function a(c){try{I(i.throw(c))}catch(l){o(l)}}function I(c){c.done?r(c.value):n(c.value).then(s,a)}I((i=i.apply(e,t||[])).next())})}var Ee=class{constructor(){this.mutex=Promise.resolve()}lock(){let t=()=>{};return this.mutex=this.mutex.then(()=>new Promise(t)),new Promise(A=>{t=A})}dispatch(t){return fs(this,void 0,void 0,function*(){let A=yield this.lock();try{return yield Promise.resolve(t())}finally{A()}})}},pf;function gN(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global}var yf=gN(),Ef=(pf=yf.Buffer)!==null&&pf!==void 0?pf:null,uN=yf.TextEncoder?new yf.TextEncoder:null;function Qm(e,t){return(e&15)+(e>>6|e>>3&8)<<4|(t&15)+(t>>6|t>>3&8)}function fN(e,t){let A=t.length>>1;for(let i=0;i>>4;e[i++]=r>9?r+gm:r+um,r=t[n]&15,e[i++]=r>9?r+gm:r+um}return String.fromCharCode.apply(null,e)}var Bm=Ef!==null?e=>{if(typeof e=="string"){let t=Ef.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(Ef.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if(typeof e=="string")return uN.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},dm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",us=new Uint8Array(256);for(let e=0;e>4,n+=1,i[n]=(s&15)<<4|a>>2,n+=1,i[n]=(a&3)<<6|I&63,n+=1}return i}var zI=16*1024,gs=4,QN=new Ee,mf=new Map;function hN(e,t){return fs(this,void 0,void 0,function*(){let A=null,i=null,n=!1;if(typeof WebAssembly>"u")throw new Error("WebAssembly is not supported in this environment!");let r=(F,S=0)=>{i.set(F,S)},o=()=>i,s=()=>A.exports,a=F=>{A.exports.Hash_SetMemorySize(F);let S=A.exports.Hash_GetBuffer(),N=A.exports.memory.buffer;i=new Uint8Array(N,S,F)},I=()=>new DataView(A.exports.memory.buffer).getUint32(A.exports.STATE_SIZE,!0),c=QN.dispatch(()=>fs(this,void 0,void 0,function*(){if(!mf.has(e.name)){let S=CN(e.data),N=WebAssembly.compile(S);mf.set(e.name,N)}let F=yield mf.get(e.name);A=yield WebAssembly.instantiate(F,{})})),l=()=>fs(this,void 0,void 0,function*(){A||(yield c);let F=A.exports.Hash_GetBuffer(),S=A.exports.memory.buffer;i=new Uint8Array(S,F,zI)}),u=(F=null)=>{n=!0,A.exports.Hash_Init(F)},g=F=>{let S=0;for(;S{if(!n)throw new Error("update() called before init()");let S=Bm(F);g(S)},Q=new Uint8Array(t*2),k=(F,S=null)=>{if(!n)throw new Error("digest() called before init()");return n=!1,A.exports.Hash_Final(S),F==="binary"?i.slice(0,t):fm(Q,i,t)},d=()=>{if(!n)throw new Error("save() can only be called after init() and before digest()");let F=A.exports.Hash_GetState(),S=I(),N=A.exports.memory.buffer,b=new Uint8Array(N,F,S),q=new Uint8Array(gs+S);return fN(q,e.hash),q.set(b,gs),q},B=F=>{if(!(F instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");let S=A.exports.Hash_GetState(),N=I(),b=gs+N,q=A.exports.memory.buffer;if(F.length!==b)throw new Error(`Bad state length (expected ${b} bytes, got ${F.length})`);if(!BN(e.hash,F.subarray(0,gs)))throw new Error("This state was written by an incompatible hash implementation");let Z=F.subarray(gs);new Uint8Array(q,S,N).set(Z),n=!0},C=F=>typeof F=="string"?F.length!0;break;case"blake2b":case"blake2s":y=(F,S)=>S<=512&&C(F);break;case"blake3":y=(F,S)=>S===0&&C(F);break;case"xxhash64":case"xxhash3":case"xxhash128":y=()=>!1;break}let D=(F,S=null,N=null)=>{if(!y(F,S))return u(S),f(F),k("hex",N);let b=Bm(F);return i.set(b),A.exports.Hash_Calculate(b.length,S,N),fm(Q,i,t)};return yield l(),{getMemory:o,writeMemory:r,getExports:s,setMemorySize:a,init:u,update:f,digest:k,save:d,load:B,calculate:D,hashLength:t}})}function pN(e,t,A){return fs(this,void 0,void 0,function*(){let i=yield e.lock(),n=yield hN(t,A);return i(),n})}var ZM=new Ee;var WM=new Ee;var jM=new DataView(new ArrayBuffer(4));var $M=new Ee;var ev=new Ee;var tv=new Ee;var Av=new Ee;var iv=new Ee;var nv=new Ee;var rv=new Ee;var ov=new Ee;var sv=new Ee;var av=new Ee;var Iv=new Ee;var cv=new Ee;var lv=new Ee;var EN="xxhash32",mN="AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwcGAAEBAgADBQQBAQICBg4CfwFBsIkFC38AQYAICwdwCAZtZW1vcnkCAA5IYXNoX0dldEJ1ZmZlcgAACUhhc2hfSW5pdAABC0hhc2hfVXBkYXRlAAIKSGFzaF9GaW5hbAADDUhhc2hfR2V0U3RhdGUABA5IYXNoX0NhbGN1bGF0ZQAFClNUQVRFX1NJWkUDAQqxEAYFAEGACQtNAEEAQgA3A6iJAUEAIAA2AoiJAUEAIABBz4yijgZqNgKMiQFBACAAQfeUr694ajYChIkBQQAgAEGoiI2hAmo2AoCJAUEAQQA2AqCJAQu4CAEHfwJAIABFDQBBAEEAKQOoiQEgAK18NwOoiQECQEEAKAKgiQEiASAAakEPSw0AAkACQCAAQQNxIgINAEGACSEDIAAhBAwBCyAAQXxxIQRBgAkhAwNAQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAy0AADoAACADQQFqIQMgAkF/aiICDQALCyAAQQRJDQEDQEEAQQAoAqCJASICQQFqNgKgiQEgAkGQiQFqIAMtAAA6AAAgA0EBai0AACECQQBBACgCoIkBIgVBAWo2AqCJASAFQZCJAWogAjoAACADQQJqLQAAIQJBAEEAKAKgiQEiBUEBajYCoIkBIAVBkIkBaiACOgAAIANBA2otAAAhAkEAQQAoAqCJASIFQQFqNgKgiQEgBUGQiQFqIAI6AAAgA0EEaiEDIARBfGoiBA0ADAILCyAAQfAIaiEGAkACQCABDQBBACgCjIkBIQJBACgCiIkBIQVBACgChIkBIQRBACgCgIkBIQFBgAkhAwwBC0GACSEDAkAgAUEPSw0AQYAJIQMCQAJAQQAgAWtBA3EiBA0AIAEhBQwBCyABIQIDQEEAIAJBAWoiBTYCoIkBIAJBkIkBaiADLQAAOgAAIANBAWohAyAFIQIgBEF/aiIEDQALCyABQXNqQQNJDQBBACEEA0AgAyAEaiIBLQAAIQdBACAFIARqIgJBAWo2AqCJASACQZCJAWogBzoAACABQQFqLQAAIQdBACACQQJqNgKgiQEgAkGRiQFqIAc6AAAgAUECai0AACEHQQAgAkEDajYCoIkBIAJBkokBaiAHOgAAIAFBA2otAAAhAUEAIAJBBGo2AqCJASACQZOJAWogAToAACAFIARBBGoiBGpBEEcNAAsgAyAEaiEDC0EAQQAoApCJAUH3lK+veGxBACgCgIkBakENd0Gx893xeWwiATYCgIkBQQBBACgClIkBQfeUr694bEEAKAKEiQFqQQ13QbHz3fF5bCIENgKEiQFBAEEAKAKYiQFB95Svr3hsQQAoAoiJAWpBDXdBsfPd8XlsIgU2AoiJAUEAQQAoApyJAUH3lK+veGxBACgCjIkBakENd0Gx893xeWwiAjYCjIkBCyAAQYAJaiEAAkAgAyAGSw0AA0AgAygCAEH3lK+veGwgAWpBDXdBsfPd8XlsIQEgA0EMaigCAEH3lK+veGwgAmpBDXdBsfPd8XlsIQIgA0EIaigCAEH3lK+veGwgBWpBDXdBsfPd8XlsIQUgA0EEaigCAEH3lK+veGwgBGpBDXdBsfPd8XlsIQQgA0EQaiIDIAZNDQALC0EAIAI2AoyJAUEAIAU2AoiJAUEAIAQ2AoSJAUEAIAE2AoCJAUEAIAAgA2s2AqCJASAAIANGDQBBACECA0AgAkGQiQFqIAMgAmotAAA6AAAgAkEBaiICQQAoAqCJAUkNAAsLC6QDAgF+Bn9BACkDqIkBIgCnIQECQAJAIABCEFQNAEEAKAKEiQFBB3dBACgCgIkBQQF3akEAKAKIiQFBDHdqQQAoAoyJAUESd2ohAgwBC0EAKAKIiQFBsc/ZsgFqIQILIAIgAWohAkGQiQEhAwJAQQAoAqCJASIEQZCJAWoiBUGUiQFJDQBBkIkBIQEDQCABKAIAQb3cypV8bCACakERd0Gv1tO+AmwhAiABQQhqIQYgAUEEaiIDIQEgBiAFTQ0ACwsCQCADIAVGDQAgBEGPiQFqIQYCQAJAIAQgA2tBAXENACADIQEMAQsgA0EBaiEBIAMtAABBsc/ZsgFsIAJqQQt3QbHz3fF5bCECCyAGIANGDQADQCABQQFqLQAAQbHP2bIBbCABLQAAQbHP2bIBbCACakELd0Gx893xeWxqQQt3QbHz3fF5bCECIAFBAmoiASAFRw0ACwtBACACQQ92IAJzQfeUr694bCIBQQ12IAFzQb3cypV8bCIBQRB2IAFzIgJBGHQgAkGA/gNxQQh0ciABQQh2QYD+A3EgAUEYdnJyrTcDgAkLBgBBgIkBC/MDAgF+BH9BAEIANwOoiQFBACABNgKIiQFBACABQc+Moo4GajYCjIkBQQAgAUH3lK+veGo2AoSJAUEAIAFBqIiNoQJqNgKAiQFBAEEANgKgiQEgABACQQApA6iJASICpyEBAkACQCACQhBUDQBBACgChIkBQQd3QQAoAoCJAUEBd2pBACgCiIkBQQx3akEAKAKMiQFBEndqIQAMAQtBACgCiIkBQbHP2bIBaiEACyAAIAFqIQBBkIkBIQMCQEEAKAKgiQEiBEGQiQFqIgVBlIkBSQ0AQZCJASEBA0AgASgCAEG93MqVfGwgAGpBEXdBr9bTvgJsIQAgAUEIaiEGIAFBBGoiAyEBIAYgBU0NAAsLAkAgAyAFRg0AIARBj4kBaiEGAkACQCAEIANrQQFxDQAgAyEBDAELIANBAWohASADLQAAQbHP2bIBbCAAakELd0Gx893xeWwhAAsgBiADRg0AA0AgAUEBai0AAEGxz9myAWwgAS0AAEGxz9myAWwgAGpBC3dBsfPd8XlsakELd0Gx893xeWwhACABQQJqIgEgBUcNAAsLQQAgAEEPdiAAc0H3lK+veGwiAUENdiABc0G93MqVfGwiAUEQdiABcyIAQRh0IABBgP4DcUEIdHIgAUEIdkGA/gNxIAFBGHZycq03A4AJCwsLAQBBgAgLBDAAAAA=",yN="9e3a00cd",wN={name:EN,data:mN,hash:yN},FN=new Ee,TI=null;function Cm(e){return!Number.isInteger(e)||e<0||e>4294967295?new Error("Seed must be a valid 32-bit long unsigned integer."):null}function _I(e,t=0){if(Cm(t))return Promise.reject(Cm(t));if(TI===null)return pN(FN,wN,4).then(A=>(TI=A,TI.calculate(e,t)));try{let A=TI.calculate(e,t);return Promise.resolve(A)}catch(A){return Promise.reject(A)}}var gv=new Ee;var uv=new ArrayBuffer(8);var fv=new Ee;var Bv=new ArrayBuffer(8);var dv=new Ee;var Cv=new ArrayBuffer(8);var Qv=new Ee;var hv=new Ee;var pv=new Ee;function Ff(e){return new Promise((t,A)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>A(e.error)})}function Qn(e,t){let A=indexedDB.open(e);A.onupgradeneeded=()=>A.result.createObjectStore(t);let i=Ff(A);return(n,r)=>i.then(o=>r(o.transaction(t,n).objectStore(t)))}var wf;function hm(){return wf||(wf=Qn("keyval-store","keyval")),wf}function kA(e,t=hm()){return t("readonly",A=>Ff(A.get(e)))}function SA(e,t,A=hm()){return A("readwrite",i=>(i.put(t,e),Ff(i.transaction)))}var kf;try{kf=new TextDecoder}catch{}var H,zt,h=0;var xm=[],Sf=xm,Uf=0,ye={},ie,Mi,Vt=0,UA=0,Ve,jA,Dt=[],ee,pm={useRecords:!1,mapsAsObjects:!0},Bs=class{},xf=new Bs;xf.name="MessagePack 0xC1";var vi=!1,Gm=2,Em,mm,ym;try{new Function("")}catch{Gm=1/0}var pn=class e{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,A){if(H)return Rm(()=>(ZI(),this?this.unpack(t,A):e.prototype.unpack.call(pm,t,A)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof A=="object"?(zt=A.end||t.length,h=A.start||0):(h=0,zt=A>-1?A:t.length),Uf=0,UA=0,Mi=null,Sf=xm,Ve=null,H=t;try{ee=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw H=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof e){if(ye=this,this.structures)return ie=this.structures,XI(A);(!ie||ie.length>0)&&(ie=[])}else ye=pm,(!ie||ie.length>0)&&(ie=[]);return XI(A)}unpackMultiple(t,A){let i,n=0;try{vi=!0;let r=t.length,o=this?this.unpack(t,r):jI.unpack(t,r);if(A){if(A(o,n,h)===!1)return;for(;hi.slice(0)));for(let i=0,n=t.length;i=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in A||[])if(i>=0){let n=t[i],r=A[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,A){return this.unpack(t,A)}};function XI(e){try{if(!ye.trusted&&!vi){let A=ie.sharedLength||0;A=32&&Em?(t=Em(H,h,zt,ye),H=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),h=zt):t=Ne(),Ve&&(h=Ve.postBundlePosition,Ve=null),vi&&(ie.restoreStructures=null),h==zt)ie&&ie.restoreStructures&&wm(),ie=null,H=null,jA&&(jA=null);else{if(h>zt)throw new Error("Unexpected end of MessagePack data");if(!vi){let A;try{A=JSON.stringify(t,(i,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(i){A="(JSON view not available "+i+")"}throw new Error("Data read, but end of buffer not reached "+A)}}return t}catch(t){throw ie&&ie.restoreStructures&&wm(),ZI(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||h>zt)&&(t.incomplete=!0),t}}function wm(){for(let e in ie.restoreStructures)ie[e]=ie.restoreStructures[e];ie.restoreStructures=null}function Ne(){let e=H[h++];if(e<160)if(e<128){if(e<64)return e;{let t=ie[e&63]||ye.getStructures&&Hm()[e&63];return t?(t.read||(t.read=Gf(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,ye.mapsAsObjects){let t={};for(let A=0;A=h)return Mi.slice(h-Vt,(h+=t)-Vt);if(UA==0&&zt<140){let A=t<16?Hf(t):Mm(t);if(A!=null)return A}return Nf(t)}else{let t;switch(e){case 192:return null;case 193:return Ve?(t=Ne(),t>0?Ve[1].slice(Ve.position1,Ve.position1+=t):Ve[0].slice(Ve.position0,Ve.position0-=t)):xf;case 194:return!1;case 195:return!0;case 196:if(t=H[h++],t===void 0)throw new Error("Unexpected end of buffer");return Df(t);case 197:return t=ee.getUint16(h),h+=2,Df(t);case 198:return t=ee.getUint32(h),h+=4,Df(t);case 199:return hn(H[h++]);case 200:return t=ee.getUint16(h),h+=2,hn(t);case 201:return t=ee.getUint32(h),h+=4,hn(t);case 202:if(t=ee.getFloat32(h),ye.useFloat32>2){let A=WI[(H[h]&127)<<1|H[h+1]>>7];return h+=4,(A*t+(t>0?.5:-.5)>>0)/A}return h+=4,t;case 203:return t=ee.getFloat64(h),h+=8,t;case 204:return H[h++];case 205:return t=ee.getUint16(h),h+=2,t;case 206:return t=ee.getUint32(h),h+=4,t;case 207:return ye.int64AsType==="number"?(t=ee.getUint32(h)*4294967296,t+=ee.getUint32(h+4)):ye.int64AsType==="string"?t=ee.getBigUint64(h).toString():ye.int64AsType==="auto"?(t=ee.getBigUint64(h),t<=BigInt(2)<=BigInt(-2)<=h?Mi.slice(h-Vt,(h+=t)-Vt):kN(t);case 218:return t=ee.getUint16(h),h+=2,UA>=h?Mi.slice(h-Vt,(h+=t)-Vt):SN(t);case 219:return t=ee.getUint32(h),h+=4,UA>=h?Mi.slice(h-Vt,(h+=t)-Vt):UN(t);case 220:return t=ee.getUint16(h),h+=2,Dm(t);case 221:return t=ee.getUint32(h),h+=4,Dm(t);case 222:return t=ee.getUint16(h),h+=2,km(t);case 223:return t=ee.getUint32(h),h+=4,km(t);default:if(e>=224)return e-256;if(e===void 0){let A=new Error("Unexpected end of MessagePack data");throw A.incomplete=!0,A}throw new Error("Unknown MessagePack token "+e)}}}var DN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Gf(e,t){function A(){if(A.count++>Gm){let n=e.read=new Function("r","return function(){return "+(ye.freezeData?"Object.freeze":"")+"({"+e.map(r=>r==="__proto__"?"__proto_:r()":DN.test(r)?r+":r()":"["+JSON.stringify(r)+"]:r()").join(",")+"})}")(Ne);return e.highByte===0&&(e.read=Fm(t,e.read)),n()}let i={};for(let n=0,r=e.length;nfunction(){let A=H[h++];if(A===0)return t();let i=e<32?-(e+(A<<5)):e+(A<<5),n=ie[i]||Hm()[i];if(!n)throw new Error("Record id is not defined for "+i);return n.read||(n.read=Gf(n,e)),n.read()};function Hm(){let e=Rm(()=>(H=null,ye.getStructures()));return ie=ye._mergeStructures(e,ie)}var Nf=ds,kN=ds,SN=ds,UN=ds;function ds(e){let t;if(e<16&&(t=Hf(e)))return t;if(e>64&&kf)return kf.decode(H.subarray(h,h+=e));let A=h+e,i=[];for(t="";h65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a)}else i.push(n);i.length>=4096&&(t+=Pe.apply(String,i),i.length=0)}return i.length>0&&(t+=Pe.apply(String,i)),t}function Dm(e){let t=new Array(e);for(let A=0;A0){h=t;return}A[i]=n}return Pe.apply(String,A)}function Hf(e){if(e<4)if(e<2){if(e===0)return"";{let t=H[h++];if((t&128)>1){h-=1;return}return Pe(t)}}else{let t=H[h++],A=H[h++];if((t&128)>0||(A&128)>0){h-=2;return}if(e<3)return Pe(t,A);let i=H[h++];if((i&128)>0){h-=3;return}return Pe(t,A,i)}else{let t=H[h++],A=H[h++],i=H[h++],n=H[h++];if((t&128)>0||(A&128)>0||(i&128)>0||(n&128)>0){h-=4;return}if(e<6){if(e===4)return Pe(t,A,i,n);{let r=H[h++];if((r&128)>0){h-=5;return}return Pe(t,A,i,n,r)}}else if(e<8){let r=H[h++],o=H[h++];if((r&128)>0||(o&128)>0){h-=6;return}if(e<7)return Pe(t,A,i,n,r,o);let s=H[h++];if((s&128)>0){h-=7;return}return Pe(t,A,i,n,r,o,s)}else{let r=H[h++],o=H[h++],s=H[h++],a=H[h++];if((r&128)>0||(o&128)>0||(s&128)>0||(a&128)>0){h-=8;return}if(e<10){if(e===8)return Pe(t,A,i,n,r,o,s,a);{let I=H[h++];if((I&128)>0){h-=9;return}return Pe(t,A,i,n,r,o,s,a,I)}}else if(e<12){let I=H[h++],c=H[h++];if((I&128)>0||(c&128)>0){h-=10;return}if(e<11)return Pe(t,A,i,n,r,o,s,a,I,c);let l=H[h++];if((l&128)>0){h-=11;return}return Pe(t,A,i,n,r,o,s,a,I,c,l)}else{let I=H[h++],c=H[h++],l=H[h++],u=H[h++];if((I&128)>0||(c&128)>0||(l&128)>0||(u&128)>0){h-=12;return}if(e<14){if(e===12)return Pe(t,A,i,n,r,o,s,a,I,c,l,u);{let g=H[h++];if((g&128)>0){h-=13;return}return Pe(t,A,i,n,r,o,s,a,I,c,l,u,g)}}else{let g=H[h++],f=H[h++];if((g&128)>0||(f&128)>0){h-=14;return}if(e<15)return Pe(t,A,i,n,r,o,s,a,I,c,l,u,g,f);let Q=H[h++];if((Q&128)>0){h-=15;return}return Pe(t,A,i,n,r,o,s,a,I,c,l,u,g,f,Q)}}}}}function Sm(){let e=H[h++],t;if(e<192)t=e-160;else switch(e){case 217:t=H[h++];break;case 218:t=ee.getUint16(h),h+=2;break;case 219:t=ee.getUint32(h),h+=4;break;default:throw new Error("Expected string")}return ds(t)}function Df(e){return ye.copyBuffers?Uint8Array.prototype.slice.call(H,h,h+=e):H.subarray(h,h+=e)}function hn(e){let t=H[h++];if(Dt[t]){let A;return Dt[t](H.subarray(h,A=h+=e),i=>{h=i;try{return Ne()}finally{h=A}})}else throw new Error("Unknown extension type "+t)}var Um=new Array(4096);function vm(){let e=H[h++];if(e>=160&&e<192){if(e=e-160,UA>=h)return Mi.slice(h-Vt,(h+=e)-Vt);if(!(UA==0&&zt<180))return Nf(e)}else return h--,Ne().toString();let t=(e<<5^(e>1?ee.getUint16(h):e>0?H[h]:0))&4095,A=Um[t],i=h,n=h+e-3,r,o=0;if(A&&A.bytes==e){for(;i{let A=Ne().map(r=>r.toString()),i=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,A.highByte=t);let n=ie[e];return n&&(n.isShared||vi)&&((ie.restoreStructures||(ie.restoreStructures=[]))[e]=n),ie[e]=A,A.read=Gf(A,i),A.read()};Dt[0]=()=>{};Dt[0].noBuffer=!0;Dt[66]=e=>{let t=e.length,A=BigInt(e[0]&128?e[0]-256:e[0]);for(let i=1;i{let e=Ne();return(NN[e[0]]||Error)(e[1])};Dt[105]=e=>{let t=ee.getUint32(h-4);jA||(jA=new Map);let A=H[h],i;A>=144&&A<160||A==220||A==221?i=[]:i={};let n={target:i};jA.set(t,n);let r=Ne();return n.used?Object.assign(i,r):(n.target=r,r)};Dt[112]=e=>{let t=ee.getUint32(h-4),A=jA.get(t);return A.used=!0,A.target};Dt[115]=()=>new Set(Ne());var Mf=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),xN=typeof globalThis=="object"?globalThis:window;Dt[116]=e=>{let t=e[0],A=Mf[t];if(!A)throw new Error("Could not find typed array for code "+t);return new xN[A](Uint8Array.prototype.slice.call(e,1).buffer)};Dt[120]=()=>{let e=Ne();return new RegExp(e[0],e[1])};var GN=[];Dt[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],A=h;return h+=t-e.length,Ve=GN,Ve=[Sm(),Sm()],Ve.position0=0,Ve.position1=0,Ve.postBundlePosition=h,h=A,Ne()};Dt[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function Rm(e){ym&&ym();let t=zt,A=h,i=Uf,n=Vt,r=UA,o=Mi,s=Sf,a=jA,I=Ve,c=new Uint8Array(H.slice(0,zt)),l=ie,u=ie.slice(0,ie.length),g=ye,f=vi,Q=e();return zt=t,h=A,Uf=i,Vt=n,UA=r,Mi=o,Sf=s,jA=a,Ve=I,H=c,vi=f,ie=l,ie.splice(0,ie.length,...u),ye=g,ee=new DataView(H.buffer,H.byteOffset,H.byteLength),Q}function ZI(){H=null,jA=null,ie=null}var WI=new Array(147);for(let e=0;e<256;e++)WI[e]=+("1e"+Math.floor(45.15-e*.30103));var jI=new pn({useRecords:!1}),HN=jI.unpack,MN=jI.unpackMultiple,vN=jI.unpack,$I={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},RN=new Float32Array(1),yv=new Uint8Array(RN.buffer,0,4);var tc;try{tc=new TextEncoder}catch{}var vf,Om,Ac=typeof Buffer<"u",ec=Ac?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,Lm=Ac?Buffer:Uint8Array,Jm=Ac?4294967296:2144337920,E,Cs,le,p=0,gt,ke=null,JN,qN=21760,KN=/[\u0080-\uFFFF]/,yr=Symbol("record-id"),En=class extends pn{constructor(t){super(t),this.offset=0;let A,i,n,r,o,s=Lm.prototype.utf8Write?function(m,J){return E.utf8Write(m,J,4294967295)}:tc&&tc.encodeInto?function(m,J){return tc.encodeInto(m,E.subarray(J)).written}:!1,a=this;t||(t={});let I=t&&t.sequential,c=t.structures||t.saveStructures,l=t.maxSharedStructures;if(l==null&&(l=c?32:0),l>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let u=t.maxOwnStructures;u==null&&(u=c?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let g=l>32||u+l>64,f=l+64,Q=l+u+64;if(Q>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let k=[],d=0,B=0;this.pack=this.encode=function(m,J){if(E||(E=new ec(8192),le=E.dataView||(E.dataView=new DataView(E.buffer,0,8192)),p=0),gt=E.length-10,gt-p<2048?(E=new ec(E.length),le=E.dataView||(E.dataView=new DataView(E.buffer,0,E.length)),gt=E.length-10,p=0):p=p+7&2147483640,i=p,J&ZN&&(p+=J&255),o=a.structuredClone?new Map:null,a.bundleStrings&&typeof m!="string"?(ke=[],ke.size=1/0):ke=null,r=a.structures,r){r.uninitialized&&(r=a._mergeStructures(a.getStructures()));let U=r.sharedLength||0;if(U>l)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let G=0;Gse.offset>ne.offset?1:-1),z=G.length,O=-1;for(;U&&z>0;){let se=G[--z].offset+i;seU.position+i?O>=0&&(O+=6):(O>=0&&(le.setUint32(U.position+i,le.getUint32(U.position+i)+O),O=-1),U=U.previous,z++)}O>=0&&U&&le.setUint32(U.position+i,le.getUint32(U.position+i)+O),p+=G.length*6,p>gt&&q(p),a.offset=p;let L=ON(E.subarray(i,p),G);return o=null,L}return a.offset=p,J&Pm?(E.start=i,E.end=p,E):E.subarray(i,p)}catch(U){throw M=U,U}finally{if(r&&(C(),n&&a.saveStructures)){let U=r.sharedLength||0,G=E.subarray(i,p),z=LN(r,a);if(!M)return a.saveStructures(z,z.isCompatible)===!1?a.pack(m,J):(a.lastNamedStructuresLength=U,G)}J&XN&&(p=i)}};let C=()=>{B<10&&B++;let m=r.sharedLength||0;if(r.length>m&&!I&&(r.length=m),d>1e4)r.transitions=null,B=0,d=0,k.length>0&&(k=[]);else if(k.length>0&&!I){for(let J=0,M=k.length;J{var J=m.length;J<16?E[p++]=144|J:J<65536?(E[p++]=220,E[p++]=J>>8,E[p++]=J&255):(E[p++]=221,le.setUint32(p,J),p+=4);for(let M=0;M{p>gt&&(E=q(p));var J=typeof m,M;if(J==="string"){let U=m.length;if(ke&&U>=4&&U<4096){if((ke.size+=U)>qN){let L,se=(ke[0]?ke[0].length*3+ke[1].length:0)+10;p+se>gt&&(E=q(p+se));let ne;ke.position?(ne=ke,E[p]=200,p+=3,E[p++]=98,L=p-i,p+=4,bm(i,D,0),le.setUint16(L+i-3,p-i-L)):(E[p++]=214,E[p++]=98,L=p-i,p+=4),ke=["",""],ke.previous=ne,ke.size=0,ke.position=L}let O=KN.test(m);ke[O?0:1]+=m,E[p++]=193,D(O?-U:U);return}let G;U<32?G=1:U<256?G=2:U<65536?G=3:G=5;let z=U*3;if(p+z>gt&&(E=q(p+z)),U<64||!s){let O,L,se,ne=p+G;for(O=0;O>6|192,E[ne++]=L&63|128):(L&64512)===55296&&((se=m.charCodeAt(O+1))&64512)===56320?(L=65536+((L&1023)<<10)+(se&1023),O++,E[ne++]=L>>18|240,E[ne++]=L>>12&63|128,E[ne++]=L>>6&63|128,E[ne++]=L&63|128):(E[ne++]=L>>12|224,E[ne++]=L>>6&63|128,E[ne++]=L&63|128);M=ne-p-G}else M=s(m,p+G);M<32?E[p++]=160|M:M<256?(G<2&&E.copyWithin(p+2,p+1,p+1+M),E[p++]=217,E[p++]=M):M<65536?(G<3&&E.copyWithin(p+3,p+2,p+2+M),E[p++]=218,E[p++]=M>>8,E[p++]=M&255):(G<5&&E.copyWithin(p+5,p+3,p+3+M),E[p++]=219,le.setUint32(p,M),p+=4),p+=M}else if(J==="number")if(m>>>0===m)m<32||m<128&&this.useRecords===!1||m<64&&!this.randomAccessStructure?E[p++]=m:m<256?(E[p++]=204,E[p++]=m):m<65536?(E[p++]=205,E[p++]=m>>8,E[p++]=m&255):(E[p++]=206,le.setUint32(p,m),p+=4);else if(m>>0===m)m>=-32?E[p++]=256+m:m>=-128?(E[p++]=208,E[p++]=m+256):m>=-32768?(E[p++]=209,le.setInt16(p,m),p+=2):(E[p++]=210,le.setInt32(p,m),p+=4);else{let U;if((U=this.useFloat32)>0&&m<4294967296&&m>=-2147483648){E[p++]=202,le.setFloat32(p,m);let G;if(U<4||(G=m*WI[(E[p]&127)<<1|E[p+1]>>7])>>0===G){p+=4;return}else p--}E[p++]=203,le.setFloat64(p,m),p+=8}else if(J==="object"||J==="function")if(!m)E[p++]=192;else{if(o){let G=o.get(m);if(G){if(!G.id){let z=o.idsToInsert||(o.idsToInsert=[]);G.id=z.push(G)}E[p++]=214,E[p++]=112,le.setUint32(p,G.id),p+=4;return}else o.set(m,{offset:p-i})}let U=m.constructor;if(U===Object)b(m,!0);else if(U===Array)y(m);else if(U===Map)if(this.mapAsEmptyObject)E[p++]=128;else{M=m.size,M<16?E[p++]=128|M:M<65536?(E[p++]=222,E[p++]=M>>8,E[p++]=M&255):(E[p++]=223,le.setUint32(p,M),p+=4);for(let[G,z]of m)D(G),D(z)}else{for(let G=0,z=vf.length;G(E=se,se=null,p+=Zt,p>gt&&q(p),{target:E,targetView:le,position:p-Zt}),D)}finally{se&&(E=se,le=ne,p=We,gt=E.length-10)}Xt&&(Xt.length+p>gt&&q(Xt.length+p),p=bN(Xt,E,p,L.type));return}}if(Array.isArray(m))y(m);else{if(m.toJSON){let G=m.toJSON();if(G!==m)return D(G)}if(J==="function")return D(this.writeFunction&&this.writeFunction(m));b(m,!m.hasOwnProperty)}}}else if(J==="boolean")E[p++]=m?195:194;else if(J==="bigint"){if(m=-(BigInt(1)<0)E[p++]=207,le.setBigUint64(p,m);else if(this.largeBigIntToFloat)E[p++]=203,le.setFloat64(p,Number(m));else if(this.useBigIntExtension&&m<2n**1023n&&m>-(2n**1023n)){E[p++]=199,p++,E[p++]=66;let U=[],G;do{let z=m&0xffn;G=(z&0x80n)===(m<0n?0x80n:0n),U.push(z),m>>=8n}while(!((m===0n||m===-1n)&&G));E[p-2]=U.length;for(let z=U.length;z>0;)E[p++]=Number(U[--z]);return}else throw new RangeError(m+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64");p+=8}else if(J==="undefined")this.encodeUndefinedAsNil?E[p++]=192:(E[p++]=212,E[p++]=0,E[p++]=0);else throw new Error("Unknown type: "+J)},F=this.variableMapSize||this.coercibleKeyAsNumber?m=>{let J=Object.keys(m),M=J.length;M<16?E[p++]=128|M:M<65536?(E[p++]=222,E[p++]=M>>8,E[p++]=M&255):(E[p++]=223,le.setUint32(p,M),p+=4);let U;if(this.coercibleKeyAsNumber)for(let G=0;G{E[p++]=222;let M=p-i;p+=2;let U=0;for(let G in m)(J||m.hasOwnProperty(G))&&(D(G),D(m[G]),U++);E[M+++i]=U>>8,E[M+i]=U&255},S=this.useRecords===!1?F:t.progressiveRecords&&!g?(m,J)=>{let M,U=r.transitions||(r.transitions=Object.create(null)),G=p++-i,z;for(let O in m)if(J||m.hasOwnProperty(O)){if(M=U[O],M)U=M;else{let L=Object.keys(m),se=U;U=r.transitions;let ne=0;for(let We=0,Xt=L.length;We{let M,U=r.transitions||(r.transitions=Object.create(null)),G=0;for(let O in m)(J||m.hasOwnProperty(O))&&(M=U[O],M||(M=U[O]=Object.create(null),G++),U=M);let z=U[yr];z?z>=96&&g?(E[p++]=((z-=96)&31)+96,E[p++]=z>>5):E[p++]=z:Z(U,U.__keys__||Object.keys(m),G);for(let O in m)(J||m.hasOwnProperty(O))&&D(m[O])},N=typeof this.useRecords=="function"&&this.useRecords,b=N?(m,J)=>{N(m)?S(m,J):F(m,J)}:S,q=m=>{let J;if(m>16777216){if(m-i>Jm)throw new Error("Packed buffer would be larger than maximum buffer size");J=Math.min(Jm,Math.round(Math.max((m-i)*(m>67108864?1.25:2),4194304)/4096)*4096)}else J=(Math.max(m-i<<2,E.length-1)>>12)+1<<12;let M=new ec(J);return le=M.dataView||(M.dataView=new DataView(M.buffer,0,J)),m=Math.min(m,E.length),E.copy?E.copy(M,0,i,m):M.set(E.slice(i,m)),p-=i,i=0,gt=M.length-10,E=M},Z=(m,J,M)=>{let U=r.nextId;U||(U=64),U=Q&&(U=f),r.nextId=U+1);let G=J.highByte=U>=96&&g?U-96>>5:-1;m[yr]=U,m.__keys__=J,r[U-64]=J,U=0?(E[p++]=(U&31)+96,E[p++]=G):E[p++]=U):(G>=0?(E[p++]=213,E[p++]=114,E[p++]=(U&31)+96,E[p++]=G):(E[p++]=212,E[p++]=114,E[p++]=U),M&&(d+=B*M),k.length>=u&&(k.shift()[yr]=0),k.push(m),D(J))},xe=(m,J,M,U)=>{let G=E,z=p,O=gt,L=i;E=Cs,p=0,i=0,E||(Cs=E=new ec(8192)),gt=E.length-10,Z(m,J,U),Cs=E;let se=p;if(E=G,p=z,gt=O,i=L,se>1){let ne=p+se-1;ne>gt&&q(ne);let We=M+i;E.copyWithin(We+se,We+1,p),E.set(Cs.slice(0,se),We),p=ne}else E[M+i]=Cs[0]},Bt=(m,J)=>{let M=JN(m,E,i,p,r,q,(U,G,z)=>{if(z)return n=!0;p=G;let O=E;return D(U),C(),O!==E?{position:p,targetView:le,target:E}:p},this);if(M===0)return b(m,!0);p=M}}useBuffer(t){E=t,le=new DataView(E.buffer,E.byteOffset,E.byteLength),p=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};Om=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Bs];vf=[{pack(e,t,A){let i=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&i>=0&&i<4294967296){let{target:n,targetView:r,position:o}=t(6);n[o++]=214,n[o++]=255,r.setUint32(o,i)}else if(i>0&&i<4294967296){let{target:n,targetView:r,position:o}=t(10);n[o++]=215,n[o++]=255,r.setUint32(o,e.getMilliseconds()*4e6+(i/1e3/4294967296>>0)),r.setUint32(o+4,i)}else if(isNaN(i)){if(this.onInvalidDate)return t(0),A(this.onInvalidDate());let{target:n,targetView:r,position:o}=t(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:r,position:o}=t(15);n[o++]=199,n[o++]=12,n[o++]=255,r.setUint32(o,e.getMilliseconds()*1e6),r.setBigInt64(o+4,BigInt(Math.floor(i)))}}},{pack(e,t,A){if(this.setAsEmptyObject)return t(0),A({});let i=Array.from(e),{target:n,position:r}=t(this.moreTypes?3:0);this.moreTypes&&(n[r++]=212,n[r++]=115,n[r++]=0),A(i)}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=101,i[n++]=0),A([e.name,e.message])}},{pack(e,t,A){let{target:i,position:n}=t(this.moreTypes?3:0);this.moreTypes&&(i[n++]=212,i[n++]=120,i[n++]=0),A([e.source,e.flags])}},{pack(e,t){this.moreTypes?qm(e,16,t):Km(Ac?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let A=e.constructor;A!==Lm&&this.moreTypes?qm(e,Mf.indexOf(A.name),t):Km(e,t)}},{pack(e,t){let{target:A,position:i}=t(1);A[i]=193}}];function qm(e,t,A,i){let n=e.byteLength;if(n+1<256){var{target:r,position:o}=A(4+n);r[o++]=199,r[o++]=n+1}else if(n+1<65536){var{target:r,position:o}=A(5+n);r[o++]=200,r[o++]=n+1>>8,r[o++]=n+1&255}else{var{target:r,position:o,targetView:s}=A(7+n);r[o++]=201,s.setUint32(o,n+1),o+=4}r[o++]=116,r[o++]=t,r.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function Km(e,t){let A=e.byteLength;var i,n;if(A<256){var{target:i,position:n}=t(A+2);i[n++]=196,i[n++]=A}else if(A<65536){var{target:i,position:n}=t(A+3);i[n++]=197,i[n++]=A>>8,i[n++]=A&255}else{var{target:i,position:n,targetView:r}=t(A+5);i[n++]=198,r.setUint32(n,A),n+=4}i.set(e,n)}function bN(e,t,A,i){let n=e.length;switch(n){case 1:t[A++]=212;break;case 2:t[A++]=213;break;case 4:t[A++]=214;break;case 8:t[A++]=215;break;case 16:t[A++]=216;break;default:n<256?(t[A++]=199,t[A++]=n):n<65536?(t[A++]=200,t[A++]=n>>8,t[A++]=n&255):(t[A++]=201,t[A++]=n>>24,t[A++]=n>>16&255,t[A++]=n>>8&255,t[A++]=n&255)}return t[A++]=i,t.set(e,A),A+=n,A}function ON(e,t){let A,i=t.length*6,n=e.length-i;for(;A=t.pop();){let r=A.offset,o=A.id;e.copyWithin(r+i,r,n),i-=6;let s=r+i;e[s++]=214,e[s++]=105,e[s++]=o>>24,e[s++]=o>>16&255,e[s++]=o>>8&255,e[s++]=o&255,n=r}return e}function bm(e,t,A){if(ke.length>0){le.setUint32(ke.position+e,p+A-ke.position-e),ke.stringsPosition=p-e;let i=ke;ke=null,t(i[0]),t(i[1])}}function LN(e,t){return e.isCompatible=A=>{let i=!A||(t.lastNamedStructuresLength||0)===A.length;return i||t._mergeStructures(A),i},e}var Ym=new En({useRecords:!1}),YN=Ym.pack,PN=Ym.pack;var{NEVER:VN,ALWAYS:zN,DECIMAL_ROUND:TN,DECIMAL_FIT:_N}=$I,Pm=512,XN=1024,ZN=2048;var bf=K(Xm(),1),Pv=bf.default.configure,Zm=bf.default;var Wm={site:{list:"0",group:"1",load:"2",update:"3"},comp:{new:"4",list:"5",group:"6",load:"7"},page:{list:"8",load:"9",cache:"10"},yjs:{um:"11",sv_local:"12",diff_local:"13",sv_remote:"14"},client:{info:"15"},code:{load:"16",edit:"17",action:"18"}},jm={0:"site.list",1:"site.group",2:"site.load",3:"site.update",4:"comp.new",5:"comp.list",6:"comp.group",7:"comp.load",8:"page.list",9:"page.load",10:"page.cache",11:"yjs.um",12:"yjs.sv_local",13:"yjs.diff_local",14:"yjs.sv_remote",15:"client.info",16:"code.load",17:"code.edit",18:"code.action"};var Ce=window;var $m=e=>Qn(`prasi-user-${e}`,"default");var ey=new En({structuredClone:!0}),Qs={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3};Ce.debug=new Proxy({},{get(e,t,A){if(t==="off")return Qs.debug=!1,localStorage.removeItem("prasi-ws-debug"),console.clear(),["WS DEBUG: Deactivated"];if(t==="on")return Qs.debug=!0,localStorage.setItem("prasi-ws-debug","1"),console.clear(),["WS DEBUG: Activated"]}});var NA={ws:null,client_id:"",idb:null,event:null},Of={action:{pending:{}}},ty=(e,t)=>{let A=ey.pack(t);Qs.debug&&console.log("%c\u2B06","color:blue",iy(A.length,0),t),e.send(A)},Ay=async e=>{let{user_id:t,site_id:A,page_id:i,events:n}=e;return NA.idb=$m(t),await A3({user_id:t,site_id:A,page_id:i},n),new lm(Wm,({target:r,trapName:o,value:s,key:a,DEFAULT:I,PROXY:c})=>{if(o==="set")throw new TypeError("target is immutable");return typeof s=="string"?(...l)=>new Promise(u=>{o3({code:s,resolve:u,args:l})}):o==="get"&&typeof s=="object"&&s!==null?c:I})},A3=(e,t)=>{let{user_id:A,page_id:i,site_id:n}=e;return NA.event=t,Ce.offline?new Promise(async r=>{r();let o="editor_start",s=await r3(o);t[o]&&t[o](s)}):new Promise((r,o)=>{if(!NA.ws){let s=0,a=()=>{let I=new URL(Ce.basehost||location.href);I.pathname="/sync",I.protocol=I.protocol==="http:"?"ws:":"wss:";let c=new WebSocket(`${I.protocol}//${I.host}${I.pathname}`);c.onopen=()=>{ty(c,{type:1,user_id:A,site_id:n,page_id:i}),NA.ws=c,t.opened()},c.onclose=async()=>{t.disconnected().reconnect?setTimeout(async()=>{s++,a()},s*Qs.reconnectTimeout):o()},c.onmessage=async l=>{let u=l.data,g=ey.unpack(Buffer.from(await u.arrayBuffer()));if(Qs.debug&&console.log("%c\u2B07","color:red",iy(u.size,0),g),g.type===0)NA.client_id=g.client_id,t.shakehand(g.client_id),r();else if(g.type===2){let f=g.event;t[f]&&(i3.includes(f)&&n3(f,g.data),t[f](g.data))}else if(g.type===4){let f=Of.action.pending[g.argid];if(f){f.resolve(g.val),delete Of.action.pending[g.argid];let Q=NA.idb;Q&&await SA(g.argid,g.val,Q)}}}};a()}})},i3=["editor_start"],n3=async(e,t)=>{let A=NA.idb;if(A){let i=await _I(`ev-${e}`);await SA(i,t,A)}},r3=async e=>{let t=NA.idb;if(t){let A=await _I(`ev-${e}`);return await kA(A,t)}},o3=async e=>{let{args:t,code:A,resolve:i}=e,n=NA.ws,r=NA.idb;if(r){let o=Zm(t),s=jm[A],a=await _I(`op-${s}-${o}`);if(n&&n.readyState===n.OPEN)Of.action.pending[a]={ts:Date.now(),resolve:i},ty(n,{type:3,code:A,args:t,argid:a});else{let I=await kA(a,r);i(I)}}};function iy(e,t){if(e==0)return"0 Bytes";var A=1024,i=t||2,n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(e)/Math.log(A));return parseFloat((e/Math.pow(A,r)).toFixed(i))+" "+n[r]}var wr={NORMAL:0,WILDCARD:1,PLACEHOLDER:2};function Fr(e={}){let t={options:e,rootNode:ry(),staticRoutesMap:{}},A=i=>e.strictTrailingSlash?i:i.replace(/\/$/,"")||"/";if(e.routes)for(let i in e.routes)ny(t,A(i),e.routes[i]);return{ctx:t,lookup:i=>s3(t,A(i)),insert:(i,n)=>ny(t,A(i),n),remove:i=>a3(t,A(i))}}function s3(e,t){let A=e.staticRoutesMap[t];if(A)return A.data;let i=t.split("/"),n={},r=!1,o=null,s=e.rootNode,a=null;for(let I=0;I{},db:null,api:null,init_local_effect:{}},page:{history:{id:"",show:!1},root_id:"root",cur:c3,doc:null,list:{},building:!1,meta:{},entry:[],tree:[],render:()=>{}},comp:{doc:null,item:null,loaded:{},list:{},group:{}},code:{},global_prop:[],ui:{comp_editable:localStorage.getItem("prasi-comp-editable")==="yes",zoom:localStorage.zoom||"100%",side:{prop:!0},layout:{left:parseInt(localStorage.getItem("prasi-layout-left")||"250"),right:parseInt(localStorage.getItem("prasi-layout-right")||"250")},prevent_indent_hook:!1,syncing:!1,tree:{item_loading:[],search:"",search_ref:null,search_mode:{Name:!0,JS:!1,HTML:!1,CSS:!1},rename_id:"",open:{}},popup:{file:{enabled:!1,open:!0,path:"/",expanded:JSON.parse(localStorage.getItem("panel-file-expanded")||"{}"),entry:{},selected:new Set,file_renaming:"",file_ctx_menu_event:null,tree:[],tree_renaming:"",tree_ctx_path:"",tree_ctx_menu_event:null,preview:!0,upload:{started:!1,progress:{}}},code:{init:!1,open:!1,name:"site",log:"",loading:!1,startup_status:"init",error:!1,show_log:!1,list:{}},page:{open:null,form:null},script:{open:!1,mode:"js",lastMode:"js",type:"item",prop_kind:"",prop_name:"",on_close:()=>{},typings:{status:"ok",err_msg:""},wb_render:()=>{}},site:null,site_form:null,comp:{preview_id:"",open:null,import:!1},comp_group:null,api:{open:!1}}}};var fy=K(rc());var By=e=>{let{item:t,item_comp:A,ids:i}=e,n=hA(A);if(dy(n,i),t.id&&(n.id=t.id),n.component){if(n.component.props&&t.component)for(let r of Object.keys(n.component.props)){let o=t.component.props[r],s=n.component.props[r];o&&(s.value=o.value,s.valueBuilt=o.valueBuilt,s.jsxCalledBy=o.jsxCalledBy,s.content=o.content)}n.component.instances=t.component?.instances,n.component.style=t.component?.style}for(let r of Object.keys(t))delete t[r];for(let[r,o]of Object.entries(n))t[r]=o},dy=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,fy.createId)()),e.id=t[e.id],e.childs)for(let A of e.childs)dy(A,t)};var Cy=e=>{for(let[t,A]of Object.entries(e.item_comp.component?.props||{})){let i=hA(A),n=e.item.component?.props;n&&n[t]&&(i.value=n[t].value,i.valueBuilt=n[t].valueBuilt,n[t].content&&(i.content=n[t].content)),i&&e.each(t,i)}};var oc=e=>{let t={};for(let[A,i]of Object.entries(e))if(A==="childs"){if(t.childs=[],i&&Array.isArray(i))for(let n of i)t.childs.push({id:n.id})}else t[A]=i;return t};var Qy=(e,t)=>{let{item:A}=t;if(A.type==="item"&&A.component?.id&&t.parent?.item.id){let i=e.comps[A.component.id];if(e.on?.visit_component&&e.on.visit_component(A,t.root||t.item),!i)return;if(i){let n;if(e.mode==="page"?(A.component.instances||(A.component.instances={}),n=A.component.instances):n=t.parent?.root_instances,n){let o=n[A.id];n[A.id]||(n[A.id]={},o=n[A.id]),By({item:A,item_comp:i,ids:o})}let r={item:oc(A),jsx_prop:t.jsx_prop,parent:{id:t.parent.item.id,comp_id:t.parent?.comp?.component?.id,instance_id:t.parent?.instance_id},instances:n};e.on?.visit&&e.on.visit(r,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[A.id]=r),Cy({item:A,item_comp:i,instance:n?n[A.id]:{},each(o,s){let a=A.component?.id;s.meta?.type==="content-element"&&a&&s.content&&(s.content.name=o,vt({...e,mode:"comp"},{item:s.content,root:t.root||s.content,is_root:!1,jsx_prop:{is_root:!0,comp_id:a,name:o},parent:{item:r.item,instance_id:A.id,comp:i,root_instances:n}}))}});for(let o of Object.values(A.childs))o.name.startsWith("jsx:")||vt({...e,mode:"comp"},{item:o,is_root:!1,root:t.root||t.item,parent:{item:A,instance_id:A.id,root_instances:n,comp:i}})}}};var vt=(e,t)=>{let A=t.item;if(A.type==="item"&&A.component?.id&&t.ignore_first_component!==!0){Qy(e,t);return}let i={item:oc(A),parent:{id:t.parent?.item.id||"root",instance_id:t.parent?.instance_id,comp_id:t.parent?.comp?.component?.id}};if(t.jsx_prop&&(i.jsx_prop=t.jsx_prop),e.on?.visit&&e.on.visit(i,A,t.root||t.item),A.id&&e.set_meta!==!1&&(e.meta[i.item.id]=i),A.childs){for(let[n,r]of Object.entries(A.childs))if(r.id){let o={item:r,is_root:!1,root:t.root||t.item,parent:{item:i.item,instance_id:t.parent?.instance_id,comp:t.parent?.comp,root_instances:t.parent?.root_instances}};t.jsx_prop&&(o.jsx_prop={...t.jsx_prop,is_root:!1}),vt(e,o)}}};var sc=async(e,t,A,i)=>{let n=new Set,r={root:t};if(vt({...e,on:{visit_component:({component:o})=>{if(o){let{id:s}=o;if(e.comps[s]||(!i||i&&!i.has(s))&&n.add(s),o?.props)for(let[a,I]of Object.entries(o.props))I.meta?.type==="content-element"&&I.content&&vt({...e,on:{visit_component:({component:c})=>{if(c){let{id:l}=c;e.comps[l]||(!i||i&&!i.has(l))&&n.add(l)}},visit(c,l){A.visit&&A.visit(c,l,r)}},set_meta:!1,note:"init-load-comp-prop"},{item:I.content})}},visit(o,s){A.visit&&A.visit(o,s,r)}},set_meta:!1,note:"init-load-comp"},{item:t,ignore_first_component:!0}),A.done&&A.done(r),n.size>0){await A.load([...n]);let o=i;o||(o=new Set),n.forEach(s=>{o&&o.add(s)});for(let s of[...o]){let a=e.comps[s];a&&await sc(e,a,A,o)}}};var p3=Qn("prasi-cache","prasi-cache-store"),wn={timeout:null,store:p3},ac=(e,t)=>{let A=[...hy(t,"navigate(",")"),...hy(t,"href = ",";")],i=e.page.cur.id;e.page.navs[i]||(e.page.navs[i]=new Set);for(let n of A)e.page.navs[i].add(n);clearTimeout(wn.timeout),wn.timeout=setTimeout(()=>{e.on_nav_loaded&&e.on_nav_loaded({urls:Array.from(e.page.navs[i])})},100)},hy=(e,t,A)=>{let i=0,n=0,r=[];for(;;){let o=e.indexOf(t,i);if(n=i,o>=0){let s=e[o+t.length];if(s==='"'||s==="'"||s==="`"){let a=e.indexOf(`${s}${A}`,o+t.length+1),I=e.substring(o+t.length+1,a);i=a+2+A.length,r.push(I)}}if(n===i)break}return r};var Ey=K(rc());var Ic=()=>{let e=document.activeElement;return!!(e&&e.attributes.getNamedItem("contenteditable"))};var py=K(rc()),cc=e=>{let{m:t,root:A,mitem:i,meta:n}=e;if(t.jsx_prop&&t.parent?.instance_id){let r=n[t.parent?.instance_id];if(r&&t.jsx_prop.is_root){let o=r.item.component?.props[t.jsx_prop.name];o&&(o.content=t.item)}}if(t.parent)if(t.parent.id==="root")t.item.id===A.id&&(t.mitem=i);else{let r=n[t.parent.id];if(r.mitem)if(t.jsx_prop?.is_root===!0){let o=r.mitem.get("component")?.get("props");if(o){let s=o.get(t.jsx_prop.name);if(s){let a=s.get("content");if(!a){let I=new Y.Map;syncronize(I,{id:(0,py.createId)(),name:t.jsx_prop.name,type:"item",dim:{w:"full",h:"full"},childs:[],adv:{css:""}}),s.set("content",I)}a&&(t.mitem=a)}}}else r.mitem.get("childs")?.forEach(o=>{o&&o.get&&o.get("id")===t.item.id&&(t.mitem=o)});if(t.item.component?.props)for(let[o,s]of Object.entries(t.item.component.props)){let a=t.mitem?.get("component")?.get("props")?.get(o);if(!a){let I=t.mitem?.get("component")?.get("props");I&&e.new_prop_jsx(t,I,o,s)}if(s.content)if(a){let I=n[s.content.id];I&&(I.mitem=a.get("content"))}else{let I=t.mitem?.get("component")?.get("props");I&&e.new_prop_jsx(t,I,o,s)}}}};var lc=(e,t,A,i)=>{if(t.parent?.id==="root")e.page.doc?.getMap("map").get("root")?.get("childs")?.forEach(n=>{n.get("id")===t.item.id&&(t.mitem=n)});else{let n=A[t.parent?.id||""];n&&n.mitem&&n.mitem.get("childs")?.forEach(r=>{r&&r.get&&r.get("id")===t.item.id&&(t.mitem=r)})}if(!t.item||!t.item.id)return console.warn("Emptry Tree Item ",t),null;if(i.find(n=>n.id===t.item.id))console.warn("Double Tree Item: ",t.item.id,t.item.name);else if(!t.parent?.comp_id)i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t});else if(t.jsx_prop)if(t.jsx_prop.is_root)t.jsx_prop.name!=="child"&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.jsx_prop.name,data:t});else{if(t.jsx_prop.name==="child"&&t.parent.instance_id){let n=A[t.parent.instance_id],r=n.item.component?.props.child.content?.id;r&&n.mitem&&A[r].item.childs.find(s=>t.item.id===s.id)&&i.push({id:t.item.id,parent:t.parent?.instance_id||"root",text:t.item.name,data:t})}t.parent.id!==t.parent.instance_id&&i.push({id:t.item.id,parent:t.parent?.id||"root",text:t.item.name,data:t})}};var uc=async(e,t,A)=>{if(e.comp.list[t])return;let i=new Y.Doc;Y.applyUpdate(i,Et(A));let n=i.getMap("map").get("root");if(n){e.comp.loaded[t]=n.toJSON(),typeof e.comp.list[t]?.on_update=="function"&&i.off("update",e.comp.list[t].on_update);let r=await gc(e,i,t);if(r){let{meta:o,tree:s}=r;e.comp.list[t]?(e.comp.list[t].meta=o,e.comp.list[t].tree=s):(e.comp.list[t]={comp:{id:t,snapshot:A},doc:i,meta:o,tree:s,async on_update(a,I){if(I==="sv_remote"||I==="local")return;let c=await e.sync?.yjs.sv_local("comp",t,Buffer.from(rA(a)));if(c){let l=Y.encodeStateAsUpdate(i,Et(c.sv));Y.applyUpdate(i,Et(c.diff),"local"),await e.sync?.yjs.diff_local("comp",t,Buffer.from(rA(l)));let u=await gc(e,e.comp.list[t].doc,t);if(u&&(e.comp.list[t].meta=u.meta,e.comp.list[t].tree=u.tree),e.comp.loaded[t]=i.getMap("map").get("root")?.toJSON(),Ic())return;IA(e),e.render()}}},i.on("update",e.comp.list[t].on_update))}}},gc=async(e,t,A)=>{let i=t.getMap("map").get("root");if(!i)return;let n={},r=[],o=i.toJSON();return e.comp.loaded[A]=o,await sc({comps:e.comp.loaded,meta:n,set_meta:!1,mode:"comp"},o,{load:async s=>{let a=s.filter(c=>!e.comp.loaded[c]),I=await e.sync?.comp.load(a,!0);if(I){let c=Object.entries(I);for(let[l,u]of c)u&&u.snapshot&&!e.comp.list[l]&&await uc(e,l,u.snapshot)}}}),vt({comps:e.comp.loaded,meta:n,mode:"comp",on:{async visit(s){lc(e,s,n,r),cc({m:s,root:o,mitem:i,meta:n,new_prop_jsx(a,I,c,l){Pf.list.push(()=>{let u=new Y.Map;l.content&&(l.content.id=(0,Ey.createId)()),syncronize(u,l),I.set(c,u)})}})}},note:"load-comp-scan-meta"},{item:o,ignore_first_component:!0}),Pf.list.length>0&&e.page.doc?.transact(()=>{for(let s of Pf.list)s()}),e.comp.loaded[A]=o,{meta:n,tree:r,item:o}},Pf={list:[]};var IA=async(e,t)=>{if(document.activeElement){let o=document.activeElement;if(o.tagName==="DIV"&&o.getAttribute("contenteditable")==="true")return}nc.should_render_main=!0;let A=e.site.layout&&e.site.layout.id===e.page.cur.id&&t?.note==="load-layout page-init";for(let[o,s]of Object.entries(e.comp.list))if(!e.comp.loaded[o]){let I=s.doc.getMap("map").get("root")?.toJSON();I&&(e.comp.loaded[o]=I)}let i=e.page.doc?.getMap("map").get("root"),n=[];i?.get("childs")?.forEach(o=>n.push(o));let r={};e.page.tree=[];for(let o of n){let s=o.toJSON();s&&vt({note:"tree-rebuild",comps:e.comp.loaded,meta:r,mode:"page",on:{async visit(a){A||((a.parent?.instance_id!==a.parent?.id||a.jsx_prop)&&lc(e,a,r,e.page.tree),cc({m:a,root:s,mitem:o,meta:r,new_prop_jsx(I,c,l,u){if(!c.get(l)){let g=new Y.Map;syncronize(g,u),c.set(l,g)}}}))}}},{item:s})}if(A)e.site.layout.meta=r;else{let o="root";if(e.site.layout&&e.site.layout.meta){for(let[s,a]of Object.entries(e.site.layout.meta))if(a.item.name==="content"){o=a.item.id;break}e.page.root_id=o}if(e.site.layout&&e.site.layout.id===e.page.cur.id)e.page.meta=r;else if(o!=="root"){for(let s of Object.values(r))s.parent?.id==="root"&&(s.parent.id=o);e.page.meta={...e.site.layout.meta,...r}}else e.page.meta=r}};function Es(e,t){return function(){return e.apply(t,arguments)}}var{toString:E3}=Object.prototype,{getPrototypeOf:Tf}=Object,Bc=(e=>t=>{let A=E3.call(t);return e[A]||(e[A]=A.slice(8,-1).toLowerCase())})(Object.create(null)),xA=e=>(e=e.toLowerCase(),t=>Bc(t)===e),dc=e=>t=>typeof t===e,{isArray:Dr}=Array,ms=dc("undefined");function m3(e){return e!==null&&!ms(e)&&e.constructor!==null&&!ms(e.constructor)&&Tt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var wy=xA("ArrayBuffer");function y3(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&wy(e.buffer),t}var w3=dc("string"),Tt=dc("function"),Fy=dc("number"),Cc=e=>e!==null&&typeof e=="object",F3=e=>e===!0||e===!1,fc=e=>{if(Bc(e)!=="object")return!1;let t=Tf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},D3=xA("Date"),k3=xA("File"),S3=xA("Blob"),U3=xA("FileList"),N3=e=>Cc(e)&&Tt(e.pipe),x3=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Tt(e.append)&&((t=Bc(e))==="formdata"||t==="object"&&Tt(e.toString)&&e.toString()==="[object FormData]"))},G3=xA("URLSearchParams"),H3=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ys(e,t,{allOwnKeys:A=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),Dr(e))for(i=0,n=e.length;i0;)if(n=A[i],t===n.toLowerCase())return n;return null}var ky=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Sy=e=>!ms(e)&&e!==ky;function zf(){let{caseless:e}=Sy(this)&&this||{},t={},A=(i,n)=>{let r=e&&Dy(t,n)||n;fc(t[r])&&fc(i)?t[r]=zf(t[r],i):fc(i)?t[r]=zf({},i):Dr(i)?t[r]=i.slice():t[r]=i};for(let i=0,n=arguments.length;i(ys(t,(n,r)=>{A&&Tt(n)?e[r]=Es(n,A):e[r]=n},{allOwnKeys:i}),e),v3=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),R3=(e,t,A,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),A&&Object.assign(e.prototype,A)},J3=(e,t,A,i)=>{let n,r,o,s={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),r=n.length;r-- >0;)o=n[r],(!i||i(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=A!==!1&&Tf(e)}while(e&&(!A||A(e,t))&&e!==Object.prototype);return t},q3=(e,t,A)=>{e=String(e),(A===void 0||A>e.length)&&(A=e.length),A-=t.length;let i=e.indexOf(t,A);return i!==-1&&i===A},K3=e=>{if(!e)return null;if(Dr(e))return e;let t=e.length;if(!Fy(t))return null;let A=new Array(t);for(;t-- >0;)A[t]=e[t];return A},b3=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Tf(Uint8Array)),O3=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let r=n.value;t.call(e,r[0],r[1])}},L3=(e,t)=>{let A,i=[];for(;(A=e.exec(t))!==null;)i.push(A);return i},Y3=xA("HTMLFormElement"),P3=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(A,i,n){return i.toUpperCase()+n}),my=(({hasOwnProperty:e})=>(t,A)=>e.call(t,A))(Object.prototype),V3=xA("RegExp"),Uy=(e,t)=>{let A=Object.getOwnPropertyDescriptors(e),i={};ys(A,(n,r)=>{let o;(o=t(n,r,e))!==!1&&(i[r]=o||n)}),Object.defineProperties(e,i)},z3=e=>{Uy(e,(t,A)=>{if(Tt(e)&&["arguments","caller","callee"].indexOf(A)!==-1)return!1;let i=e[A];if(Tt(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+A+"'")})}})},T3=(e,t)=>{let A={},i=n=>{n.forEach(r=>{A[r]=!0})};return Dr(e)?i(e):i(String(e).split(t)),A},_3=()=>{},X3=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Vf="abcdefghijklmnopqrstuvwxyz",yy="0123456789",Ny={DIGIT:yy,ALPHA:Vf,ALPHA_DIGIT:Vf+Vf.toUpperCase()+yy},Z3=(e=16,t=Ny.ALPHA_DIGIT)=>{let A="",{length:i}=t;for(;e--;)A+=t[Math.random()*i|0];return A};function W3(e){return!!(e&&Tt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var j3=e=>{let t=new Array(10),A=(i,n)=>{if(Cc(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let r=Dr(i)?[]:{};return ys(i,(o,s)=>{let a=A(o,n+1);!ms(a)&&(r[s]=a)}),t[n]=void 0,r}}return i};return A(e,0)},$3=xA("AsyncFunction"),ex=e=>e&&(Cc(e)||Tt(e))&&Tt(e.then)&&Tt(e.catch),w={isArray:Dr,isArrayBuffer:wy,isBuffer:m3,isFormData:x3,isArrayBufferView:y3,isString:w3,isNumber:Fy,isBoolean:F3,isObject:Cc,isPlainObject:fc,isUndefined:ms,isDate:D3,isFile:k3,isBlob:S3,isRegExp:V3,isFunction:Tt,isStream:N3,isURLSearchParams:G3,isTypedArray:b3,isFileList:U3,forEach:ys,merge:zf,extend:M3,trim:H3,stripBOM:v3,inherits:R3,toFlatObject:J3,kindOf:Bc,kindOfTest:xA,endsWith:q3,toArray:K3,forEachEntry:O3,matchAll:L3,isHTMLForm:Y3,hasOwnProperty:my,hasOwnProp:my,reduceDescriptors:Uy,freezeMethods:z3,toObjectSet:T3,toCamelCase:P3,noop:_3,toFiniteNumber:X3,findKey:Dy,global:ky,isContextDefined:Sy,ALPHABET:Ny,generateString:Z3,isSpecCompliantForm:W3,toJSONObject:j3,isAsyncFn:$3,isThenable:ex};function kr(e,t,A,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),A&&(this.config=A),i&&(this.request=i),n&&(this.response=n)}w.inherits(kr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:w.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var xy=kr.prototype,Gy={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Gy[e]={value:e}});Object.defineProperties(kr,Gy);Object.defineProperty(xy,"isAxiosError",{value:!0});kr.from=(e,t,A,i,n,r)=>{let o=Object.create(xy);return w.toFlatObject(e,o,function(a){return a!==Error.prototype},s=>s!=="isAxiosError"),kr.call(o,e.message,t,A,i,n),o.cause=e,o.name=e.name,r&&Object.assign(o,r),o};var j=kr;var Qc=null;function _f(e){return w.isPlainObject(e)||w.isArray(e)}function My(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function Hy(e,t,A){return e?e.concat(t).map(function(n,r){return n=My(n),!A&&r?"["+n+"]":n}).join(A?".":""):t}function tx(e){return w.isArray(e)&&!e.some(_f)}var Ax=w.toFlatObject(w,{},null,function(t){return/^is[A-Z]/.test(t)});function ix(e,t,A){if(!w.isObject(e))throw new TypeError("target must be an object");t=t||new(Qc||FormData),A=w.toFlatObject(A,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Q,k){return!w.isUndefined(k[Q])});let i=A.metaTokens,n=A.visitor||c,r=A.dots,o=A.indexes,a=(A.Blob||typeof Blob<"u"&&Blob)&&w.isSpecCompliantForm(t);if(!w.isFunction(n))throw new TypeError("visitor must be a function");function I(f){if(f===null)return"";if(w.isDate(f))return f.toISOString();if(!a&&w.isBlob(f))throw new j("Blob is not supported. Use a Buffer instead.");return w.isArrayBuffer(f)||w.isTypedArray(f)?a&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function c(f,Q,k){let d=f;if(f&&!k&&typeof f=="object"){if(w.endsWith(Q,"{}"))Q=i?Q:Q.slice(0,-2),f=JSON.stringify(f);else if(w.isArray(f)&&tx(f)||(w.isFileList(f)||w.endsWith(Q,"[]"))&&(d=w.toArray(f)))return Q=My(Q),d.forEach(function(C,y){!(w.isUndefined(C)||C===null)&&t.append(o===!0?Hy([Q],y,r):o===null?Q:Q+"[]",I(C))}),!1}return _f(f)?!0:(t.append(Hy(k,Q,r),I(f)),!1)}let l=[],u=Object.assign(Ax,{defaultVisitor:c,convertValue:I,isVisitable:_f});function g(f,Q){if(!w.isUndefined(f)){if(l.indexOf(f)!==-1)throw Error("Circular reference detected in "+Q.join("."));l.push(f),w.forEach(f,function(d,B){(!(w.isUndefined(d)||d===null)&&n.call(t,d,w.isString(B)?B.trim():B,Q,u))===!0&&g(d,Q?Q.concat(B):[B])}),l.pop()}}if(!w.isObject(e))throw new TypeError("data must be an object");return g(e),t}var qi=ix;function vy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Ry(e,t){this._pairs=[],e&&qi(e,this,t)}var Jy=Ry.prototype;Jy.append=function(t,A){this._pairs.push([t,A])};Jy.toString=function(t){let A=t?function(i){return t.call(this,i,vy)}:vy;return this._pairs.map(function(n){return A(n[0])+"="+A(n[1])},"").join("&")};var hc=Ry;function nx(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ws(e,t,A){if(!t)return e;let i=A&&A.encode||nx,n=A&&A.serialize,r;if(n?r=n(t,A):r=w.isURLSearchParams(t)?t.toString():new hc(t,A).toString(i),r){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}var Xf=class{constructor(){this.handlers=[]}use(t,A,i){return this.handlers.push({fulfilled:t,rejected:A,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){w.forEach(this.handlers,function(i){i!==null&&t(i)})}},Zf=Xf;var pc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var qy=typeof URLSearchParams<"u"?URLSearchParams:hc;var Ky=typeof FormData<"u"?FormData:null;var by=typeof Blob<"u"?Blob:null;var Oy={isBrowser:!0,classes:{URLSearchParams:qy,FormData:Ky,Blob:by},protocols:["http","https","file","blob","url","data"]};var Wf={};J0(Wf,{hasBrowserEnv:()=>Ly,hasStandardBrowserEnv:()=>rx,hasStandardBrowserWebWorkerEnv:()=>ox});var Ly=typeof window<"u"&&typeof document<"u",rx=(e=>Ly&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),ox=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var ut={...Wf,...Oy};function jf(e,t){return qi(e,new ut.classes.URLSearchParams,Object.assign({visitor:function(A,i,n,r){return ut.isNode&&w.isBuffer(A)?(this.append(i,A.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function sx(e){return w.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function ax(e){let t={},A=Object.keys(e),i,n=A.length,r;for(i=0;i=A.length;return o=!o&&w.isArray(n)?n.length:o,a?(w.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!s):((!n[o]||!w.isObject(n[o]))&&(n[o]=[]),t(A,i,n[o],r)&&w.isArray(n[o])&&(n[o]=ax(n[o])),!s)}if(w.isFormData(e)&&w.isFunction(e.entries)){let A={};return w.forEachEntry(e,(i,n)=>{t(sx(i),n,A,0)}),A}return null}var Ec=Ix;function lx(e,t,A){if(w.isString(e))try{return(t||JSON.parse)(e),w.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(A||JSON.stringify)(e)}var $f={transitional:pc,adapter:["xhr","http"],transformRequest:[function(t,A){let i=A.getContentType()||"",n=i.indexOf("application/json")>-1,r=w.isObject(t);if(r&&w.isHTMLForm(t)&&(t=new FormData(t)),w.isFormData(t))return n?JSON.stringify(Ec(t)):t;if(w.isArrayBuffer(t)||w.isBuffer(t)||w.isStream(t)||w.isFile(t)||w.isBlob(t))return t;if(w.isArrayBufferView(t))return t.buffer;if(w.isURLSearchParams(t))return A.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1)return jf(t,this.formSerializer).toString();if((s=w.isFileList(t))||i.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return qi(s?{"files[]":t}:t,a&&new a,this.formSerializer)}}return r||n?(A.setContentType("application/json",!1),lx(t)):t}],transformResponse:[function(t){let A=this.transitional||$f.transitional,i=A&&A.forcedJSONParsing,n=this.responseType==="json";if(t&&w.isString(t)&&(i&&!this.responseType||n)){let o=!(A&&A.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(s){if(o)throw s.name==="SyntaxError"?j.from(s,j.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ut.classes.FormData,Blob:ut.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch"],e=>{$f.headers[e]={}});var Sr=$f;var gx=w.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Yy=e=>{let t={},A,i,n;return e&&e.split(` +`).forEach(function(o){n=o.indexOf(":"),A=o.substring(0,n).trim().toLowerCase(),i=o.substring(n+1).trim(),!(!A||t[A]&&gx[A])&&(A==="set-cookie"?t[A]?t[A].push(i):t[A]=[i]:t[A]=t[A]?t[A]+", "+i:i)}),t};var Py=Symbol("internals");function Fs(e){return e&&String(e).trim().toLowerCase()}function mc(e){return e===!1||e==null?e:w.isArray(e)?e.map(mc):String(e)}function ux(e){let t=Object.create(null),A=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=A.exec(e);)t[i[1]]=i[2];return t}var fx=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function eB(e,t,A,i,n){if(w.isFunction(i))return i.call(this,t,A);if(n&&(t=A),!!w.isString(t)){if(w.isString(i))return t.indexOf(i)!==-1;if(w.isRegExp(i))return i.test(t)}}function Bx(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,A,i)=>A.toUpperCase()+i)}function dx(e,t){let A=w.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+A,{value:function(n,r,o){return this[i].call(this,t,n,r,o)},configurable:!0})})}var Ur=class{constructor(t){t&&this.set(t)}set(t,A,i){let n=this;function r(s,a,I){let c=Fs(a);if(!c)throw new Error("header name must be a non-empty string");let l=w.findKey(n,c);(!l||n[l]===void 0||I===!0||I===void 0&&n[l]!==!1)&&(n[l||a]=mc(s))}let o=(s,a)=>w.forEach(s,(I,c)=>r(I,c,a));return w.isPlainObject(t)||t instanceof this.constructor?o(t,A):w.isString(t)&&(t=t.trim())&&!fx(t)?o(Yy(t),A):t!=null&&r(A,t,i),this}get(t,A){if(t=Fs(t),t){let i=w.findKey(this,t);if(i){let n=this[i];if(!A)return n;if(A===!0)return ux(n);if(w.isFunction(A))return A.call(this,n,i);if(w.isRegExp(A))return A.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,A){if(t=Fs(t),t){let i=w.findKey(this,t);return!!(i&&this[i]!==void 0&&(!A||eB(this,this[i],i,A)))}return!1}delete(t,A){let i=this,n=!1;function r(o){if(o=Fs(o),o){let s=w.findKey(i,o);s&&(!A||eB(i,i[s],s,A))&&(delete i[s],n=!0)}}return w.isArray(t)?t.forEach(r):r(t),n}clear(t){let A=Object.keys(this),i=A.length,n=!1;for(;i--;){let r=A[i];(!t||eB(this,this[r],r,t,!0))&&(delete this[r],n=!0)}return n}normalize(t){let A=this,i={};return w.forEach(this,(n,r)=>{let o=w.findKey(i,r);if(o){A[o]=mc(n),delete A[r];return}let s=t?Bx(r):String(r).trim();s!==r&&delete A[r],A[s]=mc(n),i[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let A=Object.create(null);return w.forEach(this,(i,n)=>{i!=null&&i!==!1&&(A[n]=t&&w.isArray(i)?i.join(", "):i)}),A}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,A])=>t+": "+A).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...A){let i=new this(t);return A.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[Py]=this[Py]={accessors:{}}).accessors,n=this.prototype;function r(o){let s=Fs(o);i[s]||(dx(n,o),i[s]=!0)}return w.isArray(t)?t.forEach(r):r(t),this}};Ur.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);w.reduceDescriptors(Ur.prototype,({value:e},t)=>{let A=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[A]=i}}});w.freezeMethods(Ur);var ft=Ur;function Ds(e,t){let A=this||Sr,i=t||A,n=ft.from(i.headers),r=i.data;return w.forEach(e,function(s){r=s.call(A,r,n.normalize(),t?t.status:void 0)}),n.normalize(),r}function ks(e){return!!(e&&e.__CANCEL__)}function Vy(e,t,A){j.call(this,e??"canceled",j.ERR_CANCELED,t,A),this.name="CanceledError"}w.inherits(Vy,j,{__CANCEL__:!0});var Ki=Vy;function tB(e,t,A){let i=A.config.validateStatus;!A.status||!i||i(A.status)?e(A):t(new j("Request failed with status code "+A.status,[j.ERR_BAD_REQUEST,j.ERR_BAD_RESPONSE][Math.floor(A.status/100)-4],A.config,A.request,A))}var zy=ut.hasStandardBrowserEnv?{write(e,t,A,i,n,r){let o=[e+"="+encodeURIComponent(t)];w.isNumber(A)&&o.push("expires="+new Date(A).toGMTString()),w.isString(i)&&o.push("path="+i),w.isString(n)&&o.push("domain="+n),r===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function AB(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function iB(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ss(e,t){return e&&!AB(t)?iB(e,t):t}var Ty=ut.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),A=document.createElement("a"),i;function n(r){let o=r;return t&&(A.setAttribute("href",o),o=A.href),A.setAttribute("href",o),{href:A.href,protocol:A.protocol?A.protocol.replace(/:$/,""):"",host:A.host,search:A.search?A.search.replace(/^\?/,""):"",hash:A.hash?A.hash.replace(/^#/,""):"",hostname:A.hostname,port:A.port,pathname:A.pathname.charAt(0)==="/"?A.pathname:"/"+A.pathname}}return i=n(window.location.href),function(o){let s=w.isString(o)?n(o):o;return s.protocol===i.protocol&&s.host===i.host}}():function(){return function(){return!0}}();function nB(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Cx(e,t){e=e||10;let A=new Array(e),i=new Array(e),n=0,r=0,o;return t=t!==void 0?t:1e3,function(a){let I=Date.now(),c=i[r];o||(o=I),A[n]=a,i[n]=I;let l=r,u=0;for(;l!==n;)u+=A[l++],l=l%e;if(n=(n+1)%e,n===r&&(r=(r+1)%e),I-o{let r=n.loaded,o=n.lengthComputable?n.total:void 0,s=r-A,a=i(s),I=r<=o;A=r;let c={loaded:r,total:o,progress:o?r/o:void 0,bytes:s,rate:a||void 0,estimated:a&&o&&I?(o-r)/a:void 0,event:n};c[t?"download":"upload"]=!0,e(c)}}var Qx=typeof XMLHttpRequest<"u",Zy=Qx&&function(e){return new Promise(function(A,i){let n=e.data,r=ft.from(e.headers).normalize(),{responseType:o,withXSRFToken:s}=e,a;function I(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}let c;if(w.isFormData(n)){if(ut.hasStandardBrowserEnv||ut.hasStandardBrowserWebWorkerEnv)r.setContentType(!1);else if((c=r.getContentType())!==!1){let[Q,...k]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];r.setContentType([Q||"multipart/form-data",...k].join("; "))}}let l=new XMLHttpRequest;if(e.auth){let Q=e.auth.username||"",k=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";r.set("Authorization","Basic "+btoa(Q+":"+k))}let u=Ss(e.baseURL,e.url);l.open(e.method.toUpperCase(),ws(u,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function g(){if(!l)return;let Q=ft.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),d={data:!o||o==="text"||o==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:Q,config:e,request:l};tB(function(C){A(C),I()},function(C){i(C),I()},d),l=null}if("onloadend"in l?l.onloadend=g:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(g)},l.onabort=function(){l&&(i(new j("Request aborted",j.ECONNABORTED,e,l)),l=null)},l.onerror=function(){i(new j("Network Error",j.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let k=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",d=e.transitional||pc;e.timeoutErrorMessage&&(k=e.timeoutErrorMessage),i(new j(k,d.clarifyTimeoutError?j.ETIMEDOUT:j.ECONNABORTED,e,l)),l=null},ut.hasStandardBrowserEnv&&(s&&w.isFunction(s)&&(s=s(e)),s||s!==!1&&Ty(u))){let Q=e.xsrfHeaderName&&e.xsrfCookieName&&zy.read(e.xsrfCookieName);Q&&r.set(e.xsrfHeaderName,Q)}n===void 0&&r.setContentType(null),"setRequestHeader"in l&&w.forEach(r.toJSON(),function(k,d){l.setRequestHeader(d,k)}),w.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),o&&o!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",Xy(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Xy(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=Q=>{l&&(i(!Q||Q.type?new Ki(null,e,l):Q),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));let f=nB(u);if(f&&ut.protocols.indexOf(f)===-1){i(new j("Unsupported protocol "+f+":",j.ERR_BAD_REQUEST,e));return}l.send(n||null)})};var rB={http:Qc,xhr:Zy};w.forEach(rB,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var Wy=e=>`- ${e}`,hx=e=>w.isFunction(e)||e===null||e===!1,yc={getAdapter:e=>{e=w.isArray(e)?e:[e];let{length:t}=e,A,i,n={};for(let r=0;r`adapter ${s} `+(a===!1?"is not supported by the environment":"is not available in the build")),o=t?r.length>1?`since : +`+r.map(Wy).join(` +`):" "+Wy(r[0]):"as no adapter specified";throw new j("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i},adapters:rB};function oB(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ki(null,e)}function wc(e){return oB(e),e.headers=ft.from(e.headers),e.data=Ds.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),yc.getAdapter(e.adapter||Sr.adapter)(e).then(function(i){return oB(e),i.data=Ds.call(e,e.transformResponse,i),i.headers=ft.from(i.headers),i},function(i){return ks(i)||(oB(e),i&&i.response&&(i.response.data=Ds.call(e,e.transformResponse,i.response),i.response.headers=ft.from(i.response.headers))),Promise.reject(i)})}var jy=e=>e instanceof ft?e.toJSON():e;function $A(e,t){t=t||{};let A={};function i(I,c,l){return w.isPlainObject(I)&&w.isPlainObject(c)?w.merge.call({caseless:l},I,c):w.isPlainObject(c)?w.merge({},c):w.isArray(c)?c.slice():c}function n(I,c,l){if(w.isUndefined(c)){if(!w.isUndefined(I))return i(void 0,I,l)}else return i(I,c,l)}function r(I,c){if(!w.isUndefined(c))return i(void 0,c)}function o(I,c){if(w.isUndefined(c)){if(!w.isUndefined(I))return i(void 0,I)}else return i(void 0,c)}function s(I,c,l){if(l in t)return i(I,c);if(l in e)return i(void 0,I)}let a={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(I,c)=>n(jy(I),jy(c),!0)};return w.forEach(Object.keys(Object.assign({},e,t)),function(c){let l=a[c]||n,u=l(e[c],t[c],c);w.isUndefined(u)&&l!==s||(A[c]=u)}),A}var Fc="1.6.7";var sB={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{sB[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});var $y={};sB.transitional=function(t,A,i){function n(r,o){return"[Axios v"+Fc+"] Transitional option '"+r+"'"+o+(i?". "+i:"")}return(r,o,s)=>{if(t===!1)throw new j(n(o," has been removed"+(A?" in "+A:"")),j.ERR_DEPRECATED);return A&&!$y[o]&&($y[o]=!0,console.warn(n(o," has been deprecated since v"+A+" and will be removed in the near future"))),t?t(r,o,s):!0}};function px(e,t,A){if(typeof e!="object")throw new j("options must be an object",j.ERR_BAD_OPTION_VALUE);let i=Object.keys(e),n=i.length;for(;n-- >0;){let r=i[n],o=t[r];if(o){let s=e[r],a=s===void 0||o(s,r,e);if(a!==!0)throw new j("option "+r+" must be "+a,j.ERR_BAD_OPTION_VALUE);continue}if(A!==!0)throw new j("Unknown option "+r,j.ERR_BAD_OPTION)}}var Dc={assertOptions:px,validators:sB};var bi=Dc.validators,Nr=class{constructor(t){this.defaults=t,this.interceptors={request:new Zf,response:new Zf}}async request(t,A){try{return await this._request(t,A)}catch(i){if(i instanceof Error){let n;Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error;let r=n.stack?n.stack.replace(/^.+\n/,""):"";i.stack?r&&!String(i.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(i.stack+=` +`+r):i.stack=r}throw i}}_request(t,A){typeof t=="string"?(A=A||{},A.url=t):A=t||{},A=$A(this.defaults,A);let{transitional:i,paramsSerializer:n,headers:r}=A;i!==void 0&&Dc.assertOptions(i,{silentJSONParsing:bi.transitional(bi.boolean),forcedJSONParsing:bi.transitional(bi.boolean),clarifyTimeoutError:bi.transitional(bi.boolean)},!1),n!=null&&(w.isFunction(n)?A.paramsSerializer={serialize:n}:Dc.assertOptions(n,{encode:bi.function,serialize:bi.function},!0)),A.method=(A.method||this.defaults.method||"get").toLowerCase();let o=r&&w.merge(r.common,r[A.method]);r&&w.forEach(["delete","get","head","post","put","patch","common"],f=>{delete r[f]}),A.headers=ft.concat(o,r);let s=[],a=!0;this.interceptors.request.forEach(function(Q){typeof Q.runWhen=="function"&&Q.runWhen(A)===!1||(a=a&&Q.synchronous,s.unshift(Q.fulfilled,Q.rejected))});let I=[];this.interceptors.response.forEach(function(Q){I.push(Q.fulfilled,Q.rejected)});let c,l=0,u;if(!a){let f=[wc.bind(this),void 0];for(f.unshift.apply(f,s),f.push.apply(f,I),u=f.length,c=Promise.resolve(A);l{if(!i._listeners)return;let r=i._listeners.length;for(;r-- >0;)i._listeners[r](n);i._listeners=null}),this.promise.then=n=>{let r,o=new Promise(s=>{i.subscribe(s),r=s}).then(n);return o.cancel=function(){i.unsubscribe(r)},o},t(function(r,o,s){i.reason||(i.reason=new Ki(r,o,s),A(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let A=this._listeners.indexOf(t);A!==-1&&this._listeners.splice(A,1)}static source(){let t;return{token:new e(function(n){t=n}),cancel:t}}},ew=aB;function IB(e){return function(A){return e.apply(null,A)}}function cB(e){return w.isObject(e)&&e.isAxiosError===!0}var lB={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lB).forEach(([e,t])=>{lB[t]=e});var tw=lB;function Aw(e){let t=new Us(e),A=Es(Us.prototype.request,t);return w.extend(A,Us.prototype,t,{allOwnKeys:!0}),w.extend(A,t,null,{allOwnKeys:!0}),A.create=function(n){return Aw($A(e,n))},A}var He=Aw(Sr);He.Axios=Us;He.CanceledError=Ki;He.CancelToken=ew;He.isCancel=ks;He.VERSION=Fc;He.toFormData=qi;He.AxiosError=j;He.Cancel=He.CanceledError;He.all=function(t){return Promise.all(t)};He.spread=IB;He.isAxiosError=cB;He.mergeConfig=$A;He.AxiosHeaders=ft;He.formToJSON=e=>Ec(w.isHTMLForm(e)?new FormData(e):e);He.getAdapter=yc.getAdapter;He.HttpStatusCode=tw;He.default=He;var kc=He;var{Axios:U1,AxiosError:N1,CanceledError:x1,isCancel:G1,CancelToken:H1,VERSION:M1,all:v1,Cancel:R1,isAxiosError:J1,spread:q1,toFormData:K1,AxiosHeaders:b1,HttpStatusCode:O1,formToJSON:L1,getAdapter:Y1,mergeConfig:P1}=kc;BigInt.prototype.toJSON=function(){return"BigInt::"+this.toString()};var Ex=typeof window<"u"?window:null,xr=async(e,t,A)=>{let i={...A},n=null,r=!1,o=null,s=[];if(Array.isArray(t))for(let I of t)I instanceof File&&(s.push(I),r=!0),typeof I=="function"&&(o=I);else t instanceof File&&(r=!0,s.push(t));if(!r)n=JSON.stringify(t),i["content-type"]="aplication/json";else{let I=new FormData;for(let c of s)I.append(c.name,c);n=I,delete i["content-type"],i.enctype="multipart/form-data;"}let a=new URL(e);if(Ex!==null){let I=new URL(location.href),c="";if(a.host===I.host?c=a.toString():c=`${I.protocol}//${I.host}/_proxy/${encodeURIComponent(a.toString())}`,c){if(o)return(await kc({method:t?"post":void 0,url:c,data:n,onUploadProgress:o})).data;{let u=await(await fetch(c,t?{method:"POST",body:n,headers:i}:void 0)).text();try{return JSON.parse(u)}catch{return u}}}}return null};var pw=K(hw());var Gr=async(e,t)=>{let A=(0,pw.default)(e,"/"),i=await xr(Wx(A,"/_prasi/_")),n="";i&&i.prasi&&(n=i.prasi);let r=Zx(A);if(n==="v2")await new Promise(o=>{let s=document,a=s.createElement("script");a.onload=async()=>{o()},localStorage.getItem("api-ts-"+A)||localStorage.setItem("api-ts-"+A,Date.now().toString());let I=localStorage.getItem("api-ts-"+A);t?a.src=`${r}/_prasi/load.js?url=${A}&v3&dev=1&ts=${I}`:a.src=`${r}/_prasi/load.js?url=${A}&v3&ts=${I}`,document.querySelector(`script[src="${a.src}"]`)?o():s.body.appendChild(a)});else{let o=await fetch(r+"/_prasi/api-entry");if(Ce.prasiApi[A]={apiEntry:(await o.json()).srv},t){let s=await fetch(r+"/_prasi/api-types");Ce.prasiApi[A].apiTypes=await s.text(),Ce.prasiApi[A].prismaTypes={"prisma.d.ts":await BB(`${r}/_prasi/prisma/index.d.ts`),"runtime/index.d.ts":await BB(`${r}/_prasi/prisma/runtime/index.d.ts`),"runtime/library.d.ts":await BB(`${r}/_prasi/prisma/runtime/library.d.ts`)}}}},Zx=e=>{let t=new URL(e);return`${t.protocol}//${t.host}`},Wx=(e,t)=>{let A=new URL(e);return A.pathname=t,A.toString()},BB=async(e,t)=>await(await fetch(e)).text();var Ns={},Hr=e=>{Ce.prasiApi||(Ce.prasiApi={});try{let t=new URL(e),A=`${t.protocol}//${t.host}`;return Ce.prasiApi[A]||Ns[A]||(Ns[A]=Gr(A,location.hostname.includes("prasi"))),new Proxy({},{get:(i,n)=>{if(n==="_url")return(o,s)=>{let a=new URL(A);a.pathname=o.split("/").filter(l=>l).join("/");let I=new URL(location.href),c="";return a.host===I.host||s===!1?c=a.toString():c=`${I.protocol}//${I.host}/_proxy/${encodeURIComponent(a.toString())}`,c};let r=o=>function(...s){return new Promise(async(a,I)=>{try{let c=Ce.prasiApi[A];if(!c&&Ns&&typeof Ns[A]=="object"&&(await Ns[A],c=Ce.prasiApi[A]),c){if(o==="_raw"){let g=s[0],f=`${A}${g}`,Q=await Ew(f,s.slice(1));a(Q);return}if(c.apiEntry||(c.apiEntry={}),c.apiEntry&&!c.apiEntry[o]){I(`API ${o.toString()} not found, existing API: - ${Object.keys(c.apiEntry||{}).join(` - - `)}`);return}let u=c.apiEntry[o].url,l=c.apiEntry[o].args;if(u&&l){if(s.length>0&&l.length>0)for(let[h,U]of Object.entries(s)){let d=l[parseInt(h)];l&&l.includes(d)&&U&&typeof U!="string"&&typeof U!="number"||(u=u.replace(`:${d}?`,U+""),u=u.replace(`:${d}`,U+""))}let g=`${A}${u}`,B=await Mm(g,s);I(B)}else console.error(`API Not Found: ${o.toString()}`)}else a("Failed to load API: "+A)}catch(c){a(c)}})};return n==="then"?new Proxy({},{get:(o,s)=>r(s)}):r(n)}})}catch{return console.warn("Init API failed for URL: ",JSON.stringify(e)),null}},Mm=async(e,t)=>await fr(e,t,{"content-type":"application/json"});var Rm=R(qm());var Cr=e=>{let t="";return new Proxy({},{get(A,i){return i==="_tables"?()=>Va({name:t,action:"definition",table:"*"},e):i==="_definition"?n=>Va({name:t,action:"definition",table:n},e):i.startsWith("$")?(...n)=>Va({name:t,action:"query",table:i,params:n},e):new Proxy({},{get(n,r){return async(...o)=>(i==="query"&&(i=r,r="query"),await Va({name:t,action:r,table:i,params:o},e))}})}})},Ya={},Va=async(e,t)=>{let A=new URL(t);A.pathname="/_dbs",e.table&&(A.pathname+=`/${e.table}`);let i=A.toString(),n=(0,Rm.default)(e),r=Ya[n];if(!r||r&&Date.now()-r.timestamp>1e3){Ya[n]={timestamp:Date.now(),promise:fr(i,e,{"content-type":"application/json"}),result:null};let o=await Ya[n].promise;return Ya[n].result=o,o}return await r.promise};function B3(e){let t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}function f3(e){return e?new Promise((t,A)=>{let i="$importModule$"+Math.random().toString(32).slice(2),n=document.createElement("script"),r=()=>{delete window[i],n.onerror=null,n.onload=null,n.remove(),URL.revokeObjectURL(n.src),n.src=""};n.defer=!0,n.type="module",n.onerror=()=>{A(new Error(`Failed to import: ${e}`)),r()},n.onload=()=>{t(window[i]),r()};let s=`import * as m from "${fe.basehost?fe.basehost+e:B3(e)}"; window.${i} = m;`,I=new Blob([s],{type:"text/javascript"});n.src=URL.createObjectURL(I),document.head.appendChild(n)}):""}var za=f3;var hr=e=>({isMobile:e.mode==="mobile",isDesktop:e.mode==="desktop",isEditor:location.pathname.startsWith("/ed/")});var Pa=async e=>{let t=window;t.exports||(t.exports={});let A=await _db.site.findFirst({where:{id:e.site.id},include:{component_site:!0}});if(A){if(A.component_site)for(let o of A.component_site){let s=`/npm/site/${o.id_site}/site.js`;await za(s)}let i=e.site.api_url;if(i||(i=(A.config||{}).api_url||""),!i)return;try{let o=new URL(i);if(i&&o.hostname)try{await dr(i,!0)}catch{console.warn("Failed to load API:",i)}}catch{}let n=`/npm/site/${e.site.id}/site.js`;await za(n),e.site.db.get()||e.site.db.set(Cr(i)),e.site.api.get()||e.site.api.set(Qr(i));let r=window;if(A.js_compiled){let o=A.config,s=(a,c)=>(o.api_url&&!c.api&&(c.api=e.site.api.get(),c.db=e.site.db.get()),c.params=r.params,c.module={},new Function(...Object.keys(c),a)(...Object.values(c))),I={...hr({site:e.site,mode:e.mode}),types:{},exports:r.exports,load:za,render:e.render,module:{exports:{}}};if(await s(A.js_compiled,I),I.module.exports)for(let[a,c]of Object.entries(I.module.exports))r.exports[a]=c}}};var Km=(e,t=0)=>{let A=3735928559^t,i=1103547991^t;for(let n=0,r;n>>16,2246822507),A^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(A^A>>>13,3266489909),4294967296*(2097151&i)+(A>>>0)};var d3=new TextEncoder,Om=async e=>{let t=e.site.config.api_url;try{let A=new URL(t);if(t&&A.hostname){await dr(t,!0);let i=fe.prasiApi[t];if(i&&i.apiTypes&&i.prismaTypes){let n=JSON.stringify({api:i.apiTypes,prisma:i.prismaTypes}),r=Km(n),o=await e.sync?.code.action({type:"check-typings",site_id:e.site.id,hash:r});if(o?.type==="check-typings"&&!o.hash){let s=Buffer.from($t(d3.encode(n)));e.sync?.code.action({type:"push-typings",site_id:e.site.id,body:s,hash:r})}}}}catch{console.warn("Failed to load API:",t)}if(e.site.code.snapshot)for(let[A,i]of Object.entries(e.site.code.snapshot)){let n=new Y.Doc;Y.applyUpdate(n,dt(i.bin)),e.code[A]={doc:n};let r=e.code[A].doc;if(r){let o=r.getMap("map").get("files")?.get("index.js");Lm(e,o),iA(e),e.render(),r.on("update",(s,I)=>{let a=r.getMap("map").get("files")?.get("index.js");Lm(e,a),iA(e),e.render()})}}},Lm=(e,t)=>{if(t){let A=window;e.site.config.api_url&&(A.db=Cr(e.site.config.api_url),A.api=Qr(e.site.config.api_url));let i=_a(t);if(e.global_prop=Object.keys(i),typeof i=="object")for(let[n,r]of Object.entries(i))A[n]=r}};var IB=async(e,t,A)=>{e.site=t,!e.script.db&&!e.script.api&&(e.site.code.mode==="old"?await Pa({mode:e.mode,site:{api_url:e.site.config.api_url,id:e.site.id,api:{get(){return e.script.api},set(i){e.script.api=i}},db:{get(){return e.script.db},set(i){e.script.db=i}}},render:()=>{}}):await Om(e))};var bm=async(e,t,A,i)=>{if(!e.sync)return;e.status="reload";let n=await e.sync.page.load(t);if(!n){e.status="page-not-found",e.render();return}if(n.comps)for(let[r,o]of Object.entries(n.comps))o&&o.snapshot&&await ba(e,r,o.snapshot);if(e.page.cur=n,n.snapshot){let r=new Y.Doc;Y.applyUpdate(r,dt(n.snapshot));let o=e.page.list[n.id];o||(e.page.list[n.id]={},o=e.page.list[n.id]),o.on_update&&o.doc&&o.doc.off("update",o.on_update),o.on_update=async(s,I)=>{if(I==="local"||!e.sync)return;if(o.page.id!==n.id){alert(`Page ID Mismatch! - Refreshing to preventing data loss...`),location.reload();return}let a=await e.sync.yjs.sv_local("page",e.page.cur.id,Buffer.from($t(s)));if(a){let c=Y.encodeStateAsUpdate(r,dt(a.sv));Y.applyUpdate(r,dt(a.diff),"local"),Ra()||await iA(e,{note:A+" page-on-update"}),await e.sync.yjs.diff_local("page",e.page.cur.id,Buffer.from($t(c))),e.ui.syncing=!1,e.page.entry=r.getMap("map").get("root")?.get("childs")?.map(u=>u.get("id")),Ha.should_render_main&&e.render()}},r.on("update",o.on_update),e.page.doc=r,e.page.doc&&(o.page=e.page.cur,o.doc=e.page.doc,e.page.entry=e.page.doc.getMap("map").get("root")?.get("childs")?.map(s=>s.get("id")),Array.isArray(e.page.entry)||e.sync.code.action({type:"flush-page-cache",page_id:t}).then(()=>{location.reload()})),e.page.doc&&await iA(e,{note:A+" page-init"})}e.status="ready",i!==!1&&e.render()};var Ym=R(Ie()),Q3=new TextDecoder,Bn={list:[],route:null},C3=e=>{let t=JSON.parse(localStorage.getItem("prasi-session")||"null");if(!t&&location.pathname.startsWith("/ed/"))return location.href="/login",(0,Ym.jsx)(_i,{note:"logging in"});if(t?.data?.user?(e.user.id=t.data.user.id,e.user.username=t.data.user.username):(e.user.id="ab1390f5-40d5-448e-a8c3-84b0fb600930",e.user.username="anonymous"),location.pathname.startsWith("/vi/")){if(Bn.list.length===0){_db.page.findMany({where:{id_site:params.site_id,is_deleted:!1,is_default_layout:!1},select:{id:!0,url:!0}}).then(n=>{Bn.list=n,C3(e)});return}if(!Bn.route){Bn.route=Br();for(let n of Bn.list)Bn.route.insert(n.url,n)}let i="/"+location.pathname.split("/").slice(3).join("/");if(!params.page_id){let n=Bn.route.lookup(i);if(n&&(params.page_id=n.id,n.params))for(let[r,o]of Object.entries(n.params))["site_id","page_id"].includes(r)||(params[r]=o)}}if(!params.page_id&&location.pathname.startsWith("/ed"))return params.site_id?_db.page.findFirst({where:{is_deleted:!1,is_default_layout:!1,id_site:params.site_id},select:{id:!0,id_site:!0}}).then(async A=>{if(A)location.href=`/ed/${params.site_id}/${A.id}`;else{let i=await _db.page.create({data:{content_tree:{childs:[],id:"root",type:"root"},name:"home",url:"/",site:{connect:{id:params.site_id}}}});i&&(location.href=`/ed/${params.site_id}/${i.id}`)}}):_db.page.findFirst({where:{is_deleted:!1,is_default_layout:!1,site:{id_user:e.user.id}},select:{id:!0,id_site:!0}}).then(A=>{A&&(location.href=`/ed/${A.id_site}/${A.id}`)}),!1;if(e.sync){if(e.site.id==="--loading--")return!1;if(params.site_id!==e.site.id)return e.site=uA(tB),e.site.id="--loading--",e.ui.popup.code.init=!1,e.sync.site.load(params.site_id).then(async A=>{A?(await IB(e,A,"from-sync"),e.render()):(alert("Site not found. redirecting..."),location.href="/ed/")}),!1;if(!e.page.cur.id&&!params.page_id&¶ms.site_id&&location.pathname.startsWith("/ed/"))return _db.page.findFirst({where:{is_deleted:!1,is_default_layout:!1,id_site:params.site_id},select:{id:!0}}).then(A=>{A&&(location.href=`/ed/${params.site_id}/${A.id}`)}),!1}return!e.sync&&!e.sync_assigned?(e.sync_assigned=!0,ZE({user_id:e.user.id,site_id:params.site_id,page_id:params.page_id,events:{opened(){fe.offline?(console.log("reconnected!"),fe.offline=!1,e.ui.syncing=!0,e.render()):(fe.offline=!1,e.render())},shakehand(A){e.user.client_id=A},disconnected(){return console.log("offline, reconnecting..."),fe.offline=!0,e.render(),{reconnect:!0}},async editor_start(A){params.site_id!==A.site_id||params.page_id!==A.page_id?e.page.cur.id||(e.site.id=A.site_id,e.page.cur.id=A.page_id,location.pathname.startsWith("/ed/")&&(location.href=`/ed/${A.site_id}/${A.page_id}`)):(e.site.id=A.site_id,e.page.cur.id=A.page_id,e.render())},site_updated(A){for(let[i,n]of Object.entries(A))i==="js"||i==="js_compiled"?e.site[i]=Q3.decode(dt(n)):e.site[i]=n;e.render()},async remote_svlocal(A){let i=null;if(A.type==="page"&&e.page.cur.id===A.id?i=e.page.doc:A.type==="comp"&&e.comp.list[A.id]?i=e.comp.list[A.id].doc:A.type==="code"&&(i=e.code.site.doc),i&&e.sync){let n=kp(i,dt(A.sv_local)),r=Np(i),o=Buffer.from($t(r)),s=Buffer.from($t(n)),I=await e.sync.yjs.sv_remote(A.type,A.id,o,s);if(I){if(Dp(i,dt(I.diff),"sv_remote"),A.type==="page")delete e.preview.meta_cache[A.id],await iA(e,{note:"sv_remote"});else if(A.type==="comp"){let a=await Oa(e,i,A.id);a&&(e.comp.list[A.id].meta=a.meta,e.comp.list[A.id].tree=a.tree),await iA(e,{note:"sv_remote"})}e.render()}}}}}).then(A=>{e.sync=A}),!1):params.page_id!==e.page.cur.id&&location.pathname.startsWith("/ed")?(bm(e,params.page_id,"change page"),!1):!0},_a=src=>{if(src){let module={exports:{__esModule:!0}};eval(`try { + - `)}`);return}let l=c.apiEntry[o].url,u=c.apiEntry[o].args;if(l&&u){if(s.length>0&&u.length>0)for(let[Q,k]of Object.entries(s)){let d=u[parseInt(Q)];u&&u.includes(d)&&k&&typeof k!="string"&&typeof k!="number"||(l=l.replace(`:${d}?`,k+""),l=l.replace(`:${d}`,k+""))}let g=`${A}${l}`,f=await Ew(g,s);a(f)}else console.error(`API Not Found: ${o.toString()}`)}else I("Failed to load API: "+A)}catch(c){I(c)}})};return n==="then"?new Proxy({},{get:(o,s)=>r(s)}):r(n)}})}catch{return console.warn("Init API failed for URL: ",JSON.stringify(e)),null}},Ew=async(e,t)=>await xr(e,t,{"content-type":"application/json"});var Fw=K(ww());var Mr=e=>{let t="";return new Proxy({},{get(A,i){return i==="_tables"?()=>Uc({name:t,action:"definition",table:"*"},e):i==="_definition"?n=>Uc({name:t,action:"definition",table:n},e):i.startsWith("$")?(...n)=>Uc({name:t,action:"query",table:i,params:n},e):new Proxy({},{get(n,r){return async(...o)=>(i==="query"&&(i=r,r="query"),await Uc({name:t,action:r,table:i,params:o},e))}})}})},Sc={},Uc=async(e,t)=>{let A=new URL(t);A.pathname="/_dbs",e.table&&(A.pathname+=`/${e.table}`);let i=A.toString(),n=(0,Fw.default)(e),r=Sc[n];if(!r||r&&Date.now()-r.timestamp>1e3){Sc[n]={timestamp:Date.now(),promise:xr(i,e,{"content-type":"application/json"}),result:null};let o=await Sc[n].promise;return Sc[n].result=o,o}return await r.promise};function AG(e){let t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}function iG(e){return e?new Promise((t,A)=>{let i="$importModule$"+Math.random().toString(32).slice(2),n=document.createElement("script"),r=()=>{delete window[i],n.onerror=null,n.onload=null,n.remove(),URL.revokeObjectURL(n.src),n.src=""};n.defer=!0,n.type="module",n.onerror=()=>{A(new Error(`Failed to import: ${e}`)),r()},n.onload=()=>{t(window[i]),r()};let s=`import * as m from "${Ce.basehost?Ce.basehost+e:AG(e)}"; window.${i} = m;`,a=new Blob([s],{type:"text/javascript"});n.src=URL.createObjectURL(a),document.head.appendChild(n)}):""}var Nc=iG;var vr=e=>({isMobile:e.mode==="mobile",isDesktop:e.mode==="desktop",isEditor:location.pathname.startsWith("/ed/")});var xc=async e=>{let t=window;t.exports||(t.exports={});let A=await _db.site.findFirst({where:{id:e.site.id},include:{component_site:!0}});if(A){if(A.component_site)for(let o of A.component_site){let s=`/npm/site/${o.id_site}/site.js`;await Nc(s)}let i=e.site.api_url;if(i||(i=(A.config||{}).api_url||""),!i)return;try{let o=new URL(i);if(i&&o.hostname)try{await Gr(i,!0)}catch{console.warn("Failed to load API:",i)}}catch{}let n=`/npm/site/${e.site.id}/site.js`;await Nc(n),e.site.db.get()||e.site.db.set(Mr(i)),e.site.api.get()||e.site.api.set(Hr(i));let r=window;if(A.js_compiled){let o=A.config,s=(I,c)=>(o.api_url&&!c.api&&(c.api=e.site.api.get(),c.db=e.site.db.get()),c.params=r.params,c.module={},new Function(...Object.keys(c),I)(...Object.values(c))),a={...vr({site:e.site,mode:e.mode}),types:{},exports:r.exports,load:Nc,render:e.render,module:{exports:{}}};if(await s(A.js_compiled,a),a.module.exports)for(let[I,c]of Object.entries(a.module.exports))r.exports[I]=c}}};var Dw=(e,t=0)=>{let A=3735928559^t,i=1103547991^t;for(let n=0,r;n>>16,2246822507),A^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(A^A>>>13,3266489909),4294967296*(2097151&i)+(A>>>0)};var nG=new TextEncoder,Sw=async e=>{let t=e.site.config.api_url;try{let A=new URL(t);if(t&&A.hostname){await Gr(t,!0);let i=Ce.prasiApi[t];if(i&&i.apiTypes&&i.prismaTypes){let n=JSON.stringify({api:i.apiTypes,prisma:i.prismaTypes}),r=Dw(n),o=await e.sync?.code.action({type:"check-typings",site_id:e.site.id,hash:r});if(o?.type==="check-typings"&&!o.hash){let s=Buffer.from(rA(nG.encode(n)));e.sync?.code.action({type:"push-typings",site_id:e.site.id,body:s,hash:r})}}}}catch{console.warn("Failed to load API:",t)}if(e.site.code.snapshot)for(let[A,i]of Object.entries(e.site.code.snapshot)){let n=new Y.Doc;Y.applyUpdate(n,Et(i.bin)),e.code[A]={doc:n};let r=e.code[A].doc;if(r){let o=r.getMap("map").get("files")?.get("index.js");kw(e,o),IA(e),e.render(),r.on("update",(s,a)=>{let I=r.getMap("map").get("files")?.get("index.js");kw(e,I),IA(e),e.render()})}}},kw=(e,t)=>{if(t){let A=window;e.site.config.api_url&&(A.db=Mr(e.site.config.api_url),A.api=Hr(e.site.config.api_url));let i=Gc(t);if(e.global_prop=Object.keys(i),typeof i=="object")for(let[n,r]of Object.entries(i))A[n]=r}};var dB=async(e,t,A)=>{e.site=t,!e.script.db&&!e.script.api&&(e.site.code.mode==="old"?await xc({mode:e.mode,site:{api_url:e.site.config.api_url,id:e.site.id,api:{get(){return e.script.api},set(i){e.script.api=i}},db:{get(){return e.script.db},set(i){e.script.db=i}}},render:()=>{}}):await Sw(e))};var Uw=async(e,t,A,i)=>{if(!e.sync)return;e.status="reload";let n=await e.sync.page.load(t);if(!n){e.status="page-not-found",e.render();return}if(n.comps)for(let[r,o]of Object.entries(n.comps))o&&o.snapshot&&await uc(e,r,o.snapshot);if(e.page.cur=n,n.snapshot){let r=new Y.Doc;Y.applyUpdate(r,Et(n.snapshot));let o=e.page.list[n.id];o||(e.page.list[n.id]={},o=e.page.list[n.id]),o.on_update&&o.doc&&o.doc.off("update",o.on_update),o.on_update=async(s,a)=>{if(a==="local"||!e.sync)return;if(o.page.id!==n.id){alert(`Page ID Mismatch! + Refreshing to preventing data loss...`),location.reload();return}let I=await e.sync.yjs.sv_local("page",e.page.cur.id,Buffer.from(rA(s)));if(I){let c=Y.encodeStateAsUpdate(r,Et(I.sv));Y.applyUpdate(r,Et(I.diff),"local"),Ic()||await IA(e,{note:A+" page-on-update"}),await e.sync.yjs.diff_local("page",e.page.cur.id,Buffer.from(rA(c))),e.ui.syncing=!1,e.page.entry=r.getMap("map").get("root")?.get("childs")?.map(l=>l.get("id")),nc.should_render_main&&e.render()}},r.on("update",o.on_update),e.page.doc=r,e.page.doc&&(o.page=e.page.cur,o.doc=e.page.doc,e.page.entry=e.page.doc.getMap("map").get("root")?.get("childs")?.map(s=>s.get("id")),Array.isArray(e.page.entry)||e.sync.code.action({type:"flush-page-cache",page_id:t}).then(()=>{location.reload()})),e.page.doc&&await IA(e,{note:A+" page-init"})}e.status="ready",i!==!1&&e.render()};var Nw=K(ce()),rG=new TextDecoder,Fn={list:[],route:null},oG=e=>{let t=JSON.parse(localStorage.getItem("prasi-session")||"null");if(!t&&location.pathname.startsWith("/ed/"))return location.href="/login",(0,Nw.jsx)(rn,{note:"logging in"});if(t?.data?.user?(e.user.id=t.data.user.id,e.user.username=t.data.user.username):(e.user.id="ab1390f5-40d5-448e-a8c3-84b0fb600930",e.user.username="anonymous"),location.pathname.startsWith("/vi/")){if(Fn.list.length===0){_db.page.findMany({where:{id_site:params.site_id,is_deleted:!1,is_default_layout:!1},select:{id:!0,url:!0}}).then(n=>{Fn.list=n,oG(e)});return}if(!Fn.route){Fn.route=Fr();for(let n of Fn.list)Fn.route.insert(n.url,n)}let i="/"+location.pathname.split("/").slice(3).join("/");if(!params.page_id){let n=Fn.route.lookup(i);if(n&&(params.page_id=n.id,n.params))for(let[r,o]of Object.entries(n.params))["site_id","page_id"].includes(r)||(params[r]=o)}}if(!params.page_id&&location.pathname.startsWith("/ed"))return params.site_id?_db.page.findFirst({where:{is_deleted:!1,is_default_layout:!1,id_site:params.site_id},select:{id:!0,id_site:!0}}).then(async A=>{if(A)location.href=`/ed/${params.site_id}/${A.id}`;else{let i=await _db.page.create({data:{content_tree:{childs:[],id:"root",type:"root"},name:"home",url:"/",site:{connect:{id:params.site_id}}}});i&&(location.href=`/ed/${params.site_id}/${i.id}`)}}):_db.page.findFirst({where:{is_deleted:!1,is_default_layout:!1,site:{id_user:e.user.id}},select:{id:!0,id_site:!0}}).then(A=>{A&&(location.href=`/ed/${A.id_site}/${A.id}`)}),!1;if(e.sync){if(e.site.id==="--loading--")return!1;if(params.site_id!==e.site.id)return e.site=hA(Lf),e.site.id="--loading--",e.ui.popup.code.init=!1,e.sync.site.load(params.site_id).then(async A=>{A?(await dB(e,A,"from-sync"),e.render()):(alert("Site not found. redirecting..."),location.href="/ed/")}),!1;if(!e.page.cur.id&&!params.page_id&¶ms.site_id&&location.pathname.startsWith("/ed/"))return _db.page.findFirst({where:{is_deleted:!1,is_default_layout:!1,id_site:params.site_id},select:{id:!0}}).then(A=>{A&&(location.href=`/ed/${params.site_id}/${A.id}`)}),!1}return!e.sync&&!e.sync_assigned?(e.sync_assigned=!0,Ay({user_id:e.user.id,site_id:params.site_id,page_id:params.page_id,events:{opened(){Ce.offline?(console.log("reconnected!"),Ce.offline=!1,e.ui.syncing=!0,e.render()):(Ce.offline=!1,e.render())},shakehand(A){e.user.client_id=A},disconnected(){return console.log("offline, reconnecting..."),Ce.offline=!0,e.render(),{reconnect:!0}},async editor_start(A){params.site_id!==A.site_id||params.page_id!==A.page_id?e.page.cur.id||(e.site.id=A.site_id,e.page.cur.id=A.page_id,location.pathname.startsWith("/ed/")&&(location.href=`/ed/${A.site_id}/${A.page_id}`)):(e.site.id=A.site_id,e.page.cur.id=A.page_id,e.render())},site_updated(A){for(let[i,n]of Object.entries(A))i==="js"||i==="js_compiled"?e.site[i]=rG.decode(Et(n)):e.site[i]=n;e.render()},async remote_svlocal(A){let i=null;if(A.type==="page"&&e.page.cur.id===A.id?i=e.page.doc:A.type==="comp"&&e.comp.list[A.id]?i=e.comp.list[A.id].doc:A.type==="code"&&(i=e.code.site.doc),i&&e.sync){let n=HE(i,Et(A.sv_local)),r=RE(i),o=Buffer.from(rA(r)),s=Buffer.from(rA(n)),a=await e.sync.yjs.sv_remote(A.type,A.id,o,s);if(a){if(GE(i,Et(a.diff),"sv_remote"),A.type==="page")delete e.preview.meta_cache[A.id],await IA(e,{note:"sv_remote"});else if(A.type==="comp"){let I=await gc(e,i,A.id);I&&(e.comp.list[A.id].meta=I.meta,e.comp.list[A.id].tree=I.tree),await IA(e,{note:"sv_remote"})}e.render()}}}}}).then(A=>{e.sync=A}),!1):params.page_id!==e.page.cur.id&&location.pathname.startsWith("/ed")?(Uw(e,params.page_id,"change page"),!1):!0},Gc=src=>{if(src){let module={exports:{__esModule:!0}};eval(`try { ${src} } catch(e) { console.error(e); - }`);let result={...module.exports};return result.__esModule&&delete result.__esModule,result}return{}};var tc=R(Ye());var Vm=(e,t)=>{e.status="loading",e.on_status_changes&&e.on_status_changes(e.status),e.site.id=t.site_id,e.site.api_url=t.api_url,!e.site.api&&!e.site.db?e.site.code.mode==="old"&&Pa({site:{id:e.site.id,api_url:e.site.api_url,api:{get(){return e.site.api},set(A){e.site.api=A}},db:{get(){return e.site.db},set(A){e.site.db=A}}},render:e.render}).then(()=>{e.status="ready",e.on_status_changes&&e.on_status_changes(e.status),e.render()}):(e.status="ready",e.on_status_changes&&e.on_status_changes(e.status))};var Ni={ts:0,status:"init",meta:{},entry:[],tick:0,mode:"desktop",site:{id:"",api_url:"",api:null,db:null,code:{mode:"old"}},script:{init_local_effect:void 0},visit:void 0,on_status_changes:void 0,layout:void 0,page:{cur:{id:""},navs:{}},on_preload:void 0};var Sy=R(Ye());var ve=R(Ye()),aB=class extends ve.Component{displayName="ReactUseErrorBoundary";componentDidCatch(...t){this.setState({}),this.props.onError(...t)}render(){return this.props.children}},h3=()=>!1,zm=(0,ve.createContext)({componentDidCatch:{current:void 0},error:void 0,setError:h3});function Pm({children:e}){let[t,A]=(0,ve.useState)(),i=(0,ve.useRef)(),n=(0,ve.useMemo)(()=>({componentDidCatch:i,error:t,setError:A}),[t]);return ve.default.createElement(zm.Provider,{value:n},ve.default.createElement(aB,{error:t,onError:(r,o)=>{A(r),i.current?.(r,o)}},e))}Pm.displayName="ReactUseErrorBoundaryContext";function _m(e){function t(A){return ve.default.createElement(Pm,null,ve.default.createElement(e,{key:"WrappedComponent",...A}))}return t.displayName=`WithErrorBoundary(${e.displayName??e.name??"Component"})`,t}function Xm(e){let t=(0,ve.useContext)(zm);t.componentDidCatch.current=e;let A=(0,ve.useCallback)(()=>{t.setError(void 0)},[]);return[t.error,A]}var bt=R(Ie()),FA=_m(({children:e,meta:t,id:A,silent:i=!0})=>{let n=di({retrying:!1,meta:t}),[r,o]=Xm((I,a)=>{i!==!0&&console.warn(I)});t&&n.meta!==t&&(n.meta=t,setTimeout(o));let s=t;return r?(0,bt.jsxs)("div",{className:"bg-red-100 border border-red-300 rounded-sm text-xs flex flex-col items-center",children:[(0,bt.jsxs)("div",{className:"text-[10px] font-bold text-red-900 self-stretch px-1",children:["ERROR ",s?.item.name?"["+s.item.name+"]:":""]}),(0,bt.jsx)("p",{className:"border-b border-red-300 px-1 pb-1 min-w-[100px]",children:n.retrying?(0,bt.jsx)(bt.Fragment,{children:"Retrying..."}):(0,bt.jsx)(bt.Fragment,{children:r.message})}),(0,bt.jsx)("div",{className:"p-1",children:(0,bt.jsx)("button",{onClick:()=>{n.retrying=!0,n.render(),setTimeout(()=>{n.retrying=!1,n.render(),o()},100)},className:"bg-white border border-white hover:border-red-400 hover:bg-red-50 rounded px-2",children:"Try again"})})]}):e});var mt=(e,t,A,i)=>{let n=e[t];return A==="desktop"||!A?!n&&e.mobile&&e.mobile[t]&&(n=e.mobile[t]):e.mobile&&e.mobile[t]&&(n=e.mobile[t]),n||(n=i),n};var Tm=(e,t)=>{let A=mt(e,"adv",t,{});return typeof A.css=="string"&&A.css.trim()?cx(css` + }`);let result={...module.exports};return result.__esModule&&delete result.__esModule,result}return{}};var bc=K(ze());var xw=(e,t)=>{e.status="loading",e.on_status_changes&&e.on_status_changes(e.status),e.site.id=t.site_id,e.site.api_url=t.api_url,!e.site.api&&!e.site.db?e.site.code.mode==="old"&&xc({site:{id:e.site.id,api_url:e.site.api_url,api:{get(){return e.site.api},set(A){e.site.api=A}},db:{get(){return e.site.db},set(A){e.site.db=A}}},render:e.render}).then(()=>{e.status="ready",e.on_status_changes&&e.on_status_changes(e.status),e.render()}):(e.status="ready",e.on_status_changes&&e.on_status_changes(e.status))};var Oi={ts:0,status:"init",meta:{},entry:[],tick:0,mode:"desktop",site:{id:"",api_url:"",api:null,db:null,code:{mode:"old"}},script:{init_local_effect:void 0},visit:void 0,on_status_changes:void 0,layout:void 0,page:{cur:{id:""},navs:{}},on_preload:void 0};var B0=K(ze());var qe=K(ze()),CB=class extends qe.Component{displayName="ReactUseErrorBoundary";componentDidCatch(...t){this.setState({}),this.props.onError(...t)}render(){return this.props.children}},sG=()=>!1,Gw=(0,qe.createContext)({componentDidCatch:{current:void 0},error:void 0,setError:sG});function Hw({children:e}){let[t,A]=(0,qe.useState)(),i=(0,qe.useRef)(),n=(0,qe.useMemo)(()=>({componentDidCatch:i,error:t,setError:A}),[t]);return qe.default.createElement(Gw.Provider,{value:n},qe.default.createElement(CB,{error:t,onError:(r,o)=>{A(r),i.current?.(r,o)}},e))}Hw.displayName="ReactUseErrorBoundaryContext";function Mw(e){function t(A){return qe.default.createElement(Hw,null,qe.default.createElement(e,{key:"WrappedComponent",...A}))}return t.displayName=`WithErrorBoundary(${e.displayName??e.name??"Component"})`,t}function vw(e){let t=(0,qe.useContext)(Gw);t.componentDidCatch.current=e;let A=(0,qe.useCallback)(()=>{t.setError(void 0)},[]);return[t.error,A]}var _t=K(ce()),GA=Mw(({children:e,meta:t,id:A,silent:i=!0})=>{let n=wi({retrying:!1,meta:t}),[r,o]=vw((a,I)=>{i!==!0&&console.warn(a)});t&&n.meta!==t&&(n.meta=t,setTimeout(o));let s=t;return r?(0,_t.jsxs)("div",{className:"bg-red-100 border border-red-300 rounded-sm text-xs flex flex-col items-center",children:[(0,_t.jsxs)("div",{className:"text-[10px] font-bold text-red-900 self-stretch px-1",children:["ERROR ",s?.item.name?"["+s.item.name+"]:":""]}),(0,_t.jsx)("p",{className:"border-b border-red-300 px-1 pb-1 min-w-[100px]",children:n.retrying?(0,_t.jsx)(_t.Fragment,{children:"Retrying..."}):(0,_t.jsx)(_t.Fragment,{children:r.message})}),(0,_t.jsx)("div",{className:"p-1",children:(0,_t.jsx)("button",{onClick:()=>{n.retrying=!0,n.render(),setTimeout(()=>{n.retrying=!1,n.render(),o()},100)},className:"bg-white border border-white hover:border-red-400 hover:bg-red-50 rounded px-2",children:"Try again"})})]}):e});var kt=(e,t,A,i)=>{let n=e[t];return A==="desktop"||!A?!n&&e.mobile&&e.mobile[t]&&(n=e.mobile[t]):e.mobile&&e.mobile[t]&&(n=e.mobile[t]),n||(n=i),n};var Rw=(e,t)=>{let A=kt(e,"adv",t,{});return typeof A.css=="string"&&A.css.trim()?cx(css` ${A.css} - `,t):""};var Zm=(e,t)=>{let A=mt(e,"bg",t,{size:"contain",pos:"center"}),i=`${serverurl}${A.url}`;return A&&A.url&&A.url.startsWith("http")&&(i=A.url),cx(` + `,t):""};var Jw=(e,t)=>{let A=kt(e,"bg",t,{size:"contain",pos:"center"}),i=`${serverurl}${A.url}`;return A&&A.url&&A.url.startsWith("http")&&(i=A.url),cx(` background-repeat: no-repeat; `,A.color&&` background-color: ${A.color}; @@ -54,7 +59,7 @@ ${d}`),B.pop(),`{${F}}`}case"number":return isFinite(g)?String(g):t?t(g):"null"; background-size: ${A.size}; `,A.pos&&` background-position: ${A.pos}; - `)};var gy=R(cy());var ly=(e,t)=>{let A=mt(e,"border",t,{style:"solid",stroke:{},rounded:{tr:0,tl:0,bl:0,br:0},color:"transparent"});return cx(DA(A,"stroke.l","border-left-width"),DA(A,"stroke.r","border-right-width"),DA(A,"stroke.b","border-bottom-width"),DA(A,"stroke.t","border-top-width"),DA(A,"color","border-color","transparent"),DA(A,"style","border-style","dashed"),DA(A,"rounded.tl","border-top-left-radius"),DA(A,"rounded.tr","border-top-right-radius"),DA(A,"rounded.bl","border-bottom-left-radius"),DA(A,"rounded.br","border-bottom-right-radius"))},DA=(e,t,A,i)=>{let n=(0,gy.default)(e,t);if(i)return n?`${A}: ${n};`:`${A}: ${i};`;if(n)return`${A}: ${n}px;`};var uy=(e,t,A)=>{let i=mt(e,"dim",t,{h:"fit",w:"fit"});return i.w==="full"&&i.h==="full"?` + `)};var jw=K(Ww());var $w=(e,t)=>{let A=kt(e,"border",t,{style:"solid",stroke:{},rounded:{tr:0,tl:0,bl:0,br:0},color:"transparent"});return cx(HA(A,"stroke.l","border-left-width"),HA(A,"stroke.r","border-right-width"),HA(A,"stroke.b","border-bottom-width"),HA(A,"stroke.t","border-top-width"),HA(A,"color","border-color","transparent"),HA(A,"style","border-style","dashed"),HA(A,"rounded.tl","border-top-left-radius"),HA(A,"rounded.tr","border-top-right-radius"),HA(A,"rounded.bl","border-bottom-left-radius"),HA(A,"rounded.br","border-bottom-right-radius"))},HA=(e,t,A,i)=>{let n=(0,jw.default)(e,t);if(i)return n?`${A}: ${n};`:`${A}: ${i};`;if(n)return`${A}: ${n}px;`};var e0=(e,t,A)=>{let i=kt(e,"dim",t,{h:"fit",w:"fit"});return i.w==="full"&&i.h==="full"?` width:100%; height:100%; flex:1; @@ -73,7 +78,7 @@ ${d}`),B.pop(),`{${F}}`}case"number":return isFinite(g)?String(g):t?t(g):"null"; `,i.h&&typeof i.h=="number"&&i.h>=0&&` height: ${i.h}${i.hUnit||"px"}; overflow-y: clip; - `)};var By=({item:e,hover:t,active:A})=>cx(t&&css` + `)};var t0=({item:e,hover:t,active:A})=>cx(t&&css` & { box-shadow: inset 0 0 0px 3px #bae3fd; > img { @@ -85,7 +90,7 @@ ${d}`),B.pop(),`{${F}}`}case"number":return isFinite(g)?String(g):t?t(g):"null"; > img { opacity: 0.6; } - `);var Er=window,fy=(e,t)=>{let A=mt(e,"font",t,{});if(A.family){Er.loadedFonts||(Er.loadedFonts=[]);let n=`:wght@${[300,400,500,600].join(";")}`,r=A.family.replace(/ /g,"+");if(Er.loadedFonts.indexOf(A.family)<0){Er.loadedFonts.push(A.family);let o=document,s=`https://prasi.avolut.com/_font/css2?family=${r}${n}`;if(!o.querySelector(`link[href="${s}]`)){let I=o.createElement("link");I.type="text/css",I.rel="stylesheet",I.href=s,o.head.appendChild(I)}}}return!A.family&&Er.defaultFont&&(A.family=Er.defaultFont),cx(A.color&&` + `);var Jr=window,A0=(e,t)=>{let A=kt(e,"font",t,{});if(A.family){Jr.loadedFonts||(Jr.loadedFonts=[]);let n=`:wght@${[300,400,500,600].join(";")}`,r=A.family.replace(/ /g,"+");if(Jr.loadedFonts.indexOf(A.family)<0){Jr.loadedFonts.push(A.family);let o=document,s=`https://prasi.avolut.com/_font/css2?family=${r}${n}`;if(!o.querySelector(`link[href="${s}]`)){let a=o.createElement("link");a.type="text/css",a.rel="stylesheet",a.href=s,o.head.appendChild(a)}}}return!A.family&&Jr.defaultFont&&(A.family=Jr.defaultFont),cx(A.color&&` color: ${A.color}; `,A.whitespace==="whitespace-normal"&&` word-break: break-word; @@ -101,10 +106,10 @@ ${d}`),B.pop(),`{${F}}`}case"number":return isFinite(g)?String(g):t?t(g):"null"; line-height: ${A.height==="auto"?"normal":`${A.height}%`}; `,A.family&&` font-family: ${A.family}; - `)};var dy=(e,t)=>{let A=[],i=mt(e,"layout",t,{dir:"col",align:"top-left",gap:0,wrap:void 0});if(i)i.wrap&&A.push(i.wrap==="flex-wrap"?"flex-wrap: wrap;":"flex-wrap: nowrap;"),i.dir.startsWith("col")?(i.dir==="col"?A.push("flex-direction: column;"):i.dir==="col-reverse"&&A.push("flex-direction: column-reverse;"),i.gap==="auto"?(i.align==="left"&&A.push("align-items:start; justify-content: space-between;"),i.align==="center"&&A.push("align-items:center; justify-content: space-between;"),i.align==="right"&&A.push("align-items:end; justify-content: space-between;")):(A.push(`gap: ${i.gap}px;`),i.align==="top-left"&&A.push("align-items:start; justify-content: start;"),i.align==="top-center"&&A.push("align-items:center; justify-content: start;"),i.align==="top-right"&&A.push("align-items:end; justify-content: start;"),i.align==="left"&&A.push("align-items:start; justify-content: center;"),i.align==="center"&&A.push("align-items:center; justify-content: center;"),i.align==="right"&&A.push("align-items:end; justify-content: center;"),i.align==="bottom-left"&&A.push("align-items:start; justify-content: end;"),i.align==="bottom-center"&&A.push("align-items:center; justify-content: end;"),i.align==="bottom-right"&&A.push("align-items:end; justify-content: end;"))):(i.dir==="row"?A.push("flex-direction: row;"):i.dir==="row-reverse"&&A.push("flex-direction: row-reverse;"),i.gap==="auto"?(i.align==="top"&&A.push("align-items:start; justify-content: space-between;"),i.align==="center"&&A.push("align-items:center; justify-content: space-between;"),i.align==="bottom"&&A.push("align-items:end; justify-content: space-between;")):(A.push(` + `)};var i0=(e,t)=>{let A=[],i=kt(e,"layout",t,{dir:"col",align:"top-left",gap:0,wrap:void 0});if(i)i.wrap&&A.push(i.wrap==="flex-wrap"?"flex-wrap: wrap;":"flex-wrap: nowrap;"),i.dir.startsWith("col")?(i.dir==="col"?A.push("flex-direction: column;"):i.dir==="col-reverse"&&A.push("flex-direction: column-reverse;"),i.gap==="auto"?(i.align==="left"&&A.push("align-items:start; justify-content: space-between;"),i.align==="center"&&A.push("align-items:center; justify-content: space-between;"),i.align==="right"&&A.push("align-items:end; justify-content: space-between;")):(A.push(`gap: ${i.gap}px;`),i.align==="top-left"&&A.push("align-items:start; justify-content: start;"),i.align==="top-center"&&A.push("align-items:center; justify-content: start;"),i.align==="top-right"&&A.push("align-items:end; justify-content: start;"),i.align==="left"&&A.push("align-items:start; justify-content: center;"),i.align==="center"&&A.push("align-items:center; justify-content: center;"),i.align==="right"&&A.push("align-items:end; justify-content: center;"),i.align==="bottom-left"&&A.push("align-items:start; justify-content: end;"),i.align==="bottom-center"&&A.push("align-items:center; justify-content: end;"),i.align==="bottom-right"&&A.push("align-items:end; justify-content: end;"))):(i.dir==="row"?A.push("flex-direction: row;"):i.dir==="row-reverse"&&A.push("flex-direction: row-reverse;"),i.gap==="auto"?(i.align==="top"&&A.push("align-items:start; justify-content: space-between;"),i.align==="center"&&A.push("align-items:center; justify-content: space-between;"),i.align==="bottom"&&A.push("align-items:end; justify-content: space-between;")):(A.push(` gap: ${i.gap}px; `),i.align==="top-left"&&A.push("align-items:start; justify-content: start;"),i.align==="top-center"&&A.push("align-items:start; justify-content: center;"),i.align==="top-right"&&A.push("align-items:start; justify-content: end;"),i.align==="left"&&A.push("align-items:center; justify-content: start;"),i.align==="center"&&A.push("align-items:center; justify-content: center;"),i.align==="right"&&A.push("align-items:center; justify-content: end;"),i.align==="bottom-left"&&A.push("align-items:end; justify-content: start;"),i.align==="bottom-center"&&A.push("align-items:end; justify-content: center;"),i.align==="bottom-right"&&A.push("align-items:end; justify-content: end;")));else return"flex-direction:column; align-items:start; justify-content: start;";return A.join(` - `).trim()};var Qy=(e,t)=>{let A=mt(e,"padding",t,{l:0,b:0,t:0,r:0});return cx(A.l!==void 0&&` + `).trim()};var n0=(e,t)=>{let A=kt(e,"padding",t,{l:0,b:0,t:0,r:0});return cx(A.l!==void 0&&` padding-left: ${A.l}px; `,A.r!==void 0&&` padding-right: ${A.r}px; @@ -112,23 +117,23 @@ ${d}`),B.pop(),`{${F}}`}case"number":return isFinite(g)?String(g):t?t(g):"null"; padding-bottom: ${A.b}px; `,A.t!==void 0&&` padding-top: ${A.t}px; - `)};var fB=(e,t)=>{try{return cx([e.id?`s-${e.id}`:"",css` + `)};var yB=(e,t)=>{try{return cx([e.id?`s-${e.id}`:"",css` display: flex; position: relative; user-select: none; - ${dy(e,t.mode)} - ${Qy(e,t.mode)} - ${uy(e,t.mode,t?.editor)} - ${ly(e,t.mode)} - ${Zm(e,t.mode)} - ${fy(e,t.mode)} - `,(t?.hover||t?.active)&&By({item:e,hover:t?.hover,active:t?.active}),Tm(e,t.mode)])}catch(A){console.log(A)}return cx([])};var Cy=R(Ie()),ss=(e,t,A,i)=>{let n=t.item,r;n.component?.style&&(r={style:n.component.style,className:fB(n.component.style,{mode:e.mode})});let o={className:fB(n,{mode:e.mode}),inherit:r},s={},I=t.item.childs,a;return t.item.type==="text"?(a=null,o.dangerouslySetInnerHTML={__html:t.item.html||""}):a=Array.isArray(I)&&I?.map(c=>{if(!c)return null;let{id:u}=c,l=A?e.layout?.meta[u]:e.meta[u];return l?(0,Cy.jsx)(mr,{meta:l,is_layout:A,passprop:i},u):null}),o.children=a,t.item.adv?.js&&!t.item.adv.js.includes("children")&&(delete o.children,delete o.dangerouslySetInnerHTML),{props:o,text_props:s}};var Dy=R(Ye());var ja=R(Ye());var Za=R(Ye());var py=R(Ye()),Ey=(e,t)=>A=>{if(t.item.script||(t.item.script={}),t.item.script.passprop||(t.item.script.passprop={}),t.item.script.passprop){let i=!1;for(let[n,r]of Object.entries(A))["children","key"].includes(n)||(i=!0,t.item.script.passprop[n]={end:0,start:0,value:r})}return dB(A,t.script?.scope)},dB=(e,t)=>{let A={};if(Array.isArray(e)?A.children=e:A=e,Array.isArray(A.children)){let i=[];for(let n of A.children)i.push(hy(n,A,t));return i}return hy(A.children,A,t)},hy=(e,t,A)=>{if((0,py.isValidElement)(e)){let i={...t};return delete i.children,{...e,props:{...e.props,passprop:{...A,...i}}}}return e};var my=(e,t,A)=>i=>{let{children:n}=i,r=e.script?.init_local_effect,o=t?e.layout?.meta:e.meta,I=(0,Za.useRef)(i.value).current;return I.render=A.render,Wa(e,A,A.script?.scope),i.hook&&i.hook(I),(0,Za.useEffect)(()=>{let a=A.item.id;if(A.parent?.instance_id&&o){let u=o[A.parent?.instance_id];if(u&&u.instances){for(let[l,g]of Object.entries(u.instances[A.parent.instance_id]))if(g===A.item.id){a=l;break}}}return!r[a]&&(typeof r=="object"&&(r[a]=!0),(async()=>i.effect&&await i.effect(I))()),()=>{}},[location.pathname]),dB(n,{...A.script?.scope,[i.name]:I})};var QB=R(Ie()),yy=(e,t,A,i)=>{let n=ss(e,t,A,i);e.visit&&e.visit(t,n),t.script?t.script.scope=i:t.script={scope:i,result:null,Local:my(e,A,t),PassProp:Ey(e,t)};let r=t.script,o=window.exports,s={useEffect:ja.useEffect,children:n.props.children,props:n.props,Local:r.Local,db:e.site.db,api:e.site.api,PassProp:r?.PassProp,ErrorBox:FA,newElement:()=>{},render:u=>{r.result=(0,QB.jsx)(ja.Suspense,{children:u})},params,...hr(e),...o,...i};if(typeof i=="object"){for(let[u,l]of Object.entries(i))if(typeof l=="object"&&l&&l._jsx){let g=l;s[u]=(0,QB.jsx)(dN,{fn:g.fn,passprop:i,meta:t})}}!fe.isEditor&&t.item.adv?.js&&qa(e,t.item.adv.js);let I=t.item.adv?.jsBuilt||"",a=hB(I,CB)||"";new Function(...Object.keys(s),`// ${t.item.name}: ${t.item.id} -${a} - `)(...Object.values(s)),Wa(e,t,i)},dN=({fn:e,meta:t,passprop:A})=>e({passprop:A,meta:t}),CB={"stroke-width":"strokeWidth","fill-rule":"fillRule","clip-rule":"clipRule","stroke-linejoin":"strokeLinejoin","stroke-linecap":"strokeLinecap","clip-path":"clipPath"},hB=(e,t)=>{let A=e;for(let[i,n]of Object.entries(t))A=A.replaceAll(i,n);return A};var Fy=R(Ie()),wy=(e,t,A,i)=>{if(t.item.component?.id){t.item.script||(t.item.script={});let r={...window.exports,db:e.site.db,api:e.site.api,...hr(e),...i,params};t.item.script.props={};let o=new Set;if(t.item.component.props)for(let[s,I]of Object.entries(t.item.component.props))try{if(I.meta?.type==="content-element"){let g={_jsx:!0,fn:B=>{let h=I.content?.id;if(h){let U=A?e.layout?.meta[h]:e.meta[h];if(!U)return null;let d=t.instances;if(!B.meta.item.originalId||!d||!d[t.item.id])return null;let Q=B.meta.item.originalId;if(U.mitem&&(I.jsxCalledBy&&(!I.jsxCalledBy.includes(Q)||I.jsxCalledBy.length!==2)||!I.jsxCalledBy)){let y=t.mitem?.get("component")?.get("props")?.get(s);if(y){let F=y.get("jsxCalledBy");!F||typeof F!="object"?y.set("jsxCalledBy",[t.item.id,Q]):(!F.includes(Q)||F.length!==2||F[0]!==t.item.id||F[1]!==Q)&&y.set("jsxCalledBy",[t.item.id,Q])}}return(0,Fy.jsx)(mr,{meta:U,passprop:B.passprop,is_layout:A})}return null}};r[s]=g,i&&(i[s]=g);continue}I.value&&qa(e,I.value);let a=I.valueBuilt||"",c=hB(a,CB)||"",u=new Function(...Object.keys(r),`// [${t.item.name}] ${s}: ${t.item.id} + ${i0(e,t.mode)} + ${n0(e,t.mode)} + ${e0(e,t.mode,t?.editor)} + ${$w(e,t.mode)} + ${Jw(e,t.mode)} + ${A0(e,t.mode)} + `,(t?.hover||t?.active)&&t0({item:e,hover:t?.hover,active:t?.active}),Rw(e,t.mode)])}catch(A){console.log(A)}return cx([])};var r0=K(ce()),Gs=(e,t,A,i)=>{let n=t.item,r;n.component?.style&&(r={style:n.component.style,className:yB(n.component.style,{mode:e.mode})});let o={className:yB(n,{mode:e.mode}),inherit:r},s={},a=t.item.childs,I;return t.item.type==="text"?(I=null,o.dangerouslySetInnerHTML={__html:t.item.html||""}):I=Array.isArray(a)&&a?.map(c=>{if(!c)return null;let{id:l}=c,u=A?e.layout?.meta[l]:e.meta[l];return u?(0,r0.jsx)(qr,{meta:u,is_layout:A,passprop:i},l):null}),o.children=I,t.item.adv?.js&&!t.item.adv.js.includes("children")&&(delete o.children,delete o.dangerouslySetInnerHTML),{props:o,text_props:s}};var u0=K(ze());var Jc=K(ze());var vc=K(ze());var s0=K(ze()),a0=(e,t)=>A=>{if(t.item.script||(t.item.script={}),t.item.script.passprop||(t.item.script.passprop={}),t.item.script.passprop){let i=!1;for(let[n,r]of Object.entries(A))["children","key"].includes(n)||(i=!0,t.item.script.passprop[n]={end:0,start:0,value:r})}return wB(A,t.script?.scope)},wB=(e,t)=>{let A={};if(Array.isArray(e)?A.children=e:A=e,Array.isArray(A.children)){let i=[];for(let n of A.children)i.push(o0(n,A,t));return i}return o0(A.children,A,t)},o0=(e,t,A)=>{if((0,s0.isValidElement)(e)){let i={...t};return delete i.children,{...e,props:{...e.props,passprop:{...A,...i}}}}return e};var I0=(e,t,A)=>i=>{let{children:n}=i,r=e.script?.init_local_effect,o=t?e.layout?.meta:e.meta,a=(0,vc.useRef)(i.value).current;return a.render=A.render,Rc(e,A,A.script?.scope),i.hook&&i.hook(a),(0,vc.useEffect)(()=>{let I=A.item.id;if(A.parent?.instance_id&&o){let l=o[A.parent?.instance_id];if(l&&l.instances){for(let[u,g]of Object.entries(l.instances[A.parent.instance_id]))if(g===A.item.id){I=u;break}}}return!r[I]&&(typeof r=="object"&&(r[I]=!0),(async()=>i.effect&&await i.effect(a))()),()=>{}},[location.pathname]),wB(n,{...A.script?.scope,[i.name]:a})};var FB=K(ce()),c0=(e,t,A,i)=>{let n=Gs(e,t,A,i);e.visit&&e.visit(t,n),t.script?t.script.scope=i:t.script={scope:i,result:null,Local:I0(e,A,t),PassProp:a0(e,t)};let r=t.script,o=window.exports,s={useEffect:Jc.useEffect,children:n.props.children,props:n.props,Local:r.Local,db:e.site.db,api:e.site.api,PassProp:r?.PassProp,ErrorBox:GA,newElement:()=>{},render:l=>{r.result=(0,FB.jsx)(Jc.Suspense,{children:l})},params,...vr(e),...o,...i};if(typeof i=="object"){for(let[l,u]of Object.entries(i))if(typeof u=="object"&&u&&u._jsx){let g=u;s[l]=(0,FB.jsx)(nH,{fn:g.fn,passprop:i,meta:t})}}!Ce.isEditor&&t.item.adv?.js&&ac(e,t.item.adv.js);let a=t.item.adv?.jsBuilt||"",I=kB(a,DB)||"";new Function(...Object.keys(s),`// ${t.item.name}: ${t.item.id} +${I} + `)(...Object.values(s)),Rc(e,t,i)},nH=({fn:e,meta:t,passprop:A})=>e({passprop:A,meta:t}),DB={"stroke-width":"strokeWidth","fill-rule":"fillRule","clip-rule":"clipRule","stroke-linejoin":"strokeLinejoin","stroke-linecap":"strokeLinecap","clip-path":"clipPath"},kB=(e,t)=>{let A=e;for(let[i,n]of Object.entries(t))A=A.replaceAll(i,n);return A};var g0=K(ce()),l0=(e,t,A,i)=>{if(t.item.component?.id){t.item.script||(t.item.script={});let r={...window.exports,db:e.site.db,api:e.site.api,...vr(e),...i,params};t.item.script.props={};let o=new Set;if(t.item.component.props)for(let[s,a]of Object.entries(t.item.component.props))try{if(a.meta?.type==="content-element"){let g={_jsx:!0,fn:f=>{let Q=a.content?.id;if(Q){let k=A?e.layout?.meta[Q]:e.meta[Q];if(!k)return null;let d=t.instances;if(!f.meta.item.originalId||!d||!d[t.item.id])return null;let C=f.meta.item.originalId;if(k.mitem&&(a.jsxCalledBy&&(!a.jsxCalledBy.includes(C)||a.jsxCalledBy.length!==2)||!a.jsxCalledBy)){let y=t.mitem?.get("component")?.get("props")?.get(s);if(y){let D=y.get("jsxCalledBy");!D||typeof D!="object"?y.set("jsxCalledBy",[t.item.id,C]):(!D.includes(C)||D.length!==2||D[0]!==t.item.id||D[1]!==C)&&y.set("jsxCalledBy",[t.item.id,C])}}return(0,g0.jsx)(qr,{meta:k,passprop:f.passprop,is_layout:A})}return null}};r[s]=g,i&&(i[s]=g);continue}a.value&&ac(e,a.value);let I=a.valueBuilt||"",c=kB(I,DB)||"",l=new Function(...Object.keys(r),`// [${t.item.name}] ${s}: ${t.item.id} return ${c} - `);t.item.script.props[s]={value:c};let l=u(...Object.values(r));typeof l=="function"&&(t.item.script.props[s].fn=l,l=(...g)=>t.item.script?.props?.[s].fn(...g)),r[s]=l,i&&(i[s]=l)}catch{o.add(s)}}},Wa=(e,t,A)=>{if(t.item.script?.props){let i={...A,api:e.site.api,db:e.site.db};for(let[n,r]of Object.entries(t.item.script.props))if(r.fn){let o=new Function(...Object.keys(i),`// [${t.item.name}] ${n}: ${t.item.id} + `);t.item.script.props[s]={value:c};let u=l(...Object.values(r));typeof u=="function"&&(t.item.script.props[s].fn=u,u=(...g)=>t.item.script?.props?.[s].fn(...g)),r[s]=u,i&&(i[s]=u)}catch{o.add(s)}}},Rc=(e,t,A)=>{if(t.item.script?.props){let i={...A,api:e.site.api,db:e.site.db};for(let[n,r]of Object.entries(t.item.script.props))if(r.fn){let o=new Function(...Object.keys(i),`// [${t.item.name}] ${n}: ${t.item.id} return ${r.value||""} - `);r.fn=o(...Object.values(i))}}};var ky=R(Ie()),pB=({meta:e,passprop:t,is_layout:A})=>{let i=hi(Ni,"VI"),[n,r]=(0,Dy.useState)({});e.render=()=>{r({})};let o=t;return e.item.component?.id&&(o||(o={}),wy(i,e,A,o)),e.item.adv?.js&&(yy(i,e,A,o),e.script)?e.script.result:(0,ky.jsx)(EB,{meta:e,passprop:o,is_layout:A})};var _e=R(Ie()),QN=70,$a={enabled:!1,meta:{}},mr=({meta:e,children:t,passprop:A,is_layout:i})=>{if($a.enabled){let n=$a.meta;if(n[e.item.id]?n[e.item.id].last_render===Math.floor(Date.now()/1e3)?n[e.item.id].count++:n[e.item.id]={last_render:Math.floor(Date.now()/1e3),count:1}:n[e.item.id]={last_render:Math.floor(Date.now()/1e3),count:1},n[e.item.id]?.count>QN)return(0,_e.jsxs)("div",{className:"bg-orange-100 border border-orange-300 rounded-sm text-xs flex flex-col items-center",children:[(0,_e.jsxs)("div",{className:"text-[10px] font-bold text-red-900 self-stretch px-1",children:["WARNING: Render loop detected in [",e.item.name,"]"]}),(0,_e.jsxs)("p",{className:"border-b border-orange-300 px-1 pb-1 min-w-[100px]",children:["Rendered ",n[e.item.id]?.count," times in less than 1 second."]})]})}return!e||e.item.hidden?null:e.item.adv?.js||e.item.component?.id?(0,_e.jsx)(FA,{meta:e,children:(0,_e.jsx)(pB,{meta:e,is_layout:i,passprop:A})}):(0,_e.jsx)(FA,{meta:e,children:(0,_e.jsx)(EB,{meta:e,passprop:A,is_layout:i})})},EB=({meta:e,passprop:t,is_layout:A})=>{let i=hi(Ni,"VI");if(A&&e.item.name==="children"){let r=[];for(let o of i.entry){let s=i.meta[o];if(s.item.adv?.js||s.item.component?.id)r.push((0,_e.jsx)(FA,{meta:s,children:(0,_e.jsx)(pB,{meta:s,is_layout:A,passprop:t})}));else{let I=ss(i,s,!1,t);i.visit&&i.visit(s,I),r.push((0,_e.jsx)("div",{...I.props}))}}return(0,_e.jsx)(_e.Fragment,{children:r.map((o,s)=>(0,_e.jsx)(Sy.Fragment,{children:o},s))})}let n=ss(i,e,A,t);return i.visit&&i.visit(e,n),(0,_e.jsx)("div",{...n.props})};var yr=R(Ie()),Uy=({})=>{let e=hi(Ni,"VI"),t=di({tick:Date.now()});if(e.tick=t.tick,e.status!=="ready")return(0,yr.jsx)("div",{className:"flex flex-1 flex-col relative",children:(0,yr.jsx)(_i,{backdrop:!1})});let A=!!e.layout?.entry&&e.layout.entry.length>0,i=e.entry;return A&&e.layout?.entry&&(i=e.layout?.entry),(0,yr.jsx)("div",{className:"flex flex-1 flex-col relative",children:Array.isArray(i)&&i.map(n=>{let r=A?e.layout?.meta[n]:e.meta[n];return r&&Element?(0,yr.jsx)(FA,{children:(0,yr.jsx)(mr,{meta:r,is_layout:A})},r.item.id):null})})};var ec=R(Ie()),mB=window,Ny=({meta:e,entry:t,api_url:A,site_id:i,api:n,mode:r,db:o,visit:s,script:I,page_id:a,render_stat:c,on_status_changed:u,on_preload:l,layout:g})=>{let B=hi(Ni,"VI");return B.mode=r,B.entry=t,B.on_preload=l,mB.isMobile=r==="mobile",mB.isDesktop=r==="desktop",mB.preload=h=>{B.page.navs[a]||(B.page.navs[a]=new Set);let U=typeof h=="string"?[h]:h;for(let d of U)B.page.navs[a].add(d);return clearTimeout(un.timeout),un.timeout=setTimeout(()=>{B.on_preload&&B.on_preload({urls:Array.from(B.page.navs[a])})},100),""},B.layout=g,B.page.cur.id=a,B.on_status_changes=u,c==="disabled"&&($a.enabled=!1),B.meta!==e&&(B.meta=e),I&&(B.script.init_local_effect=I.init_local_effect),B.visit=s,B.status==="init"&&(B.site.db=o,B.site.api=n,Vm(B,{api_url:A,site_id:i})),l&&(0,tc.useEffect)(()=>{setTimeout(()=>{let h=B.page.navs[B.page.cur.id];h&&l({urls:Array.from(h)})},500)},[B.page.cur.id]),(0,ec.jsx)(FA,{children:(0,ec.jsx)(tc.Suspense,{children:(0,ec.jsx)(Uy,{})})})};var yB=window,M={root:null,url(...e){let t=e.map(i=>Array.isArray(i)?i.join(""):i).join(""),A=this.root.toString();return A.endsWith("/")&&(A=A.substring(0,A.length-1)),t.startsWith("/")?A+t:A+"/"+t},get pathname(){let e=location.pathname.substring(M.root.pathname.length);return e.startsWith("/")?e:`/${e}`},site:{id:yB._prasi?.site_id},init_local_effect:{},mode:"",route:{status:"init",router:null},comp:{list:{},pending:new Set},layout:{id:"",root:null,meta:null},cache:{urls:new Set},page:{id:"",url:"",root:null,meta:null,cache:{}}},xy=()=>{if(!M.root){let e=new URL(location.href);yB._prasi.basepath&&(e.pathname=yB._prasi.basepath),M.root=new URL(`${e.protocol}//${e.host}${e.pathname}`),M.root.pathname.endsWith("/")&&(M.root.pathname=M.root.pathname.substring(0,M.root.length-1))}};var nA=sn("prasi-prod","prasi-cache-prod");var Is=async e=>{let t=M.comp;for(let A of e)A&&A.type!=="text"&&wB(A);if(t.pending.size>0){let A=!0,i=[];for(let n of[...t.pending]){let r=await EA(`comp-${n}`,nA);r||(A=!1),t.list[n]=r,i.push(r)}if(A){for(let n of[...t.pending])t.pending.delete(n);await Is(i);return}}if(t.pending.size>0)try{let A=await(await fetch(M.url`_prasi/comp`,{method:"POST",body:JSON.stringify({ids:[...t.pending]})})).json();for(let[i,n]of Object.entries(A))t.pending.delete(i),t.list[i]=n,await mA(`comp-${i}`,n,nA);await Is(Object.values(A))}catch{}},wB=e=>{let t=M.comp;if(e.type==="item"){let A=e.component?.id;if(A){!t.list[A]&&!t.pending.has(A)&&t.pending.add(A);for(let i of Object.values(e.component?.props||{}))i.content&&i.meta?.type==="content-element"&&wB(i.content)}}if(e.childs)for(let A of e.childs)A&&A.type!=="text"&&wB(A)};var Gy=e=>new Promise(async t=>{let A=!1,i=await EA(`page-${e}`,nA);i&&(t(i),A=!0);let n=await(await fetch(M.url`_prasi/page/${e}`)).json();mA(`page-${e}`,{id:e,url:n.url,root:n.root},nA),A||t(n)}),CN=e=>new Promise(async t=>{let A={},i=[...new Set(e)],n=!0;for(let o of i){let s=await EA(`page-${o}`,nA);if(s)A[o]=s;else{n=!1;break}}n&&t(A);let r=await(await fetch(M.url`_prasi/pages`,{method:"POST",body:JSON.stringify({ids:i})})).json();for(let[o,s]of Object.entries(r))mA(`page-${o}`,s,nA);n||t(r)}),Hy=async e=>{let t=e.map(A=>M.route.router?.lookup(A)).filter(A=>A&&A.id);return await CN(t.map(A=>A?.id))};var vy=R(My()),Jy=()=>{let e=M;if(e.site.id){if(!e.mode&&e.site.responsive)if(e.site.responsive!=="mobile-only"&&e.site.responsive!=="desktop-only"){let t=(0,vy.default)();e.mode=t.device.type==="mobile"?"mobile":"desktop"}else e.site.responsive==="mobile-only"?e.mode="mobile":e.site.responsive==="desktop-only"&&(e.mode="desktop");localStorage.getItem("prasi-editor-mode")&&(e.mode=localStorage.getItem("prasi-editor-mode"))}};var hN=()=>new Promise(async e=>{let t=!1,A=await EA("route",nA);A&&(e(A),t=!0);let i=await(await fetch(M.url`_prasi/route`)).json();await mA("route",i,nA),t||e(i)}),qy=async()=>{let e=Br();try{let t=await hN();if(t&&t.site&&t.urls){t.layout&&(M.layout.id=t.layout.id,M.layout.root=t.layout.root,M.layout.meta={},M.layout.root&&ic(M.layout.meta,M.layout.root)),M.site=t.site,M.site.code={mode:"new"},await pN(),M.site.api=Qr(M.site.api_url),M.site.db=Cr(M.site.api_url);let A=window;A.serverurl=M.site.api_url,A.db=M.site.db,A.api=M.site.api;for(let i of t.urls)e.insert(i.url,i)}}catch{}return e},pN=()=>new Promise(e=>{let t=document,A=t.createElement("script");A.onload=async()=>{e()};let i=M.site.api_url;try{new URL(i)}catch{location.hostname==="localhost"?i="http://localhost:4550":i="https://prasi.avolut.com"}localStorage.getItem("api-ts-"+i)||localStorage.setItem("api-ts-"+i,Date.now().toString());let n=localStorage.getItem("api-ts-"+i);A.src=`${i}/_prasi/load.js?url=${i}&v3&ts=${n}`,document.querySelector(`script[src="${A.src}"]`)?e():t.body.appendChild(A)}),ic=(e,t)=>{for(let A of t.childs)Nt({comps:M.comp.list,meta:e,mode:"page"},{item:A})};var Qn=window;var _A=R(Ie()),Ky=()=>{let e=di({page_id:""}),[t,A]=(0,Ry.useState)({}),i=()=>A({});Qn.prasiContext.render=i;let n=vl.Provider;if(M.route.status!=="ready")return M.route.status==="init"&&(M.route.status="loading",qy().then(async I=>{Jy(),M.route.status="ready",M.route.router=I;let a=_a(await(await fetch(`${Qn._prasi.basepath}/_prasi/code/index.js`.replace("//","/"))).text());if(a)for(let[c,u]of Object.entries(a))window[c]=u;i()})),(0,_A.jsx)(_i,{});let r=M.route.router;if(!r)return(0,_A.jsx)(Rl,{children:"Failed to create Router"});let o=r.lookup(M.pathname);if(!o)return(0,_A.jsx)(Rl,{children:"Page Not Found"});o.id!==e.page_id&&(M.init_local_effect={}),Qn.params=o.params||{},M.page.id=o.id,M.page.url=o.url;let s=M.page.cache[o.id];if(s)M.page.root=s.root,M.page.meta=s.meta;else return Gy(o.id).then(async({root:I})=>{let a={id:o.id,url:o.url,root:I,meta:{}};await Is(I.childs),ic(a.meta,I),M.page.cache[a.id]=a,i()}).catch(()=>{i()}),(0,_A.jsx)(_i,{note:"Loading page"});return(0,_A.jsx)(n,{value:Qn.prasiContext,children:(0,_A.jsx)("div",{className:cx("relative flex flex-1 items-center justify-center"),children:(0,_A.jsx)("div",{className:cx("absolute flex flex-col items-stretch flex-1 bg-white main-content-preview",M.mode==="mobile"?css` + `);r.fn=o(...Object.values(i))}}};var f0=K(ce()),SB=({meta:e,passprop:t,is_layout:A})=>{let i=ki(Oi,"VI"),[n,r]=(0,u0.useState)({});e.render=()=>{r({})};let o=t;return e.item.component?.id&&(o||(o={}),l0(i,e,A,o)),e.item.adv?.js&&(c0(i,e,A,o),e.script)?e.script.result:(0,f0.jsx)(UB,{meta:e,passprop:o,is_layout:A})};var Ze=K(ce()),rH=70,qc={enabled:!1,meta:{}},qr=({meta:e,children:t,passprop:A,is_layout:i})=>{if(qc.enabled){let n=qc.meta;if(n[e.item.id]?n[e.item.id].last_render===Math.floor(Date.now()/1e3)?n[e.item.id].count++:n[e.item.id]={last_render:Math.floor(Date.now()/1e3),count:1}:n[e.item.id]={last_render:Math.floor(Date.now()/1e3),count:1},n[e.item.id]?.count>rH)return(0,Ze.jsxs)("div",{className:"bg-orange-100 border border-orange-300 rounded-sm text-xs flex flex-col items-center",children:[(0,Ze.jsxs)("div",{className:"text-[10px] font-bold text-red-900 self-stretch px-1",children:["WARNING: Render loop detected in [",e.item.name,"]"]}),(0,Ze.jsxs)("p",{className:"border-b border-orange-300 px-1 pb-1 min-w-[100px]",children:["Rendered ",n[e.item.id]?.count," times in less than 1 second."]})]})}return!e||e.item.hidden?null:e.item.adv?.js||e.item.component?.id?(0,Ze.jsx)(GA,{meta:e,children:(0,Ze.jsx)(SB,{meta:e,is_layout:i,passprop:A})}):(0,Ze.jsx)(GA,{meta:e,children:(0,Ze.jsx)(UB,{meta:e,passprop:A,is_layout:i})})},UB=({meta:e,passprop:t,is_layout:A})=>{let i=ki(Oi,"VI");if(A&&e.item.name==="children"){let r=[];for(let o of i.entry){let s=i.meta[o];if(s.item.adv?.js||s.item.component?.id)r.push((0,Ze.jsx)(GA,{meta:s,children:(0,Ze.jsx)(SB,{meta:s,is_layout:A,passprop:t})}));else{let a=Gs(i,s,!1,t);i.visit&&i.visit(s,a),r.push((0,Ze.jsx)("div",{...a.props}))}}return(0,Ze.jsx)(Ze.Fragment,{children:r.map((o,s)=>(0,Ze.jsx)(B0.Fragment,{children:o},s))})}let n=Gs(i,e,A,t);return i.visit&&i.visit(e,n),(0,Ze.jsx)("div",{...n.props})};var Kr=K(ce()),d0=({})=>{let e=ki(Oi,"VI"),t=wi({tick:Date.now()});if(e.tick=t.tick,e.status!=="ready")return(0,Kr.jsx)("div",{className:"flex flex-1 flex-col relative",children:(0,Kr.jsx)(rn,{backdrop:!1})});let A=!!e.layout?.entry&&e.layout.entry.length>0,i=e.entry;return A&&e.layout?.entry&&(i=e.layout?.entry),(0,Kr.jsx)("div",{className:"flex flex-1 flex-col relative",children:Array.isArray(i)&&i.map(n=>{let r=A?e.layout?.meta[n]:e.meta[n];return r&&Element?(0,Kr.jsx)(GA,{children:(0,Kr.jsx)(qr,{meta:r,is_layout:A})},r.item.id):null})})};var Kc=K(ce()),NB=window,C0=({meta:e,entry:t,api_url:A,site_id:i,api:n,mode:r,db:o,visit:s,script:a,page_id:I,render_stat:c,on_status_changed:l,on_preload:u,layout:g})=>{let f=ki(Oi,"VI");return f.mode=r,f.entry=t,f.on_preload=u,NB.isMobile=r==="mobile",NB.isDesktop=r==="desktop",NB.preload=Q=>{f.page.navs[I]||(f.page.navs[I]=new Set);let k=typeof Q=="string"?[Q]:Q;for(let d of k)f.page.navs[I].add(d);return clearTimeout(wn.timeout),wn.timeout=setTimeout(()=>{f.on_preload&&f.on_preload({urls:Array.from(f.page.navs[I])})},100),""},f.layout=g,f.page.cur.id=I,f.on_status_changes=l,c==="disabled"&&(qc.enabled=!1),f.meta!==e&&(f.meta=e),a&&(f.script.init_local_effect=a.init_local_effect),f.visit=s,f.status==="init"&&(f.site.db=o,f.site.api=n,xw(f,{api_url:A,site_id:i})),u&&(0,bc.useEffect)(()=>{setTimeout(()=>{let Q=f.page.navs[f.page.cur.id];Q&&u({urls:Array.from(Q)})},500)},[f.page.cur.id]),(0,Kc.jsx)(GA,{children:(0,Kc.jsx)(bc.Suspense,{children:(0,Kc.jsx)(d0,{})})})};var xB=window,v={root:null,url(...e){let t=e.map(i=>Array.isArray(i)?i.join(""):i).join(""),A=this.root.toString();return A.endsWith("/")&&(A=A.substring(0,A.length-1)),t.startsWith("/")?A+t:A+"/"+t},get pathname(){let e=location.pathname.substring(v.root.pathname.length);return e.startsWith("/")?e:`/${e}`},site:{id:xB._prasi?.site_id},init_local_effect:{},mode:"",route:{status:"init",router:null},comp:{list:{},pending:new Set},layout:{id:"",root:null,meta:null},cache:{urls:new Set},page:{id:"",url:"",root:null,meta:null,cache:{}}},Q0=()=>{if(!v.root){let e=new URL(location.href);xB._prasi.basepath&&(e.pathname=xB._prasi.basepath),v.root=new URL(`${e.protocol}//${e.host}${e.pathname}`),v.root.pathname.endsWith("/")&&(v.root.pathname=v.root.pathname.substring(0,v.root.length-1))}};var cA=Qn("prasi-prod","prasi-cache-prod");var Hs=async e=>{let t=v.comp;for(let A of e)A&&A.type!=="text"&&GB(A);if(t.pending.size>0){let A=!0,i=[];for(let n of[...t.pending]){let r=await kA(`comp-${n}`,cA);r||(A=!1),t.list[n]=r,i.push(r)}if(A){for(let n of[...t.pending])t.pending.delete(n);await Hs(i);return}}if(t.pending.size>0)try{let A=await(await fetch(v.url`_prasi/comp`,{method:"POST",body:JSON.stringify({ids:[...t.pending]})})).json();for(let[i,n]of Object.entries(A))t.pending.delete(i),t.list[i]=n,await SA(`comp-${i}`,n,cA);await Hs(Object.values(A))}catch{}},GB=e=>{let t=v.comp;if(e.type==="item"){let A=e.component?.id;if(A){!t.list[A]&&!t.pending.has(A)&&t.pending.add(A);for(let i of Object.values(e.component?.props||{}))i.content&&i.meta?.type==="content-element"&&GB(i.content)}}if(e.childs)for(let A of e.childs)A&&A.type!=="text"&&GB(A)};var h0=e=>new Promise(async t=>{let A=!1,i=await kA(`page-${e}`,cA);i&&(t(i),A=!0);let n=await(await fetch(v.url`_prasi/page/${e}`)).json();SA(`page-${e}`,{id:e,url:n.url,root:n.root},cA),A||t(n)}),oH=e=>new Promise(async t=>{let A={},i=[...new Set(e)],n=!0;for(let o of i){let s=await kA(`page-${o}`,cA);if(s)A[o]=s;else{n=!1;break}}n&&t(A);let r=await(await fetch(v.url`_prasi/pages`,{method:"POST",body:JSON.stringify({ids:i})})).json();for(let[o,s]of Object.entries(r))SA(`page-${o}`,s,cA);n||t(r)}),p0=async e=>{let t=e.map(A=>v.route.router?.lookup(A)).filter(A=>A&&A.id);return await oH(t.map(A=>A?.id))};var m0=K(E0()),y0=()=>{let e=v;if(e.site.id){if(!e.mode&&e.site.responsive)if(e.site.responsive!=="mobile-only"&&e.site.responsive!=="desktop-only"){let t=(0,m0.default)();e.mode=t.device.type==="mobile"?"mobile":"desktop"}else e.site.responsive==="mobile-only"?e.mode="mobile":e.site.responsive==="desktop-only"&&(e.mode="desktop");localStorage.getItem("prasi-editor-mode")&&(e.mode=localStorage.getItem("prasi-editor-mode"))}};var sH=()=>new Promise(async e=>{let t=!1,A=await kA("route",cA);A&&(e(A),t=!0);let i=await(await fetch(v.url`_prasi/route`)).json();await SA("route",i,cA),t||e(i)}),w0=async()=>{let e=Fr();try{let t=await sH();if(t&&t.site&&t.urls){t.layout&&(v.layout.id=t.layout.id,v.layout.root=t.layout.root,v.layout.meta={},v.layout.root&&Lc(v.layout.meta,v.layout.root)),v.site=t.site,v.site.code={mode:"new"},await aH(),v.site.api=Hr(v.site.api_url),v.site.db=Mr(v.site.api_url);let A=window;A.serverurl=v.site.api_url,A.db=v.site.db,A.api=v.site.api;for(let i of t.urls)e.insert(i.url,i)}}catch{}return e},aH=()=>new Promise(e=>{let t=document,A=t.createElement("script");A.onload=async()=>{e()};let i=v.site.api_url;try{new URL(i)}catch{location.hostname==="localhost"?i="http://localhost:4550":i="https://prasi.avolut.com"}localStorage.getItem("api-ts-"+i)||localStorage.setItem("api-ts-"+i,Date.now().toString());let n=localStorage.getItem("api-ts-"+i);A.src=`${i}/_prasi/load.js?url=${i}&v3&ts=${n}`,document.querySelector(`script[src="${A.src}"]`)?e():t.body.appendChild(A)}),Lc=(e,t)=>{for(let A of t.childs)vt({comps:v.comp.list,meta:e,mode:"page"},{item:A})};var Sn=window;var ti=K(ce()),D0=()=>{let e=wi({page_id:""}),[t,A]=(0,F0.useState)({}),i=()=>A({});Sn.prasiContext.render=i;let n=Eu.Provider;if(v.route.status!=="ready")return v.route.status==="init"&&(v.route.status="loading",w0().then(async a=>{y0(),v.route.status="ready",v.route.router=a;let I=Gc(await(await fetch(`${Sn._prasi.basepath}/_prasi/code/index.js`.replace("//","/"))).text());if(I)for(let[c,l]of Object.entries(I))window[c]=l;i()})),(0,ti.jsx)(rn,{});let r=v.route.router;if(!r)return(0,ti.jsx)(wu,{children:"Failed to create Router"});let o=r.lookup(v.pathname);if(!o)return(0,ti.jsx)(wu,{children:"Page Not Found"});o.id!==e.page_id&&(v.init_local_effect={}),Sn.params=o.params||{},v.page.id=o.id,v.page.url=o.url;let s=v.page.cache[o.id];if(s)v.page.root=s.root,v.page.meta=s.meta;else return h0(o.id).then(async({root:a})=>{let I={id:o.id,url:o.url,root:a,meta:{}};await Hs(a.childs),Lc(I.meta,a),v.page.cache[I.id]=I,i()}).catch(()=>{i()}),(0,ti.jsx)(rn,{note:"Loading page"});return(0,ti.jsx)(n,{value:Sn.prasiContext,children:(0,ti.jsx)("div",{className:cx("relative flex flex-1 items-center justify-center"),children:(0,ti.jsx)("div",{className:cx("absolute flex flex-col items-stretch flex-1 bg-white main-content-preview",v.mode==="mobile"?css` @media (min-width: 768px) { border-left: 1px solid #ccc; border-right: 1px solid #ccc; @@ -147,7 +152,7 @@ ${a} } `:"inset-0 overflow-auto",css` contain: content; - `),children:(0,_A.jsx)(Ny,{api_url:M.site.api_url,entry:Object.values(M.page.root.childs).filter(I=>I).map(I=>I.id),meta:M.page.meta,mode:M.mode,page_id:M.page.id,site_id:M.site.id,db:M.site.db,api:M.site.api,layout:M.layout.id&&M.layout.root&&M.layout.meta?{id:M.layout.id,meta:M.layout.meta,entry:Object.values(M.layout.root.childs).filter(I=>I).map(I=>I.id)}:void 0,script:{init_local_effect:M.init_local_effect},on_preload:async({urls:I})=>{let a=[];if(M.cache.urls)for(let c of I)M.cache.urls.has(c)||(a.push(c),M.cache.urls.add(c));if(a.length>0){let c=await Hy(a);for(let u of c){let l={id:u.id,url:u.url,root:u.root,meta:{}};await Is(u.root.childs),ic(l.meta,u.root),M.page.cache[l.id]=l}}}})})})})};var Oy=R(Ie());(async()=>{xy();let e=document.getElementById("root");if(e){let t=(0,Ly.createRoot)(e);await mh(!1),Qh(),Qn.navigateOverride=A=>(A&&A.startsWith("/")&&(location.hostname.split(".").length===4||location.hostname==="prasi.app"||location.hostname==="prasi.avolut.com"||location.hostname.includes("ngrok")||location.hostname==="localhost"||location.hostname==="127.0.0.1"||location.hostname==="10.0.2.2")&&location.pathname.startsWith("/prod")&&!A.startsWith("/prod")&&(A=`/prod/${location.pathname.split("/")[2]}${A}`),A),t.render((0,Oy.jsx)(Ky,{})),document.body.classList.contains("opacity-0")&&document.body.classList.remove("opacity-0")}})(); + `),children:(0,ti.jsx)(C0,{api_url:v.site.api_url,entry:Object.values(v.page.root.childs).filter(a=>a).map(a=>a.id),meta:v.page.meta,mode:v.mode,page_id:v.page.id,site_id:v.site.id,db:v.site.db,api:v.site.api,layout:v.layout.id&&v.layout.root&&v.layout.meta?{id:v.layout.id,meta:v.layout.meta,entry:Object.values(v.layout.root.childs).filter(a=>a).map(a=>a.id)}:void 0,script:{init_local_effect:v.init_local_effect},on_preload:async({urls:a})=>{let I=[];if(v.cache.urls)for(let c of a)v.cache.urls.has(c)||(I.push(c),v.cache.urls.add(c));if(I.length>0){let c=await p0(I);for(let l of c){let u={id:l.id,url:l.url,root:l.root,meta:{}};await Hs(l.root.childs),Lc(u.meta,l.root),v.page.cache[u.id]=u}}}})})})})};var S0=K(ce());(async()=>{Q0();let e=document.getElementById("root");if(e){let t=(0,k0.createRoot)(e);await Sp(!1),yp(),Sn.navigateOverride=A=>(A&&A.startsWith("/")&&(location.hostname.split(".").length===4||location.hostname==="prasi.app"||location.hostname==="prasi.avolut.com"||location.hostname.includes("ngrok")||location.hostname==="localhost"||location.hostname==="127.0.0.1"||location.hostname==="10.0.2.2")&&location.pathname.startsWith("/prod")&&!A.startsWith("/prod")&&(A=`/prod/${location.pathname.split("/")[2]}${A}`),A),t.render((0,S0.jsx)(D0,{})),document.body.classList.contains("opacity-0")&&document.body.classList.remove("opacity-0")}})(); /*! Bundled license information: react/cjs/react.production.min.js: diff --git a/app/web/package.json b/app/web/package.json index 61ab451c..fc1ffd01 100644 --- a/app/web/package.json +++ b/app/web/package.json @@ -13,6 +13,7 @@ "@wojtekmaj/react-qr-svg": "^1.0.0", "constrained-editor-plugin": "^1.3.0", "react-resizable-panels": "^2.0.9", + "axios": "^1.6.7", "@monaco-editor/react": "^4.6.0", "@paralleldrive/cuid2": "2.2.2", "react-contenteditable": "^3.3.7", diff --git a/app/web/src/base/load/api/api-proxy.tsx b/app/web/src/base/load/api/api-proxy.tsx index ce2194a8..948ef343 100644 --- a/app/web/src/base/load/api/api-proxy.tsx +++ b/app/web/src/base/load/api/api-proxy.tsx @@ -28,14 +28,17 @@ export const apiProxy = (api_url: string) => { { get: (_, actionName: string) => { if (actionName === "_url") { - return (pathname: string) => { + return (pathname: string, proxy?: boolean) => { const to_url = new URL(base_url); - to_url.pathname = pathname; + to_url.pathname = pathname + .split("/") + .filter((e) => e) + .join("/"); const cur_url = new URL(location.href); let final_url = ""; - if (to_url.host === cur_url.host) { + if (to_url.host === cur_url.host || proxy === false) { final_url = to_url.toString(); } else { final_url = `${cur_url.protocol}//${ @@ -155,3 +158,4 @@ const fetchSendApi = async (url: string, params: any) => { "content-type": "application/json", }); }; + \ No newline at end of file diff --git a/app/web/src/base/load/proxy.ts b/app/web/src/base/load/proxy.ts index b6e9d9e7..a3b82876 100644 --- a/app/web/src/base/load/proxy.ts +++ b/app/web/src/base/load/proxy.ts @@ -1,3 +1,5 @@ +import axios from "axios"; + (BigInt.prototype as any).toJSON = function (): string { return `BigInt::` + this.toString(); }; @@ -12,6 +14,7 @@ export const fetchViaProxy = async ( let body = null as any; let isFile = false; + let uploadProgress = null as any; const files: File[] = []; if (Array.isArray(data)) { @@ -20,11 +23,15 @@ export const fetchViaProxy = async ( files.push(item); isFile = true; } + if (typeof item === "function") { + uploadProgress = item; + } } } else if (data instanceof File) { isFile = true; files.push(data); } + if (!isFile) { body = JSON.stringify(data); headers["content-type"] = "aplication/json"; @@ -53,21 +60,32 @@ export const fetchViaProxy = async ( } if (final_url) { - const res = await fetch( - final_url, - data - ? { - method: "POST", - body, - headers, - } - : undefined - ); - const raw = await res.text(); - try { - return JSON.parse(raw); - } catch (e) { - return raw; + if (uploadProgress) { + const res = await axios({ + method: data ? "post" : undefined, + url: final_url, + data: body, + onUploadProgress: uploadProgress, + }); + + return res.data; + } else { + const res = await fetch( + final_url, + data + ? { + method: "POST", + body, + headers, + } + : undefined + ); + const raw = await res.text(); + try { + return JSON.parse(raw); + } catch (e) { + return raw; + } } } } diff --git a/app/web/src/nova/ed/logic/ed-global.ts b/app/web/src/nova/ed/logic/ed-global.ts index e999533b..6602e8ab 100644 --- a/app/web/src/nova/ed/logic/ed-global.ts +++ b/app/web/src/nova/ed/logic/ed-global.ts @@ -255,6 +255,12 @@ export const EDGlobal = { HTMLElement, MouseEvent >, + + preview: true, + upload: { + started: false, + progress: {} as Record, + }, }, code: { init: false, diff --git a/app/web/src/nova/ed/panel/file/file-browser.tsx b/app/web/src/nova/ed/panel/file/file-browser.tsx index e144426b..377e22da 100644 --- a/app/web/src/nova/ed/panel/file/file-browser.tsx +++ b/app/web/src/nova/ed/panel/file/file-browser.tsx @@ -10,10 +10,11 @@ import { EdFileTop } from "./file-top"; import { EdFileTree, reloadFileTree } from "./file-tree"; import { uploadFile } from "./file-upload"; import { FEntry } from "./type"; +import { EdFilePreview } from "./file-preview"; export const EdFileBrowser = () => { const p = useGlobal(EDGlobal, "EDITOR"); - + const f = p.ui.popup.file; useEffect(() => { if (!p.script.api && p.site.config?.api_url) { p.script.api = apiProxy(p.site.config.api_url); @@ -24,12 +25,12 @@ export const EdFileBrowser = () => { p.script.api._raw(`/_file/?dir`).then((e: FEntry[]) => { if (Array.isArray(e)) { - p.ui.popup.file.entry = { "/": e }; + f.entry = { "/": e }; - if (p.ui.popup.file.open) { + if (f.open) { reloadFileTree(p); } - p.ui.popup.file.enabled = true; + f.enabled = true; p.render(); } }); @@ -40,14 +41,14 @@ export const EdFileBrowser = () => { noClick: true, }); - if (!p.ui.popup.file.enabled) return null; + if (!f.enabled) return null; return ( <>
{ - p.ui.popup.file.open = true; + f.open = true; p.render(); reloadFileTree(p); }} @@ -71,10 +72,10 @@ export const EdFileBrowser = () => { { if (!open) { - p.ui.popup.file.open = false; + f.open = false; p.render(); } }} @@ -82,7 +83,6 @@ export const EdFileBrowser = () => {
{
- -
- - - {isDragActive && ( -
- + + {f.upload.started ? ( +
+
+
+ Uploading {Object.keys(f.upload.progress).length}{" "} + files +
+ {Object.entries(f.upload.progress).map( + ([name, progress]) => { + return ( +
+
{name}
+
{Math.round(progress * 100)}%
+
+ ); + } + )} +
+
+ ) : ( +
- - - - -
Drag Here to Upload
-
+ + + {isDragActive && ( +
+ + + + + +
Drag Here to Upload
+
+ )} +
+ )} + + {f.preview && ( + <> + + { + localStorage.setItem("panel-file-right", e + ""); + }} + defaultSize={parseInt( + localStorage.getItem("panel-file-right") || "18" + )} + className="flex items-center justify-center" + minSize={12} + > + + + )} -
+
diff --git a/app/web/src/nova/ed/panel/file/file-list.tsx b/app/web/src/nova/ed/panel/file/file-list.tsx index e0232741..02da72aa 100644 --- a/app/web/src/nova/ed/panel/file/file-list.tsx +++ b/app/web/src/nova/ed/panel/file/file-list.tsx @@ -7,9 +7,10 @@ import { import { FC, useCallback, useEffect } from "react"; import { DndProvider } from "react-dnd"; import { useGlobal, useLocal } from "web-utils"; +import { Menu, MenuItem } from "../../../../utils/ui/context-menu"; import { EDGlobal, PG } from "../../logic/ed-global"; import { FEntry } from "./type"; -import { Menu, MenuItem } from "../../../../utils/ui/context-menu"; +import { reloadFileTree } from "./file-tree"; const Tree = DNDTree; @@ -33,28 +34,38 @@ export const EdFileList = () => { container: null as null | HTMLDivElement, }); - const onKeyDown = useCallback((e: KeyboardEvent) => { - if (e.shiftKey || e.ctrlKey || e.metaKey) { - local.multi = true; - local.render(); - } - - if (e.altKey) { - local.inverse = true; - } - - if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a") { - f.selected.clear(); - for (const item of tree) { - if (item.data) f.selected.add(item.data.name); + const onKeyDown = useCallback( + (e: KeyboardEvent) => { + if (e.shiftKey || e.ctrlKey || e.metaKey) { + local.multi = true; + p.render(); } - local.render(); - } - }, []); + + if (e.altKey) { + local.inverse = true; + local.multi = true; + } + + if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a") { + if (document.activeElement?.tagName.toLowerCase() !== "input") { + f.selected.clear(); + const tree = f.entry[f.path]; + if (tree) { + for (const item of tree) { + if (item.name) f.selected.add(item.name); + } + } + p.render(); + } + } + }, + [f.entry[f.path]] + ); + const onKeyUp = useCallback(() => { local.multi = false; local.inverse = false; - local.render(); + p.render(); }, []); useEffect(() => { @@ -87,22 +98,51 @@ export const EdFileList = () => { > { e.preventDefault(); e.stopPropagation(); + f.file_ctx_menu_event = null; + p.render(); + setTimeout(async () => { + const selected = [...f.selected]; + const rename_to = prompt("Rename to:", selected[0]); + + await p.script.api._raw( + `/_file${join(f.path, selected[0])}?rename=${rename_to}` + ); + + reloadFileList(p); + }, 100); }} /> { + onClick={(e) => { e.preventDefault(); e.stopPropagation(); - - if (confirm("Delete this file ?")) { - await p.script.api._raw(`/_file${f.path}?del`); - } + f.file_ctx_menu_event = null; + p.render(); + setTimeout(async () => { + const selected = [...f.selected].map((e) => + f.path.endsWith("/") ? e : "/" + e + ); + if (f.selected.size === 1) { + if (confirm("Delete this file ?")) { + await p.script.api._raw( + `/_file${join(f.path, selected[0])}?del` + ); + } + } else { + if (confirm(`Delete ${f.selected.size} files?`)) { + for (const s of selected) { + await p.script.api._raw(`/_file${join(f.path, s)}?del`); + } + } + } + reloadFileTree(p); + }, 100); }} /> @@ -148,7 +188,9 @@ export const EdFileList = () => { } if (sq.el && sq.box.w > 5 && sq.box.h > 5) { - f.selected.clear(); + if (!local.multi) { + f.selected.clear(); + } for (const [name, el] of Object.entries(local.els)) { if (overlaps(sq.el, el)) { if (!local.inverse) { @@ -163,17 +205,16 @@ export const EdFileList = () => { local.square.up = () => { window.removeEventListener("pointerup", local.square.up); local.square.up = null; - local.multi = false; setTimeout(() => { local.square.started = false; - local.render(); + p.render(); }); }; window.addEventListener("pointerup", local.square.up); } } - local.render(); + p.render(); } }} onPointerDown={(e) => { @@ -184,7 +225,7 @@ export const EdFileList = () => { sq.start.x = e.clientX - box.x; sq.start.y = el.scrollTop + e.clientY - box.y; sq.box = { x: 0, y: 0, w: 0, h: 0 }; - local.render(); + p.render(); } }} onPointerUp={() => { @@ -192,7 +233,7 @@ export const EdFileList = () => { if (!sq.disabled && sq.started) { sq.started = false; } - local.render(); + p.render(); }} >
{ } }} className={cx( - "bg-blue-200 border border-blue-500 absolute z-10 bg-opacity-30 transition-opacity pointer-events-none", + "border absolute z-10 bg-opacity-30 transition-opacity pointer-events-none", css` left: ${sq.box.x}px; top: ${sq.box.y}px; width: ${sq.box.w}px; height: ${sq.box.h}px; `, - sq.started ? "opacity-100" : "opacity-0" + sq.started ? "opacity-100" : "opacity-0", + local.inverse + ? "bg-orange-200 border-orange-500" + : "bg-blue-200 border-blue-500" )} >
@@ -221,13 +265,18 @@ export const EdFileList = () => { display: flex; flex: 1; flex-wrap: wrap; + + li { + margin-left: 5px; + margin-top: 5px; + } } ` )} onPointerDown={() => { - if (!sq.disabled) { + if (!sq.disabled && !local.multi) { f.selected.clear(); - local.render(); + p.render(); } }} > @@ -259,7 +308,7 @@ export const EdFileList = () => { sq.start.x = e.clientX - container.x; sq.start.y = el.scrollTop + e.clientY - container.y; sq.box = { x: 0, y: 0, w: 0, h: 0 }; - local.render(); + p.render(); } } }} @@ -270,11 +319,11 @@ export const EdFileList = () => { }} onDragStart={() => { sq.started = false; - local.render(); + p.render(); }} onDragEnd={() => { sq.item_drag = false; - local.render(); + p.render(); }} /> @@ -331,7 +380,7 @@ const FileItem: FC<{ onPointerDown={(ev) => { if (f.selected.has(e.name)) { local.square.disabled = true; - local.render(); + p.render(); return; } if (!local.square.item_drag) { @@ -341,9 +390,11 @@ const FileItem: FC<{ } if (!local.square.started && f.selected.size <= 1) { local.square.disabled = true; - f.selected.clear(); + if (!local.multi) { + f.selected.clear(); + } f.selected.add(e.name); - local.render(); + p.render(); } }} onPointerUp={(ev) => { @@ -351,7 +402,7 @@ const FileItem: FC<{ if (local.square.disabled) { ev.stopPropagation(); local.square.disabled = false; - local.render(); + p.render(); } else { setTimeout(() => { if ( @@ -359,9 +410,11 @@ const FileItem: FC<{ local.square.box.h < 10 && !f.selected.has(e.name) ) { - f.selected.clear(); + if (!local.multi) { + f.selected.clear(); + } f.selected.add(e.name); - local.render(); + p.render(); } }); } @@ -385,7 +438,11 @@ const FileItem: FC<{ {isImage(ext) ? ( {e.name { item.no_image = true; @@ -411,7 +468,7 @@ const FileItem: FC<{ ); }; -const isImage = (ext: string) => { +export const isImage = (ext: string) => { if (["gif", "jpeg", "jpg", "png", "svg", "webp"].includes(ext)) return true; }; function overlaps(a: HTMLDivElement, b: HTMLDivElement) { @@ -424,3 +481,24 @@ function overlaps(a: HTMLDivElement, b: HTMLDivElement) { const isOverlapping = isInHoriztonalBounds && isInVerticalBounds; return isOverlapping; } + +export const reloadFileList = async (p: PG) => { + const f = p.ui.popup.file; + const res = await p.script.api._raw(`/_file${f.path}?dir`); + + f.entry[f.path] = res; + p.render(); +}; + +const join = (...arg: string[]) => { + let arr: string[] = []; + + for (const s of arg) { + s.split("/").forEach((e) => { + arr.push(e); + }); + } + arr = arr.filter((e) => e); + + return "/" + arg.join("/"); +}; diff --git a/app/web/src/nova/ed/panel/file/file-preview.tsx b/app/web/src/nova/ed/panel/file/file-preview.tsx new file mode 100644 index 00000000..3ece0ad1 --- /dev/null +++ b/app/web/src/nova/ed/panel/file/file-preview.tsx @@ -0,0 +1,136 @@ +import { useGlobal, useLocal } from "web-utils"; +import { EDGlobal } from "../../logic/ed-global"; +import { isImage } from "./file-list"; +import { FEntry } from "./type"; + +export const EdFilePreview = () => { + const p = useGlobal(EDGlobal, "EDITOR"); + const f = p.ui.popup.file; + const local = useLocal({ no_image: false }); + const file_by_ext: Record = {}; + let ext = ""; + let first = undefined as FEntry | undefined; + for (const file of f.selected) { + const f_ext = file.split(".").pop() || ""; + if (f_ext) { + if (!ext) { + ext = f_ext; + first = f.entry[f.path]?.find((e) => e.name === file); + } + + if (!file_by_ext[f_ext]) file_by_ext[f_ext] = []; + + file_by_ext[f_ext].push(file); + } + } + + return ( + <> + {f.selected.size === 0 && ( +
+ Select File +
+ to Preview +
+ )} + {f.selected.size === 1 && ( + + )} + {f.selected.size > 1 && ( +
+
{f.selected.size} files selected:
+
+ {Object.entries(file_by_ext).map(([ext, file]) => { + return ( +
+
+ {ext} +
+
+ {file.length} file{file.length <= 1 ? "" : "s"} +
+
+ ); + })} +
+
+ )} + + ); +}; + +function fileSize(bytes: number): string { + const sizes = ["bytes", "KB", "MB", "GB", "TB"]; + if (bytes === 0) return "0 bytes"; + + const i = Math.floor(Math.log(bytes) / Math.log(1024)); + const size = i === 0 ? bytes : (bytes / Math.pow(1024, i)).toFixed(2); + + return `${size} ${sizes[i]}`; +} diff --git a/app/web/src/nova/ed/panel/file/file-top.tsx b/app/web/src/nova/ed/panel/file/file-top.tsx index bfdd04f1..bd0a2622 100644 --- a/app/web/src/nova/ed/panel/file/file-top.tsx +++ b/app/web/src/nova/ed/panel/file/file-top.tsx @@ -24,7 +24,7 @@ export const EdFileTop = () => { for (let i = 0; i <= idx; i++) npath.push(paths[i]); return (
breadClick(p, "/" + npath.join("/"))} > @@ -33,10 +33,23 @@ export const EdFileTop = () => { ); })}
-
-
- - Upload +
+
+
+ + Upload +
+
+
{ + f.preview = !f.preview; + p.render(); + }} + > + {!f.preview ? : }
@@ -56,3 +69,40 @@ const topClass = (p: PG, className?: string) => "border px-2 mr-1 rounded-sm cursor-pointer hover:bg-blue-100 hover:text-blue-700 border-slate-600 hover:border-blue-600 ", className ); + +const icon_size = 17; +const PreviewRight = () => ( + + + + +); + +const PreviewLeft = () => ( + + + + +); diff --git a/app/web/src/nova/ed/panel/file/file-tree.tsx b/app/web/src/nova/ed/panel/file/file-tree.tsx index 302f44de..67768d41 100644 --- a/app/web/src/nova/ed/panel/file/file-tree.tsx +++ b/app/web/src/nova/ed/panel/file/file-tree.tsx @@ -104,6 +104,7 @@ const TreeItem: FC<{ f.path === path && "border-r-2 bg-blue-100 border-r-blue-700" )} onClick={() => { + f.selected.clear(); f.path = path; p.render(); if (!f.expanded[path] || !f.entry[path]) { @@ -173,13 +174,21 @@ const TreeItem: FC<{ { e.preventDefault(); e.stopPropagation(); - if (!(f.entry[f.tree_ctx_path] && f.entry[f.tree_ctx_path]?.length === 0)) { + if ( + !( + f.entry[f.tree_ctx_path] && + f.entry[f.tree_ctx_path]?.length === 0 + ) + ) { alert("Can only delete empty folder!"); } else { await p.script.api._raw(`/_file${f.tree_ctx_path}?del`); diff --git a/app/web/src/nova/ed/panel/file/file-upload.ts b/app/web/src/nova/ed/panel/file/file-upload.ts index 58602912..00b9f27b 100644 --- a/app/web/src/nova/ed/panel/file/file-upload.ts +++ b/app/web/src/nova/ed/panel/file/file-upload.ts @@ -3,7 +3,66 @@ import { PG } from "../../logic/ed-global"; import { reloadFileTree } from "./file-tree"; export const uploadFile = async (p: PG, files: File[]) => { - await p.script.api._raw(`/_upload?to=${p.ui.popup.file.path}`, ...files); + const f = p.ui.popup.file; + const promises: Promise[] = []; + f.upload.started = true; + f.upload.progress = {}; + const pr = f.upload.progress; + let folder_created = new Set(); + for (const file of files) { + let path = f.path; + let filename = (file as any).path ? (file as any).path : file.name; + + if ((file as any).path) { + const arr = (file as any).path.split("/") as string[]; + arr.pop(); + path = join(path, ...arr); + const folder = arr.filter((e) => e).join("/"); + if (folder) { + folder_created.add(folder); + } + } + + if (!pr[filename]) { + pr[filename] = 0.1; + } + + promises.push( + p.script.api._raw(`/_upload?to=${path}`, file, (arg: any) => { + pr[filename] = arg.progress; + p.render(); + }) + ); + } + + await Promise.all(promises); + alert( + `\ +Uploaded Finished: + - ${files.length} files uploaded${ + folder_created.size > 0 + ? `\n ${[...folder_created] + .map((e) => ` - Folder ${e} created.`) + .join("\n")}` + : "" + }` + ); + f.upload.progress = {}; + f.upload.started = false; + p.render(); reloadFileTree(p); }; + +const join = (...arg: string[]) => { + let arr: string[] = []; + + for (const s of arg) { + s.split("/").forEach((e) => { + arr.push(e); + }); + } + arr = arr.filter((e) => !!e.trim()); + + return "/" + arg.join("/"); +}; diff --git a/app/web/src/utils/ui/context-menu.tsx b/app/web/src/utils/ui/context-menu.tsx index 7d8d99d0..53908ba3 100644 --- a/app/web/src/utils/ui/context-menu.tsx +++ b/app/web/src/utils/ui/context-menu.tsx @@ -36,7 +36,7 @@ export const MenuItem = forwardRef< return (