PageSourceSearch

https://carpfishing.ai/assets/index-D2VGHOep.js

js carpfishing.ai collected 2026-10-05 15:29:03 UTC 1,023,548 bytes, 689 lines download raw bytes

vendor: 5,800 bytes, lines 1-9
1function dk(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function fk(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var J0={exports:{}},Wc={},G0={exports:{}},Z={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var la=Symbol.for("react.element"),hk=Symbol.for("react.portal"),pk=Symbol.for("react.fragment"),mk=Symbol.for("react.strict_mode"),gk=Symbol.for("react.profiler"),xk=Symbol.for("react.provider"),yk=Symbol.for("react.context"),vk=Symbol.for("react.forward_ref"),bk=Symbol.for("react.suspense"),wk=Symbol.for("react.memo"),kk=Symbol.for("react.lazy"),Nm=Symbol.iterator;function Nk(t){return t===null||typeof t!="object"?null:(t=Nm&&t[Nm]||t["@@iterator"],typeof t=="function"?t:null)}var X0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Y0=Object.assign,Q0={};function _i(t,e,n){this.props=t,this.context=e,this.refs=Q0,this.updater=n||X0}_i.prototype.isReactComponent={};_i.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};_i.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Z0(){}Z0.prototype=_i.prototype;function Ch(t,e,n){this.props=t,this.context=e,this.refs=Q0,this.updater=n||X0}var Eh=Ch.prototype=new Z0;Eh.constructor=Ch;Y0(Eh,_i.prototype);Eh.isPureReactComponent=!0;var jm=Array.isArray,ey=Object.prototype.hasOwnProperty,Th={current:null},ty={key:!0,ref:!0,__self:!0,__source:!0};function ny(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)ey.call(e,r)&&!ty.hasOwnProperty(r)&&(s[r]=e[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];s.children=c}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:la,type:t,key:i,ref:o,props:s,_owner:Th.current}}function jk(t,e){return{$$typeof:la,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Ah(t){return typeof t=="object"&&t!==null&&t.$$typeof===la}function _k(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var _m=/\/+/g;function Ou(t,e){return typeof t=="object"&&t!==null&&t.key!=null?_k(""+t.key):e.toString(36)}function cl(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case la:case hk:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+Ou(o,0):r,jm(s)?(n="",t!=null&&(n=t.replace(_m,"$&/")+"/"),cl(s,e,n,"",function(u){return u})):s!=null&&(Ah(s)&&(s=jk(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(_m,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",jm(t))for(var a=0;a<t.length;a++){i=t[a];var c=r+Ou(i,a);o+=cl(i,e,n,c,s)}else if(c=Nk(t),typeof c=="function")for(t=c.call(t),a=0;!(i=t.next()).done;)i=i.value,c=r+Ou(i,a++),o+=cl(i,e,n,c,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Sa(t,e,n){if(t==null)return t;var r=[],s=0;return cl(t,r,"","",function(i){return e.call(n,i,s++)}),r}function Sk(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var ft={current:null},ul={transition:null},Ck={ReactCurrentDispatcher:ft,ReactCurrentBatchConfig:ul,ReactCurrentOwner:Th};function ry(){throw Error("act(...) is not supported in production builds of React.")}
vendor: 7,457 bytes, lines 9-25
9Z.Children={map:Sa,forEach:function(t,e,n){Sa(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Sa(t,function(){e++}),e},toArray:function(t){return Sa(t,function(e){return e})||[]},only:function(t){if(!Ah(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Z.Component=_i;Z.Fragment=pk;Z.Profiler=gk;Z.PureComponent=Ch;Z.StrictMode=mk;Z.Suspense=bk;Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ck;Z.act=ry;Z.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=Y0({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Th.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(c in e)ey.call(e,c)&&!ty.hasOwnProperty(c)&&(r[c]=e[c]===void 0&&a!==void 0?a[c]:e[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:la,type:t.type,key:s,ref:i,props:r,_owner:o}};Z.createContext=function(t){return t={$$typeof:yk,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:xk,_context:t},t.Consumer=t};Z.createElement=ny;Z.createFactory=function(t){var e=ny.bind(null,t);return e.type=t,e};Z.createRef=function(){return{current:null}};Z.forwardRef=function(t){return{$$typeof:vk,render:t}};Z.isValidElement=Ah;Z.lazy=function(t){return{$$typeof:kk,_payload:{_status:-1,_result:t},_init:Sk}};Z.memo=function(t,e){return{$$typeof:wk,type:t,compare:e===void 0?null:e}};Z.startTransition=function(t){var e=ul.transition;ul.transition={};try{t()}finally{ul.transition=e}};Z.unstable_act=ry;Z.useCallback=function(t,e){return ft.current.useCallback(t,e)};Z.useContext=function(t){return ft.current.useContext(t)};Z.useDebugValue=function(){};Z.useDeferredValue=function(t){return ft.current.useDeferredValue(t)};Z.useEffect=function(t,e){return ft.current.useEffect(t,e)};Z.useId=function(){return ft.current.useId()};Z.useImperativeHandle=function(t,e,n){return ft.current.useImperativeHandle(t,e,n)};Z.useInsertionEffect=function(t,e){return ft.current.useInsertionEffect(t,e)};Z.useLayoutEffect=function(t,e){return ft.current.useLayoutEffect(t,e)};Z.useMemo=function(t,e){return ft.current.useMemo(t,e)};Z.useReducer=function(t,e,n){return ft.current.useReducer(t,e,n)};Z.useRef=function(t){return ft.current.useRef(t)};Z.useState=function(t){return ft.current.useState(t)};Z.useSyncExternalStore=function(t,e,n){return ft.current.useSyncExternalStore(t,e,n)};Z.useTransition=function(){return ft.current.useTransition()};Z.version="18.3.1";G0.exports=Z;var N=G0.exports;const ee=Sh(N),Ek=dk({__proto__:null,default:ee},[N]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var Tk=N,Ak=Symbol.for("react.element"),Mk=Symbol.for("react.fragment"),Ok=Object.prototype.hasOwnProperty,Pk=Tk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ik={key:!0,ref:!0,__self:!0,__source:!0};function sy(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Ok.call(e,r)&&!Ik.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:Ak,type:t,key:i,ref:o,props:s,_owner:Pk.current}}Wc.Fragment=Mk;Wc.jsx=sy;Wc.jsxs=sy;J0.exports=Wc;var l=J0.exports,iy={exports:{}},At={},oy={exports:{}},ay={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(t){function e($,J){var V=$.length;$.push(J);e:for(;0<V;){var he=V-1>>>1,se=$[he];if(0<s(se,J))$[he]=J,$[V]=se,V=he;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var J=$[0],V=$.pop();if(V!==J){$[0]=V;e:for(var he=0,se=$.length,Bn=se>>>1;he<Bn;){var Kt=2*(he+1)-1,Ss=$[Kt],oe=Kt+1,Jt=$[oe];if(0>s(Ss,V))oe<se&&0>s(Jt,Ss)?($[he]=Jt,$[oe]=V,he=oe):($[he]=Ss,$[Kt]=V,he=Kt);else if(oe<se&&0>s(Jt,V))$[he]=Jt,$[oe]=V,he=oe;else break e}}return J}function s($,J){var V=$.sortIndex-J.sortIndex;return V!==0?V:$.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b($){for(var J=n(u);J!==null;){if(J.callback===null)r(u);else if(J.startTime<=$)r(u),J.sortIndex=J.expirationTime,e(c,J);else break;J=n(u)}}function _($){if(g=!1,b($),!m)if(n(c)!==null)m=!0,q(C);else{var J=n(u);J!==null&&K(_,J.startTime-$)}}function C($,J){m=!1,g&&(g=!1,x(E),E=-1),p=!0;var V=h;try{for(b(J),f=n(c);f!==null&&(!(f.expirationTime>J)||$&&!A());){var he=f.callback;if(typeof he=="function"){f.callback=null,h=f.priorityLevel;var se=he(f.expirationTime<=J);J=t.unstable_now(),typeof se=="function"?f.callback=se:f===n(c)&&r(c),b(J)}else r(c);f=n(c)}if(f!==null)var Bn=!0;else{var Kt=n(u);Kt!==null&&K(_,Kt.startTime-J),Bn=!1}return Bn}finally{f=null,h=V,p=!1}}var w=!1,k=null,E=-1,S=5,j=-1;function A(){return!(t.unstable_now()-j<S)}function z(){if(k!==null){var $=t.unstable_now();j=$;var J=!0;try{J=k(!0,$)}finally{J?R():(w=!1,k=null)}}else w=!1}var R;if(typeof v=="function")R=function(){v(z)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,D=O.port2;O.port1.onmessage=z,R=function(){D.postMessage(null)}}else R=function(){y(z,0)};function q($){k=$,w||(w=!0,R())}function K($,J){E=y(function(){$(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function($){$.callback=null},t.unstable_continueExecution=function(){m||p||(m=!0,q(C))},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(c)},t.unstable_next=function($){switch(h){case 1:case 2:case 3:var J=3;break;default:J=h}var V=h;h=J;try{return $()}finally{h=V}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function($,J){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var V=h;h=$;try{return J()}finally{h=V}},t.unstable_scheduleCallback=function($,J,V){var he=t.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?he+V:he):V=he,$){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}
vendor: 4,620 bytes, lines 25-33
25return se=V+se,$={id:d++,callback:J,priorityLevel:$,startTime:V,expirationTime:se,sortIndex:-1},V>he?($.sortIndex=V,e(u,$),n(c)===null&&$===n(u)&&(g?(x(E),E=-1):g=!0,K(_,V-he))):($.sortIndex=se,e(c,$),m||p||(m=!0,q(C))),$},t.unstable_shouldYield=A,t.unstable_wrapCallback=function($){var J=h;return function(){var V=h;h=J;try{return $.apply(this,arguments)}finally{h=V}}}})(ay);oy.exports=ay;var Rk=oy.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var Lk=N,Tt=Rk;function P(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ly=new Set,To={};function bs(t,e){li(t,e),li(t+"Capture",e)}function li(t,e){for(To[t]=e,t=0;t<e.length;t++)ly.add(e[t])}var In=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ud=Object.prototype.hasOwnProperty,Dk=/^[: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]*$/,Sm={},Cm={};function $k(t){return Ud.call(Cm,t)?!0:Ud.call(Sm,t)?!1:Dk.test(t)?Cm[t]=!0:(Sm[t]=!0,!1)}function zk(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Bk(t,e,n,r){if(e===null||typeof e>"u"||zk(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ht(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Je={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Je[t]=new ht(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Je[e]=new ht(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Je[t]=new ht(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Je[t]=new ht(t,2,!1,t,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(t){Je[t]=new ht(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Je[t]=new ht(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Je[t]=new ht(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Je[t]=new ht(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Je[t]=new ht(t,5,!1,t.toLowerCase(),null,!1,!1)});var Mh=/[\-:]([a-z])/g;function Oh(t){return t[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
33-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(t){var e=t.replace(Mh,Oh);Je[e]=new ht(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Mh,Oh);Je[e]=new ht(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Mh,Oh);Je[e]=new ht(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Je[t]=new ht(t,1,!1,t.toLowerCase(),null,!1,!1)});Je.xlinkHref=new ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Je[t]=new ht(t,1,!1,t.toLowerCase(),null,!0,!0)});function Ph(t,e,n,r){var s=Je.hasOwnProperty(e)?Je[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Bk(e,n,s,r)&&(n=null),r||s===null?$k(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var $n=Lk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ca=Symbol.for("react.element"),Bs=Symbol.for("react.portal"),Fs=Symbol.for("react.fragment"),Ih=Symbol.for("react.strict_mode"),Vd=Symbol.for("react.profiler"),cy=Symbol.for("react.provider"),uy=Symbol.for("react.context"),Rh=Symbol.for("react.forward_ref"),Hd=Symbol.for("react.suspense"),qd=Symbol.for("react.suspense_list"),Lh=Symbol.for("react.memo"),Wn=Symbol.for("react.lazy"),dy=Symbol.for("react.offscreen"),Em=Symbol.iterator;function Pi(t){return t===null||typeof t!="object"?null:(t=Em&&t[Em]||t["@@iterator"],typeof t=="function"?t:null)}var xe=Object.assign,Pu;function Gi(t){if(Pu===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Pu=e&&e[1]||""}return`
34`+Pu+t}var Iu=!1;function Ru(t,e){if(!t||Iu)return"";Iu=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35`),i=r.stack.split(`
36`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var c=`
37`+s[o].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=o&&0<=a);break}}}finally{Iu=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Gi(t):""}function Fk(t){switch(t.tag){case 5:return Gi(t.type);case 16:return Gi("Lazy");case 13:return Gi("Suspense");case 19:return Gi("SuspenseList");case 0:case 2:case 15:return t=Ru(t.type,!1),t;case 11:return t=Ru(t.type.render,!1),t;case 1:return t=Ru(t.type,!0),t;default:return""}}function Wd(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Fs:return"Fragment";case Bs:return"Portal";case Vd:return"Profiler";case Ih:return"StrictMode";case Hd:return"Suspense";case qd:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case uy:return(t.displayName||"Context")+".Consumer";case cy:return(t._context.displayName||"Context")+".Provider";case Rh:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Lh:return e=t.displayName||null,e!==null?e:Wd(t.type)||"Memo";case Wn:e=t._payload,t=t._init;try{return Wd(t(e))}catch{}}return null}function Uk(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Wd(e);case 8:return e===Ih?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function br(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function fy(t){var e=t.type;
vendor: 9,220 bytes, line 37
37return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Vk(t){var e=fy(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ea(t){t._valueTracker||(t._valueTracker=Vk(t))}function hy(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=fy(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function El(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Kd(t,e){var n=e.checked;return xe({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Tm(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=br(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function py(t,e){e=e.checked,e!=null&&Ph(t,"checked",e,!1)}function Jd(t,e){py(t,e);var n=br(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Gd(t,e.type,n):e.hasOwnProperty("defaultValue")&&Gd(t,e.type,br(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Am(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Gd(t,e,n){(e!=="number"||El(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Xi=Array.isArray;function Zs(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+br(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Xd(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(P(91));return xe({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Mm(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(P(92));if(Xi(n)){if(1<n.length)throw Error(P(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:br(n)}}function my(t,e){var n=br(e.value),r=br(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Om(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function gy(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Yd(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?gy(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ta,xy=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Ta=Ta||document.createElement("div"),Ta.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Ta.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ao(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var io={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},Hk=["Webkit","ms","Moz","O"];Object.keys(io).forEach(function(t){Hk.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),io[e]=io[t]})});function yy(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||io.hasOwnProperty(t)&&io[t]?(""+e).trim():e+"px"}function vy(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=yy(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var qk=xe({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 Qd(t,e){if(e){if(qk[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(P(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(P(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(P(61))}if(e.style!=null&&typeof e.style!="object")throw Error(P(62))}}function Zd(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 ef=null;function Dh(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var tf=null,ei=null,ti=null;function Pm(t){if(t=da(t)){if(typeof tf!="function")throw Error(P(280));var e=t.stateNode;e&&(e=Yc(e),tf(t.stateNode,t.type,e))}}function by(t){ei?ti?ti.push(t):ti=[t]:ei=t}function wy(){if(ei){var t=ei,e=ti;if(ti=ei=null,Pm(t),e)for(t=0;t<e.length;t++)Pm(e[t])}}function ky(t,e){return t(e)}function Ny(){}var Lu=!1;function jy(t,e,n){if(Lu)return t(e,n);Lu=!0;try{return ky(t,e,n)}finally{Lu=!1,(ei!==null||ti!==null)&&(Ny(),wy())}}function Mo(t,e){var n=t.stateNode;if(n===null)return null;var r=Yc(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(P(231,e,typeof n));return n}var nf=!1;if(In)try{var Ii={};Object.defineProperty(Ii,"passive",{get:function(){nf=!0}}),window.addEventListener("test",Ii,Ii),window.removeEventListener("test",Ii,Ii)}catch{nf=!1}function Wk(t,e,n,r,s,i,o,a,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(d){this.onError(d)}}var oo=!1,Tl=null,Al=!1,rf=null,Kk={onError:function(t){oo=!0,Tl=t}};function Jk(t,e,n,r,s,i,o,a,c){oo=!1,Tl=null,Wk.apply(Kk,arguments)}function Gk(t,e,n,r,s,i,o,a,c){if(Jk.apply(this,arguments),oo){if(oo){var u=Tl;oo=!1,Tl=null}else throw Error(P(198));Al||(Al=!0,rf=u)}}function ws(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function _y(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Im(t){if(ws(t)!==t)throw Error(P(188))}function Xk(t){var e=t.alternate;if(!e){if(e=ws(t),e===null)throw Error(P(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Im(s),t;if(i===r)return Im(s),e;i=i.sibling}throw Error(P(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(P(189))}}if(n.alternate!==r)throw Error(P(190))}if(n.tag!==3)throw Error(P(188));return n.stateNode.current===n?t:e}function Sy(t){return t=Xk(t),t!==null?Cy(t):null}function Cy(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Cy(t);if(e!==null)return e;t=t.sibling}return null}
vendor: 6,525 bytes, line 37
37var Ey=Tt.unstable_scheduleCallback,Rm=Tt.unstable_cancelCallback,Yk=Tt.unstable_shouldYield,Qk=Tt.unstable_requestPaint,je=Tt.unstable_now,Zk=Tt.unstable_getCurrentPriorityLevel,$h=Tt.unstable_ImmediatePriority,Ty=Tt.unstable_UserBlockingPriority,Ml=Tt.unstable_NormalPriority,eN=Tt.unstable_LowPriority,Ay=Tt.unstable_IdlePriority,Kc=null,gn=null;function tN(t){if(gn&&typeof gn.onCommitFiberRoot=="function")try{gn.onCommitFiberRoot(Kc,t,void 0,(t.current.flags&128)===128)}catch{}}var sn=Math.clz32?Math.clz32:sN,nN=Math.log,rN=Math.LN2;function sN(t){return t>>>=0,t===0?32:31-(nN(t)/rN|0)|0}var Aa=64,Ma=4194304;function Yi(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ol(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Yi(a):(i&=o,i!==0&&(r=Yi(i)))}else o=n&~s,o!==0?r=Yi(o):i!==0&&(r=Yi(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-sn(e),s=1<<n,r|=t[n],e&=~s;return r}function iN(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function oN(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-sn(i),a=1<<o,c=s[o];c===-1?(!(a&n)||a&r)&&(s[o]=iN(a,e)):c<=e&&(t.expiredLanes|=a),i&=~a}}function sf(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function My(){var t=Aa;return Aa<<=1,!(Aa&4194240)&&(Aa=64),t}function Du(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function ca(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-sn(e),t[e]=n}function aN(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-sn(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function zh(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-sn(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var re=0;function Oy(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Py,Bh,Iy,Ry,Ly,of=!1,Oa=[],ar=null,lr=null,cr=null,Oo=new Map,Po=new Map,Yn=[],lN="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Lm(t,e){switch(t){case"focusin":case"focusout":ar=null;break;case"dragenter":case"dragleave":lr=null;break;case"mouseover":case"mouseout":cr=null;break;case"pointerover":case"pointerout":Oo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Po.delete(e.pointerId)}}function Ri(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=da(e),e!==null&&Bh(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function cN(t,e,n,r,s){switch(e){case"focusin":return ar=Ri(ar,t,e,n,r,s),!0;case"dragenter":return lr=Ri(lr,t,e,n,r,s),!0;case"mouseover":return cr=Ri(cr,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return Oo.set(i,Ri(Oo.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Po.set(i,Ri(Po.get(i)||null,t,e,n,r,s)),!0}return!1}function Dy(t){var e=Hr(t.target);if(e!==null){var n=ws(e);if(n!==null){if(e=n.tag,e===13){if(e=_y(n),e!==null){t.blockedOn=e,Ly(t.priority,function(){Iy(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function dl(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=af(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);ef=r,n.target.dispatchEvent(r),ef=null}else return e=da(n),e!==null&&Bh(e),t.blockedOn=n,!1;e.shift()}return!0}function Dm(t,e,n){dl(t)&&n.delete(e)}function uN(){of=!1,ar!==null&&dl(ar)&&(ar=null),lr!==null&&dl(lr)&&(lr=null),cr!==null&&dl(cr)&&(cr=null),Oo.forEach(Dm),Po.forEach(Dm)}function Li(t,e){t.blockedOn===e&&(t.blockedOn=null,of||(of=!0,Tt.unstable_scheduleCallback(Tt.unstable_NormalPriority,uN)))}function Io(t){function e(s){return Li(s,t)}if(0<Oa.length){Li(Oa[0],t);for(var n=1;n<Oa.length;n++){var r=Oa[n];r.blockedOn===t&&(r.blockedOn=null)}}for(ar!==null&&Li(ar,t),lr!==null&&Li(lr,t),cr!==null&&Li(cr,t),Oo.forEach(e),Po.forEach(e),n=0;n<Yn.length;n++)r=Yn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Yn.length&&(n=Yn[0],n.blockedOn===null);)Dy(n),n.blockedOn===null&&Yn.shift()}var ni=$n.ReactCurrentBatchConfig,Pl=!0;function dN(t,e,n,r){var s=re,i=ni.transition;ni.transition=null;try{re=1,Fh(t,e,n,r)}finally{re=s,ni.transition=i}}function fN(t,e,n,r){var s=re,i=ni.transition;ni.transition=null;try{re=4,Fh(t,e,n,r)}finally{re=s,ni.transition=i}}function Fh(t,e,n,r){if(Pl){var s=af(t,e,n,r);if(s===null)Ku(t,e,r,Il,n),Lm(t,r);else if(cN(s,t,e,n,r))r.stopPropagation();else if(Lm(t,r),e&4&&-1<lN.indexOf(t)){for(;s!==null;){var i=da(s);if(i!==null&&Py(i),i=af(t,e,n,r),i===null&&Ku(t,e,r,Il,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Ku(t,e,r,null,n)}}var Il=null;function af(t,e,n,r){if(Il=null,t=Dh(r),t=Hr(t),t!==null)if(e=ws(t),e===null)t=null;else if(n=e.tag,n===13){if(t=_y(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Il=t,null}
vendor: 10,401 bytes, line 37
37function $y(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Zk()){case $h:return 1;case Ty:return 4;case Ml:case eN:return 16;case Ay:return 536870912;default:return 16}default:return 16}}var tr=null,Uh=null,fl=null;function zy(){if(fl)return fl;var t,e=Uh,n=e.length,r,s="value"in tr?tr.value:tr.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return fl=s.slice(t,1<r?1-r:void 0)}function hl(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Pa(){return!0}function $m(){return!1}function Mt(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Pa:$m,this.isPropagationStopped=$m,this}return xe(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Pa)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Pa)},persist:function(){},isPersistent:Pa}),e}var Si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vh=Mt(Si),ua=xe({},Si,{view:0,detail:0}),hN=Mt(ua),$u,zu,Di,Jc=xe({},ua,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hh,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Di&&(Di&&t.type==="mousemove"?($u=t.screenX-Di.screenX,zu=t.screenY-Di.screenY):zu=$u=0,Di=t),$u)},movementY:function(t){return"movementY"in t?t.movementY:zu}}),zm=Mt(Jc),pN=xe({},Jc,{dataTransfer:0}),mN=Mt(pN),gN=xe({},ua,{relatedTarget:0}),Bu=Mt(gN),xN=xe({},Si,{animationName:0,elapsedTime:0,pseudoElement:0}),yN=Mt(xN),vN=xe({},Si,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),bN=Mt(vN),wN=xe({},Si,{data:0}),Bm=Mt(wN),kN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NN={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},jN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _N(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=jN[t])?!!e[t]:!1}function Hh(){return _N}var SN=xe({},ua,{key:function(t){if(t.key){var e=kN[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=hl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?NN[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hh,charCode:function(t){return t.type==="keypress"?hl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?hl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),CN=Mt(SN),EN=xe({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fm=Mt(EN),TN=xe({},ua,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hh}),AN=Mt(TN),MN=xe({},Si,{propertyName:0,elapsedTime:0,pseudoElement:0}),ON=Mt(MN),PN=xe({},Jc,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),IN=Mt(PN),RN=[9,13,27,32],qh=In&&"CompositionEvent"in window,ao=null;In&&"documentMode"in document&&(ao=document.documentMode);var LN=In&&"TextEvent"in window&&!ao,By=In&&(!qh||ao&&8<ao&&11>=ao),Um=" ",Vm=!1;function Fy(t,e){switch(t){case"keyup":return RN.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uy(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Us=!1;function DN(t,e){switch(t){case"compositionend":return Uy(e);case"keypress":return e.which!==32?null:(Vm=!0,Um);case"textInput":return t=e.data,t===Um&&Vm?null:t;default:return null}}function $N(t,e){if(Us)return t==="compositionend"||!qh&&Fy(t,e)?(t=zy(),fl=Uh=tr=null,Us=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return By&&e.locale!=="ko"?null:e.data;default:return null}}var zN={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Hm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!zN[t.type]:e==="textarea"}function Vy(t,e,n,r){by(r),e=Rl(e,"onChange"),0<e.length&&(n=new Vh("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var lo=null,Ro=null;function BN(t){ev(t,0)}function Gc(t){var e=qs(t);if(hy(e))return t}function FN(t,e){if(t==="change")return e}var Hy=!1;if(In){var Fu;if(In){var Uu="oninput"in document;if(!Uu){var qm=document.createElement("div");qm.setAttribute("oninput","return;"),Uu=typeof qm.oninput=="function"}Fu=Uu}else Fu=!1;Hy=Fu&&(!document.documentMode||9<document.documentMode)}function Wm(){lo&&(lo.detachEvent("onpropertychange",qy),Ro=lo=null)}function qy(t){if(t.propertyName==="value"&&Gc(Ro)){var e=[];Vy(e,Ro,t,Dh(t)),jy(BN,e)}}function UN(t,e,n){t==="focusin"?(Wm(),lo=e,Ro=n,lo.attachEvent("onpropertychange",qy)):t==="focusout"&&Wm()}function VN(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Gc(Ro)}function HN(t,e){if(t==="click")return Gc(e)}function qN(t,e){if(t==="input"||t==="change")return Gc(e)}function WN(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ln=typeof Object.is=="function"?Object.is:WN;function Lo(t,e){if(ln(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Ud.call(e,s)||!ln(t[s],e[s]))return!1}return!0}function Km(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Jm(t,e){var n=Km(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Km(n)}}function Wy(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Wy(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Ky(){for(var t=window,e=El();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=El(t.document)}return e}function Wh(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function KN(t){var e=Ky(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Wy(n.ownerDocument.documentElement,n)){if(r!==null&&Wh(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=Jm(n,i);var o=Jm(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var JN=In&&"documentMode"in document&&11>=document.documentMode,Vs=null,lf=null,co=null,cf=!1;function Gm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cf||Vs==null||Vs!==El(r)||(r=Vs,"selectionStart"in r&&Wh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,501 bytes, line 37
37sNode:r.focusNode,focusOffset:r.focusOffset}),co&&Lo(co,r)||(co=r,r=Rl(lf,"onSelect"),0<r.length&&(e=new Vh("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Vs)))}function Ia(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Hs={animationend:Ia("Animation","AnimationEnd"),animationiteration:Ia("Animation","AnimationIteration"),animationstart:Ia("Animation","AnimationStart"),transitionend:Ia("Transition","TransitionEnd")},Vu={},Jy={};In&&(Jy=document.createElement("div").style,"AnimationEvent"in window||(delete Hs.animationend.animation,delete Hs.animationiteration.animation,delete Hs.animationstart.animation),"TransitionEvent"in window||delete Hs.transitionend.transition);function Xc(t){if(Vu[t])return Vu[t];if(!Hs[t])return t;var e=Hs[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Jy)return Vu[t]=e[n];return t}var Gy=Xc("animationend"),Xy=Xc("animationiteration"),Yy=Xc("animationstart"),Qy=Xc("transitionend"),Zy=new Map,Xm="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Er(t,e){Zy.set(t,e),bs(e,[t])}for(var Hu=0;Hu<Xm.length;Hu++){var qu=Xm[Hu],GN=qu.toLowerCase(),XN=qu[0].toUpperCase()+qu.slice(1);Er(GN,"on"+XN)}Er(Gy,"onAnimationEnd");Er(Xy,"onAnimationIteration");Er(Yy,"onAnimationStart");Er("dblclick","onDoubleClick");Er("focusin","onFocus");Er("focusout","onBlur");Er(Qy,"onTransitionEnd");li("onMouseEnter",["mouseout","mouseover"]);li("onMouseLeave",["mouseout","mouseover"]);li("onPointerEnter",["pointerout","pointerover"]);li("onPointerLeave",["pointerout","pointerover"]);bs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));bs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));bs("onBeforeInput",["compositionend","keypress","textInput","paste"]);bs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));bs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));bs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),YN=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qi));function Ym(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,Gk(r,e,void 0,t),t.currentTarget=null}function ev(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&s.isPropagationStopped())break e;Ym(s,a,u),i=c}else for(o=0;o<r.length;o++){if(a=r[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&s.isPropagationStopped())break e;Ym(s,a,u),i=c}}}if(Al)throw t=rf,Al=!1,rf=null,t}function ce(t,e){var n=e[pf];n===void 0&&(n=e[pf]=new Set);var r=t+"__bubble";n.has(r)||(tv(e,t,2,!1),n.add(r))}function Wu(t,e,n){var r=0;e&&(r|=4),tv(n,t,r,e)}var Ra="_reactListening"+Math.random().toString(36).slice(2);function Do(t){if(!t[Ra]){t[Ra]=!0,ly.forEach(function(n){n!=="selectionchange"&&(YN.has(n)||Wu(n,!1,t),Wu(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Ra]||(e[Ra]=!0,Wu("selectionchange",!1,e))}}function tv(t,e,n,r){switch($y(e)){case 1:var s=dN;break;case 4:s=fN;break;default:s=Fh}n=s.bind(null,e,n,t),s=void 0,!nf||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function Ku(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;
vendor: 2,527 bytes, line 37
37if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Hr(a),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}a=a.parentNode}}r=r.return}jy(function(){var u=i,d=Dh(n),f=[];e:{var h=Zy.get(t);if(h!==void 0){var p=Vh,m=t;switch(t){case"keypress":if(hl(n)===0)break e;case"keydown":case"keyup":p=CN;break;case"focusin":m="focus",p=Bu;break;case"focusout":m="blur",p=Bu;break;case"beforeblur":case"afterblur":p=Bu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=zm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=mN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=AN;break;case Gy:case Xy:case Yy:p=yN;break;case Qy:p=ON;break;case"scroll":p=hN;break;case"wheel":p=IN;break;case"copy":case"cut":case"paste":p=bN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Fm}var g=(e&4)!==0,y=!g&&t==="scroll",x=g?h!==null?h+"Capture":null:h;g=[];for(var v=u,b;v!==null;){b=v;var _=b.stateNode;if(b.tag===5&&_!==null&&(b=_,x!==null&&(_=Mo(v,x),_!=null&&g.push($o(v,_,b)))),y)break;v=v.return}0<g.length&&(h=new p(h,m,null,n,d),f.push({event:h,listeners:g}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",h&&n!==ef&&(m=n.relatedTarget||n.fromElement)&&(Hr(m)||m[Rn]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=u,m=m?Hr(m):null,m!==null&&(y=ws(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(g=zm,_="onMouseLeave",x="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(g=Fm,_="onPointerLeave",x="onPointerEnter",v="pointer"),y=p==null?h:qs(p),b=m==null?h:qs(m),h=new g(_,v+"leave",p,n,d),h.target=y,h.relatedTarget=b,_=null,Hr(d)===u&&(g=new g(x,v+"enter",m,n,d),g.target=b,g.relatedTarget=y,_=g),y=_,p&&m)t:{for(g=p,x=m,v=0,b=g;b;b=Cs(b))v++;for(b=0,_=x;_;_=Cs(_))b++;for(;0<v-b;)g=Cs(g),v--;for(;0<b-v;)x=Cs(x),b--;for(;v--;){if(g===x||x!==null&&g===x.alternate)break t;g=Cs(g),x=Cs(x)}g=null}else g=null;p!==null&&Qm(f,h,p,g,!1),m!==null&&y!==null&&Qm(f,y,m,g,!0)}}
vendor: 4,153 bytes, lines 37-38
37e:{if(h=u?qs(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var C=FN;else if(Hm(h))if(Hy)C=qN;else{C=VN;var w=UN}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(C=HN);if(C&&(C=C(t,u))){Vy(f,C,n,d);break e}w&&w(t,h,u),t==="focusout"&&(w=h._wrapperState)&&w.controlled&&h.type==="number"&&Gd(h,"number",h.value)}switch(w=u?qs(u):window,t){case"focusin":(Hm(w)||w.contentEditable==="true")&&(Vs=w,lf=u,co=null);break;case"focusout":co=lf=Vs=null;break;case"mousedown":cf=!0;break;case"contextmenu":case"mouseup":case"dragend":cf=!1,Gm(f,n,d);break;case"selectionchange":if(JN)break;case"keydown":case"keyup":Gm(f,n,d)}var k;if(qh)e:{switch(t){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else Us?Fy(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(By&&n.locale!=="ko"&&(Us||E!=="onCompositionStart"?E==="onCompositionEnd"&&Us&&(k=zy()):(tr=d,Uh="value"in tr?tr.value:tr.textContent,Us=!0)),w=Rl(u,E),0<w.length&&(E=new Bm(E,t,null,n,d),f.push({event:E,listeners:w}),k?E.data=k:(k=Uy(n),k!==null&&(E.data=k)))),(k=LN?DN(t,n):$N(t,n))&&(u=Rl(u,"onBeforeInput"),0<u.length&&(d=new Bm("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=k))}ev(f,e)})}function $o(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Rl(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Mo(t,n),i!=null&&r.unshift($o(t,i,s)),i=Mo(t,e),i!=null&&r.push($o(t,i,s))),t=t.return}return r}function Cs(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Qm(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var a=n,c=a.alternate,u=a.stateNode;if(c!==null&&c===r)break;a.tag===5&&u!==null&&(a=u,s?(c=Mo(n,i),c!=null&&o.unshift($o(n,c,a))):s||(c=Mo(n,i),c!=null&&o.push($o(n,c,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var QN=/\r\n?/g,ZN=/\u0000|\uFFFD/g;function Zm(t){return(typeof t=="string"?t:""+t).replace(QN,`
38`).replace(ZN,"")}function La(t,e,n){if(e=Zm(e),Zm(t)!==e&&n)throw Error(P(425))}function Ll(){}var uf=null,df=null;function ff(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var hf=typeof setTimeout=="function"?setTimeout:void 0,ej=typeof clearTimeout=="function"?clearTimeout:void 0,eg=typeof Promise=="function"?Promise:void 0,tj=typeof queueMicrotask=="function"?queueMicrotask:typeof eg<"u"?function(t){return eg.resolve(null).then(t).catch(nj)}:hf;function nj(t){setTimeout(function(){throw t})}function Ju(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),Io(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Io(e)}function ur(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function tg(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Ci=Math.random().toString(36).slice(2),mn="__reactFiber$"+Ci,zo="__reactProps$"+Ci,Rn="__reactContainer$"+Ci,pf="__reactEvents$"+Ci,rj="__reactListeners$"+Ci,sj="__reactHandles$"+Ci;function Hr(t){var e=t[mn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Rn]||n[mn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=tg(t);t!==null;){if(n=t[mn])return n;t=tg(t)}return e}t=n,n=t.parentNode}return null}function da(t){return t=t[mn]||t[Rn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function qs(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(P(33))}function Yc(t){return t[zo]||null}var mf=[],Ws=-1;function Tr(t){return{current:t}}function de(t){0>Ws||(t.current=mf[Ws],mf[Ws]=null,Ws--)}
vendor: 29,056 bytes, lines 38-40
38function le(t,e){Ws++,mf[Ws]=t.current,t.current=e}var wr={},tt=Tr(wr),vt=Tr(!1),cs=wr;function ci(t,e){var n=t.type.contextTypes;if(!n)return wr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function bt(t){return t=t.childContextTypes,t!=null}function Dl(){de(vt),de(tt)}function ng(t,e,n){if(tt.current!==wr)throw Error(P(168));le(tt,e),le(vt,n)}function nv(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(P(108,Uk(t)||"Unknown",s));return xe({},n,r)}function $l(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wr,cs=tt.current,le(tt,t),le(vt,vt.current),!0}function rg(t,e,n){var r=t.stateNode;if(!r)throw Error(P(169));n?(t=nv(t,e,cs),r.__reactInternalMemoizedMergedChildContext=t,de(vt),de(tt),le(tt,t)):de(vt),le(vt,n)}var En=null,Qc=!1,Gu=!1;function rv(t){En===null?En=[t]:En.push(t)}function ij(t){Qc=!0,rv(t)}function Ar(){if(!Gu&&En!==null){Gu=!0;var t=0,e=re;try{var n=En;for(re=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}En=null,Qc=!1}catch(s){throw En!==null&&(En=En.slice(t+1)),Ey($h,Ar),s}finally{re=e,Gu=!1}}return null}var Ks=[],Js=0,zl=null,Bl=0,Rt=[],Lt=0,us=null,Tn=1,An="";function zr(t,e){Ks[Js++]=Bl,Ks[Js++]=zl,zl=t,Bl=e}function sv(t,e,n){Rt[Lt++]=Tn,Rt[Lt++]=An,Rt[Lt++]=us,us=t;var r=Tn;t=An;var s=32-sn(r)-1;r&=~(1<<s),n+=1;var i=32-sn(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Tn=1<<32-sn(e)+s|n<<s|r,An=i+t}else Tn=1<<i|n<<s|r,An=t}function Kh(t){t.return!==null&&(zr(t,1),sv(t,1,0))}function Jh(t){for(;t===zl;)zl=Ks[--Js],Ks[Js]=null,Bl=Ks[--Js],Ks[Js]=null;for(;t===us;)us=Rt[--Lt],Rt[Lt]=null,An=Rt[--Lt],Rt[Lt]=null,Tn=Rt[--Lt],Rt[Lt]=null}var Et=null,Ct=null,fe=!1,en=null;function iv(t,e){var n=$t(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function sg(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Et=t,Ct=ur(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Et=t,Ct=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=us!==null?{id:Tn,overflow:An}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=$t(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Et=t,Ct=null,!0):!1;default:return!1}}function gf(t){return(t.mode&1)!==0&&(t.flags&128)===0}function xf(t){if(fe){var e=Ct;if(e){var n=e;if(!sg(t,e)){if(gf(t))throw Error(P(418));e=ur(n.nextSibling);var r=Et;e&&sg(t,e)?iv(r,n):(t.flags=t.flags&-4097|2,fe=!1,Et=t)}}else{if(gf(t))throw Error(P(418));t.flags=t.flags&-4097|2,fe=!1,Et=t}}}function ig(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Et=t}function Da(t){if(t!==Et)return!1;if(!fe)return ig(t),fe=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!ff(t.type,t.memoizedProps)),e&&(e=Ct)){if(gf(t))throw ov(),Error(P(418));for(;e;)iv(t,e),e=ur(e.nextSibling)}if(ig(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(P(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Ct=ur(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Ct=null}}else Ct=Et?ur(t.stateNode.nextSibling):null;return!0}function ov(){for(var t=Ct;t;)t=ur(t.nextSibling)}function ui(){Ct=Et=null,fe=!1}function Gh(t){en===null?en=[t]:en.push(t)}var oj=$n.ReactCurrentBatchConfig;function $i(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(P(309));var r=n.stateNode}if(!r)throw Error(P(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(P(284));if(!n._owner)throw Error(P(290,t))}return t}function $a(t,e){throw t=Object.prototype.toString.call(e),Error(P(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function og(t){var e=t._init;return e(t._payload)}function av(t){function e(x,v){if(t){var b=x.deletions;b===null?(x.deletions=[v],x.flags|=16):b.push(v)}}function n(x,v){if(!t)return null;for(;v!==null;)e(x,v),v=v.sibling;return null}function r(x,v){for(x=new Map;v!==null;)v.key!==null?x.set(v.key,v):x.set(v.index,v),v=v.sibling;return x}function s(x,v){return x=pr(x,v),x.index=0,x.sibling=null,x}function i(x,v,b){return x.index=b,t?(b=x.alternate,b!==null?(b=b.index,b<v?(x.flags|=2,v):b):(x.flags|=2,v)):(x.flags|=1048576,v)}function o(x){return t&&x.alternate===null&&(x.flags|=2),x}function a(x,v,b,_){return v===null||v.tag!==6?(v=nd(b,x.mode,_),v.return=x,v):(v=s(v,b),v.return=x,v)}function c(x,v,b,_){var C=b.type;return C===Fs?d(x,v,b.props.children,_,b.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Wn&&og(C)===v.type)?(_=s(v,b.props),_.ref=$i(x,v,b),_.return=x,_):(_=bl(b.type,b.key,b.props,null,x.mode,_),_.ref=$i(x,v,b),_.return=x,_)}function u(x,v,b,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=rd(b,x.mode,_),v.return=x,v):(v=s(v,b.children||[]),v.return=x,v)}function d(x,v,b,_,C){return v===null||v.tag!==7?(v=Zr(b,x.mode,_,C),v.return=x,v):(v=s(v,b),v.return=x,v)}function f(x,v,b){if(typeof v=="string"&&v!==""||typeof v=="number")return v=nd(""+v,x.mode,b),v.return=x,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ca:return b=bl(v.type,v.key,v.props,null,x.mode,b),b.ref=$i(x,null,v),b.return=x,b;case Bs:return v=rd(v,x.mode,b),v.return=x,v;case Wn:var _=v._init;return f(x,_(v._payload),b)}if(Xi(v)||Pi(v))return v=Zr(v,x.mode,b,null),v.return=x,v;$a(x,v)}return null}function h(x,v,b,_){var C=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return C!==null?null:a(x,v,""+b,_);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ca:return b.key===C?c(x,v,b,_):null;case Bs:return b.key===C?u(x,v,b,_):null;case Wn:return C=b._init,h(x,v,C(b._payload),_)}if(Xi(b)||Pi(b))return C!==null?null:d(x,v,b,_,null);$a(x,b)}return null}function p(x,v,b,_,C){if(typeof _=="string"&&_!==""||typeof _=="number")return x=x.get(b)||null,a(v,x,""+_,C);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Ca:return x=x.get(_.key===null?b:_.key)||null,c(v,x,_,C);case Bs:return x=x.get(_.key===null?b:_.key)||null,u(v,x,_,C);case Wn:var w=_._init;return p(x,v,b,w(_._payload),C)}if(Xi(_)||Pi(_))return x=x.get(b)||null,d(v,x,_,C,null);$a(v,_)}return null}function m(x,v,b,_){for(var C=null,w=null,k=v,E=v=0,S=null;k!==null&&E<b.length;E++){k.index>E?(S=k,k=null):S=k.sibling;var j=h(x,k,b[E],_);if(j===null){k===null&&(k=S);break}t&&k&&j.alternate===null&&e(x,k),v=i(j,v,E),w===null?C=j:w.sibling=j,w=j,k=S}if(E===b.length)return n(x,k),fe&&zr(x,E),C;if(k===null){for(;E<b.length;E++)k=f(x,b[E],_),k!==null&&(v=i(k,v,E),w===null?C=k:w.sibling=k,w=k);return fe&&zr(x,E),C}for(k=r(x,k);E<b.length;E++)S=p(k,x,E,b[E],_),S!==null&&(t&&S.alternate!==null&&k.delete(S.key===null?E:S.key),v=i(S,v,E),w===null?C=S:w.sibling=S,w=S);return t&&k.forEach(function(A){return e(x,A)}),fe&&zr(x,E),C}function g(x,v,b,_){var C=Pi(b);if(typeof C!="function")throw Error(P(150));if(b=C.call(b),b==null)throw Error(P(151));for(var w=C=null,k=v,E=v=0,S=null,j=b.next();k!==null&&!j.done;E++,j=b.next()){k.index>E?(S=k,k=null):S=k.sibling;var A=h(x,k,j.value,_);if(A===null){k===null&&(k=S);break}t&&k&&A.alternate===null&&e(x,k),v=i(A,v,E),w===null?C=A:w.sibling=A,w=A,k=S}if(j.done)return n(x,k),fe&&zr(x,E),C;if(k===null){for(;!j.done;E++,j=b.next())j=f(x,j.value,_),j!==null&&(v=i(j,v,E),w===null?C=j:w.sibling=j,w=j);return fe&&zr(x,E),C}for(k=r(x,k);!j.done;E++,j=b.next())j=p(k,x,E,j.value,_),j!==null&&(t&&j.alternate!==null&&k.delete(j.key===null?E:j.key),v=i(j,v,E),w===null?C=j:w.sibling=j,w=j);return t&&k.forEach(function(z){return e(x,z)}),fe&&zr(x,E),C}function y(x,v,b,_){if(typeof b=="object"&&b!==null&&b.type===Fs&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Ca:e:{for(var C=b.key,w=v;w!==null;){if(w.key===C){if(C=b.type,C===Fs){if(w.tag===7){n(x,w.sibling),v=s(w,b.props.children),v.return=x,x=v;break e}}else if(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Wn&&og(C)===w.type){n(x,w.sibling),v=s(w,b.props),v.ref=$i(x,w,b),v.return=x,x=v;break e}n(x,w);break}else e(x,w);w=w.sibling}b.type===Fs?(v=Zr(b.props.children,x.mode,_,b.key),v.return=x,x=v):(_=bl(b.type,b.key,b.props,null,x.mode,_),_.ref=$i(x,v,b),_.return=x,x=_)}return o(x);case Bs:e:{for(w=b.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(x,v.sibling),v=s(v,b.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else e(x,v);v=v.sibling}v=rd(b,x.mode,_),v.return=x,x=v}return o(x);case Wn:return w=b._init,y(x,v,w(b._payload),_)}if(Xi(b))return m(x,v,b,_);if(Pi(b))return g(x,v,b,_);$a(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(n(x,v.sibling),v=s(v,b),v.return=x,x=v):(n(x,v),v=nd(b,x.mode,_),v.return=x,x=v),o(x)):n(x,v)}return y}var di=av(!0),lv=av(!1),Fl=Tr(null),Ul=null,Gs=null,Xh=null;function Yh(){Xh=Gs=Ul=null}function Qh(t){var e=Fl.current;de(Fl),t._currentValue=e}function yf(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ri(t,e){Ul=t,Xh=Gs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(yt=!0),t.firstContext=null)}function Ht(t){var e=t._currentValue;if(Xh!==t)if(t={context:t,memoizedValue:e,next:null},Gs===null){if(Ul===null)throw Error(P(308));Gs=t,Ul.dependencies={lanes:0,firstContext:t}}else Gs=Gs.next=t;return e}var qr=null;function Zh(t){qr===null?qr=[t]:qr.push(t)}function cv(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,Zh(e)):(n.next=s.next,s.next=n),e.interleaved=n,Ln(t,r)}function Ln(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Kn=!1;function ep(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function uv(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function On(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function dr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Ln(t,n)}return s=r.interleaved,s===null?(e.next=e,Zh(r)):(e.next=s.next,s.next=e),r.interleaved=e,Ln(t,n)}function pl(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,zh(t,n)}}function ag(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Vl(t,e,n,r){var s=t.updateQueue;Kn=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,a=i;do{var h=a.lane,p=a.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=t,g=a;switch(h=e,p=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=xe({},f,h);break e;case 2:Kn=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);fs|=o,t.lanes=o,t.memoizedState=f}}function lg(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(P(191,s));s.call(r)}}}var fa={},xn=Tr(fa),Bo=Tr(fa),Fo=Tr(fa);function Wr(t){if(t===fa)throw Error(P(174));return t}function tp(t,e){switch(le(Fo,e),le(Bo,t),le(xn,fa),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Yd(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Yd(e,t)}de(xn),le(xn,e)}function fi(){de(xn),de(Bo),de(Fo)}function dv(t){Wr(Fo.current);var e=Wr(xn.current),n=Yd(e,t.type);e!==n&&(le(Bo,t),le(xn,n))}function np(t){Bo.current===t&&(de(xn),de(Bo))}var pe=Tr(0);function Hl(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Xu=[];function rp(){for(var t=0;t<Xu.length;t++)Xu[t]._workInProgressVersionPrimary=null;Xu.length=0}var ml=$n.ReactCurrentDispatcher,Yu=$n.ReactCurrentBatchConfig,ds=0,ge=null,Re=null,$e=null,ql=!1,uo=!1,Uo=0,aj=0;function Ge(){throw Error(P(321))}function sp(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!ln(t[n],e[n]))return!1;return!0}function ip(t,e,n,r,s,i){if(ds=i,ge=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ml.current=t===null||t.memoizedState===null?dj:fj,t=n(r,s),uo){i=0;do{if(uo=!1,Uo=0,25<=i)throw Error(P(301));i+=1,$e=Re=null,e.updateQueue=null,ml.current=hj,t=n(r,s)}while(uo)}if(ml.current=Wl,e=Re!==null&&Re.next!==null,ds=0,$e=Re=ge=null,ql=!1,e)throw Error(P(300));return t}function op(){var t=Uo!==0;return Uo=0,t}function un(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $e===null?ge.memoizedState=$e=t:$e=$e.next=t,$e}function qt(){if(Re===null){var t=ge.alternate;t=t!==null?t.memoizedState:null}else t=Re.next;var e=$e===null?ge.memoizedState:$e.next;if(e!==null)$e=e,Re=t;else{if(t===null)throw Error(P(310));Re=t,t={memoizedState:Re.memoizedState,baseState:Re.baseState,baseQueue:Re.baseQueue,queue:Re.queue,next:null},$e===null?ge.memoizedState=$e=t:$e=$e.next=t}return $e}function Vo(t,e){return typeof e=="function"?e(t):e}function Qu(t){var e=qt(),n=e.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=t;var r=Re,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,c=null,u=i;do{var d=u.lane;if((ds&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(a=c=f,o=r):c=c.next=f,ge.lanes|=d,fs|=d}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=a,ln(r,e.memoizedState)||(yt=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=c,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,ge.lanes|=i,fs|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Zu(t){var e=qt(),n=e.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);ln(i,e.memoizedState)||(yt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function fv(){}function hv(t,e){var n=ge,r=qt(),s=e(),i=!ln(r.memoizedState,s);if(i&&(r.memoizedState=s,yt=!0),r=r.queue,ap(gv.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||$e!==null&&$e.memoizedState.tag&1){if(n.flags|=2048,Ho(9,mv.bind(null,n,r,s,e),void 0,null),ze===null)throw Error(P(349));ds&30||pv(n,e,s)}return s}function pv(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ge.updateQueue,e===null?(e={lastEffect:null,stores:null},ge.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function mv(t,e,n,r){e.value=n,e.getSnapshot=r,xv(e)&&yv(t)}function gv(t,e,n){return n(function(){xv(e)&&yv(t)})}function xv(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!ln(t,n)}catch{return!0}}function yv(t){var e=Ln(t,1);e!==null&&on(e,t,1,-1)}function cg(t){var e=un();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vo,lastRenderedState:t},e.queue=t,t=t.dispatch=uj.bind(null,ge,t),[e.memoizedState,t]}function Ho(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ge.updateQueue,e===null?(e={lastEffect:null,stores:null},ge.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function vv(){return qt().memoizedState}function gl(t,e,n,r){var s=un();ge.flags|=t,s.memoizedState=Ho(1|e,n,void 0,r===void 0?null:r)}function Zc(t,e,n,r){var s=qt();r=r===void 0?null:r;var i=void 0;if(Re!==null){var o=Re.memoizedState;if(i=o.destroy,r!==null&&sp(r,o.deps)){s.memoizedState=Ho(e,n,i,r);return}}ge.flags|=t,s.memoizedState=Ho(1|e,n,i,r)}function ug(t,e){return gl(8390656,8,t,e)}function ap(t,e){return Zc(2048,8,t,e)}function bv(t,e){return Zc(4,2,t,e)}function wv(t,e){return Zc(4,4,t,e)}function kv(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Nv(t,e,n){return n=n!=null?n.concat([t]):null,Zc(4,4,kv.bind(null,e,t),n)}function lp(){}function jv(t,e){var n=qt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&sp(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function _v(t,e){var n=qt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&sp(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function Sv(t,e,n){return ds&21?(ln(n,e)||(n=My(),ge.lanes|=n,fs|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,yt=!0),t.memoizedState=n)}function lj(t,e){var n=re;re=n!==0&&4>n?n:4,t(!0);var r=Yu.transition;Yu.transition={};try{t(!1),e()}finally{re=n,Yu.transition=r}}function Cv(){return qt().memoizedState}function cj(t,e,n){var r=hr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ev(t))Tv(e,n);else if(n=cv(t,e,n,r),n!==null){var s=ct();on(n,t,r,s),Av(n,e,r)}}function uj(t,e,n){var r=hr(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ev(t))Tv(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,ln(a,o)){var c=e.interleaved;c===null?(s.next=s,Zh(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}n=cv(t,e,s,r),n!==null&&(s=ct(),on(n,t,r,s),Av(n,e,r))}}function Ev(t){var e=t.alternate;return t===ge||e!==null&&e===ge}function Tv(t,e){uo=ql=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Av(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,zh(t,n)}}var Wl={readContext:Ht,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useInsertionEffect:Ge,useLayoutEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useMutableSource:Ge,useSyncExternalStore:Ge,useId:Ge,unstable_isNewReconciler:!1},dj={readContext:Ht,useCallback:function(t,e){return un().memoizedState=[t,e===void 0?null:e],t},useContext:Ht,useEffect:ug,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,gl(4194308,4,kv.bind(null,e,t),n)},useLayoutEffect:function(t,e){return gl(4194308,4,t,e)},useInsertionEffect:function(t,e){return gl(4,2,t,e)},useMemo:function(t,e){var n=un();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=un();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=cj.bind(null,ge,t),[r.memoizedState,t]},useRef:function(t){var e=un();return t={current:t},e.memoizedState=t},useState:cg,useDebugValue:lp,useDeferredValue:function(t){return un().memoizedState=t},useTransition:function(){var t=cg(!1),e=t[0];return t=lj.bind(null,t[1]),un().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ge,s=un();if(fe){if(n===void 0)throw Error(P(407));n=n()}else{if(n=e(),ze===null)throw Error(P(349));ds&30||pv(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,ug(gv.bind(null,r,i,t),[t]),r.flags|=2048,Ho(9,mv.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=un(),e=ze.identifierPrefix;if(fe){var n=An,r=Tn;n=(r&~(1<<32-sn(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Uo++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=aj++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},fj={readContext:Ht,useCallback:jv,useContext:Ht,useEffect:ap,useImperativeHandle:Nv,useInsertionEffect:bv,useLayoutEffect:wv,useMemo:_v,useReducer:Qu,useRef:vv,useState:function(){return Qu(Vo)},useDebugValue:lp,useDeferredValue:function(t){var e=qt();return Sv(e,Re.memoizedState,t)},useTransition:function(){var t=Qu(Vo)[0],e=qt().memoizedState;return[t,e]},useMutableSource:fv,useSyncExternalStore:hv,useId:Cv,unstable_isNewReconciler:!1},hj={readContext:Ht,useCallback:jv,useContext:Ht,useEffect:ap,useImperativeHandle:Nv,useInsertionEffect:bv,useLayoutEffect:wv,useMemo:_v,useReducer:Zu,useRef:vv,useState:function(){return Zu(Vo)},useDebugValue:lp,useDeferredValue:function(t){var e=qt();return Re===null?e.memoizedState=t:Sv(e,Re.memoizedState,t)},useTransition:function(){var t=Zu(Vo)[0],e=qt().memoizedState;return[t,e]},useMutableSource:fv,useSyncExternalStore:hv,useId:Cv,unstable_isNewReconciler:!1};function Yt(t,e){if(t&&t.defaultProps){e=xe({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function vf(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:xe({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var eu={isMounted:function(t){return(t=t._reactInternals)?ws(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=ct(),s=hr(t),i=On(r,s);i.payload=e,n!=null&&(i.callback=n),e=dr(t,i,s),e!==null&&(on(e,t,s,r),pl(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=ct(),s=hr(t),i=On(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=dr(t,i,s),e!==null&&(on(e,t,s,r),pl(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=ct(),r=hr(t),s=On(n,r);s.tag=2,e!=null&&(s.callback=e),e=dr(t,s,r),e!==null&&(on(e,t,r,n),pl(e,t,r))}};function dg(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!Lo(n,r)||!Lo(s,i):!0}function Mv(t,e,n){var r=!1,s=wr,i=e.contextType;return typeof i=="object"&&i!==null?i=Ht(i):(s=bt(e)?cs:tt.current,r=e.contextTypes,i=(r=r!=null)?ci(t,s):wr),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=eu,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function fg(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&eu.enqueueReplaceState(e,e.state,null)}function bf(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},ep(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Ht(i):(i=bt(e)?cs:tt.current,s.context=ci(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(vf(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&eu.enqueueReplaceState(s,s.state,null),Vl(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function hi(t,e){try{var n="",r=e;do n+=Fk(r),r=r.return;while(r);var s=n}catch(i){s=`
39Error generating stack: `+i.message+`
40`+i.stack}return{value:t,source:e,stack:s,digest:null}}function ed(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function wf(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var pj=typeof WeakMap=="function"?WeakMap:Map;function Ov(t,e,n){n=On(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Jl||(Jl=!0,Mf=r),wf(t,e)},n}function Pv(t,e,n){n=On(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){wf(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){wf(t,e),typeof r!="function"&&(fr===null?fr=new Set([this]):fr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function hg(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new pj;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=Ej.bind(null,t,e,n),e.then(t,t))}function pg(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function mg(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=On(-1,1),e.tag=2,dr(n,e,1))),n.lanes|=1),t)}var mj=$n.ReactCurrentOwner,yt=!1;function it(t,e,n,r){e.child=t===null?lv(e,null,n,r):di(e,t.child,n,r)}function gg(t,e,n,r,s){n=n.render;var i=e.ref;return ri(e,s),r=ip(t,e,n,r,i,s),n=op(),t!==null&&!yt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Dn(t,e,s)):(fe&&n&&Kh(e),e.flags|=1,it(t,e,r,s),e.child)}function xg(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!gp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,Iv(t,e,i,r,s)):(t=bl(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Lo,n(o,r)&&t.ref===e.ref)return Dn(t,e,s)}return e.flags|=1,t=pr(i,r),t.ref=e.ref,t.return=e,e.child=t}function Iv(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(Lo(i,r)&&t.ref===e.ref)if(yt=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(yt=!0);else return e.lanes=t.lanes,Dn(t,e,s)}return kf(t,e,n,r,s)}function Rv(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},le(Ys,_t),_t|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,le(Ys,_t),_t|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,le(Ys,_t),_t|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,le(Ys,_t),_t|=r;return it(t,e,s,n),e.child}function Lv(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}
vendor: 5,660 bytes, line 40
40function kf(t,e,n,r,s){var i=bt(n)?cs:tt.current;return i=ci(e,i),ri(e,s),n=ip(t,e,n,r,i,s),r=op(),t!==null&&!yt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Dn(t,e,s)):(fe&&r&&Kh(e),e.flags|=1,it(t,e,n,s),e.child)}function yg(t,e,n,r,s){if(bt(n)){var i=!0;$l(e)}else i=!1;if(ri(e,s),e.stateNode===null)xl(t,e),Mv(e,n,r),bf(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Ht(u):(u=bt(n)?cs:tt.current,u=ci(e,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||c!==u)&&fg(e,o,r,u),Kn=!1;var h=e.memoizedState;o.state=h,Vl(e,r,o,s),c=e.memoizedState,a!==r||h!==c||vt.current||Kn?(typeof d=="function"&&(vf(e,n,d,r),c=e.memoizedState),(a=Kn||dg(e,n,a,r,h,c,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),o.props=r,o.state=c,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,uv(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:Yt(e.type,a),o.props=u,f=e.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Ht(c):(c=bt(n)?cs:tt.current,c=ci(e,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||h!==c)&&fg(e,o,r,c),Kn=!1,h=e.memoizedState,o.state=h,Vl(e,r,o,s);var m=e.memoizedState;a!==f||h!==m||vt.current||Kn?(typeof p=="function"&&(vf(e,n,p,r),m=e.memoizedState),(u=Kn||dg(e,n,u,r,h,m,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),o.props=r,o.state=m,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return Nf(t,e,n,r,i,s)}function Nf(t,e,n,r,s,i){Lv(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&rg(e,n,!1),Dn(t,e,i);r=e.stateNode,mj.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=di(e,t.child,null,i),e.child=di(e,null,a,i)):it(t,e,a,i),e.memoizedState=r.state,s&&rg(e,n,!0),e.child}function Dv(t){var e=t.stateNode;e.pendingContext?ng(t,e.pendingContext,e.pendingContext!==e.context):e.context&&ng(t,e.context,!1),tp(t,e.containerInfo)}function vg(t,e,n,r,s){return ui(),Gh(s),e.flags|=256,it(t,e,n,r),e.child}var jf={dehydrated:null,treeContext:null,retryLane:0};function _f(t){return{baseLanes:t,cachePool:null,transitions:null}}function $v(t,e,n){var r=e.pendingProps,s=pe.current,i=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),le(pe,s&1),t===null)return xf(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=ru(o,r,0,null),t=Zr(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=_f(n),e.memoizedState=jf,t):cp(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return gj(t,e,o,r,a,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,a=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=c,e.deletions=null):(r=pr(s,c),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=pr(a,i):(i=Zr(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?_f(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=jf,r}return i=t.child,t=i.sibling,r=pr(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function cp(t,e){return e=ru({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function za(t,e,n,r){return r!==null&&Gh(r),di(e,t.child,null,n),t=cp(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function gj(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=ed(Error(P(422))),za(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=ru({mode:"visible",children:r.children},s,0,null),i=Zr(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&di(e,t.child,null,o),e.child.memoizedState=_f(o
vendor: 6,402 bytes, line 40
40),e.memoizedState=jf,i);if(!(e.mode&1))return za(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(P(419)),r=ed(i,r,void 0),za(t,e,o,r)}if(a=(o&t.childLanes)!==0,yt||a){if(r=ze,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Ln(t,s),on(r,t,s,-1))}return mp(),r=ed(Error(P(421))),za(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=Tj.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Ct=ur(s.nextSibling),Et=e,fe=!0,en=null,t!==null&&(Rt[Lt++]=Tn,Rt[Lt++]=An,Rt[Lt++]=us,Tn=t.id,An=t.overflow,us=e),e=cp(e,r.children),e.flags|=4096,e)}function bg(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),yf(t.return,e,n)}function td(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function zv(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(it(t,e,r.children,n),r=pe.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&bg(t,n,e);else if(t.tag===19)bg(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(le(pe,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&Hl(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),td(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&Hl(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}td(e,!0,n,null,i);break;case"together":td(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function xl(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Dn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),fs|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(P(153));if(e.child!==null){for(t=e.child,n=pr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=pr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function xj(t,e,n){switch(e.tag){case 3:Dv(e),ui();break;case 5:dv(e);break;case 1:bt(e.type)&&$l(e);break;case 4:tp(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;le(Fl,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(le(pe,pe.current&1),e.flags|=128,null):n&e.child.childLanes?$v(t,e,n):(le(pe,pe.current&1),t=Dn(t,e,n),t!==null?t.sibling:null);le(pe,pe.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return zv(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),le(pe,pe.current),r)break;return null;case 22:case 23:return e.lanes=0,Rv(t,e,n)}return Dn(t,e,n)}var Bv,Sf,Fv,Uv;Bv=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Sf=function(){};Fv=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Wr(xn.current);var i=null;switch(n){case"input":s=Kd(t,s),r=Kd(t,r),i=[];break;case"select":s=xe({},s,{value:void 0}),r=xe({},r,{value:void 0}),i=[];break;case"textarea":s=Xd(t,s),r=Xd(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Ll)}Qd(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(To.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(a=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&a[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(To.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&ce("scroll",t),i||a===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};Uv=function(t,e,n,r){n!==r&&(e.flags|=4)};function zi(t,e){if(!fe)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Xe(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function yj(t,e,n){var r=e.pendingProps;switch(Jh(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xe(e),null;case 1:return bt(e.type)&&Dl(),Xe(e),null;case 3:return r=e.stateNode,fi(),de(vt),de(tt),rp(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Da(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,en!==null&&(If(en),en=null))),Sf(t,e),
vendor: 33,298 bytes, line 40
40Xe(e),null;case 5:np(e);var s=Wr(Fo.current);if(n=e.type,t!==null&&e.stateNode!=null)Fv(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(P(166));return Xe(e),null}if(t=Wr(xn.current),Da(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[mn]=e,r[zo]=i,t=(e.mode&1)!==0,n){case"dialog":ce("cancel",r),ce("close",r);break;case"iframe":case"object":case"embed":ce("load",r);break;case"video":case"audio":for(s=0;s<Qi.length;s++)ce(Qi[s],r);break;case"source":ce("error",r);break;case"img":case"image":case"link":ce("error",r),ce("load",r);break;case"details":ce("toggle",r);break;case"input":Tm(r,i),ce("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ce("invalid",r);break;case"textarea":Mm(r,i),ce("invalid",r)}Qd(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&La(r.textContent,a,t),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&La(r.textContent,a,t),s=["children",""+a]):To.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ce("scroll",r)}switch(n){case"input":Ea(r),Am(r,i,!0);break;case"textarea":Ea(r),Om(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Ll)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=gy(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[mn]=e,t[zo]=r,Bv(t,e,!1,!1),e.stateNode=t;e:{switch(o=Zd(n,r),n){case"dialog":ce("cancel",t),ce("close",t),s=r;break;case"iframe":case"object":case"embed":ce("load",t),s=r;break;case"video":case"audio":for(s=0;s<Qi.length;s++)ce(Qi[s],t);s=r;break;case"source":ce("error",t),s=r;break;case"img":case"image":case"link":ce("error",t),ce("load",t),s=r;break;case"details":ce("toggle",t),s=r;break;case"input":Tm(t,r),s=Kd(t,r),ce("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=xe({},r,{value:void 0}),ce("invalid",t);break;case"textarea":Mm(t,r),s=Xd(t,r),ce("invalid",t);break;default:s=r}Qd(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var c=a[i];i==="style"?vy(t,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&xy(t,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ao(t,c):typeof c=="number"&&Ao(t,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(To.hasOwnProperty(i)?c!=null&&i==="onScroll"&&ce("scroll",t):c!=null&&Ph(t,i,c,o))}switch(n){case"input":Ea(t),Am(t,r,!1);break;case"textarea":Ea(t),Om(t);break;case"option":r.value!=null&&t.setAttribute("value",""+br(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Zs(t,!!r.multiple,i,!1):r.defaultValue!=null&&Zs(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=Ll)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Xe(e),null;case 6:if(t&&e.stateNode!=null)Uv(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(P(166));if(n=Wr(Fo.current),Wr(xn.current),Da(e)){if(r=e.stateNode,n=e.memoizedProps,r[mn]=e,(i=r.nodeValue!==n)&&(t=Et,t!==null))switch(t.tag){case 3:La(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&La(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[mn]=e,e.stateNode=r}return Xe(e),null;case 13:if(de(pe),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(fe&&Ct!==null&&e.mode&1&&!(e.flags&128))ov(),ui(),e.flags|=98560,i=!1;else if(i=Da(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(P(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(P(317));i[mn]=e}else ui(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Xe(e),i=!1}else en!==null&&(If(en),en=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||pe.current&1?Le===0&&(Le=3):mp())),e.updateQueue!==null&&(e.flags|=4),Xe(e),null);case 4:return fi(),Sf(t,e),t===null&&Do(e.stateNode.containerInfo),Xe(e),null;case 10:return Qh(e.type._context),Xe(e),null;case 17:return bt(e.type)&&Dl(),Xe(e),null;case 19:if(de(pe),i=e.memoizedState,i===null)return Xe(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)zi(i,!1);else{if(Le!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Hl(t),o!==null){for(e.flags|=128,zi(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return le(pe,pe.current&1|2),e.child}t=t.sibling}i.tail!==null&&je()>pi&&(e.flags|=128,r=!0,zi(i,!1),e.lanes=4194304)}else{if(!r)if(t=Hl(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),zi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!fe)return Xe(e),null}else 2*je()-i.renderingStartTime>pi&&n!==1073741824&&(e.flags|=128,r=!0,zi(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=je(),e.sibling=null,n=pe.current,le(pe,r?n&1|2:n&1),e):(Xe(e),null);case 22:case 23:return pp(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?_t&1073741824&&(Xe(e),e.subtreeFlags&6&&(e.flags|=8192)):Xe(e),null;case 24:return null;case 25:return null}throw Error(P(156,e.tag))}function vj(t,e){switch(Jh(e),e.tag){case 1:return bt(e.type)&&Dl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return fi(),de(vt),de(tt),rp(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return np(e),null;case 13:if(de(pe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(P(340));ui()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return de(pe),null;case 4:return fi(),null;case 10:return Qh(e.type._context),null;case 22:case 23:return pp(),null;case 24:return null;default:return null}}var Ba=!1,Ze=!1,bj=typeof WeakSet=="function"?WeakSet:Set,F=null;function Xs(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){we(t,e,r)}else n.current=null}function Cf(t,e,n){try{n()}catch(r){we(t,e,r)}}var wg=!1;function wj(t,e){if(uf=Pl,t=Ky(),Wh(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===s&&(a=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(df={focusedElem:t,selectionRange:n},Pl=!1,F=e;F!==null;)if(e=F,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,F=t;else for(;F!==null;){e=F;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,y=m.memoizedState,x=e.stateNode,v=x.getSnapshotBeforeUpdate(e.elementType===e.type?g:Yt(e.type,g),y);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(P(163))}}catch(_){we(e,e.return,_)}if(t=e.sibling,t!==null){t.return=e.return,F=t;break}F=e.return}return m=wg,wg=!1,m}function fo(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&Cf(e,n,i)}s=s.next}while(s!==r)}}function tu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Ef(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Vv(t){var e=t.alternate;e!==null&&(t.alternate=null,Vv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[mn],delete e[zo],delete e[pf],delete e[rj],delete e[sj])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Hv(t){return t.tag===5||t.tag===3||t.tag===4}function kg(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Hv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Tf(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Ll));else if(r!==4&&(t=t.child,t!==null))for(Tf(t,e,n),t=t.sibling;t!==null;)Tf(t,e,n),t=t.sibling}function Af(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Af(t,e,n),t=t.sibling;t!==null;)Af(t,e,n),t=t.sibling}var Ue=null,Qt=!1;function Fn(t,e,n){for(n=n.child;n!==null;)qv(t,e,n),n=n.sibling}function qv(t,e,n){if(gn&&typeof gn.onCommitFiberUnmount=="function")try{gn.onCommitFiberUnmount(Kc,n)}catch{}switch(n.tag){case 5:Ze||Xs(n,e);case 6:var r=Ue,s=Qt;Ue=null,Fn(t,e,n),Ue=r,Qt=s,Ue!==null&&(Qt?(t=Ue,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ue.removeChild(n.stateNode));break;case 18:Ue!==null&&(Qt?(t=Ue,n=n.stateNode,t.nodeType===8?Ju(t.parentNode,n):t.nodeType===1&&Ju(t,n),Io(t)):Ju(Ue,n.stateNode));break;case 4:r=Ue,s=Qt,Ue=n.stateNode.containerInfo,Qt=!0,Fn(t,e,n),Ue=r,Qt=s;break;case 0:case 11:case 14:case 15:if(!Ze&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Cf(n,e,o),s=s.next}while(s!==r)}Fn(t,e,n);break;case 1:if(!Ze&&(Xs(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){we(n,e,a)}Fn(t,e,n);break;case 21:Fn(t,e,n);break;case 22:n.mode&1?(Ze=(r=Ze)||n.memoizedState!==null,Fn(t,e,n),Ze=r):Fn(t,e,n);break;default:Fn(t,e,n)}}function Ng(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new bj),e.forEach(function(r){var s=Aj.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Gt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Ue=a.stateNode,Qt=!1;break e;case 3:Ue=a.stateNode.containerInfo,Qt=!0;break e;case 4:Ue=a.stateNode.containerInfo,Qt=!0;break e}a=a.return}if(Ue===null)throw Error(P(160));qv(i,o,s),Ue=null,Qt=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){we(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Wv(e,t),e=e.sibling}function Wv(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Gt(e,t),cn(t),r&4){try{fo(3,t,t.return),tu(3,t)}catch(g){we(t,t.return,g)}try{fo(5,t,t.return)}catch(g){we(t,t.return,g)}}break;case 1:Gt(e,t),cn(t),r&512&&n!==null&&Xs(n,n.return);break;case 5:if(Gt(e,t),cn(t),r&512&&n!==null&&Xs(n,n.return),t.flags&32){var s=t.stateNode;try{Ao(s,"")}catch(g){we(t,t.return,g)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,a=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&py(s,i),Zd(a,o);var u=Zd(a,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?vy(s,f):d==="dangerouslySetInnerHTML"?xy(s,f):d==="children"?Ao(s,f):Ph(s,d,f,u)}switch(a){case"input":Jd(s,i);break;case"textarea":my(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Zs(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Zs(s,!!i.multiple,i.defaultValue,!0):Zs(s,!!i.multiple,i.multiple?[]:"",!1))}s[zo]=i}catch(g){we(t,t.return,g)}}break;case 6:if(Gt(e,t),cn(t),r&4){if(t.stateNode===null)throw Error(P(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(g){we(t,t.return,g)}}break;case 3:if(Gt(e,t),cn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Io(e.containerInfo)}catch(g){we(t,t.return,g)}break;case 4:Gt(e,t),cn(t);break;case 13:Gt(e,t),cn(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(fp=je())),r&4&&Ng(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Ze=(u=Ze)||d,Gt(e,t),Ze=u):Gt(e,t),cn(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(F=t,d=t.child;d!==null;){for(f=F=d;F!==null;){switch(h=F,p=h.child,h.tag){case 0:case 11:case 14:case 15:fo(4,h,h.return);break;case 1:Xs(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(g){we(r,n,g)}}break;case 5:Xs(h,h.return);break;case 22:if(h.memoizedState!==null){_g(f);continue}}p!==null?(p.return=h,F=p):_g(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=yy("display",o))}catch(g){we(t,t.return,g)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(g){we(t,t.return,g)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Gt(e,t),cn(t),r&4&&Ng(t);break;case 21:break;default:Gt(e,t),cn(t)}}function cn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Hv(n)){var r=n;break e}n=n.return}throw Error(P(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Ao(s,""),r.flags&=-33);var i=kg(t);Af(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=kg(t);Tf(t,a,o);break;default:throw Error(P(161))}}catch(c){we(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function kj(t,e,n){F=t,Kv(t)}function Kv(t,e,n){for(var r=(t.mode&1)!==0;F!==null;){var s=F,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Ba;if(!o){var a=s.alternate,c=a!==null&&a.memoizedState!==null||Ze;a=Ba;var u=Ze;if(Ba=o,(Ze=c)&&!u)for(F=s;F!==null;)o=F,c=o.child,o.tag===22&&o.memoizedState!==null?Sg(s):c!==null?(c.return=o,F=c):Sg(s);for(;i!==null;)F=i,Kv(i),i=i.sibling;F=s,Ba=a,Ze=u}jg(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,F=i):jg(t)}}function jg(t){for(;F!==null;){var e=F;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Ze||tu(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Ze)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:Yt(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&lg(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}lg(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Io(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(P(163))}Ze||e.flags&512&&Ef(e)}catch(h){we(e,e.return,h)}}if(e===t){F=null;break}if(n=e.sibling,n!==null){n.return=e.return,F=n;break}F=e.return}}function _g(t){for(;F!==null;){var e=F;if(e===t){F=null;break}var n=e.sibling;if(n!==null){n.return=e.return,F=n;break}F=e.return}}function Sg(t){for(;F!==null;){var e=F;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{tu(4,e)}catch(c){we(e,n,c)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(c){we(e,s,c)}}var i=e.return;try{Ef(e)}catch(c){we(e,i,c)}break;case 5:var o=e.return;try{Ef(e)}catch(c){we(e,o,c)}}}catch(c){we(e,e.return,c)}if(e===t){F=null;break}var a=e.sibling;if(a!==null){a.return=e.return,F=a;break}F=e.return}}var Nj=Math.ceil,Kl=$n.ReactCurrentDispatcher,up=$n.ReactCurrentOwner,zt=$n.ReactCurrentBatchConfig,te=0,ze=null,Ce=null,Ke=0,_t=0,Ys=Tr(0),Le=0,qo=null,fs=0,nu=0,dp=0,ho=null,mt=null,fp=0,pi=1/0,_n=null,Jl=!1,Mf=null,fr=null,Fa=!1,nr=null,Gl=0,po=0,Of=null,yl=-1,vl=0;function ct(){return te&6?je():yl!==-1?yl:yl=je()}function hr(t){return t.mode&1?te&2&&Ke!==0?Ke&-Ke:oj.transition!==null?(vl===0&&(vl=My()),vl):(t=re,t!==0||(t=window.event,t=t===void 0?16:$y(t.type)),t):1}function on(t,e,n,r){if(50<po)throw po=0,Of=null,Error(P(185));ca(t,n,r),(!(te&2)||t!==ze)&&(t===ze&&(!(te&2)&&(nu|=n),Le===4&&Qn(t,Ke)),wt(t,r),n===1&&te===0&&!(e.mode&1)&&(pi=je()+500,Qc&&Ar()))}function wt(t,e){var n=t.callbackNode;oN(t,e);var r=Ol(t,t===ze?Ke:0);if(r===0)n!==null&&Rm(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Rm(n),e===1)t.tag===0?ij(Cg.bind(null,t)):rv(Cg.bind(null,t)),tj(function(){!(te&6)&&Ar()}),n=null;else{switch(Oy(r)){case 1:n=$h;break;case 4:n=Ty;break;case 16:n=Ml;break;case 536870912:n=Ay;break;default:n=Ml}n=tb(n,Jv.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Jv(t,e){if(yl=-1,vl=0,te&6)throw Error(P(327));var n=t.callbackNode;if(si()&&t.callbackNode!==n)return null;var r=Ol(t,t===ze?Ke:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Xl(t,r);else{e=r;var s=te;te|=2;var i=Xv();(ze!==t||Ke!==e)&&(_n=null,pi=je()+500,Qr(t,e));do try{Sj();break}catch(a){Gv(t,a)}while(!0);Yh(),Kl.current=i,te=s,Ce!==null?e=0:(ze=null,Ke=0,e=Le)}if(e!==0){if(e===2&&(s=sf(t),s!==0&&(r=s,e=Pf(t,s))),e===1)throw n=qo,Qr(t,0),Qn(t,r),wt(t,je()),n;if(e===6)Qn(t,r);else{if(s=t.current.alternate,!(r&30)&&!jj(s)&&(e=Xl(t,r),e===2&&(i=sf(t),i!==0&&(r=i,e=Pf(t,i))),e===1))throw n=qo,Qr(t,0),Qn(t,r),wt(t,je()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(P(345));case 2:Br(t,mt,_n);break;case 3:if(Qn(t,r),(r&130023424)===r&&(e=fp+500-je(),10<e)){if(Ol(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){ct(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=hf(Br.bind(null,t,mt,_n),e);break}Br(t,mt,_n);break;case 4:if(Qn(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-sn(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=je()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Nj(r/1960))-r,10<r){t.timeoutHandle=hf(Br.bind(null,t,mt,_n),r);break}Br(t,mt,_n);break;case 5:Br(t,mt,_n);break;default:throw Error(P(329))}}}return wt(t,je()),t.callbackNode===n?Jv.bind(null,t):null}function Pf(t,e){var n=ho;return t.current.memoizedState.isDehydrated&&(Qr(t,e).flags|=256),t=Xl(t,e),t!==2&&(e=mt,mt=n,e!==null&&If(e)),t}function If(t){mt===null?mt=t:mt.push.apply(mt,t)}function jj(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!ln(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Qn(t,e){for(e&=~dp,e&=~nu,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-sn(e),r=1<<n;t[n]=-1,e&=~r}}function Cg(t){if(te&6)throw Error(P(327));si();var e=Ol(t,0);if(!(e&1))return wt(t,je()),null;var n=Xl(t,e);if(t.tag!==0&&n===2){var r=sf(t);r!==0&&(e=r,n=Pf(t,r))}if(n===1)throw n=qo,Qr(t,0),Qn(t,e),wt(t,je()),n;if(n===6)throw Error(P(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Br(t,mt,_n),wt(t,je()),null}function hp(t,e){var n=te;te|=1;try{return t(e)}finally{te=n,te===0&&(pi=je()+500,Qc&&Ar())}}function hs(t){nr!==null&&nr.tag===0&&!(te&6)&&si();var e=te;te|=1;var n=zt.transition,r=re;try{if(zt.transition=null,re=1,t)return t()}finally{re=r,zt.transition=n,te=e,!(te&6)&&Ar()}}function pp(){_t=Ys.current,de(Ys)}function Qr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,ej(n)),Ce!==null)for(n=Ce.return;n!==null;){var r=n;switch(Jh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Dl();break;case 3:fi(),de(vt),de(tt),rp();break;case 5:np(r);break;case 4:fi();break;case 13:de(pe);break;case 19:de(pe);break;case 10:Qh(r.type._context);break;case 22:case 23:pp()}n=n.return}if(ze=t,Ce=t=pr(t.current,null),Ke=_t=e,Le=0,qo=null,dp=nu=fs=0,mt=ho=null,qr!==null){for(e=0;e<qr.length;e++)if(n=qr[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}qr=null}return t}function Gv(t,e){do{var n=Ce;try{if(Yh(),ml.current=Wl,ql){for(var r=ge.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ql=!1}if(ds=0,$e=Re=ge=null,uo=!1,Uo=0,up.current=null,n===null||n.return===null){Le=1,qo=e,Ce=null;break}e:{var i=t,o=n.return,a=n,c=e;if(e=Ke,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=pg(o);if(p!==null){p.flags&=-257,mg(p,o,a,i,e),p.mode&1&&hg(i,u,e),e=p,c=u;var m=e.updateQueue;if(m===null){var g=new Set;g.add(c),e.updateQueue=g}else m.add(c);break e}else{if(!(e&1)){hg(i,u,e),mp();break e}c=Error(P(426))}}else if(fe&&a.mode&1){var y=pg(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),mg(y,o,a,i,e),Gh(hi(c,a));break e}}i=c=hi(c,a),Le!==4&&(Le=2),ho===null?ho=[i]:ho.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var x=Ov(i,c,e);ag(i,x);break e;case 1:a=c;var v=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(fr===null||!fr.has(b)))){i.flags|=65536,e&=-e,i.lanes|=e;var _=Pv(i,a,e);ag(i,_);break e}}i=i.return}while(i!==null)}Qv(n)}catch(C){e=C,Ce===n&&n!==null&&(Ce=n=n.return);continue}break}while(!0)}function Xv(){var t=Kl.current;return Kl.current=Wl,t===null?Wl:t}function mp(){(Le===0||Le===3||Le===2)&&(Le=4),ze===null||!(fs&268435455)&&!(nu&268435455)||Qn(ze,Ke)}function Xl(t,e){var n=te;te|=2;var r=Xv();(ze!==t||Ke!==e)&&(_n=null,Qr(t,e));do try{_j();break}catch(s){Gv(t,s)}while(!0);if(Yh(),te=n,Kl.current=r,Ce!==null)throw Error(P(261));return ze=null,Ke=0,Le}function _j(){for(;Ce!==null;)Yv(Ce)}function Sj(){for(;Ce!==null&&!Yk();)Yv(Ce)}function Yv(t){var e=eb(t.alternate,t,_t);t.memoizedProps=t.pendingProps,e===null?Qv(t):Ce=e,up.current=null}function Qv(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=vj(n,e),n!==null){n.flags&=32767,Ce=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Le=6,Ce=null;return}}else if(n=yj(n,e,_t),n!==null){Ce=n;return}if(e=e.sibling,e!==null){Ce=e;return}Ce=e=t}while(e!==null);Le===0&&(Le=5)}function Br(t,e,n){var r=re,s=zt.transition;try{zt.transition=null,re=1,Cj(t,e,n,r)}finally{zt.transition=s,re=r}return null}function Cj(t,e,n,r){do si();while(nr!==null);if(te&6)throw Error(P(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(P(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(aN(t,i),t===ze&&(Ce=ze=null,Ke=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Fa||(Fa=!0,tb(Ml,function(){return si(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=zt.transition,zt.transition=null;var o=re;re=1;var a=te;te|=4,up.current=null,wj(t,n),Wv(n,t),KN(df),Pl=!!uf,df=uf=null,t.current=n,kj(n),Qk(),te=a,re=o,zt.transition=i}else t.current=n;if(Fa&&(Fa=!1,nr=t,Gl=s),i=t.pendingLanes,i===0&&(fr=null),tN(n.stateNode),wt(t,je()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Jl)throw Jl=!1,t=Mf,Mf=null,t;return Gl&1&&t.tag!==0&&si(),i=t.pendingLanes,i&1?t===Of?po++:(po=0,Of=t):po=0,Ar(),null}function si(){if(nr!==null){var t=Oy(Gl),e=zt.transition,n=re;try{if(zt.transition=null,re=16>t?16:t,nr===null)var r=!1;else{if(t=nr,nr=null,Gl=0,te&6)throw Error(P(331));var s=te;for(te|=4,F=t.current;F!==null;){var i=F,o=i.child;if(F.flags&16){var a=i.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(F=u;F!==null;){var d=F;switch(d.tag){case 0:case 11:case 15:fo(8,d,i)}var f=d.child;if(f!==null)f.return=d,F=f;else for(;F!==null;){d=F;var h=d.sibling,p=d.return;if(Vv(d),d===u){F=null;break}if(h!==null){h.return=p,F=h;break}F=p}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var y=g.sibling;g.sibling=null,g=y}while(g!==null)}}F=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,F=o;else e:for(;F!==null;){if(i=F,i.flags&2048)switch(i.tag){case 0:case 11:case 15:fo(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,F=x;break e}F=i.return}}var v=t.current;for(F=v;F!==null;){o=F;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,F=b;else e:for(o=v;F!==null;){if(a=F,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:tu(9,a)}}catch(C){we(a,a.return,C)}if(a===o){F=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,F=_;break e}F=a.return}}if(te=s,Ar(),gn&&typeof gn.onPostCommitFiberRoot=="function")try{gn.onPostCommitFiberRoot(Kc,t)}catch{}r=!0}return r}finally{re=n,zt.transition=e}}return!1}function Eg(t,e,n){e=hi(n,e),e=Ov(t,e,1),t=dr(t,e,1),e=ct(),t!==null&&(ca(t,1,e),wt(t,e))}function we(t,e,n){if(t.tag===3)Eg(t,t,n);else for(;e!==null;){if(e.tag===3){Eg(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(fr===null||!fr.has(r))){t=hi(n,t),t=Pv(e,t,1),e=dr(e,t,1),t=ct(),e!==null&&(ca(e,1,t),wt(e,t));break}}e=e.return}}function Ej(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=ct(),t.pingedLanes|=t.suspendedLanes&n,ze===t&&(Ke&n)===n&&(Le===4||Le===3&&(Ke&130023424)===Ke&&500>je()-fp?Qr(t,0):dp|=n),wt(t,e)}function Zv(t,e){e===0&&(t.mode&1?(e=Ma,Ma<<=1,!(Ma&130023424)&&(Ma=4194304)):e=1);var n=ct();t=Ln(t,e),t!==null&&(ca(t,e,n),wt(t,n))}function Tj(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Zv(t,n)}function Aj(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(P(314))}r!==null&&r.delete(e),Zv(t,n)}var eb;eb=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||vt.current)yt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return yt=!1,xj(t,e,n);yt=!!(t.flags&131072)}else yt=!1,fe&&e.flags&1048576&&sv(e,Bl,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;xl(t,e),t=e.pendingProps;var s=ci(e,tt.current);ri(e,n),s=ip(null,e,r,t,s,n);var i=op();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,bt(r)?(i=!0,$l(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,ep(e),s.updater=eu,e.stateNode=s,s._reactInternals=e,bf(e,r,t,n),e=Nf(null,e,r,!0,i,n)):(e.tag=0,fe&&i&&Kh(e),it(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(xl(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=Oj(r),t=Yt(r,t),s){case 0:e=kf(null,e,r,t,n);break e;case 1:e=yg(null,e,r,t,n);break e;case 11:e=gg(null,e,r,t,n);break e;case 14:e=xg(null,e,r,Yt(r.type,t),n);break e}throw Error(P(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yt(r,s),kf(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yt(r,s),yg(t,e,r,s,n);case 3:e:{if(Dv(e),t===null)throw Error(P(387));r=e.pendingProps,i=e.memoizedState,s=i.element,uv(t,e),Vl(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=hi(Error(P(423)),e),e=vg(t,e,r,n,s);break e}else if(r!==s){s=hi(Error(P(424)),e),e=vg(t,e,r,n,s);break e}else for(Ct=ur(e.stateNode.containerInfo.firstChild),Et=e,fe=!0,en=null,n=lv(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ui(),r===s){e=Dn(t,e,n);break e}it(t,e,r,n)}e=e.child}return e;case 5:return dv(e),t===null&&xf(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,ff(r,s)?o=null:i!==null&&ff(r,i)&&(e.flags|=32),Lv(t,e),it(t,e,o,n),e.child;case 6:return t===null&&xf(e),null;case 13:return $v(t,e,n);case 4:return tp(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=di(e,null,r,n):it(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yt(r,s),gg(t,e,r,s,n);case 7:return it(t,e,e.pendingProps,n),e.child;case 8:return it(t,e,e.pendingProps.children,n),e.child;case 12:return it(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,le(Fl,r._currentValue),r._currentValue=o,i!==null)if(ln(i.value,o)){if(i.children===s.children&&!vt.current){e=Dn(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var c=a.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=On(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),yf(i.return,n,e),a.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(P(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),yf(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}it(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,ri(e,n),s=Ht(s),r=r(s),e.flags|=1,it(t,e,r,n),e.child;case 14:return r=e.type,s=Yt(r,e.pendingProps),s=Yt(r.type,s),xg(t,e,r,s,n);case 15:return Iv(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Yt(r,s),xl(t,e),e.tag=1,bt(r)?(t=!0,$l(e)):t=!1,ri(e,n),Mv(e,r,s),bf(e,r,s,n),Nf(null,e,r,!0,t,n);case 19:return zv(t,e,n);case 22:return Rv(t,e,n)}throw Error(P(156,e.tag))};function tb(t,e){return Ey(t,e)}function Mj(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(t,e,n,r){return new Mj(t,e,n,r)}function gp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Oj(t){if(typeof t=="function")return gp(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Rh)return 11;if(t===Lh)return 14}return 2}function pr(t,e){var n=t.alternate;return n===null?(n=$t(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deleti
vendor: 5,099 bytes, line 40
40ons=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function bl(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")gp(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Fs:return Zr(n.children,s,i,e);case Ih:o=8,s|=8;break;case Vd:return t=$t(12,n,e,s|2),t.elementType=Vd,t.lanes=i,t;case Hd:return t=$t(13,n,e,s),t.elementType=Hd,t.lanes=i,t;case qd:return t=$t(19,n,e,s),t.elementType=qd,t.lanes=i,t;case dy:return ru(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case cy:o=10;break e;case uy:o=9;break e;case Rh:o=11;break e;case Lh:o=14;break e;case Wn:o=16,r=null;break e}throw Error(P(130,t==null?t:typeof t,""))}return e=$t(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Zr(t,e,n,r){return t=$t(7,t,r,e),t.lanes=n,t}function ru(t,e,n,r){return t=$t(22,t,r,e),t.elementType=dy,t.lanes=n,t.stateNode={isHidden:!1},t}function nd(t,e,n){return t=$t(6,t,null,e),t.lanes=n,t}function rd(t,e,n){return e=$t(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Pj(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Du(0),this.expirationTimes=Du(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Du(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function xp(t,e,n,r,s,i,o,a,c){return t=new Pj(t,e,n,a,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=$t(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ep(i),t}function Ij(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Bs,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function nb(t){if(!t)return wr;t=t._reactInternals;e:{if(ws(t)!==t||t.tag!==1)throw Error(P(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(bt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(P(171))}if(t.tag===1){var n=t.type;if(bt(n))return nv(t,n,e)}return e}function rb(t,e,n,r,s,i,o,a,c){return t=xp(n,r,!0,t,s,i,o,a,c),t.context=nb(null),n=t.current,r=ct(),s=hr(n),i=On(r,s),i.callback=e??null,dr(n,i,s),t.current.lanes=s,ca(t,s,r),wt(t,r),t}function su(t,e,n,r){var s=e.current,i=ct(),o=hr(s);return n=nb(n),e.context===null?e.context=n:e.pendingContext=n,e=On(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=dr(s,e,o),t!==null&&(on(t,s,o,i),pl(t,s,o)),o}function Yl(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Tg(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function yp(t,e){Tg(t,e),(t=t.alternate)&&Tg(t,e)}function Rj(){return null}var sb=typeof reportError=="function"?reportError:function(t){console.error(t)};function vp(t){this._internalRoot=t}iu.prototype.render=vp.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(P(409));su(t,e,null,null)};iu.prototype.unmount=vp.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;hs(function(){su(null,t,null,null)}),e[Rn]=null}};function iu(t){this._internalRoot=t}iu.prototype.unstable_scheduleHydration=function(t){if(t){var e=Ry();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Yn.length&&e!==0&&e<Yn[n].priority;n++);Yn.splice(n,0,t),n===0&&Dy(t)}};function bp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function ou(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Ag(){}function Lj(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Yl(o);i.call(u)}}var o=rb(e,r,t,0,null,!1,!1,"",Ag);return t._reactRootContainer=o,t[Rn]=o.current,Do(t.nodeType===8?t.parentNode:t),hs(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var u=Yl(c);a.call(u)}}var c=xp(t,0,!1,null,null,!1,!1,"",Ag);return t._reactRootContainer=c,t[Rn]=c.current,Do(t.nodeType===8?t.parentNode:t),hs(function(){su(e,c,n,r)}),c}function au(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var c=Yl(o);a.call(c)}}su(e,o,t,s)}else o=Lj(n,e,t,s,r);return Yl(o)}Py=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Yi(e.pendingLanes);
40n!==0&&(zh(e,n|1),wt(e,je()),!(te&6)&&(pi=je()+500,Ar()))}break;case 13:hs(function(){var r=Ln(t,1);if(r!==null){var s=ct();on(r,t,1,s)}}),yp(t,1)}};Bh=function(t){if(t.tag===13){var e=Ln(t,134217728);if(e!==null){var n=ct();on(e,t,134217728,n)}yp(t,134217728)}};Iy=function(t){if(t.tag===13){var e=hr(t),n=Ln(t,e);if(n!==null){var r=ct();on(n,t,e,r)}yp(t,e)}};Ry=function(){return re};Ly=function(t,e){var n=re;try{return re=t,e()}finally{re=n}};tf=function(t,e,n){switch(e){case"input":if(Jd(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=Yc(r);if(!s)throw Error(P(90));hy(r),Jd(r,s)}}}break;case"textarea":my(t,n);break;case"select":e=n.value,e!=null&&Zs(t,!!n.multiple,e,!1)}};ky=hp;Ny=hs;var Dj={usingClientEntryPoint:!1,Events:[da,qs,Yc,by,wy,hp]},Bi={findFiberByHostInstance:Hr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$j={bundleType:Bi.bundleType,version:Bi.version,rendererPackageName:Bi.rendererPackageName,rendererConfig:Bi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:$n.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Sy(t),t===null?null:t.stateNode},findFiberByHostInstance:Bi.findFiberByHostInstance||Rj,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ua=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ua.isDisabled&&Ua.supportsFiber)try{Kc=Ua.inject($j),gn=Ua}catch{}}At.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dj;At.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bp(e))throw Error(P(200));return Ij(t,e,null,n)};At.createRoot=function(t,e){if(!bp(t))throw Error(P(299));var n=!1,r="",s=sb;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=xp(t,1,!1,null,null,n,!1,r,s),t[Rn]=e.current,Do(t.nodeType===8?t.parentNode:t),new vp(e)};At.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(P(188)):(t=Object.keys(t).join(","),Error(P(268,t)));return t=Sy(e),t=t===null?null:t.stateNode,t};At.flushSync=function(t){return hs(t)};At.hydrate=function(t,e,n){if(!ou(e))throw Error(P(200));return au(null,t,e,!0,n)};At.hydrateRoot=function(t,e,n){if(!bp(t))throw Error(P(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=sb;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=rb(e,null,t,1,n??null,s,!1,i,o),t[Rn]=e.current,Do(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new iu(e)};At.render=function(t,e,n){if(!ou(e))throw Error(P(200));return au(null,t,e,!1,n)};At.unmountComponentAtNode=function(t){if(!ou(t))throw Error(P(40));return t._reactRootContainer?(hs(function(){au(null,null,t,!1,function(){t._reactRootContainer=null,t[Rn]=null})}),!0):!1};At.unstable_batchedUpdates=hp;At.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!ou(n))throw Error(P(200));if(t==null||t._reactInternals===void 0)throw Error(P(38));return au(t,e,n,!1,r)};At.version="18.3.1-next-f1338f8080-20240426";function ib(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ib)}catch(t){console.error(t)}}ib(),iy.exports=At;var ob=iy.exports;const zj=Sh(ob);var ab,Mg=ob;ab=Mg.createRoot,Mg.hydrateRoot;/**
41 * @remix-run/router v1.23.3
42 *
43 * Copyright (c) Remix Software Inc.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE.md file in the root directory of this source tree.
47 *
48 * @license MIT
49 */function Wo(){return Wo=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Wo.apply(null,arguments)}var rr;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(rr||(rr={}));const Og="popstate";function Bj(t){t===void 0&&(t={});function e(r,s){let{pathname:i,search:o,hash:a}=r.location;return Rf("",{pathname:i,search:o,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:lb(s)}return Uj(e,n,null,t)}function Te(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function wp(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Fj(){return Math.random().toString(36).substr(2,8)}function Pg(t,e){return{usr:t.state,key:t.key,idx:e}}function Rf(t,e,n,r){return n===void 0&&(n=null),Wo({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ei(e):e,{state:n,key:e&&e.key||r||Fj()})}function lb(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ei(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function Uj(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a=rr.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Wo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){a=rr.Pop;let y=d(),x=y==null?null:y-u;u=y,c&&c({action:a,location:g.location,delta:x})}function h(y,x){a=rr.Push;let v=Rf(g.location,y,x);u=d()+1;let b=Pg(v,u),_=g.createHref(v);try{o.pushState(b,"",_)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(_)}i&&c&&c({action:a,location:g.location,delta:1})}function p(y,x){a=rr.Replace;let v=Rf(g.location,y,x);u=d();let b=Pg(v,u),_=g.createHref(v);o.replaceState(b,"",_),i&&c&&c({action:a,location:g.location,delta:0})}function m(y){let x=s.location.origin!=="null"?s.location.origin:s.location.href,v=typeof y=="string"?y:lb(y);return v=v.replace(/ $/,"%20"),Te(x,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,x)}let g={get action(){return a},get location(){return t(s,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Og,f),c=y,()=>{s.removeEventListener(Og,f),c=null}},createHref(y){return e(s,y)},createURL:m,encodeLocation(y){let x=m(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:h,replace:p,go(y){return o.go(y)}};return g}var Ig;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Ig||(Ig={}));function Vj(t,e,n){return n===void 0&&(n="/"),Hj(t,e,n,!1)}function Hj(t,e,n,r){let s=typeof e=="string"?Ei(e):e,i=db(s.pathname||"/",n);if(i==null)return null;let o=cb(t);qj(o);let a=null,c=n_(i);for(let u=0;a==null&&u<o.length;++u)a=e_(o[u],c,r);return a}function cb(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,a)=>{let c={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Te(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not val
49id. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=es([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Te(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),cb(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:Qj(u,i.index),routesMeta:d})};return t.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let c of ub(i.path))s(i,o,c)}),e}function ub(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=ub(r.join("/")),a=[];return a.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&a.push(...o),a.map(c=>t.startsWith("/")&&c===""?"/":c)}function qj(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Zj(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Wj=/^:[\w-]+$/,Kj=3,Jj=2,Gj=1,Xj=10,Yj=-2,Rg=t=>t==="*";function Qj(t,e){let n=t.split("/"),r=n.length;return n.some(Rg)&&(r+=Yj),e&&(r+=Jj),n.filter(s=>!Rg(s)).reduce((s,i)=>s+(Wj.test(i)?Kj:i===""?Gj:Xj),r)}function Zj(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function e_(t,e,n){let{routesMeta:r}=t,s={},i="/",o=[];for(let a=0;a<r.length;++a){let c=r[a],u=a===r.length-1,d=i==="/"?e:e.slice(i.length)||"/",f=Lg({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),h=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=Lg({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!f)return null;
vendor: 6,674 bytes, lines 49-58
49Object.assign(s,f.params),o.push({params:s,pathname:es([i,f.pathname]),pathnameBase:a_(es([i,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(i=es([i,f.pathnameBase]))}return o}function Lg(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=t_(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),a=s.slice(1);return{params:r.reduce((u,d,f)=>{let{paramName:h,isOptional:p}=d;if(h==="*"){let g=a[f]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const m=a[f];return p&&!m?u[h]=void 0:u[h]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:t}}function t_(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),wp(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,c)=>(r.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function n_(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return wp(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function db(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const r_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,s_=t=>r_.test(t);function i_(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?Ei(t):t,i;if(n)if(s_(n))i=n;else{if(n.includes("//")){let o=n;n=pb(n),wp(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Dg(n.substring(1),"/"):i=Dg(n,e)}else i=e;return{pathname:i,search:l_(r),hash:c_(s)}}function Dg(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function sd(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function o_(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function fb(t,e){let n=o_(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function hb(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=Ei(t):(s=Wo({},t),Te(!s.pathname||!s.pathname.includes("?"),sd("?","pathname","search",s)),Te(!s.pathname||!s.pathname.includes("#"),sd("#","pathname","hash",s)),Te(!s.search||!s.search.includes("#"),sd("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let f=e.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}a=f>=0?e[f]:"/"}let c=i_(s,a),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const pb=t=>t.replace(/\/\/+/g,"/"),es=t=>pb(t.join("/")),a_=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),l_=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,c_=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function u_(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const mb=["post","put","patch","delete"];new Set(mb);const d_=["get",...mb];new Set(d_);/**
50 * React Router v6.30.4
51 *
52 * Copyright (c) Remix Software Inc.
53 *
54 * This source code is licensed under the MIT license found in the
55 * LICENSE.md file in the root directory of this source tree.
56 *
57 * @license MIT
58 */function Ko(){return Ko=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ko.apply(null,arguments)}const kp=N.createContext(null),f_=N.createContext(null),ha=N.createContext(null),lu=N.createContext(null),Mr=N.createContext({outlet:null,matches:[],isDataRoute:!1}),gb=N.createContext(null);function pa(){return N.useContext(lu)!=null}function ma(){return pa()||Te(!1),N.useContext(lu).location}function xb(t){N.useContext(ha).static||N.useLayoutEffect(t)}function cu(){let{isDataRoute:t}=N.useContext(Mr);return t?__():h_()}function h_(){pa()||Te(!1);let t=N.useContext(kp),{basename:e,future:n,navigator:r}=N.useContext(ha),{matches:s}=N.useContext(Mr),{pathname:i}=ma(),o=JSON.stringify(fb(s,n.v7_relativeSplatPath)),a=N.useRef(!1);return xb(()=>{a.current=!0}),N.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let f=hb(u,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:es([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,o,i,t])}function Np(){let{matches:t}=N.useContext(Mr),e=t[t.length-1];return e?e.params:{}}function p_(t,e){return m_(t,e)}function m_(t,e,n,r){pa()||Te(!1);let{navigator:s}=N.useContext(ha),{matches:i}=N.useContext(Mr),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ma(),d;if(e){var f;let y=typeof e=="string"?Ei(e):e;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Te(!1),d=y}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let y=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=Vj(t,{pathname:p}),g=b_(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:es([c,s.encodeLocation?s.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:es([c,s.encodeLocation?s.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,r);return e&&g?N.createElement(lu.Provider,{value:{location:Ko({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:rr.Pop}},g):g}function g_(){let t=j_(),e=u_(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application 
58Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},e),n?N.createElement("pre",{style:s},n):null,null)}const x_=N.createElement(g_,null);class y_ extends N.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?N.createElement(Mr.Provider,{value:this.props.routeContext},N.createElement(gb.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function v_(t){let{routeContext:e,match:n,children:r}=t,s=N.useContext(kp);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),N.createElement(Mr.Provider,{value:e},r)}function b_(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(s=n)==null?void 0:s.errors;if(a!=null){let d=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||Te(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:p}=n,m=f.route.loader&&h[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||m){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,m=!1,g=null,y=null;n&&(p=a&&f.route.id?a[f.route.id]:void 0,g=f.route.errorElement||x_,c&&(u<0&&h===0?(m=!0,y=null):u===h&&(m=!0,y=f.route.hydrateFallbackElement||null)));let x=e.concat(o.slice(0,h+1)),v=()=>{let b;return p?b=g:m?b=y:f.route.Component?b=N.createElement(f.route.Component,null):f.route.element?b=f.route.element:b=d,N.createElement(v_,{match:f,routeContext:{outlet:d,matches:x,isDataRoute:n!=null},children:b})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?N.createElement(y_,{location:n.location,revalidation:n.revalidation,component:g,error:p,children:v(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):v()},null)}var yb=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(yb||{}),Ql=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Ql||{});function w_(t){let e=N.useContext(kp);return e||Te(!1),e}function k_(t){let e=N.useContext(f_);return e||Te(!1),e}function N_(t){let e=N.useContext(Mr);return e||Te(!1),e}function vb(t){let e=N_(),n=e.matches[e.matches.length-1];return n.route.id||Te(!1),n.route.id}function j_(){var t;let e=N.useContext(gb),n=k_(Ql.UseRouteError),r=vb(Ql.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function __(){let{router:t}=w_(yb.UseNavigateStable),e=vb(Ql.UseNavigateStable),n=N.useRef(!1);return xb(()=>{n.current=!0}),N.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Ko({fromRouteId:e},i)))},[t,e])}function S_(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function jp(t){let{to:e,replace:n,state:r,relative:s}=t;pa()||Te(!1);let{future:i,static:o}=N.useContext(ha),{matches:a}=N.useContext(Mr),{pathname:c}=ma(),u=cu(),d=hb(e,fb(a,i.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return N.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:s}),[u,f,s,n,r]),null}function pt(t){Te(!1)}function C_(t){let{basename:e="/",children:n=null,location:r,navigationType:s=rr.Pop,navigator:i,static:o=!1,future:a}=t;pa()&&Te(!1);let c=e.replace(/^\/*/,"/"),u=N.useMemo(()=>({basename:c,navigator:i,static:o,future:Ko({v7_relativeSplatPath:!1},a)}),[c,a,i,o]);typeof r=="string"&&(r=Ei(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:m="default"}=r,g=N.useMemo(()=>{let y=db(d,c);return y==null?null:{location:{pathname:y,search:f,hash:h,state:p,key:m},navigationType:s}},[c,d,f,h,p,m,s]);return g==null?null:N.createElement(ha.Provider,{value:u},N.createElement(lu.Provider,{children:n,value:g}))}function E_(t){let{children:e,location:n}=t;return p_(Lf(e),n)}new Promise(()=>{});function Lf(t,e){e===void 0&&(e=[]);let n=[];
58return N.Children.forEach(t,(r,s)=>{if(!N.isValidElement(r))return;let i=[...e,s];if(r.type===N.Fragment){n.push.apply(n,Lf(r.props.children,i));return}r.type!==pt&&Te(!1),!r.props.index||!r.props.children||Te(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Lf(r.props.children,i)),n.push(o)}),n}/**
59 * React Router DOM v6.30.4
60 *
61 * Copyright (c) Remix Software Inc.
62 *
63 * This source code is licensed under the MIT license found in the
64 * LICENSE.md file in the root directory of this source tree.
65 *
66 * @license MIT
67 */function Df(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function T_(t,e){let n=Df(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}const A_="6";try{window.__reactRouterVersion=A_}catch{}const M_="startTransition",$g=Ek[M_];function O_(t){let{basename:e,children:n,future:r,window:s}=t,i=N.useRef();i.current==null&&(i.current=Bj({window:s,v5Compat:!0}));let o=i.current,[a,c]=N.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=N.useCallback(f=>{u&&$g?$g(()=>c(f)):c(f)},[c,u]);return N.useLayoutEffect(()=>o.listen(d),[o,d]),N.useEffect(()=>S_(r),[r]),N.createElement(C_,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}var zg;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(zg||(zg={}));var Bg;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Bg||(Bg={}));function P_(t){let e=N.useRef(Df(t)),n=N.useRef(!1),r=ma(),s=N.useMemo(()=>T_(r.search,n.current?null:e.current),[r.search]),i=cu(),o=N.useCallback((a,c)=>{const u=Df(typeof a=="function"?a(s):a);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}const I_="modulepreload",R_=function(t){return"/"+t},Fg={},ga=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=R_(c),c in Fg)return;Fg[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":I_,u||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})},L_=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>ga(async()=>{const{default:r}=await Promise.resolve().then(()=>Ti);return{default:r}},void 0).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)};class _p extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}}class D_ extends _p{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Ug extends _p{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Vg extends _p{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var $f;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})($f||($f={}));var $_=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}
67return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};class z_{constructor(e,{headers:n={},customFetch:r,region:s=$f.Any}={}){this.url=e,this.headers=n,this.region=s,this.fetch=L_(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,n={}){var r;return $_(this,void 0,void 0,function*(){try{const{headers:s,method:i,body:o}=n;let a={},{region:c}=n;c||(c=this.region);const u=new URL(`${this.url}/${e}`);c&&c!=="any"&&(a["x-region"]=c,u.searchParams.set("forceFunctionRegion",c));let d;o&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",d=o):typeof o=="string"?(a["Content-Type"]="text/plain",d=o):typeof FormData<"u"&&o instanceof FormData?d=o:(a["Content-Type"]="application/json",d=JSON.stringify(o)));const f=yield this.fetch(u.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),s),body:d}).catch(g=>{throw new D_(g)}),h=f.headers.get("x-relay-error");if(h&&h==="true")throw new Ug(f);if(!f.ok)throw new Vg(f);let p=((r=f.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),m;return p==="application/json"?m=yield f.json():p==="application/octet-stream"?m=yield f.blob():p==="text/event-stream"?m=f:p==="multipart/form-data"?m=yield f.formData():m=yield f.text(),{data:m,error:null,response:f}}catch(s){return{data:null,error:s,response:s instanceof Vg||s instanceof Ug?s.context:void 0}}})}}var gt={},Sp={},uu={},xa={},du={},fu={},B_=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},mi=B_();const F_=mi.fetch,bb=mi.fetch.bind(mi),wb=mi.Headers,U_=mi.Request,V_=mi.Response,Ti=Object.freeze(Object.defineProperty({__proto__:null,Headers:wb,Request:U_,Response:V_,default:bb,fetch:F_},Symbol.toStringTag,{value:"Module"})),H_=fk(Ti);var hu={};Object.defineProperty(hu,"__esModule",{value:!0});let q_=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
67de=e.code}};hu.default=q_;var kb=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fu,"__esModule",{value:!0});const W_=kb(H_),K_=kb(hu);let J_=class{constructor(e){var n,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(n=e.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=W_.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,n){return this.headers=new Headers(this.headers),this.headers.set(e,n),this}then(e,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const r=this.fetch;let s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,a,c,u;let d=null,f=null,h=null,p=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){const v=await i.text();v===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?f=v:f=JSON.parse(v))}const y=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),x=(c=i.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");y&&x&&x.length>1&&(h=parseInt(x[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(f)&&(f.length>1?(d={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,h=null,p=406,m="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{const y=await i.text();try{d=JSON.parse(y),Array.isArray(d)&&i.status===404&&(f=[],d=null,p=200,m="OK")}catch{i.status===404&&y===""?(p=204,m="No Content"):d={message:y}}if(d&&this.isMaybeSingle&&(!((u=d==null?void 0:d.details)===null||u===void 0)&&u.includes("0 rows"))&&(d=null,p=200,m="OK"),d&&this.shouldThrowOnError)throw new K_.default(d)}return{error:d,data:f,count:h,status:p,statusText:m}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,a,c;return{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(a=i==null?void 0:i.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(c=i==null?void 0:i.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),s.then(e,n)}returns(){return this}overrideTypes(){return this}};fu.default=J_;var G_=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(du,"__esModule",{value:!0});const X_=G_(fu);let Y_=class extends X_.default{select(e){let n=!1;const r=(e??"*").split("").map(s=>/\s/.test(s)&&!n?"":(s==='"'&&(n=!n),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:n=!0,nullsFirst:r,foreignTable:s,referencedTable:i=s}={}){const o=i?`${i}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${n?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,n,{foreignTable:r,referencedTable:s=r}={}){const i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(o,`${n-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
67explain({analyze:e=!1,verbose:n=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var a;const c=[e?"analyze":null,n?"verbose":null,r?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${u}"; options=${c};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};du.default=Y_;var Q_=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xa,"__esModule",{value:!0});const Z_=Q_(du);let eS=class extends Z_.default{eq(e,n){return this.url.searchParams.append(e,`eq.${n}`),this}neq(e,n){return this.url.searchParams.append(e,`neq.${n}`),this}gt(e,n){return this.url.searchParams.append(e,`gt.${n}`),this}gte(e,n){return this.url.searchParams.append(e,`gte.${n}`),this}lt(e,n){return this.url.searchParams.append(e,`lt.${n}`),this}lte(e,n){return this.url.searchParams.append(e,`lte.${n}`),this}like(e,n){return this.url.searchParams.append(e,`like.${n}`),this}likeAllOf(e,n){return this.url.searchParams.append(e,`like(all).{${n.join(",")}}`),this}likeAnyOf(e,n){return this.url.searchParams.append(e,`like(any).{${n.join(",")}}`),this}ilike(e,n){return this.url.searchParams.append(e,`ilike.${n}`),this}ilikeAllOf(e,n){return this.url.searchParams.append(e,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(e,n){return this.url.searchParams.append(e,`ilike(any).{${n.join(",")}}`),this}is(e,n){return this.url.searchParams.append(e,`is.${n}`),this}in(e,n){const r=Array.from(new Set(n)).map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,n){return typeof n=="string"?this.url.searchParams.append(e,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(e,`cs.{${n.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(n)}`),this}containedBy(e,n){return typeof n=="string"?this.url.searchParams.append(e,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(e,`cd.{${n.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(n)}`),this}rangeGt(e,n){return this.url.searchParams.append(e,`sr.${n}`),this}rangeGte(e,n){return this.url.searchParams.append(e,`nxl.${n}`),this}rangeLt(e,n){return this.url.searchParams.append(e,`sl.${n}`),this}rangeLte(e,n){return this.url.searchParams.append(e,`nxr.${n}`),this}rangeAdjacent(e,n){return this.url.searchParams.append(e,`adj.${n}`),this}overlaps(e,n){return typeof n=="string"?this.url.searchParams.append(e,`ov.${n}`):this.url.searchParams.append(e,`ov.{${n.join(",")}}`),this}textSearch(e,n,{config:r,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");const o=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${o}.${n}`),this}match(e){return Object.entries(e).forEach(([n,r])=>{this.url.searchParams.append(n,`eq.${r}`)}),this}not(e,n,r){return this.url.searchParams.append(e,`not.${n}.${r}`),this}or(e,{foreignTable:n,referencedTable:r=n}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,n,r){return this.url.searchParams.append(e,`${n}.${r}`),this}};xa.default=eS;var tS=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uu,"__esModule",{value:!0});const Fi=tS(xa);let nS=class{constructor(e,{headers:n={},schema:r,fetch:s}){this.url=e,this.headers=new Headers(n),this.schema=r,this.fetch=s}select(e,{head:n=!1,count:r}={}){const s=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(a=>/\s/.test(a)&&!i?"":(a==='"'&&(i=!i),a)).join("");return this.url.searchParams.set("select",o),r&&this.headers.append("Prefer",`count=${r}`),new Fi.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:n,defaultToNull:r=!0}={}){var s;const i="POST";if(n&&this.headers.append("Prefer",`count=${n}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((a,c)=>a.concat(Object.keys(c)),[]);if(o.length>0){const a=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",a.join(","))}}return new Fi.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}upsert(e,{onConflict:n,ignoreDuplicates:r=!1,count:s,defaultToNull:i=!0}={}){var o;const a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),s&&this.headers.append("Prefer",`count=${s}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);this.url.searchParams.set("columns",u.join(","))}}return new Fi.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:n}={}){var r;const s="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new Fi.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:e}={}){var n;const r="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new Fi.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};uu.default=nS;var Nb=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sp,"__esModule",{value:!0});const rS=Nb(uu),sS=Nb(xa);let iS=class jb{constructor(e,{headers:n={},schema:r,fetch:s}={}){this.url=e,this.headers=new Headers(n),this.schemaName=r,this.fetch=s}from(e){const n=new URL(`${this.url}/${e}`);return new rS.default(n,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new jb(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:r=!1,get:s=!1,count:i}={}){var o;let a;const c=new URL(`${this.url}/rpc/${e}`);let u;r||s?(a=r?"HEAD":"GET",Object.entries(n).filter(([f,h])=>h!==void 0).map(([f,h])=>[f,Array.isArray(h)?`{${h.join(",")}}`:`${h}
67`]).forEach(([f,h])=>{c.searchParams.append(f,h)})):(a="POST",u=n);const d=new Headers(this.headers);return i&&d.set("Prefer",`count=${i}`),new sS.default({method:a,url:c,headers:d,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};Sp.default=iS;var Ai=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gt,"__esModule",{value:!0});gt.PostgrestError=gt.PostgrestBuilder=gt.PostgrestTransformBuilder=gt.PostgrestFilterBuilder=gt.PostgrestQueryBuilder=gt.PostgrestClient=void 0;const _b=Ai(Sp);gt.PostgrestClient=_b.default;const Sb=Ai(uu);gt.PostgrestQueryBuilder=Sb.default;const Cb=Ai(xa);gt.PostgrestFilterBuilder=Cb.default;const Eb=Ai(du);gt.PostgrestTransformBuilder=Eb.default;const Tb=Ai(fu);gt.PostgrestBuilder=Tb.default;const Ab=Ai(hu);gt.PostgrestError=Ab.default;var oS=gt.default={PostgrestClient:_b.default,PostgrestQueryBuilder:Sb.default,PostgrestFilterBuilder:Cb.default,PostgrestTransformBuilder:Eb.default,PostgrestBuilder:Tb.default,PostgrestError:Ab.default};const{PostgrestClient:aS,PostgrestQueryBuilder:v7,PostgrestFilterBuilder:b7,PostgrestTransformBuilder:w7,PostgrestBuilder:k7,PostgrestError:N7}=oS;class lS{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const r=n.node,s=parseInt(r.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
68import ws from "ws"
69new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
70
71Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const r=this.getWebSocketConstructor();return new r(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const cS="2.15.5",uS=`realtime-js/${cS}`,dS="1.0.0",zf=1e4,fS=1e3,hS=100;var mo;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(mo||(mo={}));var Pe;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Pe||(Pe={}));var Zt;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Zt||(Zt={}));var Bf;(function(t){t.websocket="websocket"})(Bf||(Bf={}));var Ur;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Ur||(Ur={}));class pS{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,n,r)}_decodeBroadcast(e,n,r){const s=n.getUint8(1),i=n.getUint8(2);let o=this.HEADER_LENGTH+2;const a=r.decode(e.slice(o,o+s));o=o+s;const c=r.decode(e.slice(o,o+i));o=o+i;const u=JSON.parse(r.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:c,payload:u}}}class Mb{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var ae;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.t
vendor: 4,779 bytes, line 71
71srange="tsrange",t.tstzrange="tstzrange"})(ae||(ae={}));const Hg=(t,e,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return Object.keys(e).reduce((i,o)=>(i[o]=mS(o,t,e,s),i),{})},mS=(t,e,n,r)=>{const s=e.find(a=>a.name===t),i=s==null?void 0:s.type,o=n[t];return i&&!r.includes(i)?Ob(i,o):Ff(o)},Ob=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return vS(e,n)}switch(t){case ae.bool:return gS(e);case ae.float4:case ae.float8:case ae.int2:case ae.int4:case ae.int8:case ae.numeric:case ae.oid:return xS(e);case ae.json:case ae.jsonb:return yS(e);case ae.timestamp:return bS(e);case ae.abstime:case ae.date:case ae.daterange:case ae.int4range:case ae.int8range:case ae.money:case ae.reltime:case ae.text:case ae.time:case ae.timestamptz:case ae.timetz:case ae.tsrange:case ae.tstzrange:return Ff(e);default:return Ff(e)}},Ff=t=>t,gS=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},xS=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},yS=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},vS=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let i;const o=t.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>Ob(e,a))}return t},bS=t=>typeof t=="string"?t.replace(" ","T"):t,Pb=t=>{let e=t;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class id{constructor(e,n,r={},s=zf){this.channel=e,this.event=n,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var r;return this._hasReceived(e)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var qg;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(qg||(qg={}));class go{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=go.syncState(this.state,s,i,o),this.pendingDiffs.forEach(c=>{this.state=go.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=go.syncDiff(this.state,s,i,o),a())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,r,s){const i=this.cloneDeep(e),o=this.transformState(n),a={},c={};return this.map(i,(u,d)=>{o[u]||(c[u]=d)}),this.map(o,(u,d)=>{const f=i[u];if(f){const h=d.map(y=>y.presence_ref),p=f.map(y=>y.presence_ref),m=d.filter(y=>p.indexOf(y.presence_ref)<0),g=f.filter(y=>h.indexOf(y.presence_ref)<0);m.length>0&&(a[u]=m),g.length>0&&(c[u]=g)}else a[u]=d}),this.syncDiff(i,{joins:a,leaves:c},r,s)}static syncDiff(e,n,r,s){const{joins:i,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(a,c)=>{var u;
71const d=(u=e[a])!==null&&u!==void 0?u:[];if(e[a]=this.cloneDeep(c),d.length>0){const f=e[a].map(p=>p.presence_ref),h=d.filter(p=>f.indexOf(p.presence_ref)<0);e[a].unshift(...h)}r(a,d,c)}),this.map(o,(a,c)=>{let u=e[a];if(!u)return;const d=c.map(f=>f.presence_ref);u=u.filter(f=>d.indexOf(f.presence_ref)<0),e[a]=u,s(a,u,c),u.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const s=e[r];return"metas"in s?n[r]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):n[r]=s,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Wg;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Wg||(Wg={}));var xo;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(xo||(xo={}));var Sn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Sn||(Sn={}));class Cp{constructor(e,n={config:{}},r){this.topic=e,this.params=n,this.socket=r,this.bindings={},this.state=Pe.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new id(this,Zt.join,this.params,this.timeout),this.rejoinTimer=new Mb(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Pe.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Pe.closed,this.socket._remove(this)}),this._onError(s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=Pe.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Pe.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=Pe.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Zt.reply,{},(s,i)=>{this._trigger(this._replyEventName(i),s)}),this.presence=new go(this),this.broadcastEndpointURL=Pb(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==Pe.closed){const{config:{broadcast:o,presence:a,private:c}}=this.params,u=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[xo.PRESENCE]&&this.bindings[xo.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,f={},h={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(p=>e==null?void 0:e(Sn.CHANNEL_ERROR,p)),this._onClose(()=>e==null?void 0:e(Sn.CLOSED)),this.updateJoinPayload(Object.assign({config:h},f)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:p})=>{var m;if(this.socket.setAuth(),p===void 0){e==null||e(Sn.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,y=(m=g==null?void 0:g.length)!==null&&m!==void 0?m:0,x=[];for(let v=0;v<y;v++){const b=g[v],{filter:{event:_,schema:C,table:w,filter:k}}=b,E=p&&p[v];if(E&&E.event===_&&E.schema===C&&E.table===w&&E.filter===k)x.push(Object.assign(Object.assign({},b),{id:E.id}));else{this.unsubscribe(),this.state=Pe.errored,e==null||e(Sn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=x,e&&e(Sn.SUBSCRIBED);return}}).receive("error",p=>{this.state=Pe.errored,e==null||e(Sn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Sn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){return this.state===Pe.joined&&e===xo.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,n,r)}async send(e,n={}){var r,s;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,c;const u=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Pe.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Zt.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new id(this,Zt.leave,{},e),r.receive("ok",()=>{n(),s("ok")}).receive("timeout",()=>{n(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}
71teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Pe.closed,this.bindings={}}async _fetchWithTimeout(e,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_push(e,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new id(this,e,n,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>hS){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,r){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,r){var s,i;const o=e.toLocaleLowerCase(),{close:a,error:c,leave:u,join:d}=Zt;if(r&&[a,c,u,d].indexOf(o)>=0&&r!==this._joinRef())return;let h=this._onMessage(o,n,r);if(n&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(p=>{var m,g,y;return((m=p.filter)===null||m===void 0?void 0:m.event)==="*"||((y=(g=p.filter)===null||g===void 0?void 0:g.event)===null||y===void 0?void 0:y.toLocaleLowerCase())===o}).map(p=>p.callback(h,r)):(i=this.bindings[o])===null||i===void 0||i.filter(p=>{var m,g,y,x,v,b;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in p){const _=p.id,C=(m=p.filter)===null||m===void 0?void 0:m.event;return _&&((g=n.ids)===null||g===void 0?void 0:g.includes(_))&&(C==="*"||(C==null?void 0:C.toLocaleLowerCase())===((y=n.data)===null||y===void 0?void 0:y.type.toLocaleLowerCase()))}else{const _=(v=(x=p==null?void 0:p.filter)===null||x===void 0?void 0:x.event)===null||v===void 0?void 0:v.toLocaleLowerCase();return _==="*"||_===((b=n==null?void 0:n.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===o}).map(p=>{if(typeof h=="object"&&"ids"in h){const m=h.data,{schema:g,table:y,commit_timestamp:x,type:v,errors:b}=m;h=Object.assign(Object.assign({},{schema:g,table:y,commit_timestamp:x,eventType:v,new:{},old:{},errors:b}),this._getPayloadRecords(m))}p.callback(h,r)})}_isClosed(){return this.state===Pe.closed}_isJoined(){return this.state===Pe.joined}_isJoining(){return this.state===Pe.joining}_isLeaving(){return this.state===Pe.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,r){const s=e.toLocaleLowerCase(),i={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,n){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&Cp.isEqual(s.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Zt.close,{},e)}_onError(e){this._on(Zt.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Pe.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Hg(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Hg(e.columns,e.old_record)),n}}const od=()=>{},Va={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},wS=[1e3,2e3,5e3,1e4],kS=1e4,NS=`
72  addEventListener("message", (e) => {
73    if (e.data.event === "start") {
74      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
75    }
76  });`;class jS{constructor(e,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=zf,this.transport=null,this.heartbeatIntervalMs=Va.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=od,this.ref=0,this.reconnectTimer=null,this.logger=od,this.conn=null,this.sendBuffer=[],this.serializer
76=new pS,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>{let i;return s?i=s:typeof fetch>"u"?i=(...o)=>ga(async()=>{const{default:a}=await Promise.resolve().then(()=>Ti);return{default:a}},void 0).then(({default:a})=>a(...o)).catch(a=>{throw new Error(`Failed to load @supabase/node-fetch: ${a.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):i=fetch,(...o)=>i(...o)},!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Bf.websocket}`,this.httpEndpoint=Pb(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=lS.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
77
78To use Realtime in Node.js, you need to provide a WebSocket implementation:
79
80Option 1: Use Node.js 22+ which has native WebSocket support
81Option 2: Install and provide the "ws" package:
82
83  npm install ws
84
85  import ws from "ws"
86  const client = new RealtimeClient(url, {
87    ...options,
88    transport: ws
89  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:dS}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,r){this.logger(e,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case mo.connecting:return Ur.Connecting;case mo.open:return Ur.Open;case mo.closing:return Ur.Closing;default:return Ur.Closed}}isConnected(){return this.connectionState()===Ur.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const r=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new Cp(`realtime:${e}`,n,this);return this.channels.push(i),i}}push(e){const{topic:n,event:r,payload:s,ref:i}=e,o=()=>{this.encode(e,a=>{var c;(c=this.conn)===null||c===void 0||c.send(a)})};this.log("push",`${n} ${r} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(fS,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Va.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
890&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(u){this.log("error","error in heartbeat callback",u)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:s,payload:i,ref:o}=n,a=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${r} ${s} ${a}`.trim(),i),this.channels.filter(u=>u._isMember(r)).forEach(u=>u._trigger(s,i,o)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Zt.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const r=e.match(/\?/)?"&":"?",s=new URLSearchParams(n);return`${e}${r}${s}`}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([NS],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n;e?n=e:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(r=>{const s={access_token:n,version:uS};n&&r.updateJoinPayload(s),r.joinedOnce&&r._isJoined()&&r._push(Zt.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(n)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Mb(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Va.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,r,s,i,o,a,c,u,d;if(this.transport=(n=e==null?void 0:e.transport)!==null&&n!==void 0?n:null,this.timeout=(r=e==null?void 0:e.timeout)!==null&&r!==void 0?r:zf,this.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:Va.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e==null?void 0:e.heartbeatCallback)!==null&&a!==void 0?a:od,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:f=>wS[f-1]||kS,this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(f,h)=>h(JSON.stringify(f)),this.decode=(d=e==null?void 0:e.decode)!==null&&d!==void 0?d:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}
89class Ep extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Ie(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class _S extends Ep{constructor(e,n,r){super(e),this.name="StorageApiError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Uf extends Ep{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}var SS=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};const Ib=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>ga(async()=>{const{default:r}=await Promise.resolve().then(()=>Ti);return{default:r}},void 0).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)},CS=()=>SS(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield ga(()=>Promise.resolve().then(()=>Ti),void 0)).Response:Response}),Vf=t=>{if(Array.isArray(t))return t.map(n=>Vf(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=Vf(r)}),e},ES=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var ks=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};const ad=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),TS=(t,e,n)=>ks(void 0,void 0,void 0,function*(){const r=yield CS();t instanceof r&&!(n!=null&&n.noResolveJson)?t.json().then(s=>{const i=t.status||500,o=(s==null?void 0:s.statusCode)||i+"";e(new _S(ad(s),i,o))}).catch(s=>{e(new Uf(ad(s),s))}):e(new Uf(ad(t),t))}),AS=(t,e,n,r)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!r?s:(ES(r)?(s.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(r)):s.body=r,e!=null&&e.duplex&&(s.duplex=e.duplex),Object.assign(Object.assign({},s),n))};function ya(t,e,n,r,s,i){return ks(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(n,AS(e,r,s,i)).then(c=>{if(!c.ok)throw c;return r!=null&&r.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>TS(c,a,r))})})}function Zl(t,e,n,r){return ks(this,void 0,void 0,function*(){return ya(t,"GET",e,n,r)})}function dn(t,e,n,r,s){return ks(this,void 0,void 0,function*(){return ya(t,"POST",e,r,s,n)})}function Hf(t,e,n,r,s){return ks(this,void 0,void 0,function*(){return ya(t,"PUT",e,r,s,n)})}function MS(t,e,n,r){return ks(this,void 0,void 0,function*(){return ya(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),r)})}function Rb(t,e,n,r,s){return ks(this,void 0,void 0,function*(){return ya(t,"DELETE",e,r,s,n)})}var st=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};const OS={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Kg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class PS{constructor(e,n={},r,s){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=r,this.fetch=Ib(s)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,r,s){return st(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},Kg),s);let a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,c&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),s!=null&&s.headers&&(a=Object.assign(Object.assign({},a),s.headers));const u=this._removeEmptyFolders(n),d=this._getFinalPath(u),f=yield(e=="PUT"?Hf:dn)(this.fetch,`${this.url}/object/${d}`,i,Object.assign({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:u,id:f.Id,fullPath:f.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Ie(i))return{data:null,error:i};throw i}})}upload(e,n,r){return st(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,r)})}uploadToSignedUrl(e,n,r,s){return st(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",n);try{let c;const u=Object.assign({upsert:Kg.upsert},s),d=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.append("cacheControl",u.cacheControl)):(c=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType);const f=yield Hf(this.fetch,a.toString(),c,{headers:d});return{data:{path:i,fullPath:f.Key},error:null}}catch(c){if(this.shouldThrowOnError)throw c;if(Ie(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,n){return st(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e);const s=Object.assign({},this.headers);n!=null&&n.upsert&&(s["x-upsert"]="true");const i=yield dn(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(this.url+i.url),a=o.searchParams.get("token");if(!a)throw new Ep("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:a},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ie(r))return{data:null,error:r};throw r}})}update(e,n,r){return st(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,r)})}move(e,n,r){return st(this,void 0,void 0,function*(){try{return{data:yield dn(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ie(s))return{data:null,error:s};throw s}})}copy(e,n,r){return st(this,void 0,void 0,function*(){try{return{data:{path:(yield dn(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ie(s))return{data:null,error:s};throw s}})}createSignedUrl(e,n,r){return st(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield dn(this.fetch,`${this.url}/object/sign/${s}
89`,Object.assign({expiresIn:n},r!=null&&r.transform?{transform:r.transform}:{}),{headers:this.headers});const o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ie(s))return{data:null,error:s};throw s}})}createSignedUrls(e,n,r){return st(this,void 0,void 0,function*(){try{const s=yield dn(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:e},{headers:this.headers}),i=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{data:s.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ie(s))return{data:null,error:s};throw s}})}download(e,n){return st(this,void 0,void 0,function*(){const s=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),o=i?`?${i}`:"";try{const a=this._getFinalPath(e);return{data:yield(yield Zl(this.fetch,`${this.url}/${s}/${a}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Ie(a))return{data:null,error:a};throw a}})}info(e){return st(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const r=yield Zl(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Vf(r),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ie(r))return{data:null,error:r};throw r}})}exists(e){return st(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield MS(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ie(r)&&r instanceof Uf){const s=r.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:r}}throw r}})}getPublicUrl(e,n){const r=this._getFinalPath(e),s=[],i=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";i!==""&&s.push(i);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});c!==""&&s.push(c);let u=s.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}${u}`)}}}remove(e){return st(this,void 0,void 0,function*(){try{return{data:yield Rb(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ie(n))return{data:null,error:n};throw n}})}list(e,n,r){return st(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},OS),n),{prefix:e||""});return{data:yield dn(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ie(s))return{data:null,error:s};throw s}})}listV2(e,n){return st(this,void 0,void 0,function*(){try{const r=Object.assign({},e);return{data:yield dn(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},n),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ie(r))return{data:null,error:r};throw r}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const n=[];return e.width&&n.push(`width=${e.width}`),e.height&&n.push(`height=${e.height}`),e.resize&&n.push(`resize=${e.resize}`),e.format&&n.push(`format=${e.format}`),e.quality&&n.push(`quality=${e.quality}`),n.join("&")}}const IS="2.12.1",RS={"X-Client-Info":`storage-js/${IS}`};var Es=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};class LS{constructor(e,n={},r,s){this.shouldThrowOnError=!1;const i=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},RS),n),this.fetch=Ib(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return Es(this,void 0,void 0,function*(){try{return{data:yield Zl(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Ie(e))return{data:null,error:e};throw e}})}getBucket(e){return Es(this,void 0,void 0,function*(){try{return{data:yield Zl(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ie(n))return{data:null,error:n};throw n}})}createBucket(e,n={public:!1}){return Es(this,void 0,void 0,function*(){try{return{data:yield dn(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ie(r))return{data:null,error:r};throw r}})}updateBucket(e,n){return Es(this,void 0,void 0,function*(){try{return{data:yield Hf(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ie(r))return{data:null,error:r};throw r}})}emptyBucket(e){return Es(this,void 0,void 0,function*(){try{return{data:yield dn(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ie(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Es(this,void 0,void 0,function*(){try{return{data:yield Rb(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ie(n))return{data:null,error:n};throw n}})}}class DS extends LS{constructor(e,n={},r,s){super(e,n,r,s)}from(e){return new PS(this.url,this.headers,e,this.fetch)}}const $S="2.57.4";let Zi="";typeof Deno<"u"?Zi="deno":typeof document<"u"?Zi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Zi="react-native":Zi="node";const zS={"X-Client-Info":`supabase-js-${Zi}/${$S}`},BS={headers:zS},FS={schema:"public"},US={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},VS={};var HS=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}
89return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};const qS=t=>{let e;return t?e=t:typeof fetch>"u"?e=bb:e=fetch,(...n)=>e(...n)},WS=()=>typeof Headers>"u"?wb:Headers,KS=(t,e,n)=>{const r=qS(n),s=WS();return(i,o)=>HS(void 0,void 0,void 0,function*(){var a;const c=(a=yield e())!==null&&a!==void 0?a:t;let u=new s(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",t),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),r(i,Object.assign(Object.assign({},o),{headers:u}))})};var JS=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};function GS(t){return t.endsWith("/")?t:t+"/"}function XS(t,e){var n,r;const{db:s,auth:i,realtime:o,global:a}=t,{db:c,auth:u,realtime:d,global:f}=e,h={db:Object.assign(Object.assign({},c),s),auth:Object.assign(Object.assign({},u),i),realtime:Object.assign(Object.assign({},d),o),storage:{},global:Object.assign(Object.assign(Object.assign({},f),a),{headers:Object.assign(Object.assign({},(n=f==null?void 0:f.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:()=>JS(this,void 0,void 0,function*(){return""})};return t.accessToken?h.accessToken=t.accessToken:delete h.accessToken,h}function YS(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(GS(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const Lb="2.71.1",Rs=30*1e3,qf=3,ld=qf*Rs,QS="http://localhost:9999",ZS="supabase.auth.token",e2={"X-Client-Info":`gotrue-js/${Lb}`},Wf="X-Supabase-Api-Version",Db={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},t2=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,n2=10*60*1e3;class Tp extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function G(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class r2 extends Tp{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function s2(t){return G(t)&&t.name==="AuthApiError"}class $b extends Tp{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Or extends Tp{constructor(e,n,r,s){super(e,r,s),this.name=n,this.status=r}}class Hn extends Or{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function i2(t){return G(t)&&t.name==="AuthSessionMissingError"}class Ha extends Or{constructor(){super("Auth session or user missing","AuthInvalidToken
89ResponseError",500,void 0)}}class qa extends Or{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Wa extends Or{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function o2(t){return G(t)&&t.name==="AuthImplicitGrantRedirectError"}class Jg extends Or{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Kf extends Or{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function cd(t){return G(t)&&t.name==="AuthRetryableFetchError"}class Gg extends Or{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class Jf extends Or{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const ec="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Xg=` 	
90\r=`.split(""),a2=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Xg.length;e+=1)t[Xg[e].charCodeAt(0)]=-2;for(let e=0;e<ec.length;e+=1)t[ec[e].charCodeAt(0)]=e;return t})();function Yg(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(ec[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(ec[r]),e.queuedBits-=6}}function zb(t,e,n){const r=a2[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Qg(t){const e=[],n=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{u2(o,r,n)};for(let o=0;o<t.length;o+=1)zb(t.charCodeAt(o),s,i);return e.join("")}function l2(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function c2(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}l2(r,e)}}function u2(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function d2(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)zb(t.charCodeAt(s),n,r);return new Uint8Array(e)}function f2(t){const e=[];return c2(t,n=>e.push(n)),new Uint8Array(e)}function h2(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};return t.forEach(s=>Yg(s,n,r)),Yg(null,n,r),e.join("")}function p2(t){return Math.round(Date.now()/1e3)+t}function m2(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const Xt=()=>typeof window<"u"&&typeof document<"u",Lr={tested:!1,writable:!1},Bb=()=>{if(!Xt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Lr.tested)return Lr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Lr.tested=!0,Lr.writable=!0}catch{Lr.tested=!0,Lr.writable=!1}return Lr.writable};function g2(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{e[s]=r}),e}const Fb=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>ga(async()=>{const{default:r}=await Promise.resolve().then(()=>Ti);return{default:r}},void 0).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)},x2=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Ls=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Dr=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Un=async(t,e)=>{await t.removeItem(e)};class pu{constructor(){this.promise=new pu.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}pu.promiseConstructor=Promise;function ud(t){const e=t.split(".");if(e.length!==3)throw new Jf("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!t2.test(e[r]))throw new Jf("JWT not in base64url format");return{header:JSON.parse(Qg(e[0])),payload:JSON.parse(Qg(e[1])),signature:d2(e[2]),raw:{header:e[0],payload:e[1]}}}async function y2(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function v2(t,e){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){r(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function b2(t){return("0"+t.toString(16)).substr(-2)}function w2(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(e),Array.from(e,b2).join("")}async function k2(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",
90n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function N2(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await k2(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ts(t,e,n=!1){const r=w2();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await Ls(t,`${e}-code-verifier`,s);const i=await N2(r);return[i,r===i?"plain":"s256"]}const j2=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function _2(t){const e=t.headers.get(Wf);if(!e||!e.match(j2))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function S2(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function C2(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const E2=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function As(t){if(!E2.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function dd(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Zg(t){return JSON.parse(JSON.stringify(t))}var T2=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};const Fr=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),A2=[502,503,504];async function ex(t){var e;if(!x2(t))throw new Kf(Fr(t),0);if(A2.includes(t.status))throw new Kf(Fr(t),t.status);let n;try{n=await t.json()}catch(i){throw new $b(Fr(i),i)}let r;const s=_2(t);if(s&&s.getTime()>=Db["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new Gg(Fr(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Hn}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new Gg(Fr(n),t.status,n.weak_password.reasons);throw new r2(Fr(n),t.status||500,r)}const M2=(t,e,n,r)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function Q(t,e,n,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[Wf]||(i[Wf]=Db["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await O2(t,e,n+a,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(c):{data:Object.assign({},c),error:null}}async function O2(t,e,n,r,s,i){const o=M2(e,r,s,i);let a;try{a=await t(n,Object.assign({},o))}catch(c){throw console.error(c),new Kf(Fr(c),0)}if(a.ok||await ex(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(c){await ex(c)}}function Nn(t){var e;let n=null;L2(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=p2(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function tx(t){const e=Nn(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Zn(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function P2(t){return{data:t,error:null}}function I2(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=t,o=T2(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},c=Object.assign({},o);return{data:{properties:a,user:c},error:null}}function R2(t){return t}function L2(t){return t.access_token&&t.refresh_token&&t.expires_in}const fd=["global","local","others"];var D2=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};class $2{constructor({url:e="",headers:n={},fetch:r}){this.url=e,this.headers=n,this.fetch=Fb(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,n=fd[0]){if(fd.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${fd.join(", ")}`);try{return await Q(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(G(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await Q(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Zn})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=D2(e,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await Q(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:I2,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(G(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await Q(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Zn})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,s,i,o,a,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Q(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:R2});if(d.error)throw d.error;const f=await d.json(),h=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(a=d.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&c!==void 0?c:[];return p.length>
900&&(p.forEach(m=>{const g=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),y=JSON.parse(m.split(";")[1].split("=")[1]);u[`${y}Page`]=g}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(G(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){As(e);try{return await Q(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Zn})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){As(e);try{return await Q(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Zn})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){As(e);try{return await Q(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Zn})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){As(e.userId);try{const{data:n,error:r}=await Q(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(G(n))return{data:null,error:n};throw n}}async _deleteFactor(e){As(e.userId),As(e.id);try{return{data:await Q(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(G(n))return{data:null,error:n};throw n}}}function nx(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}function z2(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const Ms={debug:!!(globalThis&&Bb()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Ub extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class B2 extends Ub{}async function F2(t,e,n){Ms.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),Ms.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){Ms.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,s.name);try{return await n()}finally{Ms.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,s.name)}}else{if(e===0)throw Ms.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new B2(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Ms.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null,"  "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}z2();const U2={url:QS,storageKey:ZS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:e2,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function rx(t,e,n){return await n()}const Os={};class Jo{constructor(e){var n,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Jo.nextInstanceID,Jo.nextInstanceID+=1,this.instanceID>0&&Xt()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const s=Object.assign(Object.assign({},U2),e);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new $2({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Fb(s.fetch),this.lock=s.lock||rx,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Xt()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=F2:this.lock=rx,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:Bb()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=nx(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=nx(this.memoryStorage)),Xt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var e,n;return(n=(e=Os[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){Os[this.storageKey]=Object.assign(Object.assign({},Os[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=Os[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Os[this.storageKey]=Object.assign(Object.assign({},Os[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${Lb}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const n=g2(window.location.href);let r="none";if(this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce"),Xt()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),o2(i)){const c=(e=i.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return G(n)?{error:n}:{error:new $b("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,s;try{const i=await Q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:Nn}),{data:o,error:a}=i;if(a||!o)return{data:{user:null,session:null},error:a};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(i){if(G(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var n,r,s;try{let i;if("email"in e){const{email:d,password:f,options:h}=e;let p=null,m=null;this.flowType==="pkce"&&([p,m]=await Ts(this.storage,this.storageKey)),i=await Q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:d,password:f,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:m},xform:Nn})}else if("phone"in e){const{phone:d,password:f,options:h}=e;i=await Q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:f,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},channel:(s=h==null?void 0:h.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:Nn})}else throw new qa("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return{data:{user:null,session:null},error:a};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(i){if(G(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let n;if("email"in e){const{email:i,password:o,options:a}=e;n=await Q(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:tx})}else if("phone"in e){const{phone:i,password:o,options:a}=e;n=await Q(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:tx})}else throw new qa("You must provide either an email or phone number and a password");const{data:r,error:s}=n;return s?{data:{user:null,session:null},error:s}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new Ha}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,r,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;if(n==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}async signInWithSolana(e){var n,r,s,i,o,a,c,u,d,f,h,p;let m,g;if("message"in e)m=e.message,g=e.signature;else{const{chain:y,wallet:x,statement:v,options:b}=e;let _;if(Xt())if(typeof x=="object")_=x;else{const w=window;if("solana"in w&&typeof w.solana=="object"&&("signIn"in w.solana&&typeof w.solana.signIn=="function"||"signMessage"in w.solana&&typeof w.solana.signMessage=="function"))_=w.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof x!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=x}const C=new URL((n=b==null?void 0:b.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in _&&_.signIn){const w=await _.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:C.host,uri:C.href}),v?{statement:v}:null));let k;if(Array.isArray(w)&&w[0]&&typeof w[0]=="object")k=w[0];else if(w&&typeof w=="object"&&"signedMessage"in w&&"signature"in w)k=w;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in k&&"signature"in k&&(typeof k.signedMessage=="string"||k.signedMessage instanceof Uint8Array)&&k.signature instanceof Uint8Array)m=typeof k.signedMessage=="string"?k.signedMessage:new TextDecoder().decode(k.signedMessage),g=k.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in _)||typeof _.signMessage!="function"||!("publicKey"in _)||typeof _!="object"||!_.publicKey||!("toBase58"in _.publicKey)||typeof _.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${C.host} wants you to sign in with your Solana account:`,_.publicKey.toBase58(),...v?["",v,""]:[""],"Version: 1",`URI: ${C.href}`,`Issued At: ${(s=(r=b==null?void 0:b.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((u=b==null?void 0:b.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((f=(d=b==null?void 0:b.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||f===void 0)&&f.length?["Resources",...b.signInWithSolana.resources.map(k=>`- ${k}`)]:[]].join(`
91`);const w=await _.signMessage(new TextEncoder().encode(m),"utf8");if(!w||!(w instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=w}}try{const{data:y,error:x}=await Q(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:h2(g)}
91,!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Nn});if(x)throw x;return!y||!y.session||!y.user?{data:{user:null,session:null},error:new Ha}:(y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),{data:Object.assign({},y),error:x})}catch(y){if(G(y))return{data:{user:null,session:null},error:y};throw y}}async _exchangeCodeForSession(e){const n=await Dr(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{const{data:i,error:o}=await Q(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Nn});if(await Un(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new Ha}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(G(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=e,a=await Q(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Nn}),{data:c,error:u}=a;return u?{data:{user:null,session:null},error:u}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new Ha}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:u})}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,r,s,i,o;try{if("email"in e){const{email:a,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Ts(this.storage,this.storageKey));const{error:f}=await Q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(r=c==null?void 0:c.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:f}}if("phone"in e){const{phone:a,options:c}=e,{data:u,error:d}=await Q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d}}throw new qa("You must provide either an email or phone number.")}catch(a){if(G(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(e){var n,r;try{let s,i;"options"in e&&(s=(n=e.options)===null||n===void 0?void 0:n.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await Q(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Nn});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(s){if(G(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var n,r,s;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await Ts(this.storage,this.storageKey)),await Q(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:P2})}catch(i){if(G(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new Hn;const{error:s}=await Q(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(G(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:s,options:i}=e,{error:o}=await Q(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:r,type:s,options:i}=e,{data:o,error:a}=await Q(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a}}throw new qa("You must provide either an email or phone number and a type")}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Dr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not val
91id"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<ld:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await Dr(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=dd()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,u,d)=>(!o&&u==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,u,d))})}return{data:{session:e},error:null}}const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await Q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Zn}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Hn}:await Q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Zn})})}catch(n){if(G(n))return i2(n)&&(await this._removeSession(),await Un(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new Hn;const o=s.session;let a=null,c=null;this.flowType==="pkce"&&e.email!=null&&([a,c]=await Ts(this.storage,this.storageKey));const{data:u,error:d}=await Q(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:c}),jwt:o.access_token,xform:Zn});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Hn;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=ud(e.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{session:a,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:c}=await this._getUser(e.access_token);if(c)throw c;i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(n){if(G(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:o,error:a}=n;if(a)throw a;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Hn;const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!Xt())throw new Wa("No browser detected.");
91if(e.error||e.error_description||e.error_code)throw new Wa(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Jg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Wa("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Jg("No code detected.");const{data:v,error:b}=await this._exchangeCodeForSession(e.code);if(b)throw b;const _=new URL(window.location.href);return _.searchParams.delete("code"),window.history.replaceState(window.history.state,"",_.toString()),{data:{session:v.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:a,expires_at:c,token_type:u}=e;if(!i||!a||!o||!u)throw new Wa("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(a);let h=d+f;c&&(h=parseInt(c));const p=h-d;p*1e3<=Rs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${f}s`);const m=h-f;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,h,d):d-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,h,d);const{data:g,error:y}=await this._getUser(i);if(y)throw y;const x={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:f,expires_at:h,refresh_token:o,token_type:u,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:x,redirectType:e.type},error:null}}catch(r){if(G(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await Dr(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{error:i};const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(s2(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return e!=="others"&&(await this._removeSession(),await Un(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=m2(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await Ts(this.storage,this.storageKey,!0));try{return await Q(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(G(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(G(n))return{data:null,error:n};throw n}}async linkIdentity(e){var n;try{const{data:r,error:s}=await this._useSession(async i=>{var o,a,c,u,d;const{data:f,error:h}=i;if(h)throw h;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Q(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=f.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Xt()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),{data:{provider:e.provider,url:r==null?void 0:r.url},error:null}}catch(r){if(G(r))return{data:{provider:e.provider,url:null},error:r};throw r}}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;
91if(o)throw o;return await Q(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await v2(async s=>(s>0&&await y2(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await Q(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Nn})),(s,i)=>{const o=200*Math.pow(2,s);return i&&cd(i)&&Date.now()+o-r<Rs})}catch(r){if(this._debug(n,"error",r),G(r))return{data:{session:null,user:null},error:r};throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),Xt()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await Dr(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Dr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Ls(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:dd()}else if(s&&!s.user&&!s.user){const o=await Dr(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Un(this.storage,this.storageKey+"-user"),await Ls(this.storage,this.storageKey,s)):s.user=dd()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<ld;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${ld}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),cd(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new Hn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new pu;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Hn;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={session:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(s,"error",i),G(i)){const o={session:null,error:i};return cd(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,n,r=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,n)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Ls(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=Zg(s);await Ls(this.storage,this.storageKey,i)}else{const s=Zg(n);await Ls(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),await Un(this.storage,this.storageKey),await Un(this.storage,this.storageKey+"-code-verifier"),await Un(this.storage,this.storageKey+"-user"),this.userStorage&&await Un(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Xt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
91catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Rs);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-e)/Rs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Rs}ms, refresh threshold is ${qf} ticks`),s<=qf&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Ub)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Xt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await Ts(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?{data:null,error:i}:await Q(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:c,error:u}=await Q(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return u?{data:null,error:u}:(e.factorType==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{data:null,error:i};const{data:o,error:a}=await Q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return a?{data:null,error:a}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:a})})}catch(n){if(G(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?{data:null,error:i}:await Q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(G(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){const{data:{user:e},error:n}=await this.getUser();if(n)return{data:null,error:n};const r=(e==null?void 0:e.factors)||[],s=r.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=r.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:r,totp:s,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var n,r;const{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=ud(s.access_token);let a=null;o.aal&&(a=o.aal);let c=a;((r=(n=s.user.factors)===null||n===void 0?void 0:n.filter(f=>f.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(c="aal2");const d=o.amr||[];return{data:{currentLevel:a,nextLevel:c,currentAuthenticationMethods:d},error:null}}))}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(a=>a.kid===e);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===e),r&&this.jwks_cached_at+n2>s)return r;const{data:i,error:o}=await Q(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(a=>a.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:p,error:m}
91=await this.getSession();if(m||!p.session)return{data:null,error:m};r=p.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:c}}=ud(r);n!=null&&n.allowExpired||S2(i.exp);const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!u){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:i,header:s,signature:o},error:null}}const d=C2(s.alg),f=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,f,o,f2(`${a}.${c}`)))throw new Jf("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(G(r))return{data:null,error:r};throw r}}}Jo.nextInstanceID=0;const V2=Jo;class H2 extends V2{constructor(e){super(e)}}var q2=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};class W2{constructor(e,n,r){var s,i,o;this.supabaseUrl=e,this.supabaseKey=n;const a=YS(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const c=`sb-${a.hostname.split(".")[0]}-auth-token`,u={db:FS,realtime:VS,auth:Object.assign(Object.assign({},US),{storageKey:c}),global:BS},d=XS(r??{},u);this.storageKey=(s=d.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=d.global.headers)!==null&&i!==void 0?i:{},d.accessToken?(this.accessToken=d.accessToken,this.auth=new Proxy({},{get:(f,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=d.auth)!==null&&o!==void 0?o:{},this.headers,d.global.fetch),this.fetch=KS(n,this._getAccessToken.bind(this),d.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},d.realtime)),this.rest=new aS(new URL("rest/v1",a).href,{headers:this.headers,schema:d.db.schema,fetch:this.fetch}),this.storage=new DS(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),d.accessToken||this._listenForAuthEvents()}get functions(){return new z_(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},r={}){return this.rest.rpc(e,n,r)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,n;return q2(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:r}=yield this.auth.getSession();return(n=(e=r.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:i,storageKey:o,flowType:a,lock:c,debug:u},d,f){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new H2({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:o,autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:i,flowType:a,lock:c,debug:u,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new jS(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,r)=>{this._handleTokenChanged(n,"CLIENT",r==null?void 0:r.access_token)})}_handleTokenChanged(e,n,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?this.changedAccessToken=r:e==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const K2=(t,e,n)=>new W2(t,e,n);
91function J2(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}J2()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const G2="https://lodiuknjmwjyxmdovzcs.supabase.co",X2="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM",T=K2(G2,X2),Vb=N.createContext(void 0);function Y2({children:t}){const[e,n]=N.useState(null),[r,s]=N.useState(null),[i,o]=N.useState(null),[a,c]=N.useState(!0);N.useEffect(()=>{T.auth.getSession().then(({data:{session:m}})=>{n(m),s((m==null?void 0:m.user)??null),m!=null&&m.user?u(m.user.id):c(!1)});const{data:{subscription:p}}=T.auth.onAuthStateChange((m,g)=>{n(g),s((g==null?void 0:g.user)??null),g!=null&&g.user?u(g.user.id):(o(null),c(!1))});return()=>p.unsubscribe()},[]);async function u(p){const{data:m}=await T.from("profiles").select("*").eq("id",p).maybeSingle();o(m),c(!1)}async function d(p,m){const{error:g}=await T.auth.signInWithPassword({email:p,password:m});return{error:g}}async function f(){await T.auth.signOut(),o(null)}async function h(p){const{error:m}=await T.auth.updateUser({password:p});return!m&&i&&(await T.from("profiles").update({must_change_password:!1}).eq("id",i.id),o({...i,must_change_password:!1})),{error:m}}return l.jsx(Vb.Provider,{value:{session:e,user:r,profile:i,loading:a,signIn:d,signOut:f,updatePassword:h},children:t})}function Nt(){const t=N.useContext(Vb);if(!t)throw new Error("useAuth must be used within AuthProvider");return t}const Hb=N.createContext(void 0),sx="cfa_cart";function Q2({children:t}){const[e,n]=N.useState(()=>{try{const u=localStorage.getItem(sx);return u?JSON.parse(u):[]}catch{return[]}});N.useEffect(()=>{localStorage.setItem(sx,JSON.stringify(e))},[e]);function r(u){n(d=>d.find(h=>h.product_id===u.product_id)?d.map(h=>h.product_id===u.product_id?{...h,quantity:h.quantity+u.quantity}:h):[...d,{...u,id:crypto.randomUUID()}])}function s(u){n(d=>d.filter(f=>f.product_id!==u))}function i(u,d){if(d<=0){s(u);return}n(f=>f.map(h=>h.product_id===u?{...h,quantity:d}:h))}function o(){n([])}const a=e.reduce((u,d)=>u+d.quantity,0),c=e.reduce((u,d)=>u+d.price_cents*d.quantity,0);return l.jsx(Hb.Provider,{value:{items:e,addItem:r,removeItem:s,updateQuantity:i,clearCart:o,totalItems:a,totalCents:c},children:t})}function qb(){const t=N.useContext(Hb);if(!t)throw new Error("useCart must be used within CartProvider");return t}/**
92 * @license lucide-react v0.344.0 - ISC
93 *
94 * This source code is licensed under the ISC license.
95 * See the LICENSE file in the root directory of this source tree.
96 */var Z2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
97 * @license lucide-react v0.344.0 - ISC
98 *
99 * This source code is licensed under the ISC license.
100 * See the LICENSE file in the root directory of this source tree.
101 */const eC=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),L=(t,e)=>{const n=N.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:c,...u},d)=>N.createElement("svg",{ref:d,...Z2,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${eC(t)}`,a].join(" "),...u},[...e.map(([f,h])=>N.createElement(f,h)),...Array.isArray(c)?c:[c]]));return n.displayName=`${t}`,n};/**
102 * @license lucide-react v0.344.0 - ISC
103 *
104 * This source code is licensed under the ISC license.
105 * See the LICENSE file in the root directory of this source tree.
106 */const Wb=L("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/**
107 * @license lucide-react v0.344.0 - ISC
108 *
109 * This source code is licensed under the ISC license.
110 * See the LICENSE file in the root directory of this source tree.
111 */const tC=L("AlignCenter",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"17",x2:"7",y1:"12",y2:"12",key:"rsh8ii"}],["line",{x1:"19",x2:"5",y1:"18",y2:"18",key:"1t0tuv"}]]);/**
112 * @license lucide-react v0.344.0 - ISC
113 *
114 * This source code is licensed under the ISC license.
115 * See the LICENSE file in the root directory of this source tree.
116 */const nC=L("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/**
117 * @license lucide-react v0.344.0 - ISC
118 *
119 * This source code is licensed under the ISC license.
120 * See the LICENSE file in the root directory of this source tree.
121 */const rC=L("AlignRight",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}],["line",{x1:"21",x2:"7",y1:"18",y2:"18",key:"1g9eri"}]]);/**
122 * @license lucide-react v0.344.0 - ISC
123 *
124 * This source code is licensed under the ISC license.
125 * See the LICENSE file in the root directory of this source tree.
126 */const Kb=L("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
127 * @license lucide-react v0.344.0 - ISC
128 *
129 * This source code is licensed under the ISC license.
130 * See the LICENSE file in the root directory of this source tree.
131 */const kr=L("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
132 * @license lucide-react v0.344.0 - ISC
133 *
134 * This source code is licensed under the ISC license.
135 * See the LICENSE file in the root directory of this source tree.
136 */const sC=L("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
137 * @license lucide-react v0.344.0 - ISC
138 *
139 * This source code is licensed under the ISC license.
140 * See the LICENSE file in the root directory of this source tree.
141 */const iC=L("Bold",[["path",{d:"M14 12a4 4 0 0 0 0-8H6v8",key:"v2sylx"}],["path",{d:"M15 20a4 4 0 0 0 0-8H6v8Z",key:"1ef5ya"}]]);/**
142 * @license lucide-react v0.344.0 - ISC
143 *
144 * This source code is licensed under the ISC license.
145 * See the LICENSE file in the root directory of this source tree.
146 */const oC=L("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
147 * @license lucide-react v0.344.0 - ISC
148 *
149 * This source code is licensed under the ISC license.
150 * See the LICENSE file in the root directory of this source tree.
151 */const aC=L("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
152 * @license lucide-react v0.344.0 - ISC
153 *
154 * This source code is licensed under the ISC license.
155 * See the LICENSE file in the root directory of this source tree.
156 */const lC=L("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
157 * @license lucide-react v0.344.0 - ISC
158 *
159 * This source code is licensed under the ISC license.
160 * See the LICENSE file in the root directory of this source tree.
161 */const mr=L("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
162 * @license lucide-react v0.344.0 - ISC
163 *
164 * This source code is licensed under the ISC license.
165 * See the LICENSE file in the root directory of this source tree.
166 */const ts=L("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
167 * @license lucide-react v0.344.0 - ISC
168 *
169 * This source code is licensed under the ISC license.
170 * See the LICENSE file in the root directory of this source tree.
171 */const ns=L("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
172 * @license lucide-react v0.344.0 - ISC
173 *
174 * This source code is licensed under the ISC license.
175 * See the LICENSE file in the root directory of this source tree.
176 */const cC=L("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
177 * @license lucide-react v0.344.0 - ISC
178 *
179 * This source code is licensed under the ISC license.
180 * See the LICENSE file in the root directory of this source tree.
181 */const uC=L("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
182 * @license lucide-react v0.344.0 - ISC
183 *
184 * This source code is licensed under the ISC license.
185 * See the LICENSE file in the root directory of this source tree.
186 */const va=L("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
187 * @license lucide-react v0.344.0 - ISC
188 *
189 * This source code is licensed under the ISC license.
190 * See the LICENSE file in the root directory of this source tree.
191 */const mu=L("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
192 * @license lucide-react v0.344.0 - ISC
193 *
194 * This source code is licensed under the ISC license.
195 * See the LICENSE file in the root directory of this source tree.
196 */const tc=L("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
197 * @license lucide-react v0.344.0 - ISC
198 *
199 * This source code is licensed under the ISC license.
200 * See the LICENSE file in the root directory of this source tree.
201 */const Jb=L("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
202 * @license lucide-react v0.344.0 - ISC
203 *
204 * This source code is licensed under the ISC license.
205 * See the LICENSE file in the root directory of this source tree.
206 */const Ap=L("Crown",[["path",{d:"m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14",ke
206y:"zkxr6b"}]]);/**
207 * @license lucide-react v0.344.0 - ISC
208 *
209 * This source code is licensed under the ISC license.
210 * See the LICENSE file in the root directory of this source tree.
211 */const Gb=L("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
212 * @license lucide-react v0.344.0 - ISC
213 *
214 * This source code is licensed under the ISC license.
215 * See the LICENSE file in the root directory of this source tree.
216 */const ix=L("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
217 * @license lucide-react v0.344.0 - ISC
218 *
219 * This source code is licensed under the ISC license.
220 * See the LICENSE file in the root directory of this source tree.
221 */const Xb=L("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
222 * @license lucide-react v0.344.0 - ISC
223 *
224 * This source code is licensed under the ISC license.
225 * See the LICENSE file in the root directory of this source tree.
226 */const dC=L("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
227 * @license lucide-react v0.344.0 - ISC
228 *
229 * This source code is licensed under the ISC license.
230 * See the LICENSE file in the root directory of this source tree.
231 */const Yb=L("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
232 * @license lucide-react v0.344.0 - ISC
233 *
234 * This source code is licensed under the ISC license.
235 * See the LICENSE file in the root directory of this source tree.
236 */const fC=L("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
237 * @license lucide-react v0.344.0 - ISC
238 *
239 * This source code is licensed under the ISC license.
240 * See the LICENSE file in the root directory of this source tree.
241 */const hC=L("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
242 * @license lucide-react v0.344.0 - ISC
243 *
244 * This source code is licensed under the ISC license.
245 * See the LICENSE file in the root directory of this source tree.
246 */const pC=L("Fish",[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]]);/**
247 * @license lucide-react v0.344.0 - ISC
248 *
249 * This source code is licensed under the ISC license.
250 * See the LICENSE file in the root directory of this source tree.
251 */const mC=L("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
252 * @license lucide-react v0.344.0 - ISC
253 *
254 * This source code is licensed under the ISC license.
255 * See the LICENSE file in the root directory of this source tree.
256 */const nn=L("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
257 * @license lucide-react v0.344.0 - ISC
258 *
259 * This source code is licensed under the ISC license.
260 * See the LICENSE file in the root directory of this source tree.
261 */const gC=L("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
262 * @license lucide-react v0.344.0 - ISC
263 *
264 * This source code is licensed under the ISC license.
265 * See the LICENSE file in the root directory of this source tree.
266 */const xC=L("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}
266]]);/**
267 * @license lucide-react v0.344.0 - ISC
268 *
269 * This source code is licensed under the ISC license.
270 * See the LICENSE file in the root directory of this source tree.
271 */const yC=L("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
272 * @license lucide-react v0.344.0 - ISC
273 *
274 * This source code is licensed under the ISC license.
275 * See the LICENSE file in the root directory of this source tree.
276 */const vC=L("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
277 * @license lucide-react v0.344.0 - ISC
278 *
279 * This source code is licensed under the ISC license.
280 * See the LICENSE file in the root directory of this source tree.
281 */const Mi=L("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
282 * @license lucide-react v0.344.0 - ISC
283 *
284 * This source code is licensed under the ISC license.
285 * See the LICENSE file in the root directory of this source tree.
286 */const Qb=L("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
287 * @license lucide-react v0.344.0 - ISC
288 *
289 * This source code is licensed under the ISC license.
290 * See the LICENSE file in the root directory of this source tree.
291 */const bC=L("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
292 * @license lucide-react v0.344.0 - ISC
293 *
294 * This source code is licensed under the ISC license.
295 * See the LICENSE file in the root directory of this source tree.
296 */const Zb=L("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
297 * @license lucide-react v0.344.0 - ISC
298 *
299 * This source code is licensed under the ISC license.
300 * See the LICENSE file in the root directory of this source tree.
301 */const nc=L("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
302 * @license lucide-react v0.344.0 - ISC
303 *
304 * This source code is licensed under the ISC license.
305 * See the LICENSE file in the root directory of this source tree.
306 */const wC=L("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
307 * @license lucide-react v0.344.0 - ISC
308 *
309 * This source code is licensed under the ISC license.
310 * See the LICENSE file in the root directory of this source tree.
311 */const kC=L("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
312 * @license lucide-react v0.344.0 - ISC
313 *
314 * This source code is licensed under the ISC license.
315 * See the LICENSE file in the root directory of this source tree.
316 */const NC=L("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
317 * @license lucide-react v0.344.0 - ISC
318 *
319 * This source code is licensed under the ISC license.
320 * See the LICENSE file in the root directory of this source tree.
321 */const jC=L("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
322 * @license lucide-react v0.344.0 - ISC
323 *
324 * This source code is licensed under the ISC license.
325 * See the LICENSE file in the root directory of this source tree.
326 */const _C=L("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
327 * @license lucide-react v0.344.0 - ISC
328 *
329 * This source code is licensed under the ISC license.
330 * See the LICENSE file in the root directory of this source tree.
331 */const Wt=L("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
332 * @license lucide-react v0.344.0 - ISC
333 *
334 * This source code is licensed under the ISC license.
335 * See the LICENSE file in the root directory of this source tree.
336 */const e1=L("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
337 * @license lucide-react v0.344.0 - ISC
338 *
339 * This source code is licensed under the ISC license.
340 * See the LICENSE file in the root directory of this source tree.
341 */const Mp=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
342 * @license lucide-react v0.344.0 - ISC
343 *
344 * This source code is licensed under the ISC license.
345 * See the LICENSE file in the root directory of this source tree.
346 */const SC=L("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
347 * @license lucide-react v0.344.0 - ISC
348 *
349 * This source code is licensed under the ISC license.
350 * See the LICENSE file in the root directory of this source tree.
351 */const CC=L("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
352 * @license lucide-react v0.344.0 - ISC
353 *
354 * This source code is licensed under the ISC license.
355 * See the LICENSE file in the root directory of this source tree.
356 */const EC=L("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
357 * @license lucide-react v0.344.0 - ISC
358 *
359 * This source code is licensed under the ISC license.
360 * See the LICENSE file in the root directory of this source tree.
361 */const TC=L("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
362 * @license lucide-react v0.344.0 - ISC
363 *
364 * This source code is licensed under the ISC license.
365 * See the LICENSE file in the root directory of this source tree.
366 */const Op=L("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
367 * @license lucide-react v0.344.0 - ISC
368 *
369 * This source code is licensed under the ISC license.
370 * See the LICENSE file in the root directory of this source tree.
371 */const Pp=L("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
372 * @license lucide-react v0.344.0 - ISC
373 *
374 * This source code is licensed under the ISC license.
375 * See the LICENSE file in the root directory of this source tree.
376 */const AC=L("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/**
377 * @license lucide-react v0.344.0 - ISC
378 *
379 * This source code is licensed under the ISC license.
380 * See the LICENSE file in the root directory of this source tree.
381 */const MC=L("PenTool",[["path",{d:"m12 19 7-7 3 3-7 7-3-3z",key:"rklqx2"}],["path",{d:"m18 13-1.5-7.5L2 2l3.5 14.5L13 18l5-5z",key:"1et58u"}],["path",{d:"m2 2 7.586 7.586",key:"etlp93"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/**
382 * @license lucide-react v0.344.0 - ISC
383 *
384 * This source code is licensed under the ISC license.
385 * See the LICENSE file in the root directory of this source tree.
386 */const Nr=L("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
387 * @license lucide-react v0.344.0 - ISC
388 *
389 * This source code is licensed under the ISC license.
390 * See the LICENSE file in the root directory of this source tree.
391 */const OC=L("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
392 * @license lucide-react v0.344.0 - ISC
393 *
394 * This source code is licensed under the ISC license.
395 * See the LICENSE file in the root directory of this source tree.
396 */const et=L("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
397 * @license lucide-react v0.344.0 - ISC
398 *
399 * This source code is licensed under the ISC license.
400 * See the LICENSE file in the root directory of this source tree.
401 */const t1=L("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
402 * @license lucide-react v0.344.0 - ISC
403 *
404 * This source code is licensed under the ISC license.
405 * See the LICENSE file in the root directory of this source tree.
406 */const PC=L("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
407 * @license lucide-react v0.344.0 - ISC
408 *
409 * This source code is licensed under the ISC license.
410 * See the LICENSE file in the root directory of this source tree.
411 */const IC=L("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
412 * @license lucide-react v0.344.0 - ISC
413 *
414 * This source code is licensed under the ISC license.
415 * See the LICENSE file in the root directory of this source tree.
416 */const jr=L("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/**
417 * @license lucide-react v0.344.0 - ISC
418 *
419 * This source code is licensed under the ISC license.
420 * See the LICENSE file in the root directory of this source tree.
421 */const RC=L("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
422 * @license lucide-react v0.344.0 - ISC
423 *
424 * This source code is licensed under the ISC license.
425 * See the LICENSE file in the root directory of this source tree.
426 */const n1=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
427 * @license lucide-react v0.344.0 - ISC
428 *
429 * This source code is licensed under the ISC license.
430 * See the LICENSE file in the root directory of this source tree.
431 */const r1=L("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
432 * @license lucide-react v0.344.0 - ISC
433 *
434 * This source code is licensed under the ISC license.
435 * See the LICENSE file in the root directory of this source tree.
436 */const ox=L("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
436y:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
437 * @license lucide-react v0.344.0 - ISC
438 *
439 * This source code is licensed under the ISC license.
440 * See the LICENSE file in the root directory of this source tree.
441 */const ba=L("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
442 * @license lucide-react v0.344.0 - ISC
443 *
444 * This source code is licensed under the ISC license.
445 * See the LICENSE file in the root directory of this source tree.
446 */const ot=L("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
447 * @license lucide-react v0.344.0 - ISC
448 *
449 * This source code is licensed under the ISC license.
450 * See the LICENSE file in the root directory of this source tree.
451 */const LC=L("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/**
452 * @license lucide-react v0.344.0 - ISC
453 *
454 * This source code is licensed under the ISC license.
455 * See the LICENSE file in the root directory of this source tree.
456 */const DC=L("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/**
457 * @license lucide-react v0.344.0 - ISC
458 *
459 * This source code is licensed under the ISC license.
460 * See the LICENSE file in the root directory of this source tree.
461 */const Ip=L("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
462 * @license lucide-react v0.344.0 - ISC
463 *
464 * This source code is licensed under the ISC license.
465 * See the LICENSE file in the root directory of this source tree.
466 */const $C=L("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
467 * @license lucide-react v0.344.0 - ISC
468 *
469 * This source code is licensed under the ISC license.
470 * See the LICENSE file in the root directory of this source tree.
471 */const zC=L("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
472 * @license lucide-react v0.344.0 - ISC
473 *
474 * This source code is licensed under the ISC license.
475 * See the LICENSE file in the root directory of this source tree.
476 */const BC=L("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
477 * @license lucide-react v0.344.0 - ISC
478 *
479 * This source code is licensed under the ISC license.
480 * See the LICENSE file in the root directory of this source tree.
481 */const at=L("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
482 * @license lucide-react v0.344.0 - ISC
483 *
484 * This source code is licensed under the ISC license.
485 * See the LICENSE file in the root directory of this source tree.
486 */const s1=L("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
487 * @license lucide-react v0.344.0 - ISC
488 *
489 * This source code is licensed under the ISC license.
490 * See the LICENSE file in the root directory of this source tree.
491 */const ax=L("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}
491],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
492 * @license lucide-react v0.344.0 - ISC
493 *
494 * This source code is licensed under the ISC license.
495 * See the LICENSE file in the root directory of this source tree.
496 */const FC=L("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
497 * @license lucide-react v0.344.0 - ISC
498 *
499 * This source code is licensed under the ISC license.
500 * See the LICENSE file in the root directory of this source tree.
501 */const UC=L("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
502 * @license lucide-react v0.344.0 - ISC
503 *
504 * This source code is licensed under the ISC license.
505 * See the LICENSE file in the root directory of this source tree.
506 */const i1=L("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
507 * @license lucide-react v0.344.0 - ISC
508 *
509 * This source code is licensed under the ISC license.
510 * See the LICENSE file in the root directory of this source tree.
511 */const o1=L("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
512 * @license lucide-react v0.344.0 - ISC
513 *
514 * This source code is licensed under the ISC license.
515 * See the LICENSE file in the root directory of this source tree.
516 */const ps=L("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
517 * @license lucide-react v0.344.0 - ISC
518 *
519 * This source code is licensed under the ISC license.
520 * See the LICENSE file in the root directory of this source tree.
521 */const VC=L("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
522 * @license lucide-react v0.344.0 - ISC
523 *
524 * This source code is licensed under the ISC license.
525 * See the LICENSE file in the root directory of this source tree.
526 */const _r=L("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
527 * @license lucide-react v0.344.0 - ISC
528 *
529 * This source code is licensed under the ISC license.
530 * See the LICENSE file in the root directory of this source tree.
531 */const wa=L("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function HC({settings:t,navLinks:e}){var g,y;const{session:n,profile:r,signOut:s,loading:i}=Nt(),[o,a]=N.useState(!1),[c,u]=N.useState(!1),d=N.useRef(null),f=t.util_bar_issue||"001",h=t.util_bar_location||"Preston, UK",p=t.util_bar_badge||"Members & Open Access",m=(r==null?void 0:r.role)==="admin";return N.useEffect(()=>{const x=()=>a(window.scrollY>40);return window.addEventListener("scroll",x),()=>window.removeEventListener("scroll",x)},[]),N.useEffect(()=>{function x(v){d.current&&!d.current.contains(v.target)&&u(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative z-50 flex items-center justify-between gap-6 px-[clamp(20px,5vw,84px)] py-[11px] border-b border-[#0c0e10] font-mono text-[11px] tracking-[.18em] uppercase text-[#8e979e]",style:{background:"repeating-linear-gradient(90deg, rgba(255,255,255,.055) 0 1px, rgba(255,255,255,0) 1px 3px), linear-gradient(180deg, #34383c, #1b1e21 58%, #15181a)",boxShadow:"inset 0 1px 0 rgba(255,255,255,.06), inset 0 -1px 0 rgba(0,0,0,.6)"},children:[l.jsxs("div",{children:["carpfishing",l.jsx("span",{className:"text-[#c79a55]",children:".ai"})]}),l.jsxs("div",{className:"hidden md:flex gap-[22px]",children:[l.jsxs("div",{children:["Issue ",l.jsx("span",{className:"text-[#c4cacf]",children:f})]}),l.jsxs("div",{children:["Est. ",l.jsx("span",{className:"text-[#c4cacf]",children:h})]}),l.jsx("div",{className:"text-[#c79a55]",children:p})]})]}),l.jsxs("header",{className:`sticky top-0 z-40 flex items-center justify-between gap-6 px-[clamp(20px,5vw,84px)] border-b border-[#33393f] backdrop-blur-[10px] transition-all duration-300 ${o?"py-[10
531px] bg-[rgba(10,11,12,.92)]":"py-4 bg-[rgba(10,11,12,.72)]"}`,children:[l.jsxs("a",{href:"#top",className:"flex items-baseline gap-[11px] font-serif font-bold text-xl tracking-[.02em] text-[#eef1f3]",children:[l.jsxs("span",{children:[l.jsx("b",{children:"Carp Fishing"})," Advanced Innovations"]}),l.jsx("span",{className:"font-mono text-[11px] tracking-[.22em] text-[#0a0b0c] bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] px-[7px] py-[3px] rounded-[2px] -translate-y-[2px]",children:"AI"})]}),l.jsx("nav",{className:"hidden lg:flex gap-[26px]",children:e.map(x=>l.jsxs("a",{href:x.href,className:"font-mono text-[11px] tracking-[.2em] uppercase text-[#8e979e] py-[6px] relative hover:text-[#eef1f3] transition-colors group",...x.external?{target:"_blank",rel:"noopener"}:{},children:[x.label,l.jsx("span",{className:"absolute left-0 bottom-0 h-[1px] w-0 bg-[#c79a55] transition-all duration-300 group-hover:w-full"})]},x.id))}),l.jsxs("div",{className:"flex items-center gap-3",children:[!i&&n?l.jsxs("div",{ref:d,className:"relative",children:[l.jsxs("button",{onClick:()=>u(!c),className:"flex items-center gap-2 px-3 py-2 rounded-[3px] border border-[#33393f] bg-[#15181b] hover:border-[#c79a55]/40 transition-colors",children:[l.jsx("div",{className:"w-6 h-6 rounded-full bg-gradient-to-br from-[#e9cd97] to-[#9c6f33] flex items-center justify-center",children:l.jsx(o1,{className:"w-3.5 h-3.5 text-[#0a0b0c]"})}),l.jsx("span",{className:"hidden sm:inline font-mono text-[10px] tracking-[.12em] uppercase text-[#c4cacf] max-w-[100px] truncate",children:((g=r==null?void 0:r.email)==null?void 0:g.split("@")[0])||"Account"}),l.jsx(ts,{className:`w-3.5 h-3.5 text-[#8e979e] transition-transform ${c?"rotate-180":""}`})]}),c&&l.jsxs("div",{className:"absolute right-0 top-full mt-2 w-52 rounded-lg border border-[#33393f] bg-[#15181b] shadow-xl shadow-black/40 overflow-hidden animate-fadeIn",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-[#33393f]",children:[l.jsx("p",{className:"text-[#eef1f3] text-sm font-medium truncate",children:(y=r==null?void 0:r.email)==null?void 0:y.split("@")[0]}),l.jsx("p",{className:"text-[#8e979e] text-xs truncate",children:r==null?void 0:r.email})]}),l.jsxs("div",{className:"py-1.5",children:[l.jsxs("a",{href:"/account",className:"flex items-center gap-3 px-4 py-2.5 text-sm text-[#c4cacf] hover:text-[#eef1f3] hover:bg-[#1a1e22] transition-colors",children:[l.jsx(AC,{className:"w-4 h-4 text-[#8e979e]"}),"Members Area"]}),l.jsxs("a",{href:"/store",className:"flex items-center gap-3 px-4 py-2.5 text-sm text-[#c4cacf] hover:text-[#eef1f3] hover:bg-[#1a1e22] transition-colors",children:[l.jsx(ot,{className:"w-4 h-4 text-[#8e979e]"}),"Store"]}),m&&l.jsxs("a",{href:"/admin",className:"flex items-center gap-3 px-4 py-2.5 text-sm text-[#c79a55] hover:text-[#e9cd97] hover:bg-[#1a1e22] transition-colors",children:[l.jsx(ba,{className:"w-4 h-4"}),"Admin Dashboard"]})]}),l.jsx("div",{className:"border-t border-[#33393f] py-1.5",children:l.jsxs("button",{onClick:()=>{u(!1),s()},className:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-[#8e979e] hover:text-red-400 hover:bg-[#1a1e22] transition-colors",children:[l.jsx(Mp,{className:"w-4 h-4"}),"Sign Out"]})})]})]}):i?null:l.jsx("a",{href:"/admin/login",className:"relative overflow-hidden inline-flex items-center gap-[10px] font-mono text-[12px] tracking-[.16em] uppercase cursor-pointer border-0 py-[11px] px-[18px] rounded-[3px] text-[#0a0b0c] bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] shadow-[inset_0_1px_0_rgba(255,255,255,.35),0_12px_28px_-14px_rgba(199,154,85,.8)] hover:-translate-y-[2px] transition-transform",children:"Log In"}),!n&&!i&&l.jsx("a",{href:"#join",className:"hidden sm:inline-flex relative overflow-hidden items-center gap-[10px] font-mono text-[12px] tracking-[.16em] uppercase cursor-pointer border border-[#33393f] py-[11px] px-[18px] rounded-[3px] text-[#c4cacf] hover:border-[#c79a55]/40 hover:text-[#eef1f3] transition-colors",children:"Join"})]})]})]})}function qC({settings:t}){const e=t.hero_kicker||"Advanced Innovations / United Kingdom",n=t.hero_heading||"Carp fishing, <em>engineered.</em>",r=t.hero_lede||"",s=[{value:t.hero_stat_1_value||"8",label:t.hero_stat_1_label||"Pillars in the hub"},{value:t.hero_stat_2_value||"316",label:t.hero_stat_2_label||"Stainless, marine grade"},{value:t.hero_stat_3_value||"T700",label:t.hero_stat_3_label||"Carbon weave"}].filter(c=>c.value&&c.label),i={text:t.hero_cta_primary_text||"Join the community",href:t.hero_cta_primary_href||"#join"},o={text:t.hero_cta_secondary_text||"Browse the index",href:t.hero_cta_secondary_href||"#index"},a=t.hero_image||"";return l.jsxs("section",{className:"relative py-[clamp(48px,7vw,96px)] px-[clamp(20px,5vw,84px)] overflow-hidden carbon-bg",id:"top",children:[l.jsx("div",{className:"absolute inset-0 z-0",style:{background:"radial-gradient(120% 90% at 85% -10%, rgba(199,154,85,.16), transparent 55%), radial-gradient(90% 70% at 12% 110%, rgba(60,90,96,.18), transparent 60%), #0a0b0c"}}),l.jsx("div",{className:"absolute right-[-2%] top-[36%] z-0 font-serif font-extrabold italic text-[clamp(140px,30vw,460px)] leading-[.8] text-transparent pointer-events-none select-none",style:{WebkitTextStroke:"1px rgba(196,202,207,.06)"},children:"CFA"}),l.jsxs("div",{className:"relative z-[2] max-w-[1320px] mx-auto grid grid-cols-1 lg:grid-cols-[1.15fr_.85fr] gap-[clamp(28px,4vw,64px)] items-end",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] animate-fadeUp",children:e}),l.jsx("h1",{className:"font-serif font-medium text-[#eef1f3] text-[clamp(46px,8vw,104px)] leading-[.96] tracking-[-.01em] mt-[22px] animate-fadeUp [animation-delay:100ms]",dangerouslySetInnerHTML:{__html:n.replace("<em>",'<em class="italic text-[#d9bf8e]">')}}),l.jsx("p",{className:"max-w-[52ch] mt-[26px] text-[#8e979e] text-[clamp(15px,1.4vw,18px)] leading-[1.7] animate-fadeUp [animation-delay:200ms]",children:r}),l.jsxs("div",{className:"flex gap-[14px] mt-[34px] flex-wrap animate-fadeUp [animation-delay:300ms]",children:[l.jsxs("a",{href:i.href,className:"btn-primary-style",children:[i.text," ",l.jsx("span",{children:"→"})]}),l.jsxs("a",{href:o.href,className:"btn-ghost-style",children:[o.text," ",l.jsx("span",{children:"→"})]})]}),l.jsx("div",{className:"mt-[42px] flex gap-[34px] flex-wrap font-mono text-[11px] tracking-[.16em] uppercase text-[#8e979e] animate-fadeUp [animation-delay:400ms]",children:s.map((c,u)=>l.jsxs("div",{children:[l.jsx("b",{className:"block text-[#c4cacf] text-[22px] tracking-normal font-serif font-semibold",children:c.value}),c.label]},u))})]}),l.jsxs("div",{className:"relative aspect-[3/4] rounded-[4px] overflow-hidden border border-[#33393f] animate-fadeUp [animation-delay:250ms]",style:{boxShadow:"0 40px 80px -40px rgba(0,0,0,.9)"},children:[a?l.jsx("img",{src:a,alt:"",className:"absolute inset-0 w-full h-full object-cover"}):l.jsx("div",{className:"absolute inset-0",style:{background:"linear-gradient(180deg, rgba(199,154,85,.22), transparent 40%), linear-gradient(0deg, rgba(10,11,12,.95), rgba(34,39,44,.5) 55%, rgba(70,82,86,.4)), radial-gradient(120% 70% at 30% 20%, rgba(150,170,175,.35), transparent 60%), #15181b"}}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgba(8,9,10,.85)] via-trans
531parent to-transparent"}),l.jsx("div",{className:"absolute top-[14px] right-[14px] w-[18px] h-[18px] border border-[rgba(217,191,142,.6)] rounded-full",children:l.jsx("div",{className:"absolute inset-[7px] bg-[rgba(217,191,142,.7)] rounded-full"})}),l.jsxs("div",{className:"absolute left-0 bottom-0 w-full px-4 py-[18px] font-mono text-[11px] tracking-[.14em] uppercase text-[#c4cacf]",style:{background:"linear-gradient(0deg, rgba(8,9,10,.92), transparent)"},children:[l.jsx("span",{className:"text-[#c79a55]",children:"Cover plate"})," / First light, syndicate water"]})]})]})]})}function WC({sections:t}){const e=t.filter(n=>n.slug.startsWith("index_")).sort((n,r)=>n.sort_order-r.sort_order);return l.jsx("section",{id:"index",children:l.jsxs("div",{className:"max-w-[1320px] mx-auto px-[clamp(20px,5vw,84px)]",children:[l.jsxs("div",{className:"flex items-end justify-between gap-6 flex-wrap pt-[clamp(56px,7vw,96px)] pb-[30px]",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55]",children:"Contents"}),l.jsx("h2",{className:"font-serif font-medium text-[#eef1f3] text-[clamp(30px,4.4vw,54px)] leading-none tracking-[-.01em]",children:"What lives inside the hub"})]}),l.jsx("p",{className:"max-w-[42ch] text-[#8e979e] text-[15px]",children:"Eight working sections. Each one earns its place. Nothing here is filler."})]}),l.jsx("div",{className:"border-t border-[#33393f]",children:e.map(n=>{const r=n.content;return l.jsxs("a",{href:r.link_href||"#",className:"grid grid-cols-[88px_1fr_auto] md:grid-cols-[88px_1fr_auto] gap-6 items-center py-[22px] border-b border-[#33393f] relative transition-all hover:pl-[14px] group",children:[l.jsx("span",{className:"absolute left-[-100vw] top-0 bottom-0 right-[-100vw] z-[-1] bg-gradient-to-r from-transparent via-[rgba(199,154,85,.05)] to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),l.jsx("span",{className:"font-mono text-[13px] text-[#c79a55]",children:n.subtitle}),l.jsxs("div",{children:[l.jsx("span",{className:"font-serif font-semibold text-[clamp(20px,2.6vw,30px)] text-[#eef1f3] block",children:n.title}),l.jsx("span",{className:"text-[14px] text-[#8e979e] max-w-[46ch] block mt-1",children:r.description})]}),l.jsx("span",{className:"font-mono text-[11px] tracking-[.18em] uppercase text-[#8e979e] group-hover:text-[#c79a55] transition-colors",children:"View →"})]},n.id)})})]})})}function KC({materials:t}){const e={steel:{background:"repeating-linear-gradient(90deg, rgba(255,255,255,.055) 0 1px, rgba(255,255,255,0) 1px 3px), linear-gradient(180deg, #34383c, #1b1e21 58%, #15181a)"},titanium:{backgroundImage:"repeating-linear-gradient(60deg, rgba(255,255,255,.05) 0 1px, transparent 1px 4px), linear-gradient(135deg,#9aa4ab,#5d666c 50%,#3a4146)"},carbon:{backgroundColor:"#101214",backgroundImage:"repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 3px, transparent 3px 6px), repeating-linear-gradient(-45deg, rgba(0,0,0,.4) 0 3px, transparent 3px 6px)",backgroundSize:"9px 9px"}};return l.jsxs("div",{className:"max-w-[1320px] mx-auto px-[clamp(20px,5vw,84px)] mt-[clamp(40px,6vw,80px)]",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-[18px]",children:"The material language"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-[1px] bg-[#33393f] border border-[#33393f] rounded-[4px] overflow-hidden",children:t.map(n=>l.jsxs("div",{className:"p-[clamp(26px,3vw,40px)] bg-[#15181b] hover:bg-[#1a1e22] transition-colors",children:[l.jsx("div",{className:"h-16 rounded-[3px] mb-[22px]",style:{...e[n.swatch_type],boxShadow:"inset 0 1px 0 rgba(255,255,255,.2), 0 12px 28px -18px #000"}}),l.jsx("h3",{className:"font-mono text-[13px] tracking-[.22em] uppercase text-[#eef1f3] mb-2",children:n.name}),l.jsx("div",{className:"font-mono text-[11px] text-[#c79a55] tracking-[.16em]",children:n.grade}),l.jsx("p",{className:"text-[#8e979e] text-[14px] mt-3",children:n.description})]},n.id))})]})}function JC({settings:t}){const e=t.software_kicker||"Pillar 03 / Software",n=t.software_heading||"",r=t.software_description||"",s=[{value:t.software_stat_1_value||"",label:t.software_stat_1_label||""},{value:t.software_stat_2_value||"",label:t.software_stat_2_label||""},{value:t.software_stat_3_value||"",label:t.software_stat_3_label||""}].filter(c=>c.value&&c.label),i=[{label:t.software_link_1_label||"",href:t.software_link_1_href||""},{label:t.software_link_2_label||"",href:t.software_link_2_href||""}].filter(c=>c.label&&c.href),o=t.software_image_1||"",a=t.software_image_2||"";return l.jsx("section",{id:"software",children:l.jsx("div",{className:"max-w-[1320px] mx-auto px-[clamp(20px,5vw,84px)]",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-[clamp(28px,4vw,72px)] items-center py-[clamp(48px,7vw,96px)] border-t border-[#33393f]",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55]",children:e}),l.jsx("h3",{className:"font-serif font-medium text-[#eef1f3] text-[clamp(28px,3.6vw,46px)] leading-[1.02] mt-4 mb-[18px]",children:n}),l.jsx("p",{className:"text-[#8e979e] text-[16px] max-w-[48ch]",children:r}),l.jsx("div",{className:"flex gap-7 mt-[26px] mb-[30px] flex-wrap",children:s.map((c,u)=>l.jsxs("div",{children:[l.jsx("b",{className:"block font-serif font-semibold text-[#eef1f3] text-[22px]",children:c.value}),l.jsx("span",{className:"font-mono text-[11px] tracking-[.14em] uppercase text-[#8e979e]",children:c.label})]},u))}),l.jsx("div",{className:"flex gap-3 flex-wrap",children:i.map((c,u)=>l.jsxs("a",{href:c.href,target:"_blank",rel:"noopener",className:"inline-flex items-center gap-[9px] px-4 py-[11px] border border-[#33393f] rounded-[3px] font-mono text-[11px] tracking-[.14em] uppercase text-[#c4cacf] hover:border-[#c79a55] hover:text-[#eef1f3] transition-colors",children:[l.jsx("span",{className:"w-[6px] h-[6px] rounded-full bg-[#c79a55]"}),c.label," →"]},u))})]}),l.jsxs("div",{className:"relative aspect-[4/3] rounded-[4px] overflow-hidden border border-[#33393f] grid grid-cols-2",style:{boxShadow:"0 40px 80px -40px #000"},children:[l.jsxs("div",{className:"relative",style:{background:o?void 0:"linear-gradient(180deg,rgba(46,52,58,.7),rgba(10,11,12,.96)),#1a1e22"},children:[o&&l.jsx("img",{src:o,alt:"",className:"absolute inset-0 w-full h-full object-cover"}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgba(8,9,10,.85)] via-trans
531parent to-transparent"}),l.jsx("span",{className:"absolute top-3 left-3 font-mono text-[10px] tracking-[.16em] uppercase px-[9px] py-[5px] rounded-[2px] bg-[rgba(8,9,10,.75)] text-[#c4cacf]",children:"WrapApp"}),l.jsx("div",{className:"absolute left-0 bottom-0 w-full p-[14px] font-mono text-[11px] tracking-[.12em] uppercase text-[#c4cacf]",style:{background:"linear-gradient(0deg,rgba(8,9,10,.92),transparent)"},children:"Wrap design & order, from your phone"})]}),l.jsxs("div",{className:"relative",style:{background:a?void 0:"linear-gradient(180deg,rgba(199,154,85,.35),rgba(20,16,8,.96)),#9c6f33"},children:[a&&l.jsx("img",{src:a,alt:"",className:"absolute inset-0 w-full h-full object-cover"}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgba(8,9,10,.85)] via-transparent to-transparent"}),l.jsx("span",{className:"absolute top-3 left-3 font-mono text-[10px] tracking-[.16em] uppercase px-[9px] py-[5px] rounded-[2px] bg-[rgba(8,9,10,.75)] text-[#c4cacf]",children:"Carp Fishing Games"}),l.jsx("div",{className:"absolute left-0 bottom-0 w-full p-[14px] font-mono text-[11px] tracking-[.12em] uppercase text-[#c4cacf]",style:{background:"linear-gradient(0deg,rgba(8,9,10,.92),transparent)"},children:"Challenges, leaderboards, giveaway entries"})]}),l.jsx("div",{className:"absolute top-0 bottom-0 left-1/2 w-[1px] bg-[rgba(238,241,243,.4)]"})]})]})})})}function GC({settings:t}){const e=t.carptoon_kicker||"Pillar 05 / Carptoon",n=t.carptoon_heading||"",r=t.carptoon_description||"",s=[{value:t.carptoon_stat_1_value||"",label:t.carptoon_stat_1_label||""},{value:t.carptoon_stat_2_value||"",label:t.carptoon_stat_2_label||""},{value:t.carptoon_stat_3_value||"",label:t.carptoon_stat_3_label||""}].filter(u=>u.value&&u.label),i=t.carptoon_link_label||"Try Carptoon",o=t.carptoon_link_href||"#join",a=t.carptoon_image_1||"",c=t.carptoon_image_2||"";return l.jsx("section",{id:"carptoon",children:l.jsx("div",{className:"max-w-[1320px] mx-auto px-[clamp(20px,5vw,84px)]",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-[clamp(28px,4vw,72px)] items-center py-[clamp(48px,7vw,96px)] border-t border-[#33393f]",children:[l.jsx("div",{className:"order-2 lg:order-1",children:l.jsxs("div",{className:"relative aspect-[4/3] rounded-[4px] overflow-hidden border border-[#33393f] grid grid-cols-2",style:{boxShadow:"0 40px 80px -40px #000"},children:[l.jsxs("div",{className:"relative",style:{background:a?void 0:"linear-gradient(180deg, rgba(70,82,86,.5), rgba(10,11,12,.96)), radial-gradient(120% 80% at 40% 30%, rgba(150,170,175,.4), transparent 60%), #15181b"},children:[a&&l.jsx("img",{src:a,alt:"",className:"absolute inset-0 w-full h-full object-cover"}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgba(8,9,10,.7)] via-transparent to-transparent"}),l.jsx("span",{className:"absolute top-3 left-3 font-mono text-[10px] tracking-[.16em] uppercase px-[9px] py-[5px] rounded-[2px] bg-[rgba(8,9,10,.75)] text-[#c4cacf]",children:"Your photo"})]}),l.jsxs("div",{className:"relative",style:{background:c?void 0:"linear-gradient(180deg, rgba(199,154,85,.5), rgba(20,16,8,.95)), repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 6px, transparent 6px 12px), #9c6f33"},children:[c&&l.jsx("img",{src:c,alt:"",className:"absolute inset-0 w-full h-full object-cover"}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgba(8,9,10,.7)] via-transparent to-transparent"}),l.jsx("span",{className:"absolute top-3 left-3 font-mono text-[10px] tracking-[.16em] uppercase px-[9px] py-[5px] rounded-[2px] bg-[rgba(8,9,10,.75)] text-[#c4cacf]",children:"Carptoon"})]}),l.jsx("div",{className:"absolute top-0 bottom-0 left-1/2 w-[1px] bg-[rgba(238,241,243,.4)]"}),l.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[42px] h-[42px] rounded-full bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] grid place-items-center font-mono font-bold",style:{boxShadow:"0 10px 24px -10px #000"},children:"→"})]})}),l.jsxs("div",{className:"order-1 lg:order-2",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55]",children:e}),l.jsx("h3",{className:"font-serif font-medium text-[#eef1f3] text-[clamp(28px,3.6vw,46px)] leading-[1.02] mt-4 mb-[18px]",children:n}),l.jsx("p",{className:"text-[#8e979e] text-[16px] max-w-[48ch]",children:r}),l.jsx("div",{className:"flex gap-7 mt-[26px] mb-[30px] flex-wrap",children:s.map((u,d)=>l.jsxs("div",{children:[l.jsx("b",{className:"block font-serif font-semibold text-[#eef1f3] text-[22px]",children:u.value}),l.jsx("span",{className:"font-mono text-[11px] tracking-[.14em] uppercase text-[#8e979e]",children:u.label})]},d))}),l.jsx("div",{className:"flex gap-3 flex-wrap",children:l.jsxs("a",{href:o,className:"inline-flex items-center gap-[9px] px-4 py-[11px] border border-[#33393f] rounded-[3px] font-mono text-[11px] tracking-[.14em] uppercase text-[#c4cacf] hover:border-[#c79a55] hover:text-[#eef1f3] transition-colors",children:[l.jsx("span",{className:"w-[6px] h-[6px] rounded-full bg-[#c79a55]"}),i," →"]})})]})]})})})}function XC({pillars:t}){return l.jsx("section",{id:"pillars",children:l.jsxs("div",{className:"max-w-[1320px] mx-auto px-[clamp(20px,5vw,84px)]",children:[l.jsxs("div",{className:"flex items-end justify-between gap-6 flex-wrap pt-[clamp(56px,7vw,96px)] pb-[30px]",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55]",children:"The hub"}),l.jsx("h2",{className:"font-serif font-medium text-[#eef1f3] text-[clamp(30px,4.4vw,54px)] leading-none tracking-[-.01em]",children:"Everything else, in one place"})]}),l.jsx("p",{className:"max-w-[42ch] text-[#8e979e] text-[15px]",children:"Events, gear, guides, streams, giveaways and the members' room. Pick a door."})]}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-[1px] bg-[#33393f] border border-[#33393f] rounded-[4px] overflow-hidden",children:t.map(e=>l.jsxs("div",{className:"relative overflow-hidden p-[clamp(26px,2.6vw,38px)] bg-[#15181b] min-h-[230px] flex flex-col justify-between hover:bg-[#1a1e22] transition-colors group",children:[l.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-[rgba(199,154,85,.08)] to-transparent -translate-x-[120%] group-hover:translate-x-[120%] transition-transform duration-700 pointer-events-none"}),l.jsxs("span",{className:"font-mono text-[12px] text-[#c79a55] tracking-[.18em]",children:[e.number," — ",e.label]}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-serif font-semibold text-[#eef1f3] text-[26px]",children:e.title}),l.jsx("p",{className:"text-[#8e979e] text-[14px] mt-[10px]",children:e.description}),l.jsx("div",{className:"mt-4 font-mono text-[11px] tracking-[.16em] uppercase text-[#8e979e] group-hover:text-[#c79a55] transition-colors",children:e.link_text})]})]},e.id))})]})})}function YC({settings:t}){const e=t.join_kicker||"Membership",n=t.join_heading||"",r=t.join_description||"",s=t.join_fine_print||"",[i,o]=N.useState(""),[a,c]=N.useState(s),[u,d]=N.useState("#8e979e");async function f(h){if(h.preventDefault(),!i||!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(i)){c("Add a valid email and we will be in touch."),d("#c79a55");return}const{error:p}=await T.from("subscribers").insert({email:i});p&&p.code==="23505"?(c("You are already on the list. Watch your inbox."),d("#eef1f3")):p?(c("Something went wrong. Try again."),d("#c79a55")):(c("You are on the list for the next intake. Watch your inbox."),d("#eef1f3"),o(""))}return l.jsxs("section",{className:"mt-[clamp(64px,9vw,128px)] pt-[clamp(48px,7vw,96px)] pb-[clamp(48px,7vw,96px)] border-t border-[#33393f] relative overflow-hidden carbon-bg",id:"join",children:[l.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(80% 120% at 50% 0%, rgba(199,154,85,.12), transparent 60%)"}}),l.jsxs("div",{className:"relative max-w-[720px] mx-auto text-center px-[clamp(20px,5vw,84px)]",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-[18px]",children:e}),l.jsx("h2",{className:"font-serif font-medium text-[#eef1f3] text-[clamp(34px,5.2vw,68px)] leading-[1.02] tracking-[-.01em]",children:n}),l.jsx("p",{className:"text-[#8e979e] text-[16px] mt-5 mx-auto max-w-[46ch]",children:r}),l.jsxs("form",{onSubmit:f,className:"flex flex-col sm:flex-row gap-[10px] max-w-[480px] mx-auto mt-[34px]",children:[l.jsx("input",{type:"email",value:i,onChange:h=>o(h.target.value),placeholder:"[email protected]",className:"flex-1 bg-[#15181b] border border-[#33393f] rounded-[3px] px-4 py-[14px] text-[#eef1f3] font-mono text-[13px] tracking-[.04em] placeholder:text-[#8e979e] focus:outline-none focus:border-[#c79a55]"}),l.jsxs("button",{type:"submit",className:"btn-primary-style whitespace-nowrap",children:["Request access ",l.jsx("span",{children:"→"})]})]}),l.jsx("p",{className:"font-mono text-[11px] tracking-[.12em] uppercase mt-[18px] transition-colors",style:{color:u},children:a})]})]})}function QC({settings:t,navLinks:e}){const n=t.footer_description||"",r=t.footer_colophon||"",s=e.f
531ilter(a=>a.location==="footer_hub"),i=e.filter(a=>a.location==="footer_software"),o=e.filter(a=>a.location==="footer_stay");return l.jsxs("footer",{className:"border-t border-[#33393f] pt-[clamp(48px,6vw,80px)] pb-10 px-[clamp(20px,5vw,84px)] carbon-bg",children:[l.jsxs("div",{className:"max-w-[1320px] mx-auto grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-[1.6fr_1fr_1fr_1fr] gap-10",children:[l.jsxs("div",{children:[l.jsxs("a",{href:"#top",className:"flex items-baseline gap-[11px] font-serif font-bold text-2xl tracking-[.02em] text-[#eef1f3]",children:[l.jsx("b",{children:"Carp Fishing"})," AI",l.jsx("span",{className:"font-mono text-[11px] tracking-[.22em] text-[#0a0b0c] bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] px-[7px] py-[3px] rounded-[2px]",children:"CFA"})]}),l.jsx("p",{className:"text-[#8e979e] text-[14px] mt-[18px] max-w-[34ch]",children:n})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-mono text-[11px] tracking-[.2em] uppercase text-[#c79a55] mb-[18px]",children:"Hub"}),s.map(a=>l.jsx("a",{href:a.href,className:"block text-[#8e979e] text-[14px] py-[6px] hover:text-[#eef1f3] transition-colors",...a.external?{target:"_blank",rel:"noopener"}:{},children:a.label},a.id))]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-mono text-[11px] tracking-[.2em] uppercase text-[#c79a55] mb-[18px]",children:"Software"}),i.map(a=>l.jsx("a",{href:a.href,className:"block text-[#8e979e] text-[14px] py-[6px] hover:text-[#eef1f3] transition-colors",...a.external?{target:"_blank",rel:"noopener"}:{},children:a.label},a.id))]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-mono text-[11px] tracking-[.2em] uppercase text-[#c79a55] mb-[18px]",children:"Stay in"}),o.map(a=>l.jsx("a",{href:a.href,className:"block text-[#8e979e] text-[14px] py-[6px] hover:text-[#eef1f3] transition-colors",...a.external?{target:"_blank",rel:"noopener"}:{},children:a.label},a.id))]})]}),l.jsxs("div",{className:"max-w-[1320px] mx-auto mt-12 pt-[26px] border-t border-[#33393f] flex justify-between flex-wrap gap-4 font-mono text-[11px] tracking-[.14em] uppercase text-[#8e979e]",children:[l.jsx("div",{children:"© 2026 Carp Fishing Advanced Innovations — carpfishing.ai"}),l.jsx("div",{children:"Preston, United Kingdom"}),l.jsx("div",{children:r})]})]})}function ZC(){const[t,e]=N.useState([]),[n,r]=N.useState(!0);N.useEffect(()=>{s()},[]);async function s(){const{data:i}=await T.from("giveaways").select("id, slug, headline, prize_image_url, prize_title, prize_value, draw_date, entry_count, members_only, status").eq("status","active").order("created_at",{ascending:!1});i&&e(i),r(!1)}return n||t.length===0?null:l.jsx("section",{className:"py-16 px-6",children:l.jsxs("div",{className:"max-w-[1100px] mx-auto",children:[l.jsx("div",{className:"flex items-end justify-between mb-8",children:l.jsxs("div",{children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-2",children:"Win Big"}),l.jsx("h2",{className:"font-serif text-[clamp(24px,3vw,36px)] text-[#eef1f3] font-medium",children:"Active Giveaways"})]})}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(i=>{const o=i.draw_date?Math.max(0,new Date(i.draw_date).getTime()-Date.now()):0,a=Math.ceil(o/(1e3*60*60*24));return l.jsxs("a",{href:`/giveaway/${i.slug}`,className:"group rounded-xl border border-[#33393f] bg-[#15181b] overflow-hidden hover:border-[#c79a55]/30 transition-all hover:-translate-y-1",children:[l.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-[#0a0b0c]",children:[i.prize_image_url?l.jsx("img",{src:i.prize_image_url,alt:i.prize_title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):l.jsx("div",{className:"w-full h-full flex items-center justify-center",children:l.jsx(nn,{className:"w-12 h-12 text-[#c79a55]/30"})}),i.prize_value&&l.jsx("span",{className:"absolute top-3 right-3 px-2.5 py-1 rounded-lg bg-[#c79a55] text-[#0a0b0c] font-mono text-[10px] font-bold uppercase",children:i.prize_value}),i.members_only&&l.jsx("span",{className:"absolute top-3 left-3 px-2.5 py-1 rounded-lg bg-[#0a0b0c]/80 text-[#c79a55] font-mono text-[10px] font-bold uppercase border border-[#c79a55]/30",children:"Members"})]}),l.jsxs("div",{className:"p-5",children:[l.jsx("h3",{className:"font-serif text-lg text-[#eef1f3] font-medium mb-2 group-hover:text-[#c79a55] transition-colors line-clamp-2",children:i.headline}),l.jsxs("div",{className:"flex items-center gap-4 text-xs text-[#8e979e]",children:[a>0&&l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(va,{className:"w-3.5 h-3.5"})," ",a,"d left"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(ps,{className:"w-3.5 h-3.5"}
531)," ",i.entry_count.toLocaleString()]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 mt-4 text-[#c79a55] text-xs font-mono uppercase tracking-wider group-hover:gap-2.5 transition-all",children:["Enter Now ",l.jsx(kr,{className:"w-3.5 h-3.5"})]})]})]},i.id)})})]})})}function e5({siteName:t}){const[e,n]=N.useState(""),[r,s]=N.useState(""),[i,o]=N.useState(""),[a,c]=N.useState(!1),[u,d]=N.useState(!1),[f,h]=N.useState(""),p=N.useRef(null);async function m(y){var C;const x=(C=y.target.files)==null?void 0:C[0];if(!x)return;c(!0);const v=x.name.split(".").pop(),b=`waitlist/${crypto.randomUUID()}.${v}`,{error:_}=await T.storage.from("site-images").upload(b,x);if(!_){const{data:w}=T.storage.from("site-images").getPublicUrl(b);o(w.publicUrl)}c(!1)}async function g(y){if(y.preventDefault(),h(""),!e.trim()||!r.trim()){h("Name and email are required.");return}const{error:x}=await T.from("waitlist").insert({name:e.trim(),email:r.trim().toLowerCase(),photo_url:i});if(x){x.code==="23505"?h("This email is already on the waitlist."):h("Something went wrong. Please try again.");return}d(!0)}return u?l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex flex-col items-center justify-center px-6",children:l.jsxs("div",{className:"text-center max-w-md animate-fade-in",children:[l.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] mb-6",children:l.jsx(lC,{className:"w-8 h-8 text-[#0a0b0c]"})}),l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] mb-3",children:"You're on the list"}),l.jsx("p",{className:"text-[#8e979e] text-sm leading-relaxed",children:"We'll be in touch when we're ready to open the doors. Keep your rods ready."})]})}):l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex flex-col items-center justify-center px-6 py-16",children:l.jsxs("div",{className:"w-full max-w-md",children:[l.jsxs("div",{className:"text-center mb-10",children:[l.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full border border-[#c79a55]/30 mb-5",children:l.jsx(pC,{className:"w-7 h-7 text-[#c79a55]"})}),l.jsx("h1",{className:"font-serif text-3xl md:text-4xl text-[#eef1f3] font-medium tracking-tight",children:t||"Something Big Is Coming"}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-3 leading-relaxed max-w-sm mx-auto",children:"We're building something special for the carp fishing community. Join the waitlist to be first through the gates."})]}),l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsx("div",{children:l.jsx("input",{type:"text",placeholder:"Your name",value:e,onChange:y=>n(y.target.value),className:"w-full bg-[#15181b] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] placeholder-[#5a6269] focus:border-[#c79a55] focus:ring-1 focus:ring-[#c79a55]/30 outline-none transition-all"})}),l.jsx("div",{children:l.jsx("input",{type:"email",placeholder:"Email address",value:r,onChange:y=>s(y.target.value),className:"w-full bg-[#15181b] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] placeholder-[#5a6269] focus:border-[#c79a55] focus:ring-1 focus:ring-[#c79a55]/30 outline-none transition-all"})}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#5a6269] mb-2 font-mono",children:"Latest carp capture (optional)"}),l.jsxs("div",{onClick:()=>{var y;return(y=p.current)==null?void 0:y.click()},className:"relative w-full border border-dashed border-[#33393f] rounded-lg overflow-hidden cursor-pointer hover:border-[#c79a55]/40 transition-colors group",children:[i?l.jsxs("div",{className:"aspect-video relative",children:[l.jsx("img",{src:i,alt:"Your catch",className:"w-full h-full object-cover"}),l.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:l.jsx("span",{className:"text-xs text-white font-medium",children:"Change photo"})})]}):l.jsxs("div",{className:"aspect-video flex flex-col items-center justify-center gap-2 text-[#5a6269] group-hover:text-[#8e979e] transition-colors",children:[l.jsx(aC,{className:"w-6 h-6"}),l.jsx("span",{className:"text-xs",children:a?"Uploading...":"Upload your latest catch"})]}),l.jsx("input",{ref:p,type:"file",accept:"image/*",onChange:m,className:"hidden"})]})]}),f&&l.jsx("p",{className:"text-xs text-red-400 text-center",children:f}),l.jsxs("button",{type:"submit",className:"w-full flex items-center justify-center gap-2 px-6 py-3.5 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] text-sm font-bold font-mono uppercase tracking-wider hover:opacity-90 transition-opacity",children:["Join the Waitlist ",l.jsx(kr,{className:"w-4 h-4"})]})]}),l.jsx("p",{className:"text-center text-[10px] text-[#5a6269] mt-6",children:"No spam. We'll only email you when we're ready to launch."})]})})}function t5(){const{profile:t}=Nt(),[e,n]=N.useState({}),[r,s]=N.useState([]),[i,o]=N.useState([]),[a,c]=N.useState([]),[u,d]=N.useState([]),[f,h]=N.useState(!0);N.useEffect(()=>{p()},[]);async function p(){const[x,v,b,_,C]=await Promise.all([T.from("site_settings").select("*"),T.from("sections").select("*").order("sort_order"),T.from("nav_links").select("*").order("sort_order"),T.from("pillars").select("*").order("sort_order"),T.from("materials").select("*").order("sort_order")]);if(x.data){const w={};x.data.forEach(k=>
531{w[k.key]=k.value}),n(w)}v.data&&s(v.data),b.data&&o(b.data),_.data&&c(_.data),C.data&&d(C.data),h(!1)}if(f)return l.jsxs("div",{className:"min-h-screen bg-[#0a0b0c] flex flex-col items-center justify-center gap-6",children:[l.jsxs("div",{className:"relative w-16 h-16",children:[l.jsx("div",{className:"absolute inset-0 rounded-full border border-[#33393f]"}),l.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-transparent border-t-[#c79a55] animate-spin"}),l.jsx("div",{className:"absolute inset-[6px] rounded-full border border-transparent border-b-[#e9cd97] animate-spin [animation-direction:reverse] [animation-duration:1.5s]"})]}),l.jsxs("div",{className:"flex items-baseline gap-2 animate-pulse",children:[l.jsx("span",{className:"font-serif font-bold text-[#eef1f3] text-lg tracking-[.02em]",children:"CarpFishing"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.22em] text-[#0a0b0c] bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] px-[6px] py-[2px] rounded-[2px]",children:"AI"})]})]});const m=i.filter(x=>x.location==="header"),g=(t==null?void 0:t.role)==="admin";return e.coming_soon_enabled===!0&&!g?l.jsx(e5,{siteName:e.site_name}):l.jsxs("div",{className:"min-h-screen bg-[#0a0b0c] text-[#c4cacf] font-sans antialiased overflow-x-hidden",children:[l.jsx(HC,{settings:e,navLinks:m}),l.jsx(qC,{settings:e}),l.jsx(ZC,{}),l.jsx(WC,{sections:r,settings:e}),l.jsx(KC,{materials:u}),l.jsx(JC,{settings:e}),l.jsx(GC,{settings:e}),l.jsx(XC,{pillars:a}),l.jsx(YC,{settings:e}),l.jsx(QC,{settings:e,navLinks:i})]})}function n5(){const{session:t,loading:e,signIn:n}=Nt(),[r,s]=N.useState(""),[i,o]=N.useState(""),[a,c]=N.useState(""),[u,d]=N.useState(!1);if(e)return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"})});if(t)return l.jsx(jp,{to:"/admin",replace:!0});async function f(h){h.preventDefault(),c(""),d(!0);const{error:p}=await n(r,i);p&&c("Invalid credentials. Please try again."),d(!1)}return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center px-4",children:l.jsxs("div",{className:"w-full max-w-md",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] mb-4",children:l.jsx(e1,{className:"w-6 h-6 text-[#0a0b0c]"})}),l.jsx("h1",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Admin Panel"}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-2 font-mono tracking-wide uppercase text-[11px]",children:"CarpFishing.AI"})]}),l.jsxs("form",{onSubmit:f,className:"bg-[#15181b] border border-[#33393f] rounded-lg p-8",children:[a&&l.jsx("div",{className:"mb-4 p-3 rounded bg-red-900/30 border border-red-800/50 text-red-300 text-sm",children:a}),l.jsxs("div",{className:"mb-5",children:[l.jsx("label",{className:"block font-mono text-[11px] tracking-[.16em] uppercase text-[#8e979e] mb-2",children:"Email"}),l.jsx("input",{type:"email",value:r,onChange:h=>s(h.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-4 py-3 text-[#eef1f3] font-mono text-sm focus:outline-none focus:border-[#c79a55] transition-colors",required:!0})]}),l.jsxs("div",{className:"mb-6",children:[l.jsx("label",{className:"block font-mono text-[11px] tracking-[.16em] uppercase text-[#8e979e] mb-2",children:"Password"}),l.jsx("input",{type:"password",value:i,onChange:h=>o(h.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-4 py-3 text-[#eef1f3] font-mono text-sm focus:outline-none focus:border-[#c79a55] transition-colors",required:!0})]}),l.jsxs("button",{type:"submit",disabled:u,className:"w-full btn-primary-style justify-center disabled:opacity-50",children:[u?"Signing in...":"Sign In"," ",l.jsx("span",{children:"→"})]})]}),l.jsx("div",{className:"text-center mt-6",children:l.jsx("a",{href:"/",className:"text-[#8e979e] text-sm hover:text-[#c79a55] transition-colors font-mono text-[11px] tracking-[.14em] uppercase",children:"← Back to site"})})]})})}function r5(){const{updatePassword:t}=Nt(),[e,n]=N.useState(""),[r,s]=N.useState(""),[i,o]=N.useState(""),[a,c]=N.useState(!1);async function u(d){if(d.preventDefault(),o(""),e.length<8){o("Password must be at least 8 characters.");return}if(e!==r){o("Passwords do not match.");return}c(!0);const{error:f}=await t(e);f&&o(f.message),c(!1)}return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center px-4",children:l.jsxs("div",{className:"w-full max-w-md",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 roun
531ded-full bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] mb-4",children:l.jsx(Zb,{className:"w-6 h-6 text-[#0a0b0c]"})}),l.jsx("h1",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Change Password"}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-2",children:"You must set a new password before continuing."})]}),l.jsxs("form",{onSubmit:u,className:"bg-[#15181b] border border-[#33393f] rounded-lg p-8",children:[i&&l.jsx("div",{className:"mb-4 p-3 rounded bg-red-900/30 border border-red-800/50 text-red-300 text-sm",children:i}),l.jsxs("div",{className:"mb-5",children:[l.jsx("label",{className:"block font-mono text-[11px] tracking-[.16em] uppercase text-[#8e979e] mb-2",children:"New Password"}),l.jsx("input",{type:"password",value:e,onChange:d=>n(d.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-4 py-3 text-[#eef1f3] font-mono text-sm focus:outline-none focus:border-[#c79a55] transition-colors",required:!0,minLength:8})]}),l.jsxs("div",{className:"mb-6",children:[l.jsx("label",{className:"block font-mono text-[11px] tracking-[.16em] uppercase text-[#8e979e] mb-2",children:"Confirm Password"}),l.jsx("input",{type:"password",value:r,onChange:d=>s(d.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-4 py-3 text-[#eef1f3] font-mono text-sm focus:outline-none focus:border-[#c79a55] transition-colors",required:!0,minLength:8})]}),l.jsxs("button",{type:"submit",disabled:a,className:"w-full btn-primary-style justify-center disabled:opacity-50",children:[a?"Updating...":"Set New Password"," ",l.jsx("span",{children:"→"})]})]})]})})}function s5(){const[t,e]=N.useState([]),[n,r]=N.useState([]),[s,i]=N.useState([]),[o,a]=N.useState(!0),[c,u]=N.useState({slug:"",name:"",description:"",category:"general"}),[d,f]=N.useState(!1);N.useEffect(()=>{h()},[]);async function h(){const[b,_,C]=await Promise.all([T.from("features").select("*").order("category").order("name"),T.from("membership_tiers").select("*").order("sort_order"),T.from("tier_features").select("*")]);b.data&&e(b.data),_.data&&r(_.data),C.data&&i(C.data),a(!1)}async function p(){if(!c.slug||!c.name)return;const{error:b}=await T.from("features").insert(c);b||(u({slug:"",name:"",description:"",category:"general"}),f(!1),h())}async function m(b){await T.from("features").delete().eq("id",b),h()}async function g(b,_,C){C?await T.from("tier_features").delete().eq("tier_id",b).eq("feature_id",_):await T.from("tier_features").insert({tier_id:b,feature_id:_}),h()}function y(b,_){return s.some(C=>C.tier_id===b&&C.feature_id===_)}function x(b){return b==="carbon"?l.jsx(Ap,{className:"w-3.5 h-3.5"}):b==="titanium"?l.jsx(wa,{className:"w-3.5 h-3.5"}):l.jsx(ba,{className:"w-3.5 h-3.5"})}const v=[...new Set(t.map(b=>b.category))];return o?l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Feature Gates"}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-1",children:"Control which features each membership tier can access."})]}),l.jsxs("button",{onClick:()=>f(!d),className:"flex items-center gap-2 font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Feature"]})]}),d&&l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4 mb-6",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:[l.jsx("input",{placeholder:"Slug (e.g. carptoon_access)",value:c.slug,onChange:b=>u({...c,slug:b.target.value}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{placeholder:"Display Name",value:c.name,onChange:b=>u({...c,name:b.target.value}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{placeholder:"Description",value:c.description,onChange:b=>u({...c,description:b.target.value}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{placeholder:"Category",value:c.category,onChange:b=>u({...c,category:b.target.value}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"})]}),l.jsx("button",{onClick:p,className:"font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2 rounded bg-gradient-to-r from-[#e9cd97] to-[#9c6f33] text-[#0a0b0c] font-bold hover:opacity-90 transition-opacity",children:"Save Feature"})]}),l.jsx("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[#33393f]",children:[l.jsx("th",{className:"text-left px-4 py-3 font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e]",children:"Feature"}),n.map(b=>l.jsx("th",{className:"text-center px-4 py-3",children:l.jsxs("div",{className:"flex items-center justify-center gap-1.5 font-mono text-[10px] tracking-[.14em] uppercase text-[#c4cacf]",children:[x(b.slug),b.name]})},b.id)),l.jsx("th",{className:"w-10"})]})}),l.jsx("tbody",{children:v.map(b=>l.jsxs(l.Fragment,{children:[l.jsx("tr",{children:l.jsx("td",{colSpan:n.length+2,className:"px-4 pt-4 pb-1",children:l.jsx("span",{className:"font-mono text-[9px] tracking-[.2em] uppercase text-[#c79a55]",children:b})})},`cat-${b}`),t.filter(_=>_.category===b).map(_=>l.jsxs("tr",{className:"border-t border-[#33393f]/50 hover:bg-[#1a1e22]",children:[l.jsxs("td",{className:"px-4 py-2.5",children:[l.jsx("div",{className:"text-sm text-[#eef1f3]",children:_.name}),l.jsx("div",{className:"text-xs text-[#8e979e]",children:_.slug})]}),n.map(C=>l.jsx("td",{className:"text-center px-4 py-2.5",children:l.jsx("button",{onClick:()=>g(C.id,_.id,y(C.id,_.id)),className:`w-8 h-5 rounded-full transition-colors relative ${y(C.id,_.id)?"bg-[#c79a55]":"bg-[#33393f]"}`,children:l.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-[#eef1f3] transition-transform ${y(C.id,_.id)?"left-[14px]":"left-0.5"}`})})},C.id)),l.jsx("td",{className:"px-2",children:l.jsx("button",{onClick:()=>m(_.id),className:"text-[#8e979e] hover:text-red-400 transition-colors p-1",children:l.jsx(at,{className:"w-3.5 h-3.5"})})})]},_.id))]}))})]})})}),t.length===0&&l.jsx("div",{className:"text-center py-10 text-[#8e979e] text-sm",children:"No features defined yet. Add a feature to start gating access."})]})}function i5(){const[t,e]=N.useState(null),[n,r]=N.useState(!0),[s,i]=N.useState("30d");N.useEffect(()=>{o()},[s]);async function o(){r(!0);let a=T.from("orders").select("*").order("created_at",{ascending:!1});if(s!=="all"){const v=s==="7d"?7:30,b=new Date(Date.now()-v*24*60*60*1e3).toISOString();a=a.gte("created_at",b)}const{data:c}=await a;if(!c){r(!1);return}const u=c.slice(0,20).map(v=>v.id),{data:d}=await T.from("order_items").select("*").in("order_id",u.length>0?u:["none"]),{data:f}=await T.from("profiles").select("membership_tier"),h={};if(f)for(const v of f){const b=v.membership_tier||"stainless";h[b]=(h[b]||0)+1}const p=c.filter(v=>v.status==="completed"),m=p.reduce((v,b)=>v+b.total_cents,0),g={},y={};for(const v of c)y[v.status]=(y[v.status]||0)+1,v.status==="completed"&&(g[v.funnel]=(g[v.funnel]||0)+v.total_cents);const x=c.slice(0,20).map(v=>({...v,items:(d||[]).filter(b=>b.order_id===v.id)}
531));e({totalRevenue:m,totalOrders:c.length,completedOrders:p.length,avgOrderValue:p.length>0?m/p.length:0,revenueByFunnel:g,ordersByStatus:y,recentOrders:x,memberCounts:h}),r(!1)}return n||!t?l.jsx("div",{className:"text-[#8e979e]",children:"Loading sales data..."}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Sales Dashboard"}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-1",children:"Revenue and order analytics across all funnels."})]}),l.jsx("div",{className:"flex gap-1 bg-[#15181b] border border-[#33393f] rounded p-1",children:["7d","30d","all"].map(a=>l.jsx("button",{onClick:()=>i(a),className:`font-mono text-[10px] tracking-[.12em] uppercase px-3 py-1.5 rounded transition-colors ${s===a?"bg-[#22272c] text-[#eef1f3]":"text-[#8e979e] hover:text-[#c4cacf]"}`,children:a==="all"?"All Time":a==="7d"?"7 Days":"30 Days"},a))})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(Gb,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e]",children:"Revenue"})]}),l.jsxs("div",{className:"text-[#eef1f3] font-serif text-2xl font-medium",children:["£",(t.totalRevenue/100).toFixed(2)]})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(ot,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e]",children:"Orders"})]}),l.jsx("div",{className:"text-[#eef1f3] font-serif text-2xl font-medium",children:t.completedOrders}),l.jsxs("div",{className:"text-[#8e979e] text-xs mt-0.5",children:[t.totalOrders," total"]})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(s1,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e]",children:"AOV"})]}),l.jsxs("div",{className:"text-[#eef1f3] font-serif text-2xl font-medium",children:["£",(t.avgOrderValue/100).toFixed(2)]})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(ps,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e]",children:"Members"})]}),l.jsx("div",{className:"text-[#eef1f3] font-serif text-2xl font-medium",children:Object.values(t.memberCounts).reduce((a,c)=>a+c,0)})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8",children:[l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx(sC,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:"Revenue by Funnel"})]}),Object.keys(t.revenueByFunnel).length===0?l.jsx("p",{className:"text-[#8e979e] text-sm",children:"No revenue data yet."}):l.jsx("div",{className:"space-y-3",children:Object.entries(t.revenueByFunnel).map(([a,c])=>{const u=t.totalRevenue>0?c/t.totalRevenue*100:0;return l.jsxs("div",{children:[l.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[l.jsx("span",{className:"text-[#c4cacf] capitalize",children:a}),l.jsxs("span",{className:"text-[#eef1f3] font-medium",children:["£",(c/100).toFixed(2)]})]}),l.jsx("div",{className:"h-2 rounded-full bg-[#22272c] overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#c79a55] to-[#e9cd97]",style:{width:`${u}%`}})})]},a)})})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx(ps,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:"Members by Tier"})]}),l.jsx("div",{className:"space-y-3",children:["stainless","titanium","carbon"].map(a=>{const c=t.memberCounts[a]||0,u=Object.values(t.memberCounts).reduce((f,h)=>f+h,0),d=u>0?c/u*100:0;return l.jsxs("div",{children:[l.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[l.jsx("span",{className:"text-[#c4cacf] capitalize",children:a}),l.jsx("span",{className:"text-[#eef1f3] font-medium",children:c})]}),l.jsx("div",{className:"h-2 rounded-full bg-[#22272c] overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,background:a==="carbon"?"linear-gradient(to right, #c79a55, #e9cd97)":a==="titanium"?"linear-gradient(to right, #5a7a88, #a8b8c0)":"linear-gradient(to right, #8e979e, #c4cacf)"}})})]},a)})})]})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg overflow-hidden",children:[l.jsx("div",{className:"px-5 py-4 border-b border-[#33393f]",children:l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:"Recent Orders"})}),t.recentOrders.length===0?l.jsx("div",{className:"p-8 text-center text-[#8e979e] text-sm",children:"No orders yet."}):l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[#33393f]",children:[l.jsx("th",{className:"text-left px-4 py-2.5 font-mono text-[9px] tracking-[.14em] uppercase text-[#8e979e]",children:"Date"}),l.jsx("th",{className:"text-left px-4 py-2.5 font-mono text-[9px] tracking-[.14em] uppercase text-[#8e979e]",children:"Items"}),l.jsx("th",{className:"text-left px-4 py-2.5 font-mono text-[9px] tracking-[.14em] uppercase text-[#8e979e]",children:"Funnel"}),l.jsx("th",{className:"text-left px-4 py-2.5 font-mono text-[9px] tracking-[.14em] uppercase text-[#8e979e]",children:"Status"}),l.jsx("th",{className:"text-right px-4 py-2.5 font-mono text-[9px] tracking-[.14em] uppercase text-[#8e979e]",children:"Amount"})]})}),l.jsx("tbody",{children:t.recentOrders.map(a=>l.jsxs("tr",{className:"border-t border-[#33393f]/50 hover:bg-[#1a1e22]",children:[l.jsx("td",{className:"px-4 py-2.5 text-[#8e979e] text-xs font-mono",children:new Date(a.created_at).toLocaleDateString("en-GB",{day:"2-digit",month:"short"})}),l.jsx("td",{className:"px-4 py-2.5 text-[#c4cacf] text-sm",children:a.items.map(c=>c.description).join(", ")||"-"}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:"font-mono text-[10px] tracking-[.1em] uppercase text-[#8e979e] capitalize",children:a.funnel})}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:`inline-flex px-2 py-0.5 rounded text-[9px] font-mono tracking-[.1em] uppercase border ${a.status==="completed"?"bg-emerald-900/30 text-emerald-400 border-emerald-800/50":a.status==="failed"?"bg-red-900/30 text-red-400 border-red-800/50":"bg-amber-900/30 text-amber-400 border-amber-800/50"}`,children:a.status})}),l.jsxs("td",{className:"px-4 py-2.5 text-right text-[#eef1f3] text-sm font-medium",children:["£",(a.total_cents/100).toFixed(2)]})]},a.id))})]})})]})]})}function o5(){var E;const[t,e]=N.useState([]),[n,r]=N.useState([]),[s,i]=N.useState([]),[o,a]=N.useState(!0),[c,u]=N.useState(null),[d,f]=N.useState(""),[h,p]=N.useState(!1),[m,g]=N.useState({user_id:"",amount:0,description:""}),[y,x]=N.useState(!1);N.useEffect(()=>
531{v()},[]);async function v(){a(!0);const{data:S}=await T.rpc("get_all_credit_balances");let j=[];if(S)j=S;else{const{data:O}=await T.from("credit_ledger").select("user_id, amount, created_at").order("created_at",{ascending:!1});if(O){const D={};for(const q of O)D[q.user_id]||(D[q.user_id]={balance:0,count:0,last:q.created_at}),D[q.user_id].balance+=q.amount,D[q.user_id].count++;j=Object.entries(D).map(([q,K])=>({user_id:q,balance:K.balance,total_transactions:K.count,last_transaction_at:K.last}))}}const{data:A}=await T.from("profiles").select("id, email, membership_tier");if(A){const O=Object.fromEntries(A.map(D=>[D.id,D]));j=j.map(D=>{var q,K;return{...D,email:(q=O[D.user_id])==null?void 0:q.email,membership_tier:(K=O[D.user_id])==null?void 0:K.membership_tier}});for(const D of A)!j.find(q=>q.user_id===D.id)&&D.role!=="admin"&&j.push({user_id:D.id,balance:0,total_transactions:0,last_transaction_at:"",email:D.email,membership_tier:D.membership_tier})}e(j);const{data:z}=await T.from("tier_monthly_credits").select("*"),{data:R}=await T.from("membership_tiers").select("id, name, slug").order("sort_order");if(z&&R){const O=R.map(D=>{const q=z.find(K=>K.tier_id===D.id);return{tier_id:D.id,credits_per_month:(q==null?void 0:q.credits_per_month)||0,tier_name:D.name,tier_slug:D.slug}});i(O)}a(!1)}async function b(S){u(S);const{data:j}=await T.from("credit_ledger").select("*").eq("user_id",S).order("created_at",{ascending:!1}).limit(50);j&&r(j)}async function _(){var A,z;if(!m.user_id||m.amount===0||!m.description)return;const S=((A=t.find(R=>R.user_id===m.user_id))==null?void 0:A.balance)||0,{error:j}=await T.from("credit_ledger").insert({user_id:m.user_id,amount:m.amount,balance_after:S+m.amount,type:m.amount>0?"admin_award":"admin_adjustment",description:m.description,reference_type:"admin",reference_id:"",created_by:(z=(await T.auth.getUser()).data.user)==null?void 0:z.id});j||(p(!1),g({user_id:"",amount:0,description:""}),v(),c===m.user_id&&b(m.user_id))}async function C(S,j){await T.from("tier_monthly_credits").upsert({tier_id:S,credits_per_month:j,updated_at:new Date().toISOString()}),v()}const w=t.filter(S=>!d||S.email&&S.email.toLowerCase().includes(d.toLowerCase()));function k(S){const j={purchase:"bg-emerald-900/30 text-emerald-400 border-emerald-800/50",earned:"bg-sky-900/30 text-sky-400 border-sky-800/50",admin_award:"bg-amber-900/30 text-amber-400 border-amber-800/50",admin_adjustment:"bg-orange-900/30 text-orange-400 border-orange-800/50",monthly_award:"bg-teal-900/30 text-teal-400 border-teal-800/50",spent:"bg-red-900/30 text-red-400 border-red-800/50",refund:"bg-[#22272c] text-[#8e979e] border-[#33393f]"};return l.jsx("span",{className:`inline-flex px-2 py-0.5 rounded text-[9px] font-mono tracking-[.1em] uppercase border ${j[S]||j.refund}`,children:S.replace("_"," ")})}return o?l.jsx("div",{className:"text-[#8e979e]",children:"Loading credits data..."}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Credits Manager"}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-1",children:"Award, adjust, and track member credit balances."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("button",{onClick:()=>x(!y),className:"flex items-center gap-2 font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#2e343a] transition-colors",children:[l.jsx(n1,{className:"w-3.5 h-3.5"})," Config"]}),l.jsxs("button",{onClick:()=>p(!h),className:"flex items-center gap-2 font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Award / Adjust"]})]})]}),y&&l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-5 mb-6",children:[l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55] mb-4",children:"Monthly Credit Awards by Tier"}),l.jsx("p",{className:"text-[#8e979e] text-xs mb-4",children:"Credits automatically awarded when a member's subscription renews."}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:s.map(S=>l.jsxs("div",{className:"bg-[#0a0b0c] border border-[#33393f] rounded p-3",children:[l.jsx("div",{className:"text-sm text-[#c4cacf] mb-2 capitalize",children:S.tier_name}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"number",min:0,value:S.credits_per_month,onChange:j=>{const A=parseInt(j.target.value)||0;i(z=>z.map(R=>R.tier_id===S.tier_id?{...R,credits_per_month:A}:R))},className:"w-20 bg-[#15181b] border border-[#33393f] rounded px-2 py-1.5 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"}),l.jsx("span",{className:"text-[#8e979e] text-xs",children:"/ month"}),l.jsx("button",{onClick:()=>C(S.tier_id,S.credits_per_month),className:"ml-auto font-mono text-[9px] tracking-[.12em] uppercase px-2 py-1 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:"Save"})]})]},S.tier_id))})]}),h&&l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-5 mb-6",children:[l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55] mb-4",children:"Manual Credit Adjustment"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-3",children:[l.jsxs("select",{value:m.user_id,onChange:S=>g({...m,user_id:S.target.value}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]",children:[l.jsx("option",{value:"",children:"Select Member"}),t.filter(S=>S.email).map(S=>l.jsxs("option",{value:S.user_id,children:[S.email," (",S.balance," pts)"]}
531,S.user_id))]}),l.jsx("input",{type:"number",placeholder:"Amount (+ or -)",value:m.amount||"",onChange:S=>g({...m,amount:parseInt(S.target.value)||0}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{placeholder:"Reason / Description",value:m.description,onChange:S=>g({...m,description:S.target.value}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{onClick:_,disabled:!m.user_id||m.amount===0||!m.description,className:"font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2 rounded bg-gradient-to-r from-[#e9cd97] to-[#9c6f33] text-[#0a0b0c] font-bold hover:opacity-90 transition-opacity disabled:opacity-50",children:m.amount>=0?"Award Credits":"Debit Credits"}),m.amount!==0&&l.jsxs("span",{className:`text-xs font-mono ${m.amount>0?"text-emerald-400":"text-red-400"}`,children:[m.amount>0?"+":"",m.amount," credits"]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg overflow-hidden",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-[#33393f] flex items-center gap-2",children:[l.jsx(RC,{className:"w-3.5 h-3.5 text-[#8e979e]"}),l.jsx("input",{placeholder:"Search by email...",value:d,onChange:S=>f(S.target.value),className:"flex-1 bg-transparent text-sm text-[#eef1f3] placeholder-[#8e979e] focus:outline-none"}),l.jsx("button",{onClick:v,className:"text-[#8e979e] hover:text-[#c4cacf] transition-colors",children:l.jsx(t1,{className:"w-3.5 h-3.5"})})]}),l.jsx("div",{className:"max-h-[480px] overflow-y-auto",children:w.length===0?l.jsx("div",{className:"p-6 text-center text-[#8e979e] text-sm",children:"No members found."}):w.map(S=>l.jsxs("button",{onClick:()=>b(S.user_id),className:`w-full flex items-center justify-between px-4 py-3 border-b border-[#33393f]/50 text-left transition-colors ${c===S.user_id?"bg-[#22272c]":"hover:bg-[#1a1e22]"}`,children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm text-[#eef1f3]",children:S.email||"Unknown"}),l.jsx("div",{className:"text-xs text-[#8e979e] capitalize",children:S.membership_tier||"stainless"})]}),l.jsxs("div",{className:"text-right",children:[l.jsxs("div",{className:`font-mono text-sm font-medium ${S.balance>0?"text-[#c79a55]":"text-[#8e979e]"}`,children:[S.balance," pts"]}),l.jsxs("div",{className:"text-[10px] text-[#8e979e]",children:[S.total_transactions," txns"]})]})]},S.user_id))})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg overflow-hidden",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-[#33393f]",children:[l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:c?"Transaction History":"Select a member"}),c&&l.jsx("p",{className:"text-xs text-[#8e979e] mt-0.5",children:(E=t.find(S=>S.user_id===c))==null?void 0:E.email})]}),l.jsx("div",{className:"max-h-[480px] overflow-y-auto",children:c?n.length===0?l.jsx("div",{className:"p-8 text-center text-[#8e979e] text-sm",children:"No transactions yet."}):n.map(S=>l.jsxs("div",{className:"px-4 py-3 border-b border-[#33393f]/50",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[k(S.type),l.jsx("span",{className:"text-xs text-[#8e979e] font-mono",children:new Date(S.created_at).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"2-digit"})})]}),l.jsxs("span",{className:`font-mono text-sm font-medium ${S.amount>0?"text-emerald-400":"text-red-400"}`,children:[S.amount>0?"+":"",S.amount]})]}),l.jsx("div",{className:"text-sm text-[#c4cacf]",children:S.description}),l.jsxs("div",{className:"text-[10px] text-[#8e979e] mt-0.5",children:["Balance: ",S.balance_after]})]},S.id)):l.jsxs("div",{className:"p-8 text-center text-[#8e979e] text-sm",children:[l.jsx(mu,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),"Select a member to view their credit history."]})})]})]})]})}function a5(){const[t,e]=N.useState("products");return l.jsxs("div",{children:[l.jsx("div",{className:"flex gap-2 mb-6",children:[{key:"products",label:"Products",icon:Op},{key:"categories",label:"Categories",icon:mC},{key:"tags",label:"Tags",icon:zC}].map(n=>{const r=n.icon;return l.jsxs("button",{onClick:()=>e(n.key),className:`flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${t===n.key?"bg-[#22272c] text-[#eef1f3] border border-[#c79a55]/30":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#15181b]"}`,children:[l.jsx(r,{className:"w-3.5 h-3.5"}),n.label]},n.key)})}),t==="products"&&l.jsx(u5,{}),t==="categories"&&l.jsx(l5,{}),t==="tags"&&l.jsx(c5,{})]})}function l5(){const[t,e]=N.useState([]),[n,r]=N.useState(null);N.useEffect(()=>{s()},[]);async function s(){const{data:a}=await T.from("store_categories").select("*").order("sort_order");a&&e(a)}async function i(){var c;if(!n)return;const a={name:n.name||"",slug:n.slug||((c=n.name)==null?void 0:c.toLowerCase().replace(/[^a-z0-9]+/g,"-"))||"",description:n.description||"",parent_id:n.parent_id||null,image_url:n.image_url||"",sort_order:n.sort_order||0,active:n.active!==!1};n.id?await T.from("store_categories").update(a).eq("id",n.id):await T.from("store_categories").insert(a),r(null),s()}async function o(a){confirm("Delete this category?")&&(await T.from("store_categories").delete().eq("id",a),s())}return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:"Categories"}),l.jsxs("button",{onClick:()=>r({active:!0,sort_order:t.length}),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9
531cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Category"]})]}),n&&l.jsxs("div",{className:"mb-4 p-4 rounded-lg bg-[#15181b] border border-[#33393f] space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Name"}),l.jsx("input",{value:n.name||"",onChange:a=>r({...n,name:a.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Slug"}),l.jsx("input",{value:n.slug||"",onChange:a=>r({...n,slug:a.target.value}),placeholder:"auto-generated",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Description"}),l.jsx("textarea",{value:n.description||"",onChange:a=>r({...n,description:a.target.value}),rows:2,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none"})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Parent"}),l.jsxs("select",{value:n.parent_id||"",onChange:a=>r({...n,parent_id:a.target.value||null}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"",children:"None"}),t.filter(a=>a.id!==n.id).map(a=>l.jsx("option",{value:a.id,children:a.name},a.id))]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Sort Order"}),l.jsx("input",{type:"number",value:n.sort_order||0,onChange:a=>r({...n,sort_order:+a.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsx("div",{className:"flex items-end",children:l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.active!==!1,onChange:a=>r({...n,active:a.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-sm text-[#c4cacf]",children:"Active"})]})})]}),l.jsxs("div",{className:"flex gap-2 pt-2",children:[l.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-[#c79a55] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3 h-3"})," Save"]}),l.jsx("button",{onClick:()=>r(null),className:"px-3 py-1.5 rounded text-xs text-[#8e979e] hover:text-[#c4cacf]",children:"Cancel"})]})]}),l.jsxs("div",{className:"space-y-1",children:[t.map(a=>l.jsxs("div",{className:"flex items-center justify-between p-3 rounded bg-[#15181b] border border-[#33393f]",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:`w-2 h-2 rounded-full ${a.active?"bg-emerald-500":"bg-[#8e979e]"}`}),l.jsx("span",{className:"text-sm text-[#eef1f3]",children:a.name}),l.jsxs("span",{className:"text-xs text-[#8e979e]",children:["/",a.slug]})]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:()=>r(a),className:"p-1.5 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(Nr,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:()=>o(a.id),className:"p-1.5 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]})]},a.id)),t.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-8",children:"No categories yet"})]})]})}function c5(){const[t,e]=N.useState([]),[n,r]=N.useState(null);N.useEffect(()=>{s()},[]);async function s(){const{data:a}=await T.from("store_tags").select("*").order("name");a&&e(a)}async function i(){var c;if(!n)return;const a={name:n.name||"",slug:n.slug||((c=n.name)==null?void 0:c.toLowerCase().replace(/[^a-z0-9]+/g,"-"))||"",color:n.color||"#c79a55"};n.id?await T.from("store_tags").update(a).eq("id",n.id):await T.from("store_tags").insert(a),r(null),s()}async function o(a){confirm("Delete this tag?")&&(await T.from("store_tags").delete().eq("id",a),s())}return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:"Tags"}),l.jsxs("button",{onClick:()=>r({}),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9
531cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Tag"]})]}),n&&l.jsxs("div",{className:"mb-4 p-4 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Name"}),l.jsx("input",{value:n.name||"",onChange:a=>r({...n,name:a.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Slug"}),l.jsx("input",{value:n.slug||"",onChange:a=>r({...n,slug:a.target.value}),placeholder:"auto",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Color"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"color",value:n.color||"#c79a55",onChange:a=>r({...n,color:a.target.value}),className:"w-10 h-9 rounded border border-[#33393f] bg-[#0a0b0c] cursor-pointer"}),l.jsx("input",{value:n.color||"#c79a55",onChange:a=>r({...n,color:a.target.value}),className:"flex-1 bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]})]}),l.jsxs("div",{className:"flex gap-2 pt-3",children:[l.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-[#c79a55] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3 h-3"})," Save"]}),l.jsx("button",{onClick:()=>r(null),className:"px-3 py-1.5 rounded text-xs text-[#8e979e] hover:text-[#c4cacf]",children:"Cancel"})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.map(a=>l.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-[#15181b] border border-[#33393f] group",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:a.color}}),l.jsx("span",{className:"text-sm text-[#c4cacf]",children:a.name}),l.jsx("button",{onClick:()=>r(a),className:"text-[#8e979e] hover:text-[#c79a55] opacity-0 group-hover:opacity-100 transition-opacity",children:l.jsx(Nr,{className:"w-3 h-3"})}),l.jsx("button",{onClick:()=>o(a.id),className:"text-[#8e979e] hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",children:l.jsx(at,{className:"w-3 h-3"})})]},a.id)),t.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-8 w-full",children:"No tags yet"})]})]})}function u5(){const[t,e]=N.useState([]),[n,r]=N.useState([]),[s,i]=N.useState([]),[o,a]=N.useState(null),[c,u]=N.useState([]),[d,f]=N.useState([]),[h,p]=N.useState(!1),m=N.useRef(null);N.useEffect(()=>{g()},[]);async function g(){const[w,k,E]=await Promise.all([T.from("store_products").select("*, store_product_images(*), store_product_tags(tag_id)").order("created_at",{ascending:!1}),T.from("store_categories").select("*").order("sort_order"),T.from("store_tags").select("*").order("name")]);w.data&&e(w.data),k.data&&r(k.data),E.data&&i(E.data)}function y(w){var k;w?(a(w),u(((k=w.store_product_tags)==null?void 0:k.map(E=>E.tag_id))||[]),f(w.store_product_images||[])):(a({status:"draft",stock_qty:-1,digital:!1,featured:!1,weight_grams:0}),u([]),f([]))}async function x(){var E;if(!o)return;const w={name:o.name||"",slug:o.slug||((E=o.name)==null?void 0:E.toLowerCase().replace(/[^a-z0-9]+/g,"-"))||"",description:o.description||"",long_description:o.long_description||"",price_cents:o.price_cents||0,compare_at_cents:o.compare_at_cents||null,sku:o.sku||"",stock_qty:o.stock_qty??-1,category_id:o.category_id||null,status:o.status||"draft",featured:o.featured||!1,digital:o.digital||!1,weight_grams:o.weight_grams||0};let k=o.id;if(o.id)await T.from("store_products").update(w).eq("id",o.id);else{const{data:S}=await T.from("store_products").insert(w).select().single();S&&(k=S.id)}k&&(await T.from("store_product_tags").delete().eq("product_id",k),c.length>0&&await T.from("store_product_tags").insert(c.map(S=>({product_id:k,tag_id:S})))),a(null),g()}async function v(w){confirm("Delete this product and all its images?")&&(await T.from("store_products").delete().eq("id",w),g())}async function b(w){var j;const k=(j=w.target.files)==null?void 0:j[0];if(!k||!(o!=null&&o.id))return;p(!0);const E=`store/${o.id}/${Date.now()}_${k.name}`,{error:S}=await T.storage.from("site-images").upload(E,k,{contentType:k.type});if(!S){const{data:A}=T.storage.from("site-images").getPublicUrl(E),{data:z}=await T.from("store_product_images").insert({product_id:o.id,url:A.publicUrl,alt_text:k.name,sort_order:d.length,is_primary:d.length===0}).select().single();z&&f([...d,z])}p(!1),m.current&&(m.current.value="")}async function _(w){await T.from("store_product_images").delete().eq("id",w),f(d.filter(k=>k.id!==w))}async function C(w){o!=null&&o.id&&(await T.from("store_product_images").update({is_primary:!1}
531).eq("product_id",o.id),await T.from("store_product_images").update({is_primary:!0}).eq("id",w),f(d.map(k=>({...k,is_primary:k.id===w}))))}return o?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:o.id?"Edit Product":"New Product"}),l.jsx("button",{onClick:()=>a(null),className:"text-[#8e979e] hover:text-[#c4cacf]",children:l.jsx(_r,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Product Name"}),l.jsx("input",{value:o.name||"",onChange:w=>a({...o,name:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Slug"}),l.jsx("input",{value:o.slug||"",onChange:w=>a({...o,slug:w.target.value}),placeholder:"auto-generated",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Short Description"}),l.jsx("textarea",{value:o.description||"",onChange:w=>a({...o,description:w.target.value}),rows:2,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Full Description"}),l.jsx("textarea",{value:o.long_description||"",onChange:w=>a({...o,long_description:w.target.value}),rows:5,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none"})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Price (pence)"}),l.jsx("input",{type:"number",value:o.price_cents||0,onChange:w=>a({...o,price_cents:+w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Compare At"}),l.jsx("input",{type:"number",value:o.compare_at_cents||"",onChange:w=>a({...o,compare_at_cents:+w.target.value||null}),placeholder:"0",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"SKU"}),l.jsx("input",{value:o.sku||"",onChange:w=>a({...o,sku:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Stock (-1 = unlimited)"}),l.jsx("input",{type:"number",value:o.stock_qty??-1,onChange:w=>a({...o,stock_qty:+w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Category"}),l.jsxs("select",{value:o.category_id||"",onChange:w=>a({...o,category_id:w.target.value||null}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"",children:"None"}),n.map(w=>l.jsx("option",{value:w.id,children:w.name},w.id))]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Status"}),l.jsxs("select",{value:o.status||"draft",onChange:w=>a({...o,status:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"draft",children:"Draft"}),l.jsx("option",{value:"active",children:"Active"}),l.jsx("option",{value:"archived",children:"Archived"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Weight (g)"}),l.jsx("input",{type:"number",value:o.weight_grams||0,onChange:w=>a({...o,weight_grams:+w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"flex gap-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:o.featured||!1,onChange:w=>a({...o,featured:w.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-sm text-[#c4cacf]",children:"Featured"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:o.digital||!1,onChange:w=>a({...o,digital:w.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-sm text-[#c4cacf]",children:"Digital Product"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-2",children:"Tags"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(w=>l.jsxs("button",{onClick:()=>u(k=>k.includes(w.id)?k.filter(E=>E!==w.id):[...k,w.id]),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs transition-colors border ${c.includes(w.id)?"border-[#c79a55] bg-[#c79a55]/10 text-[#c79a55]":"border-[#33393f] text-[#8e979e] hover:border-[#c79a55]/30"}`,children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:w.color}}),w.name]},w.id))})]}),o.id&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-2",children:"Product Images"}),l.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[d.map(w=>l.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${w.is_primary?"border-[#c79a55]":"border-[#33393f]"} group`,children:[l.jsx("img",{src:w.url,alt:w.alt_text,className:"w-full aspect-square object-cover"}),l.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[!w.is_primary&&l.jsx("button",{onClick:()=>C(w.id),className:"p-1.5 rounded bg-[#c79a55] text-[#0a0b0c]",title:"Set as primary",children:l.jsx(Mi,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:()=>_(w.id),className:"p-1.5 rounded bg-red-600 text-white",title:"Delete",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]}),w.is_primary&&l.jsx("span",{className:"absolute top-1 left-1 text-[8px] uppercase tracking-wider bg-[#c79a55] text-[#0a0b0c] px-1.5 py-0.5 rounded font-bold",children:"Primary"})]},w.id)),l.jsxs("label",{className:"flex flex-col items-center justify-center aspect-square rounded-lg border-2 border-dashed border-[#33393f] cursor-pointer hover:border-[#c79a55]/50 transition-colors",children:[l.jsx("input",{ref:m,type:"file",accept:"image/*",onChange:b,className:"hidden"}
531),h?l.jsx("div",{className:"w-5 h-5 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"}):l.jsxs(l.Fragment,{children:[l.jsx(i1,{className:"w-5 h-5 text-[#8e979e] mb-1"}),l.jsx("span",{className:"text-[10px] text-[#8e979e]",children:"Upload"})]})]})]})]}),!o.id&&l.jsx("p",{className:"text-xs text-[#8e979e] italic",children:"Save the product first to upload images."}),l.jsxs("div",{className:"flex gap-2 pt-2 border-t border-[#33393f]",children:[l.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-4 py-2 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3.5 h-3.5"})," Save Product"]}),l.jsx("button",{onClick:()=>a(null),className:"px-4 py-2 rounded text-xs text-[#8e979e] hover:text-[#c4cacf] border border-[#33393f]",children:"Cancel"})]})]}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("h3",{className:"text-[#eef1f3] font-medium",children:["Products (",t.length,")"]}),l.jsxs("button",{onClick:()=>y(),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Product"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.map(w=>{var E,S,j;const k=((E=w.store_product_images)==null?void 0:E.find(A=>A.is_primary))||((S=w.store_product_images)==null?void 0:S[0]);return l.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-[#15181b] border border-[#33393f] hover:border-[#33393f]/80",children:[l.jsx("div",{className:"w-12 h-12 rounded bg-[#0a0b0c] border border-[#33393f] overflow-hidden shrink-0",children:k?l.jsx("img",{src:k.url,alt:"",className:"w-full h-full object-cover"}):l.jsx("div",{className:"w-full h-full flex items-center justify-center",children:l.jsx(Op,{className:"w-5 h-5 text-[#33393f]"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-[#eef1f3] font-medium truncate",children:w.name}),l.jsx("span",{className:`text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded font-bold ${w.status==="active"?"bg-emerald-500/10 text-emerald-400":w.status==="archived"?"bg-red-500/10 text-red-400":"bg-[#c79a55]/10 text-[#c79a55]"}`,children:w.status})]}),l.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[l.jsx("span",{className:"text-xs text-[#c79a55] font-mono",children:(w.price_cents/100).toFixed(2)}),w.compare_at_cents&&l.jsx("span",{className:"text-xs text-[#8e979e] line-through font-mono",children:(w.compare_at_cents/100).toFixed(2)}),l.jsxs("span",{className:"text-xs text-[#8e979e]",children:[((j=w.store_product_images)==null?void 0:j.length)||0," imgs"]})]})]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:()=>y(w),className:"p-2 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(Nr,{className:"w-4 h-4"})}),l.jsx("button",{onClick:()=>v(w.id),className:"p-2 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-4 h-4"})})]})]},w.id)}),t.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-8",children:"No products yet. Add your first product to get started."})]})]})}function d5(){var C;const[t,e]=N.useState([]),[n,r]=N.useState(null),[s,i]=N.useState([]),[o,a]=N.useState([]),[c,u]=N.useState([]),[d,f]=N.useState("main"),[h,p]=N.useState([]),[m,g]=N.useState(null);N.useEffect(()=>{y()},[]);async function y(){const{data:w}=await T.from("giveaways").select("*").order("created_at",{ascending:!1});w&&e(w)}async function x(w){if(w){r(w);const[k,E,S]=await Promise.all([T.from("giveaway_faqs").select("*").eq("giveaway_id",w.id).order("sort_order"),T.from("giveaway_testimonials").select("*").eq("giveaway_id",w.id).order("sort_order"),T.from("giveaway_thank_you_steps").select("*").eq("giveaway_id",w.id).order("sort_order")]);i(k.data||[]),a(E.data||[]),u(S.data||[])}else r({status:"draft",phone_required:!1,create_membership:!1,membership_tier_slug:"stainless",post_optin_type:"none",discount_percent:0,free_carptoon_credits:1,members_only:!1,notify_on_lead:!0,notify_on_purchase:!0,entry_count:0}),i([]),a([]),u([{title:"Share with friends",description:"Share this giveaway to earn bonus entries",icon:"share",action_url:"",action_label:"Share Now",points:5,sort_order:0,step_type:"share"},{title:"Join the Community",description:"Connect with fellow members",icon:"users",action_url:"",action_label:"Join",points:3,sort_order:1,step_type:"community"},{title:"Try Carptoon Free",description:"Get a free AI-generated cartoon",icon:"palette",action_url:"/tools/carptoon",action_label:"Try Now",points:2,sort_order:2,step_type:"carptoon"},{title:"Browse the Store",description:"Check out our products with your discount",icon:"shopping-bag",action_url:"/store",action_label:"Shop Now",points:1,sort_order:3,step_type:"store"}]);f("main")}async function v(){var E;if(!n)return;const w={slug:n.slug||((E=n.title)==null?void 0:E.toLowerCase().replace(/[^a-z0-9]+/g,"-"))||"",title:n.title||"",headline:n.headline||"",subheadline:n.subheadline||"",prize_image_url:n.prize_image_url||"",prize_title:n.prize_title||"",prize_description:n.prize_description||"",prize_value:n.prize_value||"",draw_date:n.draw_date||null,phone_required:n.phone_required||!1,create_membership:n.create_membership||!1,membership_tier_slug:n.membership_tier_slug||"stainless",post_optin_type:n.post_optin_type||"none",post_optin_product_id:n.post_optin_product_id||null,post_optin_funnel_url:n.post_optin_funnel_url||"",discount_percent:n.discount_percent||0,discount_code:n.discount_code||"",free_carptoon_credits:n.free_carptoon_credits||0,community_url:n.community_url||"",facebook_pixel_id:n.facebook_pixel_id||"",notify_on_lead:n.notify_on_lead||!1,notify_on_purchase:n.notify_on_purchase||!1,notification_email:n.notification_email||"",status:n.status||"draft",members_only:n.members_only||!1,footer_text:n.footer_text||"",og_image_url:n.og_image_url||"",og_description:n.og_description||""};let k=n.id;if(n.id)await T.from("giveaways").update(w).eq("id",n.id);else{const{data:S}=await T.from("giveaways").insert(w).select().single();S&&(k=S.id)}k&&(await T.from("giveaway_faqs").delete().eq("giveaway_id",k),s.length>0&&await T.from("giveaway_faqs").insert(s.map((S,j)=>({giveaway_id:k,question:S.question,answer:S.answer,sort_order:j}))),await T.from("giveaway_testimonials").delete().eq("giveaway_id",k),o.length>0&&await T.from("giveaway_testimonials").insert(o.map((S,j)=>({giveaway_id:k,name:S.name,text:S.text,avatar_url:S.avatar_url,rating:S.rating,sort_order:j}))),await T.from("giveaway_thank_you_steps").delete().eq("giveaway_id",k),c.length>0&&await T.from("giveaway_thank_you_steps").insert(c.map((S,j)=>
531({giveaway_id:k,title:S.title,description:S.description,icon:S.icon,action_url:S.action_url,action_label:S.action_label,points:S.points,sort_order:j,step_type:S.step_type})))),r(null),y()}async function b(w){confirm("Delete this giveaway and all its entries?")&&(await T.from("giveaways").delete().eq("id",w),y())}async function _(w){if(g(m===w?null:w),m!==w){const{data:k}=await T.from("giveaway_entries").select("*").eq("giveaway_id",w).order("created_at",{ascending:!1}).limit(100);p(k||[])}}return n?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:n.id?"Edit Giveaway":"New Giveaway"}),l.jsx("button",{onClick:()=>r(null),className:"text-[#8e979e] hover:text-[#c4cacf]",children:l.jsx(_r,{className:"w-5 h-5"})})]}),l.jsx("div",{className:"flex gap-2 border-b border-[#33393f] pb-3",children:["main","faqs","testimonials","steps"].map(w=>l.jsx("button",{onClick:()=>f(w),className:`px-3 py-1.5 rounded text-xs capitalize transition-colors ${d===w?"bg-[#22272c] text-[#c79a55] border border-[#c79a55]/30":"text-[#8e979e] hover:text-[#c4cacf]"}`,children:w==="main"?"Landing Page":w},w))}),d==="main"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Internal Title"}),l.jsx("input",{value:n.title||"",onChange:w=>r({...n,title:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"URL Slug"}),l.jsx("input",{value:n.slug||"",onChange:w=>r({...n,slug:w.target.value}),placeholder:"auto-generated",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Headline"}),l.jsx("input",{value:n.headline||"",onChange:w=>r({...n,headline:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",placeholder:"Win a Premium Carp Setup Worth..."})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Subheadline"}),l.jsx("input",{value:n.subheadline||"",onChange:w=>r({...n,subheadline:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Prize Image URL"}),l.jsx("input",{value:n.prize_image_url||"",onChange:w=>r({...n,prize_image_url:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Prize Title"}),l.jsx("input",{value:n.prize_title||"",onChange:w=>r({...n,prize_title:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Prize Description"}),l.jsx("textarea",{value:n.prize_description||"",onChange:w=>r({...n,prize_description:w.target.value}),rows:2,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Prize Value"}),l.jsx("input",{value:n.prize_value||"",onChange:w=>r({...n,prize_value:w.target.value}),placeholder:"Worth 500 GBP",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Draw Date"}),l.jsx("input",{type:"datetime-local",value:((C=n.draw_date)==null?void 0:C.slice(0,16))||"",onChange:w=>r({...n,draw_date:w.target.value?new Date(w.target.value).toISOString():null}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Status"}),l.jsxs("select",{value:n.status||"draft",onChange:w=>r({...n,status:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"draft",children:"Draft"}),l.jsx("option",{value:"active",children:"Active"}),l.jsx("option",{value:"ended",children:"Ended"})]})]}),l.jsxs("div",{className:"flex flex-col justify-end gap-2",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.members_only||!1,onChange:w=>r({...n,members_only:w.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Members Only"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.phone_required||!1,onChange:w=>r({...n,phone_required:w.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Phone Required"})]})]})]}),l.jsxs("div",{className:"p-3 rounded-lg border border-[#33393f] space-y-2",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.create_membership||!1,onChange:w=>r({...n,create_membership:w.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Create free membership on opt-in"})]}),n.create_membership&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Membership Tier"}),l.jsx("input",{value:n.membership_tier_slug||"stainless",onChange:w=>r({...n,membership_tier_slug:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"p-3 rounded-lg border border-[#33393f] space-y-2",children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"After Opt-in Show"}),l.jsxs("select",{value:n.post_optin_type||"none",onChange:w=>r({...n,post_optin_type:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"none",children:"Nothing (go to thank you)"}),l.jsx("option",{value:"store_product",children:"Store Product"}
531),l.jsx("option",{value:"funnel",children:"External Funnel URL"})]}),n.post_optin_type==="funnel"&&l.jsx("input",{value:n.post_optin_funnel_url||"",onChange:w=>r({...n,post_optin_funnel_url:w.target.value}),placeholder:"https://...",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{className:"p-3 rounded-lg border border-[#33393f] space-y-3",children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[#8e979e] font-bold",children:"Thank You Page Settings"}),l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Store Discount %"}),l.jsx("input",{type:"number",value:n.discount_percent||0,onChange:w=>r({...n,discount_percent:+w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Discount Code"}),l.jsx("input",{value:n.discount_code||"",onChange:w=>r({...n,discount_code:w.target.value}),placeholder:"GIVEAWAY10",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Free Carptoon Credits"}),l.jsx("input",{type:"number",value:n.free_carptoon_credits||0,onChange:w=>r({...n,free_carptoon_credits:+w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Community URL"}),l.jsx("input",{value:n.community_url||"",onChange:w=>r({...n,community_url:w.target.value}),placeholder:"https://facebook.com/groups/...",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"p-3 rounded-lg border border-[#33393f] space-y-3",children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[#8e979e] font-bold",children:"Tracking & Notifications"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Facebook Pixel ID"}),l.jsx("input",{value:n.facebook_pixel_id||"",onChange:w=>r({...n,facebook_pixel_id:w.target.value}),placeholder:"123456789",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Notification Email"}),l.jsx("input",{value:n.notification_email||"",onChange:w=>r({...n,notification_email:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"flex gap-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.notify_on_lead||!1,onChange:w=>r({...n,notify_on_lead:w.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Notify on new lead"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.notify_on_purchase||!1,onChange:w=>r({...n,notify_on_purchase:w.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Notify on purchase"})]})]})]}),l.jsxs("div",{className:"p-3 rounded-lg border border-[#33393f] space-y-2",children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[#8e979e] font-bold",children:"Social Sharing"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"OG Image URL"}),l.jsx("input",{value:n.og_image_url||"",onChange:w=>r({...n,og_image_url:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"OG Description"}),l.jsx("input",{value:n.og_description||"",onChange:w=>r({...n,og_description:w.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Footer Text"}),l.jsx("textarea",{value:n.footer_text||"",onChange:w=>r({...n,footer_text:w.target.value}),rows:2,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none",placeholder:"Terms & conditions, disclaimer, etc."})]})]}),d==="faqs"&&l.jsxs("div",{className:"space-y-3",children:[s.map((w,k)=>l.jsxs("div",{className:"p-3 rounded-lg bg-[#0a0b0c] border border-[#33393f] space-y-2",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsxs("span",{className:"text-[10px] text-[#8e979e]",children:["FAQ #",k+1]}),l.jsx("button",{onClick:()=>i(s.filter((E,S)=>S!==k)),className:"text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]}),l.jsx("input",{value:w.question,onChange:E=>i(s.map((S,j)=>j===k?{...S,question:E.target.value}:S)),placeholder:"Question",className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),l.jsx("textarea",{value:w.answer,onChange:E=>i(s.map((S,j)=>j===k?{...S,answer:E.target.value}:S)),placeholder:"Answer",rows:2,className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none"})]},k)),l.jsxs("button",{onClick:()=>i([...s,{question:"",answer:"",sort_order:s.length}]),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9
531cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add FAQ"]})]}),d==="testimonials"&&l.jsxs("div",{className:"space-y-3",children:[o.map((w,k)=>l.jsxs("div",{className:"p-3 rounded-lg bg-[#0a0b0c] border border-[#33393f] space-y-2",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsxs("span",{className:"text-[10px] text-[#8e979e]",children:["Testimonial #",k+1]}),l.jsx("button",{onClick:()=>a(o.filter((E,S)=>S!==k)),className:"text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx("input",{value:w.name,onChange:E=>a(o.map((S,j)=>j===k?{...S,name:E.target.value}:S)),placeholder:"Name",className:"bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),l.jsx("input",{value:w.avatar_url,onChange:E=>a(o.map((S,j)=>j===k?{...S,avatar_url:E.target.value}:S)),placeholder:"Avatar URL (optional)",className:"bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsx("textarea",{value:w.text,onChange:E=>a(o.map((S,j)=>j===k?{...S,text:E.target.value}:S)),placeholder:"Testimonial text",rows:2,className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none"}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-[#8e979e]",children:"Rating"}),l.jsx("div",{className:"flex gap-1 mt-1",children:[1,2,3,4,5].map(E=>l.jsx("button",{onClick:()=>a(o.map((S,j)=>j===k?{...S,rating:E}:S)),className:`text-lg ${E<=w.rating?"text-[#c79a55]":"text-[#33393f]"}`,children:"★"},E))})]})]},k)),l.jsxs("button",{onClick:()=>a([...o,{name:"",text:"",avatar_url:"",rating:5,sort_order:o.length}]),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Testimonial"]})]}),d==="steps"&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-[#8e979e]",children:"These steps appear on the thank-you page after opt-in. Users earn points for completing them."}),c.map((w,k)=>l.jsxs("div",{className:"p-3 rounded-lg bg-[#0a0b0c] border border-[#33393f] space-y-2",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsxs("span",{className:"text-[10px] text-[#8e979e]",children:["Step #",k+1," (",w.step_type,")"]}),l.jsx("button",{onClick:()=>u(c.filter((E,S)=>S!==k)),className:"text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[l.jsx("input",{value:w.title,onChange:E=>u(c.map((S,j)=>j===k?{...S,title:E.target.value}:S)),placeholder:"Title",className:"bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),l.jsx("input",{value:w.action_label,onChange:E=>u(c.map((S,j)=>j===k?{...S,action_label:E.target.value}:S)),placeholder:"Button Label",className:"bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),l.jsx("input",{type:"number",value:w.points,onChange:E=>u(c.map((S,j)=>j===k?{...S,points:+E.target.value}:S)),placeholder:"Points",className:"bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsx("input",{value:w.description,onChange:E=>u(c.map((S,j)=>j===k?{...S,description:E.target.value}:S)),placeholder:"Description",className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx("input",{value:w.action_url,onChange:E=>u(c.map((S,j)=>j===k?{...S,action_url:E.target.value}:S)),placeholder:"Action URL",className:"bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),l.jsxs("select",{value:w.step_type,onChange:E=>u(c.map((S,j)=>j===k?{...S,step_type:E.target.value}:S)),className:"bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"share",children:"Share"}),l.jsx("option",{value:"community",children:"Community"}),l.jsx("option",{value:"carptoon",children:"Carptoon"}),l.jsx("option",{value:"store",children:"Store"}),l.jsx("option",{value:"custom",children:"Custom"})]})]})]},k)),l.jsxs("button",{onClick:()=>u([...c,{title:"",description:"",icon:"gift",action_url:"",action_label:"Complete",points:1,sort_order:c.length,step_type:"custom"}]),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9
531cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Step"]})]}),l.jsxs("div",{className:"flex gap-2 pt-4 border-t border-[#33393f]",children:[l.jsxs("button",{onClick:v,className:"flex items-center gap-1.5 px-4 py-2 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3.5 h-3.5"})," Save Giveaway"]}),l.jsx("button",{onClick:()=>r(null),className:"px-4 py-2 rounded text-xs text-[#8e979e] hover:text-[#c4cacf] border border-[#33393f]",children:"Cancel"}),n.id&&n.slug&&l.jsxs("a",{href:`/giveaway/${n.slug}`,target:"_blank",className:"flex items-center gap-1.5 px-4 py-2 rounded text-xs text-[#c79a55] border border-[#c79a55]/30 hover:bg-[#c79a55]/5",children:[l.jsx(Yb,{className:"w-3.5 h-3.5"})," Preview"]})]})]}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:"Giveaway Funnels"}),l.jsxs("button",{onClick:()=>x(),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," New Giveaway"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.map(w=>l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsx("div",{className:"w-12 h-12 rounded bg-[#0a0b0c] border border-[#33393f] flex items-center justify-center shrink-0",children:l.jsx(nn,{className:"w-5 h-5 text-[#c79a55]"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-[#eef1f3] font-medium truncate",children:w.title||w.headline}),l.jsx("span",{className:`text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded font-bold ${w.status==="active"?"bg-emerald-500/10 text-emerald-400":w.status==="ended"?"bg-red-500/10 text-red-400":"bg-[#c79a55]/10 text-[#c79a55]"}`,children:w.status}),w.members_only&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded font-bold bg-[#22272c] text-[#8e979e]",children:"Members"})]}),l.jsxs("div",{className:"flex items-center gap-3 mt-0.5 text-xs text-[#8e979e]",children:[l.jsxs("span",{children:["/giveaway/",w.slug]}),l.jsxs("span",{children:[w.entry_count," entries"]})]})]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:()=>_(w.id),className:"p-2 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(ps,{className:"w-4 h-4"})}),l.jsx("button",{onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/giveaway/${w.slug}`)},className:"p-2 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(tc,{className:"w-4 h-4"})}),l.jsx("button",{onClick:()=>x(w),className:"p-2 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(Nr,{className:"w-4 h-4"})}),l.jsx("button",{onClick:()=>b(w.id),className:"p-2 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-4 h-4"})})]})]}),m===w.id&&l.jsxs("div",{className:"ml-4 mt-1 p-3 rounded-lg bg-[#0a0b0c] border border-[#33393f] max-h-60 overflow-y-auto",children:[l.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-[#8e979e] mb-2",children:["Recent Entries (",h.length,")"]}),h.length===0?l.jsx("p",{className:"text-xs text-[#8e979e]",children:"No entries yet"}):l.jsx("div",{className:"space-y-1",children:h.map(k=>l.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[l.jsx("span",{className:"text-[#eef1f3]",children:k.name}),l.jsx("span",{className:"text-[#8e979e]",children:k.email}),k.phone&&l.jsx("span",{className:"text-[#8e979e]",children:k.phone}),l.jsxs("span",{className:"text-[#c79a55] ml-auto",children:[k.points," pts"]}),l.jsx("span",{className:"text-[#8e979e]",children:new Date(k.created_at).toLocaleDateString()})]},k.id))})]})]},w.id)),t.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-8",children:"No giveaways yet. Create your first giveaway funnel to start collecting leads."})]})]})}function f5(){const[t,e]=N.useState([]),[n,r]=N.useState(null);N.useEffect(()=>{s()},[]);async function s(){const{data:a}=await T.from("tracking_pixels").select("*").order("created_at");a&&e(a)}async function i(){if(!n)return;const a={name:n.name||"",pixel_type:n.pixel_type||"facebook",pixel_id:n.pixel_id||"",active:n.active!==!1,notify_leads:n.notify_leads||!1,notify_purchases:n.notify_purchases||!1,notification_email:n.notification_email||""};n.id?await T.from("tracking_pixels").update(a).eq("id",n.id):await T.from("tracking_pixels").insert(a),r(null),s()}async function o(a){confirm("Delete this tracking pixel?")&&(await T.from("tracking_pixels").delete().eq("id",a),s())}return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:"Tracking Pixels & Notifications"}),l.jsxs("button",{onClick:()=>r({active:!0,pixel_type:"facebook"}),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9
531cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Pixel"]})]}),n&&l.jsxs("div",{className:"mb-4 p-4 rounded-lg bg-[#15181b] border border-[#33393f] space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Name"}),l.jsx("input",{value:n.name||"",onChange:a=>r({...n,name:a.target.value}),placeholder:"Main FB Pixel",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Type"}),l.jsxs("select",{value:n.pixel_type||"facebook",onChange:a=>r({...n,pixel_type:a.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"facebook",children:"Facebook Pixel"}),l.jsx("option",{value:"tiktok",children:"TikTok Pixel"}),l.jsx("option",{value:"google",children:"Google Tag"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Pixel ID"}),l.jsx("input",{value:n.pixel_id||"",onChange:a=>r({...n,pixel_id:a.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Notification Email"}),l.jsx("input",{value:n.notification_email||"",onChange:a=>r({...n,notification_email:a.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{className:"flex items-end gap-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.active!==!1,onChange:a=>r({...n,active:a.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Active"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.notify_leads||!1,onChange:a=>r({...n,notify_leads:a.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Lead Alerts"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.notify_purchases||!1,onChange:a=>r({...n,notify_purchases:a.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Purchase Alerts"})]})]})]}),l.jsxs("div",{className:"flex gap-2 pt-2",children:[l.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-[#c79a55] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3 h-3"})," Save"]}),l.jsx("button",{onClick:()=>r(null),className:"px-3 py-1.5 rounded text-xs text-[#8e979e] hover:text-[#c4cacf]",children:"Cancel"})]})]}),l.jsxs("div",{className:"space-y-2",children:[t.map(a=>l.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Wb,{className:`w-4 h-4 ${a.active?"text-emerald-500":"text-[#8e979e]"}`}),l.jsxs("div",{children:[l.jsx("span",{className:"text-sm text-[#eef1f3]",children:a.name}),l.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[l.jsx("span",{className:"text-[10px] text-[#8e979e] uppercase",children:a.pixel_type}),l.jsx("span",{className:"text-[10px] text-[#8e979e] font-mono",children:a.pixel_id})]})]})]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:()=>r(a),className:"p-1.5 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(Nr,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:()=>o(a.id),className:"p-1.5 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]})]},a.id)),t.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-6",children:"No tracking pixels configured. Add a Facebook pixel to track leads and conversions."})]})]})}var a1={exports:{}},l1={};/**
532 * @license React
533 * use-sync-external-store-shim.production.js
534 *
535 * Copyright (c) Meta Platforms, Inc. and affiliates.
536 *
537 * This source code is licensed under the MIT license found in the
538 * LICENSE file in the root directory of this source tree.
539 */var gi=N;function h5(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var p5=typeof Object.is=="function"?Object.is:h5,m5=gi.useState,g5=gi.useEffect,x5=gi.useLayoutEffect,y5=gi.useDebugValue;function v5(t,e){var n=e(),r=m5({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return x5(function(){s.value=n,s.getSnapshot=e,hd(s)&&i({inst:s})},[t,n,e]),g5(function(){return hd(s)&&i({inst:s}),t(function(){hd(s)&&i({inst:s})})},[t]),y5(n),n}function hd(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!p5(t,n)}catch{return!0}}function b5(t,e){return e()}var w5=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b5:v5;l1.useSyncExternalStore=gi.useSyncExternalStore!==void 0?gi.useSyncExternalStore:w5;a1.exports=l1;var Rp=a1.exports;function Ve(t){this.content=t}Ve.prototype={constructor:Ve,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new Ve(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ve(n)},addToStart:function(t,e){return new Ve([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ve(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new Ve(s)}
vendor: 5,144 bytes, line 539
539,forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ve.from(t),t.size?new Ve(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ve.from(t),t.size?new Ve(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ve.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ve.from=function(t){if(t instanceof Ve)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ve(e)};function c1(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=c1(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function u1(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),c=o.nodeSize;if(o==a){n-=c,r-=c;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let u=0,d=Math.min(o.text.length,a.text.length);for(;u<d&&o.text[o.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let u=u1(o.content,a.content,n-1,r-1);if(u)return u}n-=c,r-=c}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,a=0;a<n;o++){let c=this.content[o],u=a+c.nodeSize;if(u>e&&r(c,s+a,i||null,o)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),r,s+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,c)=>{let u=a.isText?a.text.slice(Math.max(e,c)-c,n-c):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new M(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],c=o+a.nodeSize;c>e&&((o<e||c>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=c}return new M(r,s)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new M(s,i)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return c1(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return u1(this,e,n,r)}findIndex(e){if(e==0)return Ka(0,e);if(e==this.size)return Ka(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?Ka(n+1,i):Ka(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return M.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const pd={index:0,offset:0};function Ka(t,e){return pd.index=t,pd.offset=e,pd}function rc(t,e){if(t===e)return!0;
vendor: 4,153 bytes, line 539
539if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!rc(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!rc(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ie=class Gf{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&rc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Gf.none;if(e instanceof Gf)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};ie.none=[];class sc extends Error{}class B{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=f1(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,n){return new B(d1(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return B.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(M.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new B(e,r,s)}}B.empty=new B(M.empty,0,0);function d1(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(d1(i.content,e-s-1,n-s-1)))}function f1(t,e,n,r,s,i){let{index:o,offset:a}=t.findIndex(e),c=t.maybeChild(o);if(a==e||c.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=f1(c.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,c);return u&&t.replaceChild(o,c.copy(u))}function k5(t,e,n){if(n.openStart>t.depth)throw new sc("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sc("Inconsistent open depths");return h1(t,e,n,0)}function h1(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=h1(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return ss(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=N5(n,t);return ss(i,m1(t,o,a,e,r))}else return ss(i,ic(t,e,r))}function p1(t,e){if(!e.type.compatibleContent(t.type))throw new sc("Cannot join "+e.type.n
vendor: 21,987 bytes, lines 539-540
539ame+" onto "+t.type.name)}function Xf(t,e,n){let r=t.node(n);return p1(r,e.node(n)),r}function rs(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function yo(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(rs(t.nodeAfter,r),i++));for(let a=i;a<o;a++)rs(s.child(a),r);e&&e.depth==n&&e.textOffset&&rs(e.nodeBefore,r)}function ss(t,e){return t.type.checkContent(e),t.copy(e)}function m1(t,e,n,r,s){let i=t.depth>s&&Xf(t,e,s+1),o=r.depth>s&&Xf(n,r,s+1),a=[];return yo(null,t,s,a),i&&o&&e.index(s)==n.index(s)?(p1(i,o),rs(ss(i,m1(t,e,n,r,s+1)),a)):(i&&rs(ss(i,ic(t,e,s+1)),a),yo(e,n,s,a),o&&rs(ss(o,ic(n,r,s+1)),a)),yo(r,null,s,a),new M(a)}function ic(t,e,n){let r=[];if(yo(null,t,n,r),t.depth>n){let s=Xf(t,e,n+1);rs(ss(s,ic(t,e,n+1)),r)}return yo(e,null,n,r),new M(r)}function N5(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(M.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Go{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ie.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new oc(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:a,offset:c}=o.content.findIndex(i),u=i-c;if(r.push(o,a,s+c),!u||(o=o.child(a),o.isText))break;i=u-1,s+=c+1}return new Go(n,r,i)}static resolveCached(e,n){let r=lx.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else lx.set(e,r=new j5);let s=r.elts[r.i]=Go.resolve(e,n);return r.i=(r.i+1)%_5,s}}class j5{constructor(){this.elts=[],this.i=0}}const _5=12,lx=new WeakMap;class oc{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const S5=Object.create(null);class an{constructor(e,n,r,s=ie.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&rc(this.attrs,n||e.defaultAttrs||S5)&&ie.sameSet(this.marks,r||ie.none)}copy(e=null){return e==this.content?this:new an(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new an(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return B.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),u=s.node(o).content.cut(s.pos-a,i.pos-a);return new B(u,s.depth-o,i.depth-o)}replace(e,n,r){return k5(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return Go.resolveCached(this,e)}resolveNoCache(e){return Go.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),g1(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let c=s;c<i;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ie.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ie.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=M.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}an.prototype.text=void 0;class ac extends an{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):g1(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ac(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ac(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function g1(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ms{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new C5(e,n);if(r.next==null)return ms.empty;let s=x1(r);r.next&&r.err("Unexpected trailing text");let i=I5(P5(s));return R5(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,a){let c=o.matchFragment(e,r);if(c&&(!n||c.validEnd))return M.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:f}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let h=i(f,a.concat(d));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:c}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
540`)}}ms.empty=new ms(!0);class C5{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function x1(t){let e=[];do e.push(E5(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function E5(t){let e=[];do e.push(T5(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function T5(t){let e=O5(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=A5(t,e);else break;return e}function cx(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function A5(t,e){let n=cx(t),r=n;return t.eat(",")&&(t.next!="}"?r=cx(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function M5(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function O5(t){if(t.eat("(")){let e=x1(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=M5(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function P5(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,c){let u={term:c,to:a};return e[o].push(u),u}function s(o,a){o.forEach(c=>c.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((c,u)=>c.concat(i(u,a)),[]);if(o.type=="seq")for(let c=0;;c++){let u=i(o.exprs[c],a);if(c==o.exprs.length-1)return u;s(u,a=n())}else if(o.type=="star"){let c=n();return r(a,c),s(i(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=n();return s(i(o.expr,a),c),s(i(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let c=a;for(let u=0;u<o.min;u++){let d=n();s(i(o.expr,c),d),c=d}if(o.max==-1)s(i(o.expr,c),c);else for(let u=o.min;u<o.max;u++){let d=n();r(c,d),s(i(o.expr,c),d),c=d}return[r(c)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function y1(t,e){return e-t}function ux(t,e){let n=[];return r(e),n.sort(y1);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:c}=i[o];!a&&n.indexOf(c)==-1&&r(c)}}}function I5(t){let e=Object.create(null);return n(ux(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:c})=>{if(!a)return;let u;for(let d=0;d<s.length;d++)s[d][0]==a&&(u=s[d][1]);ux(t,c).forEach(d=>{u||s.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new ms(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(y1);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function R5(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:c,next:u}=s.next[a];o.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function v1(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function b1(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function w1(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function k1(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new D5(t,r,e[r]);return n}let dx=class N1{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=k1(e,r.attrs),this.defaultAttrs=v1(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ms.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:b1(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new an(this,this.computeAttrs(e),M.from(n),ie.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new an(this,this.computeAttrs(e),n,ie.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(M.empty,!0);return i?new an(this,e,n.append(i),ie.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){w1(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ie.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new N1(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function L5(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class D5{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?L5(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class gu{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=k1(e,s.attrs),this.excluded=null;let i=v1(this.attrs);this.instance=i?new ie(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ie(this,b1(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new gu(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){w1(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class j1{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Ve.from(e.nodes),n.marks=Ve.from(e.marks||{}),this.nodes=dx.compile(this.spec.nodes,this),this.marks=gu.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=ms.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?fx(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:fx(this,o.split(" "))}this.nodeFromJSON=s=>an.fromJSON(this,s),this.markFromJSON=s=>ie.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof dx){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new ac(r,r.defaultAttrs,e,ie.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function fx(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let c=t.marks[a];(s=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function $5(t){return t.tag!=null}function z5(t){return t.style!=null}class gr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];
vendor: 6,240 bytes, lines 540-542
540n.forEach(s=>{if($5(s))this.tags.push(s);else if(z5(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new px(this,n,!1);return r.addAll(e,ie.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new px(this,n,!0);return r.addAll(e,ie.none,n.from,n.to),B.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(U5(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let c=o.getAttrs(n);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=mx(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=mx(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gr(e,gr.schemaRules(e)))}}const _1={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},B5={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},S1={ol:!0,ul:!0},Xo=1,Yf=2,vo=4;function hx(t,e,n){return e!=null?(e?Xo:0)|(e==="full"?Yf:0):t&&t.whitespace=="pre"?Xo|Yf:n&~vo}class Ja{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=ie.none,this.match=i||(o&vo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Xo)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!_1.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class px{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=hx(null,n.preserveWhitespace,0)|(r?vo:0);s?i=new Ja(s.type,s.attrs,ie.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Ja(null,null,ie.none,!0,null,o):i=new Ja(e.schema.topNodeType,null,ie.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&Yf?"full":this.localPreserveWS||(s.options&Xo)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
541`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let c=0;c<a.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[c]&&this.insertNode(o.text(a[c]),n,!/\S/.test(a[c]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],c=e.previousSibling;(!a||c&&c.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;S1.hasOwnProperty(o)&&this.parser.normalizeLists&&F5(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:B5.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let u,d=this.needsBlock;if(_1.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=c&&c.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,c,u,c.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
542`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let c=this.parser.matchStyle(i,o,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(u=>!c.clearMark(u)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return n}addElementByRule(e,n,r,s){let i,o;
vendor: 4,119 bytes, line 542
542if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(o,n.attrs||null,r,n.preserveWhitespace);c&&(i=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let c=this.nodes[o],u=c.findWrapping(e);if(u&&(!s||s.length>u.length+a)&&(s=u,i=c,!u.length))break;if(c.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ie.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):gx(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=hx(e,i,o.options);o.options&vo&&o.content.length==0&&(a|=vo);let c=ie.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):gx(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new Ja(e,n,c,s,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Xo)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,c)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;c>=i;c--)if(o(a-1,c))return!0;return!1}else{let d=c>0||c==0&&s?this.nodes[c].type:r&&c>=i?r.node(c-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;c--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];
vendor: 4,471 bytes, line 542
542if(r.isTextblock&&r.defaultAttrs)return r}}}function F5(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&S1.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function U5(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function mx(t){let e={};for(let n in t)e[n]=t[n];return e}function gx(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let c=0;c<a.edgeCount;c++){let{type:u,next:d}=a.edge(c);if(u==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class Ns{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ga(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,c=0;for(;a<i.length&&c<o.marks.length;){let u=o.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(i[a][0])||u.type.spec.spanning===!1)break;a++,c++}for(;a<i.length;)s=i.pop()[1];for(;c<o.marks.length;){let u=o.marks[c++],d=this.serializeMark(u,o.isInline,n);d&&(i.push([u,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Ga(n).createTextNode(e.text);let{dom:r,contentDOM:s}=wl(Ga(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&wl(Ga(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:wl(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ns(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=xx(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return xx(e.marks)}}function xx(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ga(t){return t.document||window.document}const yx=new WeakMap;function V5(t){let e=yx.get(t);return e===void 0&&yx.set(t,e=H5(t)),e}function H5(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function wl(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=V5(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,c=n?t.createElementNS(n,s):t.createElement(s),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let h=f.indexOf(" ");h>0?c.setAttributeNS(f.slice(0,h),f.slice(h+1),u[f]):f=="style"&&c.style?c.style.cssText=u[f]:c.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else if(typeof h=="string")c.appendChild(t.createTextNode(h));else{let{dom:p,contentDOM:m}=wl(t,h,n,r);if(c.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:c,contentDOM:a}}const C1=65535,E1=Math.pow(2,16);function q5(t,e){return t+e*E1}function vx(t){return t&C1}function W5(t){return(t-(t&C1))/E1}const T1=1,A1=2,kl=4,M1=8;class Qf{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&M1)>0}get deletedBefore(){return(this.delInfo&(T1|kl))>0}get deletedAfter(){return(this.delInfo&(A1|kl))>0}get deletedAcross(){return(this.delInfo&kl)>0}}class St{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&St.empty)return St.empty}recover(e){let n=0,r=vx(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+W5(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;
vendor: 5,290 bytes, line 542
542for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?s:0);if(c>e)break;let u=this.ranges[a+i],d=this.ranges[a+o],f=c+u;if(e<=f){let h=u?e==c?-1:e==f?1:n:n,p=c+s+(h<0?0:d);if(r)return p;let m=e==(n<0?c:f)?null:q5(a/3,e-c),g=e==c?A1:e==f?T1:kl;return(n<0?e!=c:e!=f)&&(g|=M1),new Qf(p,g,m)}s+=d-u}return r?e+s:new Qf(e+s,0,null)}touches(e,n){let r=0,s=vx(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[a+i],d=c+u;if(e<=d&&a==s*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),c=o+(this.inverted?0:i),u=this.ranges[s+n],d=this.ranges[s+r];e(a,a+u,c,c+d),i+=d-u}}invert(){return new St(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?St.empty:new St(e<0?[0,-e,0]:[0,0,e])}}St.empty=new St([]);class Yo{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Yo(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Yo;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,n);if(a.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new Qf(e,s,null)}}const md=Object.create(null);class rt{getMap(){return St.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=md[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in md)throw new RangeError("Duplicate use of step JSON ID "+e);return md[e]=n,n.prototype.jsonID=e,n}}class Ee{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ee(e,null)}static fail(e){return new Ee(null,e)}static fromReplace(e,n,r,s){try{return Ee.ok(e.replace(n,r,s))}catch(i){if(i instanceof sc)return Ee.fail(i.message);throw i}}}function Lp(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(Lp(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return M.fromArray(r)}class sr extends rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new B(Lp(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return Ee.fromReplace(e,this.from,this.to,i)}invert(){return new rn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sr(n.pos,r.pos,this.mark)}merge(e){return e instanceof sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new sr(n.from,n.to,e.markFromJSON(n.mark))}}rt.jsonID("addMark",sr);class rn extends rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new B(Lp(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return Ee.fromReplace(e,this.from,this.to,r)}invert(){return new sr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new rn(n.pos,r.pos,this.mark)}merge(e){return e instanceof rn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new rn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new rn(n.from,n.to,e.markFromJSON(n.mark))}}rt.jsonID("removeMark",rn);class ir extends rt{constructor(e,n){super(),this.pos=e,this.mark=n}
vendor: 5,626 bytes, line 542
542apply(e){let n=e.nodeAt(this.pos);if(!n)return Ee.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ee.fromReplace(e,this.pos,this.pos+1,new B(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new ir(this.pos,n.marks[s]);return new ir(this.pos,this.mark)}}return new gs(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ir(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ir(n.pos,e.markFromJSON(n.mark))}}rt.jsonID("addNodeMark",ir);class gs extends rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ee.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ee.fromReplace(e,this.pos,this.pos+1,new B(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ir(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new gs(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new gs(n.pos,e.markFromJSON(n.mark))}}rt.jsonID("removeNodeMark",gs);class Se extends rt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Zf(e,this.from,this.to)?Ee.fail("Structure replace would overwrite content"):Ee.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new St([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Se.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Se(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Se)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Se(n.from,n.to,B.fromJSON(e,n.slice),!!n.structure)}}Se.MAP_BIAS=1;rt.jsonID("replace",Se);class Be extends rt{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Zf(e,this.from,this.gapFrom)||Zf(e,this.gapTo,this.to)))return Ee.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ee.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ee.fromReplace(e,this.from,this.to,r):Ee.fail("Content does not fit in gap")}getMap(){return new St([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new Be(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Be(n.from,n.to,n.gapFrom,n.gapTo,B.fromJSON(e,n.slice),n.insert,!!n.structure)}}rt.jsonID("replaceAround",Be);function Zf(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function K5(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(c,u,d)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+c.nodeSize,n),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(o&&o.to==h&&o.mark.eq(f[g])?o.to=p:s.push(o=new rn(h,p,f[g])));a&&a.to==h?a.to=p:i.push(a=new sr(h,p,r))}}
vendor: 14,955 bytes, lines 542-543
542),s.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function J5(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let c=null;if(r instanceof gu){let u=o.marks,d;for(;d=r.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let u=Math.min(a+o.nodeSize,n);for(let d=0;d<c.length;d++){let f=c[d],h;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&f.eq(s[p].style)&&(h=m)}h?(h.to=u,h.step=i):s.push({style:f,from:Math.max(a,e),to:u,step:i})}}}),s.forEach(o=>t.step(new rn(o.from,o.to,o.style)))}function Dp(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let c=0;c<i.childCount;c++){let u=i.child(c),d=a+u.nodeSize,f=r.matchType(u.type);if(!f)o.push(new Se(a,d,B.empty));else{r=f;for(let h=0;h<u.marks.length;h++)n.allowsMarkType(u.marks[h].type)||t.step(new rn(a,d,u.marks[h]));if(s&&u.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(u.text);)m||(m=new B(M.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new Se(a+h.index,a+h.index+h[0].length,m))}}a=d}if(!r.validEnd){let c=r.fillBefore(M.empty,!0);t.replace(a,a,new B(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function G5(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Oi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+s,c=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(a,c,n))return r;if(r==0||o.type.spec.isolating||!G5(o,a,c))break;a&&(s=1),c<o.childCount&&(i=1)}return null}function X5(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),c=o,u=a,d=M.empty,f=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,d=M.from(r.node(m).copy(d)),f++):c--;let h=M.empty,p=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,h=M.from(s.node(m).copy(h)),p++):u++;t.step(new Be(c,u,o,a,new B(d.append(h),f,p),d.size-f,!0))}function $p(t,e,n=null,r=t){let s=Y5(t,e),i=s&&Q5(r,e);return i?s.map(bx).concat({type:e,attrs:n}).concat(i.map(bx)):null}function bx(t){return{type:t,attrs:null}}function Y5(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function Q5(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;c&&u<s;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:o}function Z5(t,e,n){let r=M.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Be(s,i,s,i,new B(r,0,0),n.length,!0))}function e9(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let c=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,c)&&t9(t.doc,t.mapping.slice(i).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&P1(t,o,a,i),Dp(t,t.mapping.slice(i).map(a,1),r,void 0,u===null);let d=t.mapping.slice(i),f=d.map(a,1),h=d.map(a+o.nodeSize,1);return t.step(new Be(f,h,f+1,h-1,new B(M.from(r.create(c,null,o.marks)),0,0),1,!0)),u===!0&&O1(t,o,a,i),!1}})}function O1(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let c=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function P1(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
543`))}})}function t9(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function n9(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Be(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new B(M.from(o),0,0),1,!0))}function ii(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,d=n-2;u>i;u--,d--){let f=s.node(u),h=s.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let a=s.indexAfter(i),c=r&&r[0];return s.node(i).canReplaceWith(a,a,c?c.type:s.node(i+1).type)}function r9(t,e,n=1,r){let s=t.doc.resolve(e),i=M.empty,o=M.empty;for(let a=s.depth,c=s.depth-n,u=n-1;a>c;a--,u--){i=M.from(s.node(a).copy(i));let d=r&&r[u];o=M.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}t.step(new Se(e,e,new B(i.append(o),n,n),!0))}function Pr(t,e){let n=t.resolve(e),r=n.index();return I1(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function s9(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function I1(t,e){return!!(t&&e&&!t.isLeaf&&s9(t,e))}function xu(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&I1(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function i9(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",f=!!o.contentMatch.matchType(s);d&&!f?r=!1:!d&&f&&(r=!0)}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);P1(t,d.node(),d.before(),a)}o.inlineContent&&Dp(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let c=t.mapping.slice(a),u=c.map(e-n);if(t.step(new Se(u,c.map(e+n,-1),B.empty,!0)),r===!0){let d=t.doc.resolve(u);O1(t,d.node(),d.before(),t.steps.length)}return t}function o9(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function R1(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(a>0?1:0),u=r.node(o),d=!1;if(i==1)d=u.canReplace(c,c,s);else{let f=u.contentMatchAt(c).findWrapping(s.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function yu(t,e,n=e,r=B.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return L1(s,i,r)?new Se(e,n,r):new a9(s,i,r).fit()}function L1(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class a9{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=M.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let c=new B(i,o,a);return e>-1?new Be(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Se(r.pos,s.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=gd(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:u}=this.frontier[a],d,f=null;if(n==1&&(o?u.matchType(o.type)||(f=u.fillBefore(M.from(o),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:f};if(n==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=gd(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new B(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=gd(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new B(eo(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new B(eo(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,a=r?r.content:o.content,c=o.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)d.push(s.child(g));f=f.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let g=a.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||c==0||g.content.size)&&(f=y,d.push(D1(g.mark(h.allowedMarks(g.marks)),u==1?c:0,u==a.childCount?p:-1)))}let m=u==a.childCount;m||(p=-1),this.placed=to(this.placed,n,M.from(d)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<p;g++){let x=y.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),y=x.content}this.unplaced=m?e==0?B.empty:new B(eo(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new B(eo(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!xd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=xd(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:c,type:u}=this.frontier[a],d=xd(e,a,u,c,!0);if(!d||d.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=to(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=to(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=to(this.placed,this.frontier.length,n))}}function eo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(eo(t.firstChild.content,e-1,n)))}function to(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(to(t.lastChild.content,e-1,n)))}function gd(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function D1(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,D1(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),t.copy(r)}function xd(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!l9(n,i.content,o)?a:null}function l9(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function c9(t){return t.spec.defining||t.spec.definingForContent}function u9(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(L1(s,i,r))return t.step(new Se(e,n,r));let o=z1(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,p=s.pos-1;h>0;h--,p--){let m=s.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==p&&o.splice(1,0,-h)}let c=o.indexOf(a),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=c9(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(a)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=u[p];if(m)for(let g=0;g<o.length;g++){let y=o[(g+c)%o.length],x=!0;y<0&&(x=!1,y=-y);let v=s.node(y-1),b=s.index(y-1);if(v.canReplaceWith(b,b,m.type,m.marks))return t.replace(s.before(y),x?i.after(y):n,new B($1(r.content,0,r.openStart,p),p,r.openEnd))}}let f=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let p=o[h];p<0||(e=s.before(p),n=i.after(p))}}function $1(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy($1(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(M.empty,!0))}return t}function d9(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=o9(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new B(M.from(r),0,0))}function f9(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let c=r.depth;c>o;
vendor: 4,140 bytes, line 543
543c--)r.node(c).type.spec.isolating&&(a=!0);for(let c=s.depth;c>o;c--)s.node(c).type.spec.isolating&&(a=!0);if(!a){for(let c=r.depth;c>0&&e==r.start(c);c--)e=r.before(c);for(let c=s.depth;c>0&&n==s.start(c);c--)n=s.before(c);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=z1(r,s);for(let o=0;o<i.length;o++){let a=i[o],c=o==i.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function z1(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class oi extends rt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ee.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Ee.fromReplace(e,this.pos,this.pos+1,new B(M.from(s),0,n.isLeaf?0:1))}getMap(){return St.empty}invert(e){return new oi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new oi(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new oi(n.pos,n.attr,n.value)}}rt.jsonID("attr",oi);class Qo extends rt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Ee.ok(r)}getMap(){return St.empty}invert(e){return new Qo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qo(n.attr,n.value)}}rt.jsonID("docAttr",Qo);let xi=class extends Error{};xi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};xi.prototype=Object.create(Error.prototype);xi.prototype.constructor=xi;xi.prototype.name="TransformError";class B1{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Yo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new xi(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,a,c)=>{e=Math.min(e,a),n=Math.max(n,c)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=B.empty){let s=yu(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new B(M.from(r),0,0))}delete(e,n){return this.replace(e,n,B.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return u9(this,e,n,r),this}replaceRangeWith(e,n,r){return d9(this,e,n,r),this}deleteRange(e,n){return f9(this,e,n),this}lift(e,n){return X5(this,e,n),this}join(e,n=1){return i9(this,e,n),this}wrap(e,n){return Z5(this,e,n),this}setBlockType(e,n=e,r,s=null){return e9(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return n9(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new oi(e,n,r)),this}setDocAttribute(e,n){return this.step(new Qo(e,n)),this}addNodeMark(e,n){return this.step(new ir(e,n)),this}
vendor: 5,070 bytes, line 543
543removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ie)n.isInSet(r.marks)&&this.step(new gs(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new gs(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return r9(this,e,n,r),this}addMark(e,n,r){return K5(this,e,n,r),this}removeMark(e,n,r){return J5(this,e,n,r),this}clearIncompatible(e,n,r){return Dp(this,e,n,r),this}}const yd=Object.create(null);class X{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new h9(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=B.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:c,$to:u}=o[a],d=e.mapping.slice(i);e.replaceRange(d.map(c.pos),d.map(u.pos),a?B.empty:n),a==0&&Nx(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],c=e.mapping.slice(r),u=c.map(o.pos),d=c.map(a.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,n),Nx(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new W(e):Ds(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?Ds(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Ds(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Ds(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Ds(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=yd[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in yd)throw new RangeError("Duplicate use of selection JSON ID "+e);return yd[e]=n,n.prototype.jsonID=e,n}getBookmark(){return W.between(this.$anchor,this.$head).getBookmark()}}X.prototype.visible=!0;class h9{constructor(e,n){this.$from=e,this.$to=n}}let wx=!1;function kx(t){!wx&&!t.parent.inlineContent&&(wx=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class W extends X{constructor(e,n=e){kx(e),kx(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return X.near(r);let s=e.resolve(n.map(this.anchor));return new W(s.parent.inlineContent?s:r,r)}replace(e,n=B.empty){if(super.replace(e,n),n==B.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof W&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new vu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new W(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=X.findFrom(n,r,!0)||X.findFrom(n,-r,!0);if(i)n=i.$head;else return X.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(X.findFrom(e,-r,!0)||X.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new W(e,n)}}X.jsonID("text",W);class vu{constructor(e,n){this.anchor=e,this.head=n}map(e){return new vu(e.map(this.anchor),e.map(this.head))}resolve(e){return W.between(e.resolve(this.anchor),e.resolve(this.head))}}class H extends X{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?X.near(i):new H(i)}content(){return new B(M.from(this.node),0,0)}eq(e){return e instanceof H&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new zp(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new H(e.resolve(n.anchor))}static create(e,n){return new H(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}H.prototype.visible=!1;X.jsonID("node",H);class zp{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new vu(r,r):new zp(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&H.isSelectable(r)?new H(n):X.near(n)}}class Bt extends X{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}
vendor: 4,233 bytes, line 543
543replace(e,n=B.empty){if(n==B.empty){e.delete(0,e.doc.content.size);let r=X.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return p9}}X.jsonID("all",Bt);const p9={map(){return this},resolve(t){return new Bt(t)}};function Ds(t,e,n,r,s,i=!1){if(e.inlineContent)return W.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&H.isSelectable(a))return H.create(t,n-(s<0?a.nodeSize:0))}else{let c=Ds(t,a,n+s,s<0?a.childCount:0,s,i);if(c)return c}n+=a.nodeSize*s}return null}function Nx(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Se||s instanceof Be))return;let i=t.mapping.maps[r],o;i.forEach((a,c,u,d)=>{o==null&&(o=d)}),t.setSelection(X.near(t.doc.resolve(o),n))}const jx=1,Xa=2,_x=4;class m9 extends B1{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|jx)&~Xa,this.storedMarks=null,this}get selectionSet(){return(this.updated&jx)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xa,this}ensureMarks(e){return ie.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Xa)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Xa,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ie.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(X.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=_x,this}get scrolledIntoView(){return(this.updated&_x)>0}}function Sx(t,e){return!e||!t?t:t.bind(e)}class no{constructor(e,n,r){this.name=e,this.init=Sx(n.init,r),this.apply=Sx(n.apply,r)}}const g9=[new no("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new no("selection",{init(t,e){return t.selection||X.atStart(e.doc)},apply(t){return t.selection}}),new no("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new no("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class vd{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=g9.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new no(r.key,r.spec.state,r))})}}class Qs{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}
vendor: 10,721 bytes, lines 543-544
543apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let c=s?s[o].n:0,u=s?s[o].state:this,d=c<n.length&&a.spec.appendTransaction.call(a,c?n.slice(c):n,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let f=0;f<this.config.plugins.length;f++)s.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Qs(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new m9(this)}static create(e){let n=new vd(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Qs(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new vd(this.schema,e.plugins),r=n.fields,s=new Qs(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new vd(e.schema,e.plugins),i=new Qs(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=an.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=X.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=u.fromJSON.call(c,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function F1(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=F1(s,e,{})),n[r]=s}return n}class ye{constructor(e){this.spec=e,this.props={},e.props&&F1(e.props,this,this.props),this.key=e.key?e.key.key:U1("plugin")}getState(e){return e[this.key]}}const bd=Object.create(null);function U1(t){return t in bd?t+"$"+ ++bd[t]:(bd[t]=0,t+"$")}class De{constructor(e="key"){this.key=U1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}function V1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const x9=(t,e,n)=>{let r=V1(t,n);if(!r)return!1;let s=Bp(r);if(!s){let o=r.blockRange(),a=o&&Oi(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(K1(t,s,e,-1))return!0;if(r.parent.content.size==0&&(yi(i,"end")||H.isSelectable(i)))for(let o=r.depth;;o--){let a=yu(t.doc,r.before(o),r.after(o),B.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=t.tr.step(a);c.setSelection(yi(i,"end")?X.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):H.create(c.doc,s.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},y9=(t,e,n)=>{let r=V1(t,n);if(!r)return!1;let s=Bp(r);return s?H1(t,s,e):!1},v9=(t,e,n)=>{let r=q1(t,n);if(!r)return!1;let s=Fp(r);return s?H1(t,s,e):!1};function H1(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,a=o,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let u=yu(t.doc,i,c,B.empty);if(!u||u.from!=i||u instanceof Se&&u.slice.size>=c-i)return!1;if(n){let d=t.tr.step(u);d.setSelection(W.create(d.doc,i)),n(d.scrollIntoView())}return!0}function yi(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const b9=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Bp(r)}let o=i&&i.nodeBefore;return!o||!H.isSelectable(o)?!1:(e&&e(t.tr.setSelection(H.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Bp(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function q1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const w9=(t,e,n)=>{let r=q1(t,n);if(!r)return!1;let s=Fp(r);if(!s)return!1;let i=s.nodeAfter;if(K1(t,s,e,1))return!0;if(r.parent.content.size==0&&(yi(i,"start")||H.isSelectable(i))){let o=yu(t.doc,r.before(),r.after(),B.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(yi(i,"start")?X.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):H.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},k9=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Fp(r)}let o=i&&i.nodeAfter;return!o||!H.isSelectable(o)?!1:(e&&e(t.tr.setSelection(H.create(t.doc,i.pos)).scrollIntoView()),!0)};function Fp(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const N9=(t,e)=>{let n=t.selection,r=n instanceof H,s;if(r){if(n.node.isTextblock||!Pr(t.doc,n.from))return!1;s=n.from}else if(s=xu(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(H.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},j9=(t,e)=>{let n=t.selection,r;if(n instanceof H){if(n.node.isTextblock||!Pr(t.doc,n.to))return!1;r=n.to}else if(r=xu(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},_9=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&Oi(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},S9=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
544`).scrollIntoView()),!0)};function W1(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const C9=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=W1(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),c=t.tr.replaceWith(a,a,o.createAndFill());c.setSelection(X.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},E9=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Bt||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=W1(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(W.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},T9=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ii(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Oi(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)},A9=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(H.create(t.doc,s))),!0)};function M9(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Pr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function K1(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,c=s.type.spec.isolating||i.type.spec.isolating;if(!c&&M9(t,e,n))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,m=M.empty;for(let x=o.length-1;x>=0;x--)m=M.from(o[x].create(null,m));m=M.from(s.copy(m));let g=t.tr.step(new Be(e.pos-1,p,e.pos,p,new B(m,1,0),o.length,!0)),y=g.doc.resolve(p+2*o.length);y.nodeAfter&&y.nodeAfter.type==s.type&&Pr(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&c?null:X.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&Oi(f);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(f,h).scrollIntoView()),!0;if(u&&yi(i,"start",!0)&&yi(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let x=M.empty;for(let b=m.length-1;b>=0;b--)x=M.from(m[b].copy(x));let v=t.tr.step(new Be(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new B(x,m.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function J1(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(W.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const O9=J1(-1),P9=J1(1);function I9(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&$p(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Cx(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(c,u)=>{if(s)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)s=!0;else{let d=n.doc.resolve(u),f=d.index();s=d.parent.canReplaceWith(f,f+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:c}}=n.selection.ranges[o];i.setBlockType(a,c,t,e)}
vendor: 4,845 bytes, line 544
544r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function R9(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return L9(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function L9(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=o.resolve(e.start-2);i=new oc(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new oc(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=$p(i,n,r,e);return a?(t&&D9(t,e,a,s,n),!0):!1}function D9(t,e,n,r,s){let i=M.empty;for(let d=n.length-1;d>=0;d--)i=M.from(n[d].type.create(n[d].attrs,i));t.step(new Be(e.start-(r?2:0),e.end,e.start,e.end,new B(i,0,0),n.length,!0));let o=0;for(let d=0;d<n.length;d++)n[d].type==s&&(o=d+1);let a=n.length-o,c=e.start+n.length-(r?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&ii(t.doc,c,a)&&(t.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return t}function $9(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?z9(e,n,t,i):B9(e,n,i):!0:!1}}function z9(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Be(i-1,o,i,o,new B(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new oc(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=Oi(r);if(a==null)return!1;s.lift(r,a);let c=s.doc.resolve(s.mapping.map(i,-1)-1);return Pr(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),e(s.scrollIntoView()),!0}function B9(t,e,n){let r=t.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,c=n.endIndex==s.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(a?0:1),d+1,o.content.append(c?M.empty:M.from(s))))return!1;let f=i.pos,h=f+o.nodeSize;return r.step(new Be(f-(a?1:0),h+(c?1:0),f+1,h-1,new B((a?M.empty:M.from(s.copy(M.empty))).append(c?M.empty:M.from(s.copy(M.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function F9(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,c=a.child(o-1);if(c.type!=t)return!1;if(n){let u=c.lastChild&&c.lastChild.type==a.type,d=M.from(u?t.create():null),f=new B(M.from(t.create(null,M.from(a.type.create(null,d)))),u?3:1,0),h=i.start,p=i.end;n(e.tr.step(new Be(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const He=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},vi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let eh=null;const Cn=function(t,e,n){let r=eh||(eh=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},U9=function(){eh=null},xs=function(t,e,n,r){return n&&(Ex(t,e,n,r,-1)||Ex(t,e,n,r,1))},V9=/^(img|br|input|textarea|hr)$/i;function Ex(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Dt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ka(t)||V9.test(t.nodeName)||t.contentEditable=="false")return!1;e=He(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Dt(t):0}else return!1}}function Dt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function H9(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Dt(t)}else if(t.parentNode&&!ka(t))e=He(t),t=t.parentNode;else return null}}function q9(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ka(t))e=He(t)+1,t=t.parentNode;else return null}}function W9(t,e,n){for(let r=e==0,s=e==Dt(t);r||s;){if(t==n)return!0;let i=He(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==Dt(t)}}function ka(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const bu=function(t){return t.focusNode&&xs(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Vr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function K9(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function J9(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);
vendor: 5,031 bytes, line 544
544if(r)return{node:r.offsetNode,offset:Math.min(Dt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Dt(r.startContainer),r.startOffset)}}}const yn=typeof navigator<"u"?navigator:null,Tx=typeof document<"u"?document:null,Ir=yn&&yn.userAgent||"",th=/Edge\/(\d+)/.exec(Ir),G1=/MSIE \d/.exec(Ir),nh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ir),kt=!!(G1||nh||th),xr=G1?document.documentMode:nh?+nh[1]:th?+th[1]:0,Ft=!kt&&/gecko\/(\d+)/i.test(Ir);Ft&&+(/Firefox\/(\d+)/.exec(Ir)||[0,0])[1];const rh=!kt&&/Chrome\/(\d+)/.exec(Ir),We=!!rh,X1=rh?+rh[1]:0,nt=!kt&&!!yn&&/Apple Computer/.test(yn.vendor),bi=nt&&(/Mobile\/\w+/.test(Ir)||!!yn&&yn.maxTouchPoints>2),It=bi||(yn?/Mac/.test(yn.platform):!1),Y1=yn?/Win/.test(yn.platform):!1,Mn=/Android \d/.test(Ir),Na=!!Tx&&"webkitFontSmoothing"in Tx.documentElement.style,G9=Na?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function X9(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function bn(t,e){return typeof t=="number"?t:t[e]}function Y9(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Ax(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=vi(o);continue}let a=o,c=a==i.body,u=c?X9(i):Y9(a),d=0,f=0;if(e.top<u.top+bn(r,"top")?f=-(u.top-e.top+bn(s,"top")):e.bottom>u.bottom-bn(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+bn(s,"top")-u.top:e.bottom-u.bottom+bn(s,"bottom")),e.left<u.left+bn(r,"left")?d=-(u.left-e.left+bn(s,"left")):e.right>u.right-bn(r,"right")&&(d=e.right-u.right+bn(s,"right")),d||f)if(c)i.defaultView.scrollBy(d,f);else{let p=a.scrollLeft,m=a.scrollTop;f&&(a.scrollTop+=f),d&&(a.scrollLeft+=d);let g=a.scrollLeft-p,y=a.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:vi(o)}}function Q9(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=n-20){r=a,s=c.top;break}}return{refDOM:r,refTop:s,stack:Q1(t.dom)}}function Q1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=vi(r));return e}function Z9({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Z1(n,r==0?0:r-e)}function Z1(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Ps=null;function eE(t){if(t.setActive)return t.setActive();if(Ps)return t.focus(Ps);let e=Q1(t);t.focus(Ps==null?{get preventScroll(){return Ps={preventScroll:!0},!0}}:void 0),Ps||(Ps=!1,Z1(e,0))}function ew(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,c,u;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Cn(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){n=d,r=g,s=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&c&&(n=c,s=u,r=0),n&&n.nodeType==3?tE(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:ew(n,s)}function tE(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=qn(r,1);if(o.top!=o.bottom&&Up(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Up(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function nE(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function rE(t,e,n){let{node:r,offset:s}=ew(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function sE(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&c.left>r.left||c.top>
vendor: 10,114 bytes, lines 544-545
544r.top?s=a.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function tw(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(Up(e,u))return tw(o,e,u)}}if((i=(i+1)%r)==s)break}return t}function iE(t,e){let n=t.dom.ownerDocument,r,s=0,i=J9(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!Up(e,u)||(o=tw(t.dom,e,u),!o))return null}if(nt)for(let u=o;r&&u;u=vi(u))u.draggable&&(r=void 0);if(o=nE(o,e),r){if(Ft&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let d=r.childNodes[s],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&s++}let u;Na&&s&&r.nodeType==1&&(u=r.childNodes[s-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=sE(t,r,s,e))}a==null&&(a=rE(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Mx(t){return t.top<t.bottom||t.left<t.right}function qn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Mx(r))return r}return Array.prototype.find.call(n,Mx)||t.getBoundingClientRect()}const oE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function nw(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Na||Ft;if(r.nodeType==3)if(o&&(oE.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let c=qn(Cn(r,s,s),n);if(Ft&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=qn(Cn(r,s-1,s-1),-1);if(u.top==c.top){let d=qn(Cn(r,s,s+1),-1);if(d.top!=c.top)return Ui(d,d.left<u.left)}}return c}else{let c=s,u=s,d=n<0?1:-1;return n<0&&!s?(u++,d=-1):n>=0&&s==r.nodeValue.length?(c--,d=1):n<0?c--:u++,Ui(qn(Cn(r,c,u),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Dt(r))){let c=r.childNodes[s-1];if(c.nodeType==1)return wd(c.getBoundingClientRect(),!1)}if(i==null&&s<Dt(r)){let c=r.childNodes[s];if(c.nodeType==1)return wd(c.getBoundingClientRect(),!0)}return wd(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Dt(r))){let c=r.childNodes[s-1],u=c.nodeType==3?Cn(c,Dt(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return Ui(qn(u,1),!1)}if(i==null&&s<Dt(r)){let c=r.childNodes[s];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?Cn(c,0,o?0:1):c.nodeType==1?c:null:null;if(u)return Ui(qn(u,-1),!0)}return Ui(qn(r.nodeType==3?Cn(r):r,-n),n>=0)}function Ui(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function wd(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function rw(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function aE(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return rw(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=nw(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=Cn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(n=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const lE=/[\u0590-\u08ac]/;function cE(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!lE.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:rw(t,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&u==g;try{a.collapse(d,f),c&&(c!=d||u!=f)&&a.extend&&a.extend(c,u)}catch{}return h!=null&&(a.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Ox=null,Px=null,Ix=!1;function uE(t,e,n){return Ox==e&&Px==n?Ix:(Ox=e,Px=n,Ix=n=="up"||n=="down"?aE(t,e,n):cE(t,e,n))}const Ut=0,Rx=1,Kr=2,vn=3;class ja{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Ut,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>He(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof iw){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof sw&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?He(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?He(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let c=this.children[a],u=o+c.size;if(s==-1&&e<=u){let d=o+c.border;if(e>=d&&n<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,d);e=o;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=He(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(u>n||a==this.children.length-1)){n=u;for(let d=a+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=He(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(i>m&&o<y)return g.setSelection(e-m-g.border,n-m-g.border,r,s);m=y}let a=this.domFromPos(e,e?-1:1),c=n==e?a:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),f=!1;if((Ft||nt)&&e==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
545`),f&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=c={node:y.parentNode,offset:He(y)+1});break}
vendor: 4,470 bytes, line 545
545let x=g.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ft&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||f&&nt)&&xs(a.node,a.offset,d.anchorNode,d.anchorOffset)&&xs(c.node,c.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==n)&&!(f&&Ft)){u.collapse(a.node,a.offset);try{e!=n&&u.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>n){let m=a;a=c,c=m}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+i.border,c=o-i.border;if(e>=a&&n<=c){this.dirty=e==r||n==o?Kr:Rx,e==a&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=vn:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Kr:vn}r=o}this.dirty=Kr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Kr:Rx;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class sw extends ja{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Ut&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class dE extends ja{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ys extends ja{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Ns.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ys(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&vn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=vn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ut){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ut}}slice(e,n,r){let s=ys.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=ih(i,n,o,r)),e>0&&(i=ih(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class yr extends ja{constructor(e,n,r,s,i,o,a,c,u){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],c,u=a&&a(n,i,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,s),d=u&&u.dom,f=u&&u.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=Ns.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let h=d;return d=lw(d,r,n),u?c=new fE(e,n,r,s,d,f||null,h,u,i,o+1):n.isText?new wu(e,n,r,s,d,h,i):new yr(e,n,r,s,d,f||null,h,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;
vendor: 5,106 bytes, line 545
545let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,n,r){return this.dirty==Ut&&e.eq(this.node)&&lc(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,c=new pE(this,o&&o.node,e);xE(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?c.syncToMarks(u.spec.marks,r,e,d):u.type.side>=0&&!f&&c.syncToMarks(d==this.node.childCount?ie.none:this.node.child(d).marks,r,e,d),c.placeWidget(u,e,s)},(u,d,f,h)=>{c.syncToMarks(u.marks,r,e,h);let p;c.findNodeMatch(u,d,f,h)||a&&e.state.selection.from>s&&e.state.selection.to<s+u.nodeSize&&(p=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(u,d,f,p,e)||c.updateNextNode(u,d,f,e,h,s)||c.addNode(u,d,f,e,s),s+=u.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Kr)&&(o&&this.protectLocalComposition(e,o),ow(this.contentDOM,this.children,e),bi&&yE(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof W)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=vE(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new dE(this,i,n,s);e.input.compositionNodes.push(o),this.children=ih(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==vn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Ut}updateOuterDeco(e){if(lc(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=aw(this.dom,this.nodeDOM,sh(this.outerDeco,this.node,n),sh(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Lx(t,e,n,r,s){lw(r,e,t);let i=new yr(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class wu extends yr{constructor(e,n,r,s,i,o,a){super(e,n,r,s,i,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==vn||this.dirty!=Ut&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ut||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Ut,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new wu(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=vn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class iw extends ja{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ut&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class fE extends yr{constructor(e,n,r,s,i,o,a,c,u,d){super(e,n,r,s,i,o,a,u,d),this.spec=c}update(e,n,r,s){if(this.dirty==vn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}
vendor: 7,882 bytes, line 545
545setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ow(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Dx(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof ys){let c=r?r.previousSibling:t.lastChild;ow(o.contentDOM,o.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=Dx(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const bo=function(t){t&&(this.nodeName=t)};bo.prototype=Object.create(null);const Jr=[new bo];function sh(t,e,n){if(t.length==0)return Jr;let r=n?Jr[0]:new bo,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new bo(o.nodeName));for(let a in o){let c=o[a];c!=null&&(n&&s.length==1&&s.push(r=new bo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return s}function aw(t,e,n,r){if(n==Jr&&r==Jr)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let c;a&&a.nodeName==o.nodeName&&s!=t&&(c=s.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(s),a=Jr[0]),s=c}hE(s,a||Jr[0],o)}return s}function hE(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function lw(t,e,n){return aw(t,t,Jr,sh(e,n,t.nodeType!=1))}function lc(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Dx(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class pE{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=mE(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Ut,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,u=this.top.children.length;s<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=ys.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let u=this.top.children[a];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==vn&&o.dom==o.contentDOM&&(o.dirty=Kr),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof yr){let u=this.preMatch.matched.get(c);if(u!=null&&u!=i)return!1;let d=c.dom,f,h=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=vn&&lc(n,c.outerDeco));if(!h&&c.update(e,n,r,s))return this.destroyBetween(this.index,a),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Kr,f.updateChildren(s,o+1),f.dirty=Ut),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!lc(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=yr.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=yr.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new sw(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ys;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof wu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((nt||We)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new iw(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function mE(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof ys)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=a.node;if(c){if(c!=t.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function gE(t,e){return t.type.side-e.type.side}function xE(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let u=0;u<t.childCount;u++){let d=t.child(u);r(d,s,e.forChild(i,d),u),i+=d.nodeSize}return}let o=0,a=[],c=null;for(let u=0;;){let d,f;for(;o<s.length&&s[o].to==i;){let y=s[o++];y.widget&&(d?(f||(f=[d])).push(y):d=y)}if(d)if(f){f.sort(gE);for(let y=0;y<f.length;y++)n(f[y],u,!!c)}else n(d,u,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(u<t.childCount)p=u,h=t.child(u++);else break;for(let y=0;y<a.length;y++)a[y].to<=i&&a.splice(y--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let m=i+h.nodeSize;if(h.isText){let y=m;o<s.length&&s[o].from<y&&(y=s[o].from);for(let x=0;x<a.length;x++)a[x].to<y&&(y=a[x].to);y<m&&(c=h.cut(y-i),h=h.cut(0,y-i),m=y,p=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=h.isInline&&!h.isLeaf?a.filter(y=>!y.inline):a.slice();r(h,g,e.forChild(i,h),p),i=m}}
vendor: 9,532 bytes, line 545
545function yE(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function vE(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let c=o.text;for(;s<t.childCount;){let u=t.child(s++);if(i+=u.nodeSize,!u.isText)break;c+=u.text}if(i>=n){if(i>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?c.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function ih(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let c=t[o],u=a,d=a+=c.size;u>=n||d<=e?i.push(c):(u<e&&i.push(c.slice(0,e-u,r)),s&&(i.push(s),s=void 0),d>n&&i.push(c.slice(n-u,c.size,r)))}return i}function Vp(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),c,u;if(bu(n)){for(c=o;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&H.isSelectable(f)&&s.parent&&!(f.isInline&&W9(n.focusNode,n.focusOffset,s.dom))){let h=s.posBefore;u=new H(o==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=o,h=o;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,o]=h==t.state.selection.anchor?[h,f]:[f,h],a=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!u){let f=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;u=Hp(t,d,a,f)}return u}function cw(t){return t.editable?t.hasFocus():dw(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Pn(t,e=!1){let n=t.state.selection;if(uw(t,n),!!cw(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&We){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&xs(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)wE(t);else{let{anchor:r,head:s}=n,i,o;$x&&!(n instanceof W)&&(n.$from.parent.inlineContent||(i=zx(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=zx(t,n.to))),t.docView.setSelection(r,s,t,e),$x&&(i&&Bx(i),o&&Bx(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&bE(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const $x=nt||We&&X1<63;function zx(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(nt&&s&&s.contentEditable=="false")return kd(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return kd(s);if(i)return kd(i)}}function kd(t){return t.contentEditable="true",nt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Bx(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function bE(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!cw(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function wE(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,He(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&kt&&xr<=11&&(n.disabled=!0,n.disabled=!1)}function uw(t,e){if(e instanceof H){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Fx(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Fx(t)}function Fx(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Hp(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||W.between(e,n,r)}function Ux(t){return t.editable&&!t.hasFocus()?!1:dw(t)}function dw(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function kE(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return xs(e.node,e.offset,n.anchorNode,n.anchorOffset)}function oh(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&X.findFrom(i,e)}function Jn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Vx(t,e,n){let r=t.state.selection;if(r instanceof W)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Jn(t,new W(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=oh(t.state,e);return s&&s instanceof H?Jn(t,s):!1}else if(!(It&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?H.isSelectable(i)?Jn(t,new H(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Na?Jn(t,new W(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof H&&r.node.isInline)return Jn(t,new W(e>0?r.$to:r.$from));{let s=oh(t.state,e);return s?Jn(t,s):!1}}}function cc(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Is(t,e){return e<0?NE(t):jE(t)}function NE(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Ft&&n.nodeType==1&&r<cc(n)&&wo(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(wo(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(fw(n))break;{let a=n.previousSibling;for(;a&&wo(a,-1);)s=n.parentNode,i=He(a),a=a.previousSibling;if(a)n=a,r=cc(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?ah(t,n,r):s&&ah(t,s,i)}function jE(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=cc(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(wo(a,1))i=n,o=++r;else break}else{if(fw(n))break;{let a=n.nextSibling;for(;a&&wo(a,1);)i=a.parentNode,o=He(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=cc(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&ah(t,i,o)}function fw(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function _E(t,e){for(;t&&e==t.childNodes.length&&!ka(t);)e=He(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function SE(t,e){for(;t&&!e&&!ka(t);)e=He(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function ah(t,e,n){if(e.nodeType!=3){let i,o;(o=_E(e,n))?(e=o,n=0):(i=SE(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(bu(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Pn(t)},50)}function Hx(t,e){let n=t.state.doc.resolve(e);if(!(We||Y1)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function qx(t,e,n){let r=t.state.selection;if(r instanceof W&&!r.empty||n.indexOf("s")>-1||It&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=oh(t.state,e);if(o&&o instanceof H)return Jn(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Bt?X.near(o,e):X.findFrom(o,e);return a?Jn(t,a):!1}return!1}function Wx(t,e){if(!(t.state.selection instanceof W))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Kx(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function CE(t){if(!nt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Kx(t,r,"true"),setTimeout(()=>Kx(t,r,"false"),20)}return!1}function EE(t){let e="";
vendor: 4,149 bytes, lines 545-548
545return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function TE(t,e){let n=e.keyCode,r=EE(e);if(n==8||It&&n==72&&r=="c")return Wx(t,-1)||Is(t,-1);if(n==46&&!e.shiftKey||It&&n==68&&r=="c")return Wx(t,1)||Is(t,1);if(n==13||n==27)return!0;if(n==37||It&&n==66&&r=="c"){let s=n==37?Hx(t,t.state.selection.from)=="ltr"?-1:1:-1;return Vx(t,s,r)||Is(t,s)}else if(n==39||It&&n==70&&r=="c"){let s=n==39?Hx(t,t.state.selection.from)=="ltr"?1:-1:1;return Vx(t,s,r)||Is(t,s)}else{if(n==38||It&&n==80&&r=="c")return qx(t,-1,r)||Is(t,-1);if(n==40||It&&n==78&&r=="c")return CE(t)||qx(t,1,r)||Is(t,1);if(r==(It?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function qp(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||Ns.fromSchema(t.state.schema),a=yw(),c=a.createElement("div");c.appendChild(o.serializeFragment(r,{document:a}));let u=c.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=xw[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=a.createElement(d[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
546
547`);return{dom:c,text:h,slice:e}}function hw(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let c=!!e&&(r||i||!n);if(c){if(t.someProp("transformPastedText",h=>{e=h(e,i||r,t)}),i)return a=new B(M.from(t.state.schema.text(e.replace(/\r\n?/g,`
548`))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let f=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(f)a=f;else{let h=s.marks(),{schema:p}=t.state,m=Ns.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=PE(n),Na&&IE(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||gr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!AE.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=RE(Jx(a,+d[1],+d[2]),d[4]);else if(a=B.maxOpen(ME(a.content,s),!0),a.openStart||a.openEnd){let f=0,h=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=Jx(a,f,h)}return t.someProp("transformPasted",f=>{a=f(a,t,c)}),a}const AE=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ME(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let c=s.findWrapping(a.type),u;if(!c)return o=null;if(u=o.length&&i.length&&mw(c,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=gw(o[o.length-1],i.length));let d=pw(a,c);o.push(d),s=s.matchType(d.type),i=c}}),o)return M.from(o)}return t}function pw(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function mw(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=mw(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(M.from(pw(n,t,s+1))))}}function gw(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,gw(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}
vendor: 4,770 bytes, line 548
548function lh(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=lh(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Jx(t,e,n){return e<t.openStart&&(t=new B(lh(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new B(lh(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const xw={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Gx=null;function yw(){return Gx||(Gx=document.implementation.createHTMLDocument("title"))}let Nd=null;function OE(t){let e=window.trustedTypes;return e?(Nd||(Nd=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Nd.createHTML(t)):t}function PE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=yw().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&xw[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=OE(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function IE(t){let e=t.querySelectorAll(We?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function RE(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let c=n.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;s=M.from(c.create(r[a+1],s)),i++,o++}return new B(s,i,o)}const ut={},dt={},LE={touchstart:!0,touchmove:!0};class DE{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function $E(t){for(let e in ut){let n=ut[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{BE(t,r)&&!Wp(t,r)&&(t.editable||!(r.type in dt))&&n(t,r)},LE[e]?{passive:!0}:void 0)}nt&&t.dom.addEventListener("input",()=>null),ch(t)}function or(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function zE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ch(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Wp(t,r))})}function Wp(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function BE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function FE(t,e){!Wp(t,e)&&ut[e.type]&&(t.editable||!(e.type in dt))&&ut[e.type](t,e)}dt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!bw(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Mn&&We&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Vr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||TE(t,n)?n.preventDefault():or(t,"key")};dt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};dt.keypress=(t,e)=>{let n=e;if(bw(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||It&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof W)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function ku(t){return{left:t.clientX,top:t.clientY}}function UE(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}
vendor: 6,732 bytes, line 548
548function Kp(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function ai(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function VE(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&H.isSelectable(r)?(ai(t,new H(n)),!0):!1}function HE(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof H&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(H.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(ai(t,H.create(t.state.doc,s)),!0):!1}function qE(t,e,n,r,s){return Kp(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?HE(t,n):VE(t,n))}function WE(t,e,n,r){return Kp(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function KE(t,e,n,r){return Kp(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||JE(t,n,r)}function JE(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ai(t,W.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)ai(t,W.create(r,a+1,a+1+o.content.size));else if(H.isSelectable(o))ai(t,H.create(r,a));else continue;return!0}}function Jp(t){return uc(t)}const vw=It?"metaKey":"ctrlKey";ut.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Jp(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&UE(n,t.input.lastClick)&&!n[vw]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(ku(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new GE(t,o,n,!!r)):(i=="doubleClick"?WE:KE)(t,o.pos,o.inside,n)?n.preventDefault():or(t,"pointer"))};class GE{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[vw],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const a=s?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof H&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ft&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),or(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Pn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ku(e))),this.updateAllowDefault(e),this.allowDefault||!n?or(this.view,"pointer"):qE(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||nt&&this.mightDrag&&!this.mightDrag.node.isAtom||We&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ai(this.view,X.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):or(this.view,"pointer")}move(e){this.updateAllowDefault(e),or(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ut.touchstart=t=>{t.input.lastTouch=Date.now(),Jp(t),or(t,"pointer")};ut.touchmove=t=>{t.input.lastTouch=Date.now(),or(t,"pointer")};ut.contextmenu=t=>Jp(t);function bw(t,e){return t.composing?!0:nt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const XE=Mn?5e3:-1;dt.compositionstart=dt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof W&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||We&&Y1&&YE(t)))t.markCursor=t.state.storedMarks||n.marks(),uc(t,!0),t.markCursor=null;else if(uc(t,!e.selection.empty),Ft&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}ww(t,XE)};function YE(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}dt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,ww(t,20))};function ww(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>uc(t),e))}function kw(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=ZE());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function QE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;
vendor: 4,769 bytes, line 548
548let n=H9(e.focusNode,e.focusOffset),r=q9(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function ZE(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function uc(t,e=!1){if(!(Mn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),kw(t),e||t.docView&&t.docView.dirty){let n=Vp(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function eT(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Zo=kt&&xr<15||bi&&G9<604;ut.copy=dt.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Zo?null:n.clipboardData,o=r.content(),{dom:a,text:c}=qp(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):eT(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function tT(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function nT(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ea(t,r.value,null,s,e):ea(t,r.textContent,r.innerHTML,s,e)},50)}function ea(t,e,n,r,s){let i=hw(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,s,i||B.empty)))return!0;if(!i)return!1;let o=tT(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Nw(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}dt.paste=(t,e)=>{let n=e;if(t.composing&&!Mn)return;let r=Zo?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ea(t,Nw(r),r.getData("text/html"),s,n)?n.preventDefault():nT(t,n)};class jw{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const rT=It?"altKey":"ctrlKey";function _w(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[rT]}ut.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(ku(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof H?s.to-1:s.to))){if(r&&r.mightDrag)o=H.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=H.create(t.state.doc,f.posBefore))}}let a=(o||t.state.selection).content(),{dom:c,text:u,slice:d}=qp(t,a);(!n.dataTransfer.files.length||!We||X1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Zo?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Zo||n.dataTransfer.setData("text/plain",u),t.dragging=new jw(d,_w(t,n),o)};ut.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};dt.dragover=dt.dragenter=(t,e)=>e.preventDefault();dt.drop=(t,e)=>{try{sT(t,e,t.dragging)}finally{t.dragging=null}};function sT(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(ku(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=hw(t,Nw(e.dataTransfer),Zo?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&_w(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||B.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?R1(t.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let c=t.state.tr;if(o){let{node:p}=n;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&H.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new H(h));else{let p=c.mapping.map(a);
vendor: 9,400 bytes, line 548
548c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,x)=>p=x),c.setSelection(Hp(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}ut.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Pn(t)},20))};ut.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ut.beforeinput=(t,e)=>{if(We&&Mn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Vr(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in dt)ut[t]=dt[t];function ta(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class dc{constructor(e,n){this.toDOM=e,this.spec=n||is,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new lt(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof dc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ta(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class vr{constructor(e,n){this.attrs=e,this.spec=n||is}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new lt(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof vr&&ta(this.attrs,e.attrs)&&ta(this.spec,e.spec)}static is(e){return e.type instanceof vr}destroy(){}}class Gp{constructor(e,n){this.attrs=e,this.spec=n||is}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new lt(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof Gp&&ta(this.attrs,e.attrs)&&ta(this.spec,e.spec)}destroy(){}}class lt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new lt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new lt(e,e,new dc(n,r))}static inline(e,n,r,s){return new lt(e,n,new vr(r,s))}static node(e,n,r,s){return new lt(e,n,new Gp(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof vr}get widget(){return this.type instanceof dc}}const $s=[],is={};class me{constructor(e,n){this.local=e.length?e:$s,this.children=n.length?n:$s}static create(e,n){return n.length?fc(n,e,0,is):Qe}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==Qe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||is)}mapInner(e,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,s);c&&c.type.valid(n,c)?(o||(o=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?iT(this.children,o||[],e,n,r,s,i):o?new me(o.sort(as),$s):Qe}add(e,n){return n.length?this==Qe?me.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,c)=>{let u=c+r,d;if(d=Cw(n,a,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<c;)i+=3;s[i]==c?s[i+2]=s[i+2].addInner(a,d,u+1):s.splice(i,0,c,c+a.nodeSize,fc(d,a,u+1,is)),i+=3}});let o=Sw(i?Ew(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new me(o.length?this.local.concat(o).sort(as):this.local,s||this.children)}remove(e){return e.length==0||this==Qe?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,c=r[i+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>a&&f.to<c&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,a+1);u!=Qe?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new me(s,r):Qe}forChild(e,n){if(this==Qe)return this;if(n.isLeaf)return me.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<o&&c.to>i&&c.type instanceof vr){let u=Math.max(i,c.from)-i,d=Math.min(o,c.to)-i;u<d&&(s||(s=[])).push(c.copy(u,d))}}if(s){let a=new me(s.sort(as),$s);return r?new er([a,r]):a}return r||Qe}eq(e){if(this==e)return!0;if(!(e instanceof me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Xp(this.localsInner(e))}localsInner(e){if(this==Qe)return $s;if(e.inlineContent||!this.local.some(vr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof vr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}me.empty=new me([],[]);me.removeOverlap=Xp;const Qe=me.empty;class er{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,is));return er.from(r)}forChild(e,n){if(n.isLeaf)return me.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=Qe&&(i instanceof er?r=r.concat(i.members):r.push(i))}return er.from(r)}eq(e){if(!(e instanceof er)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Xp(r?n:n.sort(as)):$s}static from(e){switch(e.length){case 0:return Qe;case 1:return e[0];default:return new er(e.every(n=>n instanceof me)?e:e.reduce((n,r)=>n.concat(r instanceof me?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function iT(t,e,n,r,s,i,o){let a=t.slice();for(let u=0,d=i;u<n.maps.length;u++){let f=0;n.maps[u].forEach((h,p,m,g)=>{let y=g-m-(p-h);for(let x=0;x<a.length;x+=3){let v=a[x+1];if(v<0||h>v+d-f)continue;let b=a[x]+d-f;p>=b?a[x+1]=h<=b?-2:-1:h>=d&&y&&(a[x]+=y,a[x+1]+=y)}f+=y}),d=n.maps[u].map(d,-1)}let c=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){c=!0,a[u+1]=-1;continue}let d=n.map(t[u]+i),f=d-s;if(f<0||f>=r.content.size){c=!0;continue}let h=n.map(t[u+1]+i,-1),p=h-s,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let x=a[u+2].mapInner(n,y,d+1,t[u]+i+1,o);x!=Qe?(a[u]=f,a[u+1]=p,a[u+2]=x):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=oT(a,t,e,n,s,i,o),d=fc(u,r,0,o);e=d.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new me(e.sort(as),a)}function Sw(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new lt(s.from+e,s.to+e,s.type))}return n}function oT(t,e,n,r,s,i,o){function a(c,u){for(let d=0;d<c.local.length;d++){let f=c.local[d].map(r,s,u);f?n.push(f):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)a(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&a(t[c+2],e[c]+i+1);return n}function Cw(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function Ew(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function fc(t,e,n,r){let s=[],i=!1;e.forEach((a,c)=>{let u=Cw(t,a,c+n);if(u){i=!0;let d=fc(u,a,n+c+1,r);d!=Qe&&s.push(c,c+a.nodeSize,d)}});let o=Sw(i?Ew(t):t,-n).sort(as);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new me(o,s):Qe}function as(t,e){return t.from-e.from||t.to-e.to}function Xp(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Xx(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Xx(e,s,r.copy(i.from,r.to)));break}}}return e}function Xx(t,e,n){for(;e<t.length&&as(n,t[e])>0;)e++;t.splice(e,0,n)}
vendor: 10,459 bytes, line 548
548function jd(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Qe&&e.push(r)}),t.cursorWrapper&&e.push(me.create(t.state.doc,[t.cursorWrapper.deco])),er.from(e)}const aT={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lT=kt&&xr<=11;class cT{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class uT{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cT,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);kt&&xr<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():nt&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lT&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,aT)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ux(this.view)){if(this.suppressingSelectionUpdates)return Pn(this.view);if(kt&&xr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&xs(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=vi(i))n.add(i);for(let i=e.anchorNode;i;i=vi(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ux(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,c=[];if(e.editable)for(let d=0;d<n.length;d++){let f=this.registerMutation(n[d],c);f&&(i=i<0?f.from:Math.min(f.from,i),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){d.parentNode.removeChild(d);break}f=f.firstChild}}}else if(Ft&&c.length){let d=c.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||hT(e,f)!=p)&&h.remove()}}}let u=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&bu(r)&&(u=Vp(e))&&u.eq(X.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Pn(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),dT(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,pT(e,c)),this.handleDOMChange(i,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Pn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(kt&&xr<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?He(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),c=i&&i.parentNode==e.target?He(i):e.target.childNodes.length,u=r.localPosFromDOM(e.target,c,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Yx=new WeakMap,Qx=!1;function dT(t){if(!Yx.has(t)&&(Yx.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ft,Qx)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Qx=!0}}function Zx(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return xs(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function fT(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Zx(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Zx(t,n):null}function hT(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function pT(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let c=a.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;a=c}a.insertBefore(i,a.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function mT(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],bu(c)||u.push({node:c.focusNode,offset:c.focusOffset})),We&&t.input.lastKeyCode===8)for(let y=i;y>s;y--){let x=r.childNodes[y-1],v=x.pmViewDesc;if(x.nodeName=="BR"&&!v){i=y;break}if(!v||v.size)break}let f=t.state.doc,h=t.someProp("domParser")||gr.fromSchema(t.state.schema),p=f.resolve(o),m=null,g=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:gT,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,x=u[1]&&u[1].pos;x==null&&(x=y),m={anchor:y+o,head:x+o}}return{doc:g,sel:m,from:o,to:a}}function gT(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(nt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||nt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const xT=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yT(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let k=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=Vp(t,k);if(E&&!t.state.selection.eq(E)){if(We&&Mn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",j=>j(t,Vr(13,"Enter"))))return;let S=t.state.tr.setSelection(E);k=="pointer"?S.setMeta("pointer",!0):k=="key"&&S.scrollIntoView(),i&&S.setMeta("composition",i),t.dispatch(S)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let c=t.state.selection,u=mT(t,e,n),d=t.state.doc,f=d.slice(u.from,u.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=wT(f.content,u.doc.content,u.from,h,p);if(m&&t.input.domChangeCount++,(bi&&t.input.lastIOSEnter>Date.now()-225||Mn)&&s.some(k=>k.nodeType==1&&!xT.test(k.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",k=>k(t,Vr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof W&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head)
vendor: 4,132 bytes, line 548
548)m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let k=e0(t,t.state.doc,u.sel);if(k&&!k.eq(t.state.selection)){let E=t.state.tr.setSelection(k);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof W&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),kt&&xr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),x=d.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&x.end()>=m.endA;if((bi&&t.input.lastIOSEnter>Date.now()-225&&(!v||s.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!v&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&t.someProp("handleKeyDown",k=>k(t,Vr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&bT(d,m.start,m.endA,g,y)&&t.someProp("handleKeyDown",k=>k(t,Vr(8,"Backspace")))){Mn&&We&&t.domObserver.suppressSelectionUpdates();return}We&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),Mn&&!v&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(k){return k(t,Vr(13,"Enter"))})},20));let b=m.start,_=m.endA,C=k=>{let E=k||t.state.tr.replace(b,_,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let S=e0(t,E.doc,u.sel);S&&!(We&&t.composing&&S.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==b||S.head==E.mapping.map(_)-1)||kt&&S.empty&&S.head==b)&&E.setSelection(S)}return i&&E.setMeta("composition",i),E.scrollIntoView()},w;if(v)if(g.pos==y.pos){kt&&xr<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Pn(t),20));let k=C(t.state.tr.delete(b,_)),E=d.resolve(m.start).marksAcross(d.resolve(m.endA));E&&k.ensureMarks(E),t.dispatch(k)}else if(m.endA==m.endB&&(w=vT(g.parent.content.cut(g.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let k=C(t.state.tr);w.type=="add"?k.addMark(b,_,w.mark):k.removeMark(b,_,w.mark),t.dispatch(k)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let k=g.parent.textBetween(g.parentOffset,y.parentOffset),E=()=>C(t.state.tr.insertText(k,b,_));t.someProp("handleTextInput",S=>S(t,b,_,k,E))||t.dispatch(E())}else t.dispatch(C());else t.dispatch(C())}function e0(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Hp(t,e.resolve(n.anchor),e.resolve(n.head))}function vT(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,c;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",c=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",c=d=>d.mark(a.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(M.from(u).eq(t))return{mark:a,type:o}}function bT(t,e,n,r,s){if(n-e<=s.pos-r.pos||_d(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(_d(i,!0,!0));return!o.parent.isTextblock||o.pos>n||_d(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function _d(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function wT(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);
vendor: 4,448 bytes, line 548
548if(s=="end"){let c=Math.max(0,i-Math.min(o,a));r-=o+c-i}if(o<i&&t.size<e.size){let c=r<=i&&r>=o?i-r:0;i-=c,i&&i<e.size&&t0(e.textBetween(i-1,i+1))&&(i+=c?1:-1),a=i+(a-o),o=i}else if(a<i){let c=r<=i&&r>=a?i-r:0;i-=c,i&&i<t.size&&t0(t.textBetween(i-1,i+1))&&(i+=c?1:-1),o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}function t0(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Tw{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new DE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(o0),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=s0(this),r0(this),this.nodeViews=i0(this),this.docView=Lx(this.state.doc,n0(this),jd(this),this.dom,this),this.domObserver=new uT(this,(r,s,i,o)=>yT(this,r,s,i,o)),this.domObserver.start(),$E(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ch(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(o0),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(kw(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=i0(this);NT(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ch(this),this.editable=s0(this),r0(this);let c=jd(this),u=n0(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,c);(f||!e.selection.eq(s.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Q9(this);if(o){this.domObserver.stop();let p=f&&(kt||We)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&kT(s.selection,e.selection);if(f){let m=We?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=QE(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Lx(e.doc,u,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&kE(this))?Pn(this,p):(uw(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&Z9(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof H){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Ax(this,n.getBoundingClientRect(),e)}else Ax(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;
vendor: 6,060 bytes, line 548
548if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new jw(e.slice,e.move,s<0?void 0:H.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(kt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&eE(this.dom),Pn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return iE(this,e)}coordsAtPos(e,n=1){return nw(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return uE(this,n||this.state,e)}pasteHTML(e,n){return ea(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ea(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return qp(this,e)}destroy(){this.docView&&(zE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,U9())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return FE(this,e)}domSelectionRange(){let e=this.domSelection();return e?nt&&this.root.nodeType===11&&K9(this.dom.ownerDocument)==this.dom&&fT(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Tw.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function n0(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[lt.node(0,t.state.doc.content.size,e)]}function r0(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:lt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function s0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function kT(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function i0(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function NT(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function o0(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Sr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},hc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},jT=typeof navigator<"u"&&/Mac/.test(navigator.platform),_T=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qe=0;qe<10;qe++)Sr[48+qe]=Sr[96+qe]=String(qe);for(var qe=1;qe<=24;qe++)Sr[qe+111]="F"+qe;for(var qe=65;qe<=90;qe++)Sr[qe]=String.fromCharCode(qe+32),hc[qe]=String.fromCharCode(qe);for(var Sd in Sr)hc.hasOwnProperty(Sd)||(hc[Sd]=Sr[Sd]);function ST(t){var e=jT&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||_T&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?hc:Sr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const CT=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ET=typeof navigator<"u"&&/Win/.test(navigator.platform);function TT(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))CT?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function AT(t){let e=Object.create(null);for(let n in t)e[TT(n)]=t[n];return e}
vendor: 5,076 bytes, line 548
548function Cd(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function MT(t){return new ye({props:{handleKeyDown:Aw(t)}})}function Aw(t){let e=AT(t);return function(n,r){let s=ST(r),i,o=e[Cd(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[Cd(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(ET&&r.ctrlKey&&r.altKey)&&(i=Sr[r.keyCode])&&i!=s){let a=e[Cd(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var OT=Object.defineProperty,Yp=(t,e)=>{for(var n in e)OT(t,n,{get:e[n],enumerable:!0})};function Nu(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var ju=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...u)=>{const d=a(...u)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],a=!!t,c=t||s.tr,u=()=>(!a&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),o.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(n).map(([f,h])=>[f,(...m)=>{const g=this.buildProps(c,e),y=h(...m)(g);return o.push(y),d}])),run:u};return d}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...u)=>c(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Nu({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,c])=>[a,(...u)=>c(...u)(o)]))}};return o}},Mw={};Yp(Mw,{blur:()=>PT,clearContent:()=>IT,clearNodes:()=>RT,command:()=>LT,createParagraphNear:()=>DT,cut:()=>$T,deleteCurrentNode:()=>zT,deleteNode:()=>BT,deleteRange:()=>FT,deleteSelection:()=>HT,enter:()=>qT,exitCode:()=>WT,extendMarkRange:()=>KT,first:()=>JT,focus:()=>XT,forEach:()=>YT,insertContent:()=>QT,insertContentAt:()=>t4,joinBackward:()=>s4,joinDown:()=>r4,joinForward:()=>i4,joinItemBackward:()=>o4,joinItemForward:()=>a4,joinTextblockBackward:()=>l4,joinTextblockForward:()=>c4,joinUp:()=>n4,keyboardShortcut:()=>d4,lift:()=>f4,liftEmptyBlock:()=>h4,liftListItem:()=>p4,newlineInCode:()=>m4,resetAttributes:()=>g4,scrollIntoView:()=>x4,selectAll:()=>y4,selectNodeBackward:()=>v4,selectNodeForward:()=>b4,selectParentNode:()=>w4,selectTextblockEnd:()=>k4,selectTextblockStart:()=>N4,setContent:()=>j4,setMark:()=>q4,setMeta:()=>W4,setNode:()=>K4,setNodeSelection:()=>J4,setTextDirection:()=>G4,setTextSelection:()=>X4,sinkListItem:()=>Y4,splitBlock:()=>Q4,splitListItem:()=>Z4,toggleList:()=>tA,toggleMark:()=>nA,toggleNode:()=>rA,toggleWrap:()=>sA,undoInputRule:()=>iA,unsetAllMarks:()=>oA,unsetMark:()=>aA,unsetTextDirection:()=>lA,updateAttributes:()=>cA,wrapIn:()=>uA,wrapInList:()=>dA});var PT=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),IT=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),RT=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,c)=>{if(a.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(c)),h=u.resolve(d.map(c+a.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Oi(p);if(a.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},LT=t=>e=>t(e),DT=()=>({state:t,dispatch:e})=>E9(t,e),$T=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new W(r.doc.resolve(Math.max(o-1,0)))),!0},zT=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const a=s.before(i),c=s.after(i);t.delete(a,c).scrollIntoView()}return!0}return!1};function Ae(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);
vendor: 5,586 bytes, line 548
548return e.nodes[t]}return t}var BT=t=>({tr:e,state:n,dispatch:r})=>{const s=Ae(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const c=i.before(o),u=i.after(o);e.delete(c,u).scrollIntoView()}return!0}return!1},FT=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},UT=t=>t.content?/^text(\*|\+)/.test(t.content):!1,a0=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return UT(r)?n==="left"?t.start()-1:t.end()+1:t.pos},VT=(t,e,n)=>{const r=a0(t,n,"left"),s=a0(e,n,"right");return{from:r,to:s}},HT=()=>({state:t,dispatch:e})=>{const{$from:n,$to:r}=t.selection;if(t.selection.empty)return!1;const{from:s,to:i}=VT(n,r,t.schema);return e&&(t.tr.deleteRange(s,i).scrollIntoView(),e(t.tr)),!0},qT=()=>({commands:t})=>t.keyboardShortcut("Enter"),WT=()=>({state:t,dispatch:e})=>C9(t,e);function Qp(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function pc(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:Qp(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function Ow(t,e,n={}){return t.find(r=>r.type===e&&pc(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function l0(t,e,n={}){return!!Ow(t,e,n)}function Zp(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e))return;if(!n){const u=r.node.marks.find(d=>d.type===e);u&&(n=u.attrs)}if(!Ow([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,a=i+1,c=o+r.node.nodeSize;for(;i>0&&l0([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&l0([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:c}}function zn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var KT=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=zn(t,r.schema),{doc:o,selection:a}=n,{$from:c,from:u,to:d}=a;if(s){const f=Zp(c,i,e);if(f&&f.from<=u&&f.to>=d){const h=W.create(o,f.from,f.to);n.setSelection(h)}}return!0},JT=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Pw(t){return t instanceof W}function Gr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Iw(t,e=null){if(!e)return null;const n=X.atStart(t),r=X.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?W.create(t,Gr(0,s,i),Gr(t.content.size,s,i)):W.create(t,Gr(e,s,i),Gr(e,s,i))}function c0(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function mc(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function GT(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var XT=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(mc()||c0())&&r.dom.focus(),GT()&&!mc()&&!c0()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!Pw(n.state.selection))return o(),!0;const a=Iw(s.doc,t)||n.state.selection,c=n.state.selection.eq(a);return i&&(c||s.setSelection(a),c&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},YT=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),QT=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Rw=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Rw(r)}return t};function Ya(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Rw(n)}function na(t,e,n){if(t instanceof an||t instanceof M)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),na("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const c=new j1({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?gr.fromSchema(c).parseSlice(Ya(t),n.parseOptions):gr.fromSchema(c).parse(Ya(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=gr.fromSchema(e);return n.slice?i.parseSlice(Ya(t),n.parseOptions).content:i.parse(Ya(t),n.parseOptions)}return na("",e,n)}function ZT(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof Se||s instanceof Be))return;const i=t.mapping.maps[r];let o=0;
vendor: 7,468 bytes, line 548
548i.forEach((a,c,u,d)=>{o===0&&(o=d)}),t.setSelection(X.near(t.doc.resolve(o),n))}var e4=t=>!("type"in t),t4=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const c=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{na(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){c(y)}try{a=na(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(y){return c(y),!1}let{from:d,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,p=!0;if((e4(a)?a:[a]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===f&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof M){let y="";e.forEach(x=>{x.text&&(y+=x.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,f)}else{g=a;const y=r.doc.resolve(d),x=y.node(),v=y.parentOffset===0,b=x.isText||x.isTextblock,_=x.content.size>0;v&&b&&_&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}n.updateSelection&&ZT(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},n4=()=>({state:t,dispatch:e})=>N9(t,e),r4=()=>({state:t,dispatch:e})=>j9(t,e),s4=()=>({state:t,dispatch:e})=>x9(t,e),i4=()=>({state:t,dispatch:e})=>w9(t,e),o4=()=>({state:t,dispatch:e,tr:n})=>{try{const r=xu(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},a4=()=>({state:t,dispatch:e,tr:n})=>{try{const r=xu(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},l4=()=>({state:t,dispatch:e})=>y9(t,e),c4=()=>({state:t,dispatch:e})=>v9(t,e);function Lw(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function u4(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))mc()||Lw()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var d4=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=u4(t).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return c==null||c.steps.forEach(u=>{const d=u.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function Cr(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Ae(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(s,h+f.nodeSize);a.push({node:f,from:p,to:m})});const c=s-r,u=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>pc(f.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((f,h)=>f+h.to-h.from,0)>=c}var f4=(t,e={})=>({state:n,dispatch:r})=>{const s=Ae(t,n.schema);return Cr(n,s,e)?_9(n,r):!1},h4=()=>({state:t,dispatch:e})=>T9(t,e),p4=t=>({state:e,dispatch:n})=>{const r=Ae(t,e.schema);return $9(r)(e,n)},m4=()=>({state:t,dispatch:e})=>S9(t,e);function _u(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function u0(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var g4=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=_u(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Ae(t,r.schema)),a==="mark"&&(o=zn(t,r.schema));let c=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(c=!0,s&&n.setNodeMarkup(f,void 0,u0(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(h=>{o===h.type&&(c=!0,s&&n.addMark(f,f+d.nodeSize,o.create(u0(h.attrs,e))))})})}),c},x4=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),y4=()=>({tr:t,dispatch:e})=>{if(e){const n=new Bt(t.doc);t.setSelection(n)}return!0},v4=()=>({state:t,dispatch:e})=>b9(t,e),b4=()=>({state:t,dispatch:e})=>k9(t,e),w4=()=>({state:t,dispatch:e})=>A9(t,e),k4=()=>({state:t,dispatch:e})=>P9(t,e),N4=()=>({state:t,dispatch:e})=>O9(t,e);function uh(t,e,n={},r={}){return na(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var j4=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:c}=i;if(r.preserveWhitespace!=="full"){const u=uh(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,c.content.size,u).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function Dw(t,e){const n=zn(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,c=>{o.push(...c.marks)});const a=o.find(c=>c.type.name===n.name);return a?{...a.attrs}:{}}function $w(t,e){const n=new B1(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function _4(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function S4(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function C4(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Su(t){return e=>C4(e.$from,t)}function U(t,e,n){return t.config[e]===void 0&&t.parent?U(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?U(t.parent,e,n):null}):t.config[e]}function em(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=U(e,"addExtensions",n);return r?[e,...em(r())]:e}).flat(10)}function tm(t,e){const n=Ns.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function zw(t){return typeof t=="function"}function ne(t,e=void 0,...n){return zw(t)?e?t.bind(e)(...n):t(...n):t}function E4(t={}){return Object.keys(t).length===0&&t.constructor===Object}function wi(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Bw(t){const e=[],{nodeExtensions:n,markExtensions:r}=wi(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),c=[...o,...a];return t.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage,extensions:s},f=U(u,"addGlobalAttributes",d);if(!f)return;
548f().forEach(p=>{let m;Array.isArray(p.types)?m=p.types:p.types==="*"?m=c:p.types==="nodes"?m=o:p.types==="marks"?m=a:m=[],m.forEach(g=>{Object.entries(p.attributes).forEach(([y,x])=>{e.push({type:g,name:y,attribute:{...i,...x}})})})})}),s.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage},f=U(u,"addAttributes",d);if(!f)return;const h=f();Object.entries(h).forEach(([p,m])=>{const g={...i,...m};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:u.name,name:p,attribute:g})})}),e}function T4(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let a=0;a<o;a+=1){const c=t[a];if(c==="'"&&!s){r=!r,n+=c;continue}if(c==='"'&&!r){s=!s,n+=c;continue}if(!r&&!s){if(c==="("){i+=1,n+=c;continue}if(c===")"&&i>0){i-=1,n+=c;continue}if(c===";"&&i===0){e.push(n),n="";continue}}n+=c}return n&&e.push(n),e}function d0(t){const e=[],n=T4(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),c=i.slice(o+1).trim();a&&c&&e.push([a,c])}return e}function _e(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],c=r[s]?r[s].split(" "):[],u=a.filter(d=>!c.includes(d));r[s]=[...c,...u].join(" ")}else if(s==="style"){const a=new Map([...d0(r[s]),...d0(i)]);r[s]=Array.from(a.entries()).map(([c,u])=>`${c}: ${u}`).join("; ")}else r[s]=i}),r},{})}function ra(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>_e(n,r),{})}function A4(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function f0(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):A4(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function h0(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&E4(n)?!1:n!=null))}function p0(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function M4(t,e){var n;const r=Bw(t),{nodeExtensions:s,markExtensions:i}=wi(t),o=(n=s.find(u=>U(u,"topNode")))==null?void 0:n.name,a=Object.fromEntries(s.map(u=>{const d=r.filter(x=>x.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((x,v)=>{const b=U(v,"extendNodeSchema",f);return{...x,...b?b(u):{}}},{}),p=h0({...h,content:ne(U(u,"content",f)),marks:ne(U(u,"marks",f)),group:ne(U(u,"group",f)),inline:ne(U(u,"inline",f)),atom:ne(U(u,"atom",f)),selectable:ne(U(u,"selectable",f)),draggable:ne(U(u,"draggable",f)),code:ne(U(u,"code",f)),whitespace:ne(U(u,"whitespace",f)),linebreakReplacement:ne(U(u,"linebreakReplacement",f)),defining:ne(U(u,"defining",f)),isolating:ne(U(u,"isolating",f)),attrs:Object.fromEntries(d.map(p0))}),m=ne(U(u,"parseHTML",f));m&&(p.parseDOM=m.map(x=>f0(x,d)));const g=U(u,"renderHTML",f);g&&(p.toDOM=x=>g({node:x,HTMLAttributes:ra(x,d)}));const y=U(u,"renderText",f);return y&&(p.toText=y),[u.name,p]})),c=Object.fromEntries(i.map(u=>{const d=r.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((y,x)=>{const v=U(x,"extendMarkSchema",f);return{...y,...v?v(u):{}}},{}),p=h0({...h,inclusive:ne(U(u,"inclusive",f)),excludes:ne(U(u,"excludes",f)),group:ne(U(u,"group",f)),spanning:ne(U(u,"spanning",f)),code:ne(U(u,"code",f)),attrs:Object.fromEntries(d.map(p0))}),m=ne(U(u,"parseHTML",f));m&&(p.parseDOM=m.map(y=>f0(y,d)));const g=U(u,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:ra(y,d)})),[u.name,p]}));return new j1({topNode:o,nodes:a,marks:c})}function O4(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ko(t){return t.sort((n,r)=>{const s=U(n,"priority")||100,i=U(r,"priority")||100;return s>i?-1:s<i?1:0})}function Fw(t){const e=ko(em(t)),n=O4(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Uw(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
549
550`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(c,u,d,f)=>{var h;c.isBlock&&u>r&&(a+=i);const p=o==null?void 0:o[c.type.name];if(p)return d&&(a+=p({node:c,pos:u,parent:d,index:f,range:e})),!1;c.isText&&(a+=(h=c==null?void 0:c.text)==null?void 0:h.slice(Math.max(r,u)-u,s-u))}),a}function P4(t,e){const n={from:0,to:t.content.size};return Uw(t,n,e)}function Vw(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function I4(t,e){const n=Ae(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function Hw(t,e){const n=_u(typeof e=="string"?e:e.name,t.schema);return n==="node"?I4(t,e):n==="mark"?Dw(t,e):{}}function R4(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function L4(t){const e=R4(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function qw(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,c)=>{o.push({from:a,to:c})});else{const{from:a,to:c}=n[i];if(a===void 0||c===void 0)return;o.push({from:a,to:c})}o.forEach(({from:a,to:c})=>{const u=e.slice(i).map(a,-1),d=e.slice(i).map(c),f=e.invert().map(u,-1),h=e.invert().map(d);r.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),L4(r)}function nm(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=Zp(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var D4=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);(a==null?void 0:a.type.name)===e?o=a:i-=1}return[o,i]};function Vi(t,e){return e.nodes[t]||e.marks[t]||null}function Nl(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var $4=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var c,u;const d=((u=(c=s.type.spec).toText)==null?void 0:u.call(c,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),n};function dh(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?zn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>pc(f.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(g,y)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const x=Math.max(p,y),v=Math.min(m,y+g.nodeSize),b=v-x;o+=b,a.push(...g.marks.map(_=>({mark:_,from:x,to:v})))})}),o===0)return!1;const c=a.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>pc(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),u=a.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,h)=>f+h.to-h.from,0);return(c>0?c+u:c)>=o}function z4(t,e,n={}){if(!e)return Cr(t,null,n)||dh(t,null,n);const r=_u(e,t.schema);return r==="node"?Cr(t,e,n):r==="mark"?dh(t,e,n):!1}var B4=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=Su(a=>a.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},F4=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function m0(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ed(t,e){const{nodeExtensions:n}=wi(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=ne(U(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function sa(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;
vendor: 43,942 bytes, lines 550-623
550if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(sa(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function Ww(t){return t instanceof H}var Kw=class Jw{constructor(e){this.position=e}static fromJSON(e){return new Jw(e.position)}toJSON(){return{position:this.position}}};function U4(t,e){const n=e.mapping.mapResult(t.position);return{position:new Kw(n.pos),mapResult:n}}function V4(t){return new Kw(t)}function H4(t,e,n){var r;const{selection:s}=e;let i=null;if(Pw(s)&&(i=s.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(u=>u.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:a,$to:c})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,c.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(n));u=p&&m}return!u}),u})}var q4=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,c=zn(t,r.schema);if(s)if(o){const u=Dw(r,c);n.addStoredMark(c.create({...u,...e}))}else a.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(d,f,(h,p)=>{const m=Math.max(p,d),g=Math.min(p+h.nodeSize,f);h.marks.find(x=>x.type===c)?h.marks.forEach(x=>{c===x.type&&n.addMark(m,g,c.create({...x.attrs,...e}))}):n.addMark(m,g,c.create(e))})});return H4(r,n,c)},W4=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),K4=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Ae(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>Cx(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Cx(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},J4=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Gr(t,0,r.content.size),i=H.create(r,s);e.setSelection(i)}return!0},G4=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&n.doc.nodesBetween(o,a,(c,u)=>{c.isText||n.setNodeMarkup(u,void 0,{...c.attrs,dir:t})}),!0},X4=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=W.atStart(r).from,a=W.atEnd(r).to,c=Gr(s,o,a),u=Gr(i,o,a),d=W.create(r,c,u);e.setSelection(d)}return!0},Y4=t=>({state:e,dispatch:n})=>{const r=Ae(t,e.schema);return F9(r)(e,n)};function g0(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var Q4=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:c}=i,u=s.extensionManager.attributes,d=Nl(u,a.node().type.name,a.node().attrs);if(i instanceof H&&i.node.isBlock)return!a.parentOffset||!ii(o,a.pos)?!1:(r&&(t&&g0(n,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,h=a.depth===0?void 0:_4(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,m=ii(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&ii(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(m&&(i instanceof W&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&g0(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},Z4=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const a=Ae(t,r.schema),{$from:c,$to:u}=r.selection,d=r.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(u))return!1;const f=c.node(-1);if(f.type!==a)return!1;const h=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(s){let x=M.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let E=c.depth-v;E>=c.depth-3;E-=1)x=M.from(c.node(E).copy(x));const b=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,_={...Nl(h,c.node().type.name,c.node().attrs),...e},C=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(_))||void 0;x=x.append(M.from(a.createAndFill(null,C)||void 0));const w=c.before(c.depth-(v-1));n.replace(w,c.after(-b),new B(x,4-v,0));let k=-1;n.doc.nodesBetween(w,n.doc.content.size,(E,S)=>{if(k>-1)return!1;E.isTextblock&&E.content.size===0&&(k=S+1)}),k>-1&&n.setSelection(W.near(n.doc.resolve(k))),n.scrollIntoView()}return!0}const p=u.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Nl(h,f.type.name,f.attrs),...e},g={...Nl(h,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,u.pos);const y=p?[{type:a,attrs:m},{type:p,attrs:g}]:[{type:a,attrs:m}];if(!ii(n.doc,c.pos,2))return!1;if(s){const{selection:x,storedMarks:v}=r,{splittableMarks:b}=i.extensionManager,_=v||x.$to.parentOffset&&x.$from.marks();if(n.split(c.pos,2,y).scrollIntoView(),!_||!s)return!0;const C=_.filter(w=>b.includes(w.type.name));n.ensureMarks(C)}return!0},Td=(t,e)=>{const n=Su(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Pr(t.doc,n.pos)&&t.join(n.pos),!0},Ad=(t,e)=>{const n=Su(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Pr(t.doc,r)&&t.join(r),!0};function eA(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return W.between(r,s)}var tA=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:c,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=s.extensionManager,p=Ae(t,o.schema),m=Ae(e,o.schema),{selection:g,storedMarks:y}=o,{$from:x,$to:v}=g,b=x.blockRange(v),_=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const C=Su(R=>Ed(R.type.name,f))(g),w=g.from===0&&g.to===o.doc.content.size,k=o.doc.content.content,E=k.length===1?k[0]:null,S=w&&E&&Ed(E.type.name,f)?{node:E,pos:0,depth:0}:null,j=C??S,A=!!C&&b.depth>=1&&b.depth-C.depth<=1,z=!!S;if((A||z)&&j){if(j.node.type===p)return w&&z?c().command(({tr:R,dispatch:O})=>{const D=eA(R);return D?(R.setSelection(D),O&&O(R),!0):!1}).liftListItem(m).run():u.liftListItem(m);if(Ed(j.node.type.name,f)&&p.validContent(j.node.content))return c().command(()=>(i.setNodeMarkup(j.pos,p),!0)).command(()=>Td(i,p)).command(()=>Ad(i,p)).run()}return!n||!_||!a?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Td(i,p)).command(()=>Ad(i,p)).run():c().command(()=>{const R=d().wrapInList(p,r),O=_.filter(D=>h.includes(D.type.name));return i.ensureMarks(O),R?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Td(i,p)).command(()=>Ad(i,p)).run()},nA=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=zn(t,r.schema);return dh(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},rA=(t,e,n={})=>({state:r,commands:s})=>{const i=Ae(t,r.schema),o=Ae(e,r.schema),a=Cr(r,i,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?s.setNode(o,c):s.setNode(i,{...c,...n})},sA=(t,e={})=>({state:n,commands:r})=>{const s=Ae(t,n.schema);return Cr(n,s,e)?r.lift(s):r.wrapIn(s,e)},iA=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,a=i.transform;for(let c=a.steps.length-1;c>=0;c-=1)o.step(a.steps[c].invert(a.docs[c]));if(i.text){const c=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else o.delete(i.from,i.to)}return!0}}return!1},oA=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},aA=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,c=zn(t,r.schema),{$from:u,empty:d,ranges:f}=a;if(!s)return!0;if(d&&o){let{from:h,to:p}=a;const m=(i=u.marks().find(y=>y.type===c))==null?void 0:i.attrs,g=Zp(u,c,m);g&&(h=g.from,p=g.to),n.removeMark(h,p,c)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,c)});return n.removeStoredMark(c),!0},lA=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,c)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(c,void 0,u)}),!0},cA=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=_u(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Ae(t,r.schema)),a==="mark"&&(o=zn(t,r.schema));let c=!1;return n.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let h,p,m,g;n.selection.empty?r.doc.nodesBetween(d,f,(y,x)=>{i&&i===y.type&&(c=!0,m=Math.max(x,d),g=Math.min(x+y.nodeSize,f),h=x,p=y)}):r.doc.nodesBetween(d,f,(y,x)=>{x<d&&i&&i===y.type&&(c=!0,m=Math.max(x,d),g=Math.min(x+y.nodeSize,f),h=x,p=y),x>=d&&x<=f&&(i&&i===y.type&&(c=!0,s&&n.setNodeMarkup(x,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(v=>{if(o===v.type&&(c=!0,s)){const b=Math.max(x,d),_=Math.min(x+y.nodeSize,f);n.addMark(b,_,o.create({...v.attrs,...e}))}}))}),p&&(h!==void 0&&s&&n.setNodeMarkup(h,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(y=>{o===y.type&&s&&n.addMark(m,g,o.create({...y.attrs,...e}))}))}),c},uA=(t,e={})=>({state:n,dispatch:r})=>{const s=Ae(t,n.schema);return I9(s,e)(n,r)},dA=(t,e={})=>({state:n,dispatch:r})=>{const s=Ae(t,n.schema);return R9(s,e)(n,r)},fA=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Cu=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},hA=(t,e)=>{if(Qp(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Qa(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:c}=n;if(c.composing)return!1;const u=c.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const f=$4(u)+i;return o.forEach(h=>{if(d)return;const p=hA(f,h.find);if(!p)return;const m=c.state.tr,g=Nu({state:c.state,transaction:m}),y={from:r-(p[0].length-i.length),to:s},{commands:x,chain:v,can:b}=new ju({editor:n,state:g});h.handler({state:g,range:y,match:p,commands:x,chain:v,can:b})===null||!m.steps.length||(h.undoable&&m.setMeta(a,{transform:m,from:r,to:s,text:i}),c.dispatch(m),d=!0)}),d}function pA(t){const{editor:e,rules:n}=t,r=new ye({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const c=s.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:d}=c;typeof d=="string"?d=d:d=tm(M.from(d),o.schema);const{from:f}=c,h=f+d.length;Qa({editor:e,from:f,to:h,text:d,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return Qa({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Qa({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Qa({editor:e,from:o.pos,to:o.pos,text:`
551`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function mA(t){return Object.prototype.toString.call(t).slice(8,-1)}function Za(t){return mA(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Gw(t,e){const n={...t};return Za(t)&&Za(e)&&Object.keys(e).forEach(r=>{Za(e[r])&&Za(t[r])?n[r]=Gw(t[r],e[r]):n[r]=e[r]}),n}var rm=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...ne(U(this,"addOptions",{name:this.name}))}}get storage(){return{...ne(U(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Gw(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},js=class Xw extends rm{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Xw(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const c=o.find(u=>(u==null?void 0:u.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function gA(t){return typeof t=="number"}var xA=class{constructor(t){this.find=t.find,this.handler=t.handler}},yA=(t,e,n)=>{if(Qp(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function vA(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:c,chain:u,can:d}=new ju({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,s,(p,m)=>{var g,y,x,v,b;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const _=(b=(v=(x=p.content)==null?void 0:x.size)!=null?v:p.nodeSize)!=null?b:0,C=Math.max(r,m),w=Math.min(s,m+_);if(C>=w)return;const k=p.isText?p.text||"":p.textBetween(C-m,w-m,void 0,"");yA(k,i.find,o).forEach(S=>{if(S.index===void 0)return;const j=C+S.index+1,A=j+S[0].length,z={from:n.tr.mapping.map(j),to:n.tr.mapping.map(A)},R=i.handler({state:n,range:z,match:S,commands:c,chain:u,can:d,pasteEvent:o,dropEvent:a});f.push(R)})}),f.every(p=>p!==null)}var el=null,bA=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function wA(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:d,from:f,to:h,rule:p,pasteEvt:m})=>{const g=d.tr,y=Nu({state:d,transaction:g});if(!(!vA({editor:e,state:y,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(d=>new ye({view(f){const h=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(el=e)},p=()=>{el&&(el=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(i=r===f.dom.parentElement,a=h,!i){const p=el;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return o=h,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!s,y=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),v=!!x;if(!g&&!y&&!v)return;if(v){let{text:C}=x;typeof C=="string"?C=C:C=tm(M.from(C),p.schema);const{from:w}=x,k=w+C.length,E=bA(C);return c({rule:d,state:p,from:w,to:{b:k},pasteEvt:E})}const b=h.doc.content.findDiffStart(p.doc.content),_=h.doc.content.findDiffEnd(p.doc.content);if(!(!gA(b)||!_||b===_.b))return c({rule:d,state:p,from:b,to:_,pasteEvt:o})}}))}var Eu=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Fw(t),this.schema=M4(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vi(e.name,this.schema)},r=U(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ko([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Vi(r.name,this.schema)},i=[],o=U(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&U(r,"exitable",s)&&(a.ArrowRight=()=>js.handleExit({editor:t,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:t})]));a={...a,...h}}const c=MT(a);i.push(c);const u=U(r,"addInputRules",s);if(m0(r,t.options.enableInputRules)&&u){const h=u();if(h&&h.length){const p=pA({editor:t,rules:h}),m=Array.isArray(p)?p:[p];i.push(...m)}}const d=U(r,"addPasteRules",s);if(m0(r,t.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const p=wA({editor:t,rules:h});i.push(...p)}}const f=U(r,"addProseMirrorPlugins",s);if(f){const h=f();i.push(...h)}return i})}get attributes(){return Bw(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=wi(this.extensions);return Object.fromEntries(e.filter(n=>!!U(n,"addNodeView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ae(n.name,this.schema)},i=U(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(c,u,d,f,h)=>{const p=ra(c,r);return o({node:c,view:u,getPos:d,decorations:f,innerDecorations:h,editor:t,extension:n,HTMLAttributes:p})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return ko([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Vi(s.name,this.schema)},o=U(s,"dispatchTransaction",i);return o?a=>{o.call(i,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return ko([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Vi(s.name,this.schema)},o=U(s,"transformPastedHTML",i);return o?(a,c)=>{const u=r(a,c);return o.call(i,u)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=wi(this.extensions);return Object.fromEntries(e.filter(n=>!!U(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:zn(n.name,this.schema)},i=U(n,"addMarkView",s);if(!i)return[];const o=(a,c,u)=>{const d=ra(a,r);return i()({mark:a,view:c,inline:u,editor:t,extension:n,HTMLAttributes:d,updateAttributes:f=>{LA(a,t,f)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vi(e.name,this.schema)};e.type==="mark"&&((n=ne(U(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=U(e,"onBeforeCreate",r),i=U(e,"onCreate",r),o=U(e,"onUpdate",r),a=U(e,"onSelectionUpdate",r),c=U(e,"onTransaction",r),u=U(e,"onFocus",r),d=U(e,"onBlur",r),f=U(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Eu.resolve=Fw;Eu.sort=ko;Eu.flatten=em;var kA={};Yp(kA,{ClipboardTextSerializer:()=>Qw,Commands:()=>Zw,Delete:()=>e3,Drop:()=>t3,Editable:()=>n3,FocusEvents:()=>s3,Keymap:()=>i3,Paste:()=>o3,Tabindex:()=>a3,TextDirection:()=>l3,focusEventsPluginKey:()=>r3});var Ne=class Yw extends rm{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Yw(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Qw=Ne.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ye({key:new De("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(d=>d.$from.pos)),a=Math.max(...i.map(d=>d.$to.pos)),c=Vw(n);return Uw(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Zw=Ne.create({name:"commands",addCommands(){return{...Mw}}}),e3=Ne.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,a,c,u;if((u=(c=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:c.call(a,t))!=null?u:t.getMeta("y-sync$"))return;const d=$w(t.before,[t,...e]);qw(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,x=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((p,m)=>{var g,y;if(p instanceof rn){const x=h.slice(m).map(p.from,-1),v=h.slice(m).map(p.to),b=h.invert().map(x,-1),_=h.invert().map(v),C=x>0?(g=d.doc.nodeAt(x-1))==null?void 0:g.marks.some(k=>k.eq(p.mark)):!1,w=(y=d.doc.nodeAt(v))==null?void 0:y.marks.some(k=>k.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:b,to:_},newRange:{from:x,to:v},partial:!!(w||C),editor:this.editor,transaction:t,combinedTransform:d})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),t3=Ne.create({name:"drop",addProseMirrorPlugins(){return[new ye({key:new De("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),n3=Ne.create({name:"editable",addProseMirrorPlugins(){return[new ye({key:new De("editable"),props:{editable:()=>this.editor.options.editable}})]}}),r3=new De("focusEvents"),s3=Ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ye({key:r3,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),i3=Ne.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:c,doc:u}=a,{empty:d,$anchor:f}=c,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,x=g&&m.parent.childCount===1?y===f.pos:X.atStart(u).from===h;return!d||!p.type.isTextblock||p.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return mc()||Lw()?i:s},addProseMirrorPlugins(){return[new ye({key:new De("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),s=t.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,c=X.atStart(e.doc).from,u=X.atEnd(e.doc).to;if(i||!(o===c&&a===u)||!sa(n.doc))return;const h=n.tr,p=Nu({state:n,transaction:h}),{commands:m}=new ju({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),o3=Ne.create({name:"paste",addProseMirrorPlugins(){return[new ye({key:new De("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),a3=Ne.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new ye({key:new De("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),l3=Ne.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=wi(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ye({key:new De("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),NA=class ro{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new ro(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ro(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ro(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(a);if(!s&&!o&&c.depth<=this.depth)return;const u=new ro(c,this.editor,s,s||o?n:null);s&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const c=o[a];if(i[c]!==n[c])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(c=>n[c]===o.node.attrs[c])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},jA=`.ProseMirror {
552  position: relative;
553}
554
555.ProseMirror {
556  word-wrap: break-word;
557  white-space: pre-wrap;
558  white-space: break-spaces;
559  -webkit-font-variant-ligatures: none;
560  font-variant-ligatures: none;
561  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
562}
563
564.ProseMirror [contenteditable="false"] {
565  white-space: normal;
566}
567
568.ProseMirror [contenteditable="false"] [contenteditable="true"] {
569  white-space: pre-wrap;
570}
571
572.ProseMirror pre {
573  white-space: pre-wrap;
574}
575
576img.ProseMirror-separator {
577  display: inline !important;
578  border: none !important;
579  margin: 0 !important;
580  width: 0 !important;
581  height: 0 !important;
582}
583
584.ProseMirror-gapcursor {
585  display: none;
586  pointer-events: none;
587  position: absolute;
588  margin: 0;
589}
590
591.ProseMirror-gapcursor:after {
592  content: "";
593  display: block;
594  position: absolute;
595  top: -2px;
596  width: 20px;
597  border-top: 1px solid black;
598  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
599}
600
601@keyframes ProseMirror-cursor-blink {
602  to {
603    visibility: hidden;
604  }
605}
606
607.ProseMirror-hideselection *::selection {
608  background: transparent;
609}
610
611.ProseMirror-hideselection *::-moz-selection {
612  background: transparent;
613}
614
615.ProseMirror-hideselection * {
616  caret-color: transparent;
617}
618
619.ProseMirror-focused .ProseMirror-gapcursor {
620  display: block;
621}`;function _A(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var SA=class extends fA{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:U4,createMappablePosition:V4},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Iw(e,this.options.autofocus);this.editorState=Qs.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=_A(jA,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=zw(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const i=[...this.options.enableCoreExtensions?[n3,Qw.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Zw,s3,i3,a3.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),t3,o3,e3,l3.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Eu(i,this)}createCommandManager(){this.commandManager=new ju({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=uh(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=uh(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new Tw(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),c=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),c&&this.emit("blur",{editor:this,event:c.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Hw(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return z4(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return tm(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
622
623`,textSerializers:n={}}=t||{};return P4(this.state.doc,{blockSeparator:e,textSerializers:{...Vw(this.schema),...n}})}get isEmpty(){return sa(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new NA(e,this,!1,n)}get $doc(){return this.$pos(0)}};function ki(t){return new Cu({find:t.find,handler:({state:e,range:n,match:r})=>{const s=ne(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const c=a.search(/\S/),u=n.from+a.indexOf(o),d=u+o.length;if(nm(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;d<n.to&&i.delete(d,n.to),u>n.from&&i.delete(n.from+c,u);const h=n.from+c+o.length;i.addMark(n.from+c,h,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function c3(t){return new Cu({find:t.find,handler:({state:e,range:n,match:r})=>{const s=ne(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let a=n.to;const c=t.type.create(s);if(r[1]){const u=r[0].lastIndexOf(r[1]);let d=o+u;d>a?d=a:a=d+r[1].length;const f=r[0][r[0].length-1];i.insertText(f,o+r[0].length-1),i.replaceWith(d,a,c)}else if(r[0]){const u=t.type.isInline?o:o-1;i.insert(u,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:t.undoable})}function fh(t){return new Cu({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=ne(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Ni(t){return new Cu({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=ne(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),c=o.doc.resolve(n.from).blockRange(),u=c&&$p(c,t.type,i);if(!u)return null;if(o.wrap(c,u),t.keepMarks&&t.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(f,i).run()}const d=o.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&Pr(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&o.join(n.from-1)},undoable:t.undoable})}var CA=t=>"touches"in t,EA=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=a=>{if(!this.isResizing||!this.activeHandle)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const c=a.touches[0];if(!c)return;const u=c.clientX-this.startX,d=c.clientY-this.startY;this.handleResize(u,d)},this.handleMouseUp=()=>
623{if(!this.isResizing)return;const a=this.element.offsetWidth,c=this.element.offsetHeight;this.onCommit(a,c),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}
623removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,CA(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,s,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const i=t.includes("right"),o=t.includes("left"),a=t.includes("bottom"),c=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),a?s=this.startHeight+n:c&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,i,o;if(!n){let u=Math.max(this.minSize.width,t),d=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(u=Math.min(this.maxSize.width,u)),(s=this.maxSize)!=null&&s.height&&(d=Math.min(this.maxSize.height,d)),{width:u,height:d}}let a=t,c=e;return a<this.minSize.width&&(a=this.minSize.width,c=a/this.aspectRatio),c<this.minSize.height&&(c=this.minSize.height,a=c*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&a>this.maxSize.width&&(a=this.maxSize.width,c=a/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&c>this.maxSize.height&&(c=this.maxSize.height,a=c*this.aspectRatio),{width:a,height:c}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function TA(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof H){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}var AA={};Yp(AA,{createAtomBlockMarkdownSpec:()=>MA,createBlockMarkdownSpec:()=>OA,createInlineMarkdownSpec:()=>RA,parseAttributes:()=>sm,parseIndentedBlocks:()=>hh,renderNestedMarkdownContent:()=>om,serializeAttributes:()=>im});function sm(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const u=s.map(d=>d.trim().slice(1));e.class=u.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,u,d])=>{var f;const h=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=n[h];p&&(e[u]=p.slice(1,-1))});const c=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();
vendor: 4,343 bytes, lines 623-629
623return c&&c.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function im(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function MA(t){const{nodeName:e,name:n,parseAttributes:r=sm,serializeAttributes:s=im,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{const h={...i,...d.attributes};return f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}(?:\\s|$)`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const g=m[1]||"",y=r(g);if(!o.find(v=>!(v in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const f=u(d.attrs||{}),h=s(f),p=h?` {${h}}`:"";return`:::${c}${p} :::`}}}function OA(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=sm,serializeAttributes:i=im,defaultAttributes:o={},content:a="block",allowedAttributes:c}=t,u=n||e,d=f=>{if(!c)return f;const h={};return c.forEach(p=>{p in f&&(h[p]=f[p])}),h};return{parseMarkdown:(f,h)=>{let p;if(r){const g=r(f);p=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?p=h.parseChildren(f.tokens||[]):p=h.parseInline(f.tokens||[]);const m={...o,...f.attributes};return h.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(f){var h;const p=new RegExp(`^:::${u}`,"m"),m=(h=f.match(p))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,h,p){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[x,v=""]=y,b=s(v);let _=1;const C=x.length;let w="";const k=/^:::([\w-]*)(\s.*)?/gm,E=f.slice(C);for(k.lastIndex=0;;){const S=k.exec(E);if(S===null)break;const j=S.index,A=S[1];if(!((m=S[2])!=null&&m.endsWith(":::"))){if(A)_+=1;else if(_-=1,_===0){const z=E.slice(0,j);w=z.trim();const R=f.slice(0,C+j+S[0].length);let O=[];if(w)if(a==="block")for(O=p.blockTokens(z),O.forEach(D=>{D.text&&(!D.tokens||D.tokens.length===0)&&(D.tokens=p.inlineTokens(D.text))});O.length>0;){const D=O[O.length-1];if(D.type==="paragraph"&&(!D.text||D.text.trim()===""))O.pop();else break}else O=p.inlineTokens(w);return{type:e,raw:R,attributes:b,content:w,tokens:O}}}}}},renderMarkdown:(f,h)=>{const p=d(f.attrs||{}),m=i(p),g=m?` {${m}}`:"",y=h.renderChildren(f.content||[],`
624
625`);return`:::${u}${g}
626
627${y}
628
629:::`}}}function PA(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function IA(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function RA(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=PA,serializeAttributes:i=IA,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:c}=t,u=n||e,d=h=>{if(!c)return h;const p={};return c.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in h){const x=h[g];if(y!==void 0&&x===y)return;p[g]=x}}),p},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const m={...o,...h.attributes};if(a)return p.createNode(e,m);const g=r?r(h):h.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=h.match(p),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(h,p,m){const g=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=h.match(g);if(!y)return;let x="",v="";if(a){const[,_]=y;v=_}else{const[,_,C]=y;v=_,x=C||""}const b=s(v.trim());return{type:e,raw:y[0],content:x.trim(),attributes:b}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=d(h.attrs||{}),g=i(m),y=g?` ${g}`:"";return a?`[${u}${y}]`:`[${u}${y}]${p}[/${u}]`}}
629}function hh(t,e,n){var r,s,i,o;const a=t.split(`
630`),c=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<a.length;){const h=a[d],p=h.match(e.itemPattern);if(!p){if(c.length>0)break;if(h.trim()===""){d+=1,u=`${u}${h}
631`;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:y}=m;u=`${u}${h}
632`;const x=[y];for(d+=1;d<a.length;){const C=a[d];if(C.trim()===""){const k=a.slice(d+1).findIndex(j=>j.trim()!=="");if(k===-1)break;if((((s=(r=a[d+1+k].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){x.push(C),u=`${u}${C}
633`,d+=1;continue}else break}if((((o=(i=C.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)x.push(C),u=`${u}${C}
634`,d+=1;else break}let v;const b=x.slice(1);if(b.length>0){const C=b.map(w=>w.slice(g+f)).join(`
635`);C.trim()&&(e.customNestedParser?v=e.customNestedParser(C):v=n.blockTokens(C))}const _=e.createToken(m,v);c.push(_)}if(c.length!==0)return{items:c,raw:u}}function om(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,a=e.renderChildren([i]);let c=`${s}${a}`;return o&&o.length>0&&o.forEach((u,d)=>{var f,h;const p=(h=(f=e.renderChild)==null?void 0:f.call(e,u,d+1))!=null?h:e.renderChildren([u]);if(p!=null){const m=p.split(`
636`).map(g=>g?e.indent(g):e.indent("")).join(`
637`);c+=u.type==="paragraph"?`
638
639${m}`:`
640${m}`}}),c}function LA(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,c)=>{const u=i.mapping.map(c),d=i.mapping.map(c)+a.nodeSize;let f=null;if(a.marks.forEach(p=>{if(p!==o)return!1;f=p}),!f)return;let h=!1;if(Object.keys(n).forEach(p=>{n[p]!==f.attrs[p]&&(h=!0)}),h){const p=t.type.create({...t.attrs,...n});i.removeMark(u,d,t.type),i.addMark(u,d,p)}}),i.docChanged&&e.view.dispatch(i)}var jt=class u3 extends rm{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new u3(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function vs(t){return new xA({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=ne(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],c=r[0];let u=n.to;if(a){const d=c.search(/\S/),f=n.from+c.indexOf(a),h=f+a.length;if(nm(n.from,n.to,e.doc).filter(g=>g.mark.type.excluded.find(x=>x===t.type&&x!==g.mark.type)).filter(g=>g.to>f).length)return null;h<n.to&&o.delete(h,n.to),f>n.from&&o.delete(n.from+d,f),u=n.from+d+a.length,o.addMark(n.from+d,u,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:DA,getOwnPropertySymbols:$A}=Object,{hasOwnProperty:zA}=Object.prototype;function Md(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function tl(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),a=i.get(r);if(o&&a)return o===r&&a===n;i.set(n,r),i.set(r,n);const c=t(n,r,s);return i.delete(n),i.delete(r),c}}function BA(t){return t!=null?t[Symbol.toStringTag]:void 0}function x0(t){return DA(t).concat($A(t))}const FA=Object.hasOwn||((t,e)=>zA.call(t,e));function _s(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const UA="__v",VA="__o",HA="_owner",{getOwnPropertyDescriptor:y0,keys:v0}=Object;function qA(t,e){return t.byteLength===e.byteLength&&gc(new Uint8Array(t),new Uint8Array(e))}function WA(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function KA(t,e){return t.byteLength===e.byteLength&&gc(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function JA(t,e){return _s(t.getTime(),e.getTime())}function GA(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function XA(t,e){return t===e}function b0(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,a,c=0;for(;(o=i.next())&&!o.done;){const u=e.entries();let d=!1,f=0;for(;(a=u.next())&&!a.done;){if(s[f]){f++;continue}const h=o.value,p=a.value;if(n.equals(h[0],p[0],c,f,t,e,n)&&n.equals(h[1],p[1],h[0],p[0],t,e,n)){d=s[f]=!0;break}f++}if(!d)return!1;c++}return!0}const YA=_s;function QA(t,e,n){const r=v0(t);let s=r.length;if(v0(e).length!==s)return!1;for(;s-- >0;)if(!d3(t,e,n,r[s]))return!1;return!0}function Hi(t,e,n){const r=x0(t);let s=r.length;if(x0(e).length!==s)return!1;let i,o,a;for(;s-- >0;)if(i=r[s],!d3(t,e,n,i)||(o=y0(t,i),a=y0(e,i),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function ZA(t,e){return _s(t.valueOf(),e.valueOf())}function eM(t,e){return t.source===e.source&&t.flags===e.flags}function w0(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,a;for(;(o=i.next())&&!o.done;){const c=e.values();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(!s[d]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function gc(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function tM(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function d3(t,e,n,r){return(r===HA||r===VA||r===UA)&&(t.$$typeof||e.$$typeof)?!0:FA(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const nM="[object ArrayBuffer]",rM="[object Arguments]",sM="[object Boolean]",iM="[object DataView]",oM="[object Date]",aM="[object Error]",lM="[object Map]",cM="[object Number]",uM="[object Object]",dM="[object RegExp]",fM="[object Set]",hM="[object String]",pM={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array
640]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},mM="[object URL]",gM=Object.prototype.toString;function xM({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:f,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:m}){return function(y,x,v){if(y===x)return!0;if(y==null||x==null)return!1;const b=typeof y;if(b!==typeof x)return!1;if(b!=="object")return b==="number"?a(y,x,v):b==="function"?i(y,x,v):!1;const _=y.constructor;if(_!==x.constructor)return!1;if(_===Object)return c(y,x,v);if(Array.isArray(y))return e(y,x,v);if(_===Date)return r(y,x,v);if(_===RegExp)return d(y,x,v);if(_===Map)return o(y,x,v);if(_===Set)return f(y,x,v);const C=gM.call(y);if(C===oM)return r(y,x,v);if(C===dM)return d(y,x,v);if(C===lM)return o(y,x,v);if(C===fM)return f(y,x,v);if(C===uM)return typeof y.then!="function"&&typeof x.then!="function"&&c(y,x,v);if(C===mM)return p(y,x,v);if(C===aM)return s(y,x,v);if(C===rM)return c(y,x,v);if(pM[C])return h(y,x,v);if(C===nM)return t(y,x,v);if(C===iM)return n(y,x,v);if(C===sM||C===cM||C===hM)return u(y,x,v);if(m){let w=m[C];if(!w){const k=BA(y);k&&(w=m[k])}if(w)return w(y,x,v)}return!1}}function yM({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:qA,areArraysEqual:n?Hi:WA,areDataViewsEqual:KA,areDatesEqual:JA,areErrorsEqual:GA,areFunctionsEqual:XA,areMapsEqual:n?Md(b0,Hi):b0,areNumbersEqual:YA,areObjectsEqual:n?Hi:QA,arePrimitiveWrappersEqual:ZA,areRegExpsEqual:eM,areSetsEqual:n?Md(w0,Hi):w0,areTypedArraysEqual:n?Md(gc,Hi):gc,areUrlsEqual:tM,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=tl(r.areArraysEqual),i=tl(r.areMapsEqual),o=tl(r.areObjectsEqual),a=tl(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:a})}return r}function vM(t){return function(e,n,r,s,i,o,a){return t(e,n,a)}}function bM({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(a,c){const{cache:u=t?new WeakMap:void 0,meta:d}=n();return e(a,c,{cache:u,equals:r,meta:d,strict:s})};if(t)return function(a,c){return e(a,c,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,c){return e(a,c,i)}}const wM=Rr();Rr({strict:!0});Rr({circular:!0});Rr({circular:!0,strict:!0});Rr({createInternalComparator:()=>_s});Rr({strict:!0,createInternalComparator:()=>_s});Rr({circular:!0,createInternalComparator:()=>_s});Rr({circular:!0,createInternalComparator:()=>_s,strict:!0});function Rr(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=yM(t),o=xM(i),a=n?n(o):vM(o);return bM({circular:e,comparator:o,createState:r,equals:a,strict:s})}var f3={exports:{}},h3={};/**
641 * @license React
642 * use-sync-external-store-shim/with-selector.production.js
643 *
644 * Copyright (c) Meta Platforms, Inc. and affiliates.
645 *
646 * This source code is licensed under the MIT license found in the
647 * LICENSE file in the root directory of this source tree.
648 */var Tu=N,kM=Rp;function NM(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var jM=typeof Object.is=="function"?Object.is:NM,_M=kM.useSyncExternalStore,SM=Tu.useRef,CM=Tu.useEffect,EM=Tu.useMemo,TM=Tu.useDebugValue;h3.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=SM(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=EM(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var m=o.value;if(s(m,p))return f=m}return f=p}if(m=f,jM(d,p))return m;var g=r(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,f=g)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(e())},h===null?void 0:function(){return c(h())}]},[e,n,r,s]);var a=_M(t,i[0],i[1]);return CM(function(){o.hasValue=!0,o.value=a},[a]),TM(a),a};f3.exports=h3;var AM=f3.exports,MM=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},OM=({contentComponent:t})=>{const e=Rp.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return l.jsx(l.Fragment,{children:Object.values(e)})};function PM(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:zj.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var IM=class extends ee.Component{constructor(t){super(t),this.editorContentRef=ee.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=PM(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:MM(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&l.jsx(OM,{contentComponent:t.contentComponent})]})}},RM=N.forwardRef((t,e)=>{const n=ee.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ee.createElement(IM,{key:n,innerRef:e,...t})}),p3=ee.memo(RM),LM=typeof window<"u"?N.useLayoutEffect:N.useEffect,DM=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0}
648,this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function $M(t){var e;const[n]=N.useState(()=>new DM(t.editor)),r=AM.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:wM);return LM(()=>n.watch(t.editor),[t.editor,n]),N.useDebugValue(r),r}var zM=!1,m3=typeof window>"u",BM=m3||!!(typeof window<"u"&&window.next),FM=class g3{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return m3?(n&&zM&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):BM&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new SA(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?g3.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}
648):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function UM(t={},e=[]){const n=N.useRef(t);n.current=t;const[r]=N.useState(()=>new FM(n)),s=Rp.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return N.useDebugValue(s),N.useEffect(r.onRender(e)),$M({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var x3=N.createContext({editor:null});x3.Consumer;var VM=N.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),HM=()=>N.useContext(VM);ee.forwardRef((t,e)=>{const{onDragStart:n}=HM(),r=t.as||"div";return l.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});ee.createContext({markViewContentRef:()=>{}});var am=N.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});am.displayName="TiptapContext";var qM=()=>N.useContext(am);function y3({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=N.useMemo(()=>({editor:r}),[r]),i=N.useMemo(()=>({editor:r}),[r]);return l.jsx(x3.Provider,{value:i,children:l.jsx(am.Provider,{value:s,children:n})})}y3.displayName="Tiptap";function v3({...t}){const{editor:e}=qM();return l.jsx(p3,{editor:e,...t})}v3.displayName="Tiptap.Content";Object.assign(y3,{Content:v3});var xc=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},WM=/^\s*>\s$/,KM=jt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return xc("blockquote",{..._e(this.options.HTMLAttributes,t),children:xc("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,i)=>{var o,a;const d=((a=(o=e.renderChild)==null?void 0:o.call(e,s,i))!=null?a:e.renderChildren([s])).split(`
649`).map(f=>f.trim()===""?n:`${n} ${f}`);r.push(d.join(`
650`))}),r.join(`
651${n}
652`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}}
vendor: 1,201 bytes, line 652
652,addInputRules(){return[Ni({find:WM,type:this.type})]}}),JM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,GM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,XM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,YM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,QM=js.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return xc("strong",{..._e(this.options.HTMLAttributes,t),children:xc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
vendor: 7,847 bytes, lines 652-673
652,addInputRules(){return[ki({find:JM,type:this.type}),ki({find:XM,type:this.type})]},addPasteRules(){return[vs({find:GM,type:this.type}),vs({find:YM,type:this.type})]}}),ZM=/(^|[^`])`([^`]+)`(?!`)$/,eO=/(^|[^`])`([^`]+)`(?!`)/g,tO=js.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",_e(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ki({find:ZM,type:this.type})]},addPasteRules(){return[vs({find:eO,type:this.type})]}}),Od=4,nO=/^```([a-z]+)?[\s\n]$/,rO=/^~~~([a-z]+)?[\s\n]$/,sO=jt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Od,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",_e(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
653`):r=`\`\`\`${s}
654
655\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Od,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:c})=>{const{from:u,to:d}=s,p=r.doc.textBetween(u,d,`
656`,`
657`).split(`
658`).map(m=>a+m).join(`
659`);return c.replaceWith(u,d,r.schema.text(p)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Od,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var c;const{pos:u}=i,d=i.start(),f=i.end(),p=r.doc.textBetween(d,f,`
660`,`
661`).split(`
662`);let m=0,g=0;const y=u-d;for(let w=0;w<p.length;w+=1){if(g+p[w].length>=y){m=w;break}g+=p[w].length+1}const v=((c=p[m].match(/^ */))==null?void 0:c[0])||"",b=Math.min(v.length,n);if(b===0)return!0;let _=d;for(let w=0;w<m;w+=1)_+=p[w].length+1;return a.delete(_,_+b),u-_<=b&&a.setSelection(W.create(a.doc,_)),!0}):t.commands.command(({tr:a})=>{const{from:c,to:u}=s,h=r.doc.textBetween(c,u,`
663`,`
664`).split(`
665`).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,n);return p.slice(y)}).join(`
666`);return a.replaceWith(c,u,r.schema.text(h)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
667
668`);return!i||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:u})=>(u.setSelection(X.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[fh({find:nO,type:this.type,getAttributes:t=>({language:t[1]})}),fh({find:rO,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ye({key:new De("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:a}=t.state,c=a.text(n.replace(/\r\n?/g,`
669`));return o.replaceSelectionWith(this.type.create({language:i},c)),o.selection.$from.parent.type!==this.type&&o.setSelection(W.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),iO=jt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
670
671`):""}),oO=jt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",_e(this.options.HTMLAttributes,t)]},renderText(){return`
672`},renderMarkdown:()=>`  
673`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,c=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&o){const f=c.filter(h=>a.includes(h.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),aO=jt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,_e(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>fh({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}}
673)\\s$`),type:this.type,getAttributes:{level:t}}))}}),lO=jt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",_e(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!TA(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return Ww(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(W.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(H.create(o.doc,c.pos)):o.setSelection(W.create(o.doc,c.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=d==null?void 0:d.create();f&&(o.insert(u,f),o.setSelection(W.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[c3({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 4,505 bytes, line 673
673ype})]}}),cO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,uO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,dO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,fO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,hO=js.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",_e(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ki({find:cO,type:this.type}),ki({find:dO,type:this.type})]},addPasteRules(){return[vs({find:uO,type:this.type}),vs({find:fO,type:this.type})]}});const pO="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
673ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",mO="ελ1υ2бг1ел3дети4ею2католик6ом3мÐ
673ºÐ´2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3Õ°Õ¡Õµ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1ì»´2삼성2한국2",ph="numeric",mh="ascii",gh="alpha",No="asciinumeric",so="alphanumeric",xh="domain",b3="emoji",gO="scheme",xO="slashscheme",Pd="whitespace";function yO(t,e){return t in e||(e[t]=[]),e[t]}function Xr(t,e,n){e[ph]&&(e[No]=!0,e[so]=!0),e[mh]&&(e[No]=!0,e[gh]=!0),e[No]&&(e[so]=!0),e[gh]&&(e[so]=!0),e[so]&&(e[xh]=!0),e[b3]&&(e[xh]=!0);for(const r in e){const s=yO(r,n);s.indexOf(t)<0&&s.push(t)}}function vO(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function xt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}xt.groups={};xt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||xt.groups;let s;return e&&e.j?s=e:(s=new xt(e),n&&r&&Xr(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||xt.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new xt,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new xt,i){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(vO(o.t,r),n);Xr(i,c,r)}else n&&Xr(i,n,r);o.t=i}return s.j[t]=o,o}};const Y=(t,e,n,r,s)=>t.ta(e,n,r,s),ve=(t,e,n,r,s)=>t.tr(e,n,r,s),k0=(t,e,n,r,s)=>t.ts(e,n,r,s),I=(t,e,n,r,s)=>t.tt(e,n,r,s),jn="WORD",yh="UWORD",w3="ASCIINUMERICAL",k3="ALPHANUMERICAL",ia="LOCALHOST",vh="TLD",bh="UTLD",jl="SCHEME",zs="SLASH_SCHEME",lm="NUM",wh="WS",cm="NL",jo="OPENBRACE",_o="CLOSEBRACE",yc="OPENBRACKET",vc="CLOSEBRACKET",bc="OPENPAREN",wc="CLOSEPAREN",kc="OPENANGLEBRACKET",Nc="CLOSEANGLEBRACKET",jc="FULLWIDTHLEFTPAREN",_c="FULLWIDTHRIGHTPAREN",Sc="LEFTCORNERBRACKET",Cc="RIGHTCORNERBRACKET",Ec="LEFTWHITECORNERBRACKET",Tc="RIGHTWHITECORNERBRACKET",Ac="FULLWIDTHLESSTHAN",Mc="FULLWIDTHGREATERTHAN",Oc="AMPERSAND",Pc="APOSTROPHE",Ic="ASTERISK",Gn="AT",Rc="BACKSLASH",Lc="BACKTICK",Dc="CARET",Yr="COLON",um="COMMA",$c="DOLLAR",fn="DOT",zc="EQUALS",dm="EXCLAMATION",Pt="HYPHEN",So="PERCENT",Bc="PIPE",Fc="PLUS",Uc="POUND",Co="QUERY",fm="QUOTE",N3="FULLWIDTHMIDDLEDOT",hm="SEMI",hn="SLASH",Eo="TILDE",Vc="UNDERSCORE",j3="EMOJI",Hc="SYM";var _3=Object.freeze({__proto__:null,ALPHANUMERICAL:k3,AMPERSAND:Oc,APOSTROPHE:Pc,ASCIINUMERICAL:w3,ASTERISK:Ic,AT:Gn,BACKSLASH:Rc,BACKTICK:Lc,CARET:Dc,CLOSEANGLEBRACKET:Nc,CLOSEBRACE:_o,CLOSEBRACKET:vc,CLOSEPAREN:wc,COLON:Yr,COMMA:um,DOLLAR:$c,DOT:fn,EMOJI:j3,EQUALS:zc,EXCLAMATION:dm,FULLWIDTHGREATERTHAN:Mc,FULLWIDTHLEFTPAREN:jc,FULLWIDTHLESSTHAN:Ac,FULLWIDTHMIDDLEDOT:N3,FULLWIDTHRIGHTPAREN:_c,HYPHEN:Pt,LEFTCORNERBRACKET:Sc,LEFTWHITECORNERBRACKET:Ec,LOCALHOST:ia,NL:cm,NUM:lm,OPENANGLEBRACKET:kc,OPENBRACE:jo,OPENBRACKET:yc,OPENPAREN:bc,PERCENT:So,PIPE:Bc,PLUS:Fc,POUND:Uc,QUERY:Co,QUOTE:fm,RIGHTCORNERBRACKET:Cc,RIGHTWHITECORNERBRACKET:Tc,SCHEME:jl,SEMI:hm,SLASH:hn,SLASH_SCHEME:zs,SYM:Hc,TILDE:Eo,TLD:vh,UNDERSCORE:Vc,UTLD:bh,UWORD:yh,WORD:jn,WS:wh});const wn=/[a-z]/,qi=new RegExp("\\p{L}","u"),Id=new RegExp("\\p{Emoji}","u"),kn=/\d/,Rd=/\s/,N0="\r",Ld=`
674`,bO="️",wO="‍",Dd="";let nl=null,rl=null;function kO(t=[]){const e={};xt.groups=e;const n=new xt;nl==null&&(nl=j0(pO)),rl==null&&(rl=j0(mO)),I(n,"'",Pc),I(n,"{",jo),I(n,"}",_o),I(n,"[",yc),I(n,"]",vc),I(n,"(",bc),I(n,")",wc),I(n,"<",kc),I(n,">
674",Nc),I(n,"(",jc),I(n,")",_c),I(n,"「",Sc),I(n,"」",Cc),I(n,"『",Ec),I(n,"』",Tc),I(n,"<",Ac),I(n,">",Mc),I(n,"&",Oc),I(n,"*",Ic),I(n,"@",Gn),I(n,"`",Lc),I(n,"^",Dc),I(n,":",Yr),I(n,",",um),I(n,"$",$c),I(n,".",fn),I(n,"=",zc),I(n,"!",dm),I(n,"-",Pt),I(n,"%",So),I(n,"|",Bc),I(n,"+",Fc),I(n,"#",Uc),I(n,"?",Co),I(n,'"',fm),I(n,"/",hn),I(n,";",hm),I(n,"~",Eo),I(n,"_",Vc),I(n,"\\",Rc),I(n,"・",N3);const r=ve(n,kn,lm,{[ph]:!0});ve(r,kn,r);const s=ve(r,wn,w3,{[No]:!0}),i=ve(r,qi,k3,{[so]:!0}),o=ve(n,wn,jn,{[mh]:!0});ve(o,kn,s),ve(o,wn,o),ve(s,kn,s),ve(s,wn,s);const a=ve(n,qi,yh,{[gh]:!0});ve(a,wn),ve(a,kn,i),ve(a,qi,a),ve(i,kn,i),ve(i,wn),ve(i,qi,i);const c=I(n,Ld,cm,{[Pd]:!0}),u=I(n,N0,wh,{[Pd]:!0}),d=ve(n,Rd,wh,{[Pd]:!0});I(n,Dd,d),I(u,Ld,c),I(u,Dd,d),ve(u,Rd,d),I(d,N0),I(d,Ld),ve(d,Rd,d),I(d,Dd,d);const f=ve(n,Id,j3,{[b3]:!0});I(f,"#"),ve(f,Id,f),I(f,bO,f);const h=I(f,wO);I(h,"#"),ve(h,Id,f);const p=[[wn,o],[kn,s]],m=[[wn,null],[qi,a],[kn,i]];for(let g=0;g<nl.length;g++)Vn(n,nl[g],vh,jn,p);for(let g=0;g<rl.length;g++)Vn(n,rl[g],bh,yh,m);Xr(vh,{tld:!0,ascii:!0},e),Xr(bh,{utld:!0,alpha:!0},e),Vn(n,"file",jl,jn,p),Vn(n,"mailto",jl,jn,p),Vn(n,"http",zs,jn,p),Vn(n,"https",zs,jn,p),Vn(n,"ftp",zs,jn,p),Vn(n,"ftps",zs,jn,p),Xr(jl,{scheme:!0,ascii:!0},e),Xr(zs,{slashscheme:!0,ascii:!0},e),t=t.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<t.length;g++){const y=t[g][0],v=t[g][1]?{[gO]:!0}:{[xO]:!0};y.indexOf("-")>=0?v[xh]=!0:wn.test(y)?kn.test(y)?v[No]=!0:v[mh]=!0:v[ph]=!0,k0(n,y,y,v)}return k0(n,"localhost",ia,{ascii:!0}),n.jd=new xt(Hc),{start:n,tokens:Object.assign({groups:e},_3)}}function S3(t,e){const n=NO(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,c=null,u=0,d=null,f=-1,h=-1;for(;o<r&&(c=a.go(n[o]));)a=c,a.accepts()?(f=0,h=0,d=a):f>=0&&(f+=n[o].length,h++),u+=n[o].length,i+=n[o].length,o++;i-=f,o-=h,u-=f,s.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return s}function NO(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Vn(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const c=e[a];t.j[c]?i=t.j[c]:(i=new xt(r),i.jr=s.slice(),t.j[c]=i),t=i}return i=new xt(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function j0(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const oa={defaultProtocol:"http",events:null,format:_0,formatHref:_0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function pm(t,e=null){let n=Object.assign({},oa);t&&(n=Object.assign(n,t instanceof pm?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}pm.prototype={o:oa,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:oa[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function _0(t){return t}function C3(t,e){this.t="token",this.v=t,this.tk=e}C3.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=oa.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),c=t.get("target",n,e),u=t.get("rel",n,e),d=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),c&&(o.target=c),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:s,attributes:o,content:i,eventListeners:f}}};
vendor: 15,823 bytes, lines 674-678
674function Au(t,e){class n extends C3{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const jO=Au("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),S0=Au("text"),_O=Au("nl"),sl=Au("url",{isLink:!0,toHref(t=oa.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ia&&t[1].t===Yr}}),Ot=t=>new xt(t);function SO({groups:t}){const e=t.domain.concat([Oc,Ic,Gn,Rc,Lc,Dc,$c,zc,Pt,lm,So,Bc,Fc,Uc,hn,Hc,Eo,Vc]),n=[Pc,Yr,um,fn,dm,So,Co,fm,hm,kc,Nc,jo,_o,vc,yc,bc,wc,jc,_c,Sc,Cc,Ec,Tc,Ac,Mc],r=[Oc,Pc,Ic,Rc,Lc,Dc,$c,zc,Pt,jo,_o,So,Bc,Fc,Uc,Co,hn,Hc,Eo,Vc],s=Ot(),i=I(s,Eo);Y(i,r,i),Y(i,t.domain,i);const o=Ot(),a=Ot(),c=Ot();Y(s,t.domain,o),Y(s,t.scheme,a),Y(s,t.slashscheme,c),Y(o,r,i),Y(o,t.domain,o);const u=I(o,Gn);I(i,Gn,u),I(a,Gn,u),I(c,Gn,u);const d=I(i,fn);Y(d,r,i),Y(d,t.domain,i);const f=Ot();Y(u,t.domain,f),Y(f,t.domain,f);const h=I(f,fn);Y(h,t.domain,f);const p=Ot(jO);Y(h,t.tld,p),Y(h,t.utld,p),I(u,ia,p);const m=I(f,Pt);I(m,Pt,m),Y(m,t.domain,f),Y(p,t.domain,f),I(p,fn,h),I(p,Pt,m);const g=I(o,Pt),y=I(o,fn);I(g,Pt,g),Y(g,t.domain,o),Y(y,r,i),Y(y,t.domain,o);const x=Ot(sl);Y(y,t.tld,x),Y(y,t.utld,x),Y(x,t.domain,o),Y(x,r,i),I(x,fn,y),I(x,Pt,g),I(x,Gn,u);const v=I(x,Yr),b=Ot(sl);Y(v,t.numeric,b);const _=Ot(sl),C=Ot();Y(_,e,_),Y(_,n,C),Y(C,e,_),Y(C,n,C),I(x,hn,_),I(b,hn,_);const w=I(a,Yr),k=I(c,Yr),E=I(k,hn),S=I(E,hn);Y(a,t.domain,o),I(a,fn,y),I(a,Pt,g),Y(c,t.domain,o),I(c,fn,y),I(c,Pt,g),Y(w,t.domain,_),I(w,hn,_),I(w,Co,_),Y(S,t.domain,_),Y(S,e,_),I(S,hn,_);const j=[[jo,_o],[yc,vc],[bc,wc],[kc,Nc],[jc,_c],[Sc,Cc],[Ec,Tc],[Ac,Mc]];for(let A=0;A<j.length;A++){const[z,R]=j[A],O=I(_,z);I(C,z,O);const D=Ot(sl);Y(O,e,D);const q=Ot();Y(O,n,q),I(O,R,_),Y(D,e,D),Y(D,n,q),Y(q,e,D),Y(q,n,q),I(D,R,_),I(q,R,_)}return I(s,ia,x),I(s,cm,_O),{start:s,tokens:_3}}function CO(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let a=t,c=null,u=null,d=0,f=null,h=-1;for(;s<r&&!(c=a.go(n[s].t));)o.push(n[s++]);for(;s<r&&(u=c||a.go(n[s].t));)c=null,a=u,a.accepts()?(h=0,f=a):h>=0&&h++,s++,d++;if(h<0)s-=d,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push($d(S0,e,o)),o=[]),s-=h,d-=h;const p=f.t,m=n.slice(s-d,s);i.push($d(p,e,m))}}return o.length>0&&i.push($d(S0,e,o)),i}function $d(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const EO=typeof console<"u"&&console&&console.warn||(()=>{}),TO="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ue={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function AO(){return xt.groups={},ue.scanner=null,ue.parser=null,ue.tokenQueue=[],ue.pluginQueue=[],ue.customSchemes=[],ue.initialized=!1,ue}function C0(t,e=!1){if(ue.initialized&&EO(`linkifyjs: already initialized - will not register custom scheme "${t}" ${TO}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
6751. Must only contain digits, lowercase ASCII letters or "-"
6762. Cannot start or end with "-"
6773. "-" cannot repeat`);ue.customSchemes.push([t,e])}function MO(){ue.scanner=kO(ue.customSchemes);for(let t=0;t<ue.tokenQueue.length;t++)ue.tokenQueue[t][1]({scanner:ue.scanner});ue.parser=SO(ue.scanner.tokens);for(let t=0;t<ue.pluginQueue.length;t++)ue.pluginQueue[t][1]({scanner:ue.scanner,parser:ue.parser});return ue.initialized=!0,ue}function mm(t){return ue.initialized||MO(),CO(ue.parser.start,t,S3(ue.scanner.start,t))}mm.scan=S3;function E3(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new pm(n),s=mm(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var gm="[\0-   ᠎ -\u2029  ]",OO=new RegExp(gm),PO=new RegExp(`${gm}$`),IO=new RegExp(gm,"g");function RO(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function LO(t){return new ye({key:new De("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=$w(n.doc,[...e]);if(qw(a).forEach(({newRange:u})=>{const d=S4(r.doc,u,p=>p.isTextblock);let f,h;if(d.length>1)f=d[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(u.from,u.to," "," ");if(!PO.test(p))return;f=d[0],h=r.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&h){const p=h.split(OO).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=mm(m).map(x=>x.toObject(t.defaultProtocol));if(!RO(y))return!1;y.filter(x=>x.isLink).map(x=>({...x,from:g+x.start+1,to:g+x.end+1})).filter(x=>r.schema.marks.code?!r.doc.rangeHasMark(x.from,x.to,r.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{nm(x.from,x.to,r.doc).some(v=>v.mark.type===t.type)||o.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!o.steps.length)return o}})}function DO(t){return new ye({key:new De("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const c=r.target;if(!c)return!1;const u=t.editor.view.dom;o=c.closest("a"),o&&!u.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const c=Hw(e.state,t.type.name),u=(s=o.href)!=null?s:c.href,d=(i=o.target)!=null?i:c.target;u&&(window.open(u,d),a=!0)}return a}}})}function $O(t){return new ye({key:new De("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const u=E3(c,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!u||s!==void 0&&!s(u.value)?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function $r(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(IO,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var T3=js.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){C0(t);return}C0(t.scheme,t.optionalSlashes)})},onDestroy(){AO()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!$r(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!$r(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!$r(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",_e(this.options.HTMLAttributes,t),0]:["a",_e(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",c=e.renderChildren(t);return a?`[${c}](${o} "${a}")`:`[${c}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!$r(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!$r(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=E3(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!$r(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(LO({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!$r(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(DO({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push($O({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),zO=T3,BO=Object.defineProperty,FO=(t,e)=>{for(var n in e)BO(t,n,{get:e[n],enumerable:!0})},UO="listItem",E0="textStyle",T0=/^\s*([-+*])\s$/,A3=jt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",_e(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
678`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(UO,this.editor.getAttributes(E0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ni({find:T0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ni({find:T0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(E0),editor:this.editor})),[t]}});function VO(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function HO(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var M3=jt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",_e(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(VO(t))return{type:"listItem",content:[{type:"paragraph",content:HO(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))s=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const c=t.tokens.slice(1),u=r(c);s.push(...u)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>om(t,e,r=>{var s,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),qO={};FO(qO,{findListItemPos:()=>_a,getNextListDepth:()=>xm,handleBackspace:()=>kh,handleDelete:()=>Nh,hasListBefore:()=>O3,hasListItemAfter:()=>WO,hasListItemBefore:()=>P3,listItemHasSubList:()=>I3,nextListIsDeeper:()=>R3,nextListIsHigher:()=>L3});var _a=(t,e)=>{const{$from:n}=e.selection,r=Ae(t,e.schema);let s=null,i=n.depth,o=n.pos,a=null;for(;i>0&&a===null;)s=n.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},xm=(t,e)=>{const n=_a(t,e);if(!n)return!1;const[,r]=D4(e,t,n.$pos.pos+4);return r},O3=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},P3=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},I3=(t,e,n)=>{if(!n)return!1;const r=Ae(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},kh=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Cr(t.state,e)&&O3(t.state,e,n)){const{$anchor:a}=t.state.selection,c=t.state.doc.resolve(a.before()-1),u=[];c.node().descendants((h,p)=>{h.type.name===e&&u.push({node:h,pos:p})});const d=u.at(-1);if(!d)return!1;const f=t.state.doc.resolve(c.start()+d.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Cr(t.state,e)||!F4(t.state))return!1;const r=_a(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=I3(e,t.state,i);return P3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},R3=(t,e)=>{const n=xm(t,e),r=_a(t,e);return!r||!n?!1:n>r.depth},L3=(t,e)=>{const n=xm(t,e),r=_a(t,e);return!r||!n?!1:n<r.depth},Nh=(t,e)=>{if(!Cr(t.state,e)||!B4(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:R3(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():L3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},WO=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},D3=Ne.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;
678return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Nh(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Nh(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&kh(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&kh(t,n,r)&&(e=!0)}),e}}}}),A0=/^(\s*)(\d+)\.\s+(.*)$/,KO=/^\s/;function JO(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function GO(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&JO(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function XO(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(A0);if(!i)break;const[,o,a,c]=i,u=o.length,d=[c];let f=n+1;const h=[s];let p=!1;for(;f<t.length;){const m=t[f];if(m.match(A0))break;if(m.trim()==="")h.push(m),d.push(""),p=!0,f+=1;else if(m.match(KO))h.push(m),d.push(m.slice(u+2)),f+=1;else{if(p)break;h.push(m),d.push(m),f+=1}}e.push({indent:u,number:parseInt(a,10),content:d.join(`
679`).trim(),contentLines:d,raw:h.join(`
680`)}),r=f,n=f}return[e,r]}function $3(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:a}=GO(i.contentLines),c=o.join(`
681`).trim(),u=[];c&&u.push({type:"paragraph",raw:c,tokens:n.inlineTokens(c)});const d=a.join(`
682`).trim();if(d){const p=n.blockTokens(d);u.push(...p)}let f=s+1;const h=[];for(;f<t.length&&t[f].indent>e;)h.push(t[f]),f+=1;if(h.length>0){const p=Math.min(...h.map(g=>g.indent)),m=$3(h,p,n);u.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
683`)})}r.push({type:"list_item",raw:i.raw,tokens:u}),s=f}else s+=1}return r}function YO(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var QO="listItem",M0="textStyle",O0=/^(\d+)\.\s$/,z3=jt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",_e(this.options.HTMLAttributes,n),0]:["ol",_e(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?YO(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
684`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(`
685`),[i,o]=XO(s);if(i.length===0)return;const a=$3(i,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:a,raw:s.slice(0,o).join(`
686`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QO,this.editor.getAttributes(M0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}
vendor: 4,567 bytes, lines 686-687
686,addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ni({find:O0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ni({find:O0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(M0)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),ZO=/^\s*(\[([( |x])?\])\s$/,eP=jt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",_e(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return om(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),u=f=>{var h,p;a.ariaLabel=((p=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:p.call(h,f,a.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};u(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{s.setAttribute(f,h)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,o),s.append(i,c),Object.entries(e).forEach(([f,h])=>{s.setAttribute(f,h)});let d=new Set(Object.keys(e));return{dom:s,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;s.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(f);const h=r.extensionManager.attributes,p=ra(f,h),m=new Set(Object.keys(p)),g=this.options.HTMLAttributes;return d.forEach(y=>{m.has(y)||(y in g?s.setAttribute(y,g[y]):s.removeAttribute(y))}),Object.entries(p).forEach(([y,x])=>{x==null?y in g?s.setAttribute(y,g[y]):s.removeAttribute(y):s.setAttribute(y,x)}),d=m,!0}}}},addInputRules(){return[Ni({find:ZO,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),tP=jt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",_e(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
687`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=hh(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>
687({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,c)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:c}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=hh(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ne.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(A3.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(M3.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(D3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(z3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(eP.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(tP.configure(this.options.taskList)),t}});var il="&nbsp;",zd=" ",nP=jt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",_e(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===il||n[0].text===il||n[0].raw===zd||n[0].text===zd)&&r.length===1&&r[0].type==="text"&&(r[0].text===il||r[0].text===zd)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?il:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),rP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,iP=js.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",_e(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ki({find:rP,type:this.type})]},addPasteRules(){return[vs({find:sP,type:this.type})]}}),oP=jt.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),B3=js.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",_e(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),aP=B3;function lP(t={}){return new ye({view(e){return new cP(e,t)}})}class cP{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}
vendor: 4,293 bytes, line 687
687destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,d;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=c.getBoundingClientRect(),h=f.width/c.offsetWidth,p=f.height/c.offsetHeight;u=f.left-c.scrollLeft*h,d=f.top-c.scrollTop*p}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=R1(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ke extends X{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ke.valid(r)?new ke(r):X.near(r)}content(){return B.empty}eq(e){return e instanceof ke&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ke(e.resolve(n.pos))}getBookmark(){return new ym(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!uP(e)||!dP(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ke.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let c=e.doc.resolve(s);if(ke.valid(c))return c}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!H.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(ke.valid(a))return a}return null}}}ke.prototype.visible=!1;ke.findFrom=ke.findGapCursorFrom;X.jsonID("gapcursor",ke);class ym{constructor(e){this.pos=e}map(e){return new ym(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ke.valid(n)?new ke(n):X.near(n)}}function F3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function uP(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||F3(s.type))return!0;
vendor: 14,216 bytes, line 687
687if(s.inlineContent)return!1}}return!0}function dP(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||F3(s.type))return!0;if(s.inlineContent)return!1}}return!0}function fP(){return new ye({props:{decorations:gP,createSelectionBetween(t,e,n){return e.pos==n.pos&&ke.valid(n)?new ke(n):null},handleClick:pP,handleKeyDown:hP,handleDOMEvents:{beforeinput:mP}}})}const hP=Aw({ArrowLeft:ol("horiz",-1),ArrowRight:ol("horiz",1),ArrowUp:ol("vert",-1),ArrowDown:ol("vert",1)});function ol(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,c=o.empty;if(o instanceof W){if(!i.endOfTextblock(n)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=ke.findGapCursorFrom(a,e,c);return u?(s&&s(r.tr.setSelection(new ke(u))),!0):!1}}function pP(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ke.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&H.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ke(r))),!0)}function mP(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ke))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=M.empty;for(let o=r.length-1;o>=0;o--)s=M.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new B(s,0,0));return i.setSelection(W.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function gP(t){if(!(t.selection instanceof ke))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",me.create(t.doc,[lt.widget(t.selection.head,e,{key:"gapcursor"})])}var qc=200,Fe=function(){};Fe.prototype.append=function(e){return e.length?(e=Fe.from(e),!this.length&&e||e.length<qc&&this.leafAppend(e)||this.length<qc&&e.leafPrepend(this)||this.appendInner(e)):this};Fe.prototype.prepend=function(e){return e.length?Fe.from(e).append(this):this};Fe.prototype.appendInner=function(e){return new xP(this,e)};Fe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Fe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Fe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Fe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Fe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};Fe.from=function(e){return e instanceof Fe?e:e&&e.length?new U3(e):Fe.empty};var U3=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var c=i;c<o;c++)if(s(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var c=i-1;c>=o;c--)if(s(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=qc)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=qc)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Fe);Fe.empty=new U3([]);var xP=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Fe);const yP=500;class tn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,c,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,d.push(f);return}if(s){d.push(new pn(f.map));let p=f.step.map(s.slice(i)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new pn(m,void 0,void 0,u.length+d.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(f.step);if(f.selection)return a=s?f.selection.map(s.slice(i)):f.selection,c=new tn(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,c=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new pn(e.mapping.maps[d],f,n),p;(p=c&&c.merge(h))&&(h=p,d?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(o++,n=void 0),s||(c=h)}let u=o-r.depth;return u>bP&&(a=vP(a,u),o-=u),new tn(a.append(i),o)}remapping(e,n){let r=new Yo;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new tn(this.items.append(e.map(n=>new pn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let c=n;this.items.forEach(h=>{let p=i.getMirror(--c);if(p==null)return;o=Math.min(o,p);let m=i.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(i.slice(c+1,p));y&&a++,r.push(new pn(m,g,y))}else r.push(new pn(m))},s);let u=[];for(let h=n;h<o;h++)u.push(new pn(i.maps[h]));let d=this.items.slice(0,s).append(u).append(r),f=new tn(d,a);return f.emptyItemCount()>yP&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let c=o.step.map(n.slice(r)),u=c&&c.getMap();if(r--,u&&n.appendMap(u,r),c){let d=o.selection&&o.selection.map(n.slice(r));d&&i++;let f=new pn(u.invert(),c,d),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else o.map&&r--},this.items.length,0),new tn(Fe.from(s.reverse()),i)}}tn.empty=new tn(Fe.empty,0);function vP(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class pn{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new pn(n.getMap().invert(),n,this.selection)}}}class Xn{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const bP=20;function wP(t,e,n,r){let s=n.getMeta(ls),i;if(s)return s.historyState;n.getMeta(jP)&&(t=new Xn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ls))return o.getMeta(ls).redo?new Xn(t.done.addTransform(n,void 0,r,_l(e)),t.undone,P0(n.mapping.maps),t.prevTime,t.prevComposition):new Xn(t.done,t.undone.addTransform(n,void 0,r,_l(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),c=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!kP(n,t.prevRanges)),u=o?Bd(t.prevRanges,n.mapping):P0(n.mapping.maps);return new Xn(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,_l(e)),tn.empty,u,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Xn(t.done.rebased(n,i),t.undone.rebased(n,i),Bd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Xn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Bd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function kP(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function P0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function Bd(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function NP(t,e,n){let r=_l(e),s=ls.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),c=new Xn(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(ls,{redo:n,historyState:c})}let Fd=!1,I0=null;function _l(t){let e=t.plugins;if(I0!=e){Fd=!1,I0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fd=!0;break}}return Fd}const ls=new De("history"),jP=new De("closeHistory");function _P(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ye({key:ls,state:{init(){return new Xn(tn.empty,tn.empty,null,0,-1)},apply(e,n,r){return wP(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?H3:r=="historyRedo"?q3:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function V3(t,e){return(n,r)=>{let s=ls.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=NP(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const H3=V3(!1,!0),q3=V3(!0,!0);Ne.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ye({key:new De("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const a=o-s,c=0,u=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,u);return t=!0,d}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,c=i-r,u=a-c,d=a;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>r)}})]}});var SP=Ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[lP(this.options)]}});Ne.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ye({key:new De("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return me.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(s>=u&&s<=u+c.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((c,u)=>{if(c.isText||!(s>=u&&s<=u+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(lt.node(u,u+c.nodeSize,{class:this.options.className}))}),me.create(t,i)}}})]}});var CP=Ne.create({name:"gapCursor",addProseMirrorPlugins(){return[fP()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ne(U(t,"allowGapCursor",n)))!=null?e:null}}}),W3="placeholder",aa=new De("tiptap__placeholder"),R0=200;function L0(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:c,emptyEditor:u}}=t,d=[c];return o&&d.push(u),lt.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:a}):n})}function EP({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){var i,o;if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:c}=s,u=[],d=t.isEmpty,f={emptyEditor:e.emptyEditorClass,emptyNode:e.emptyNodeClass};if(e.showOnlyCurrent&&!e.includeChildren){const p=r.resolve(c),m=p.depth>
6870?p.node(1):p.nodeAfter,g=p.depth>0?p.before(1):c;if(m&&m.type.isTextblock&&sa(m)){const y=c>=g&&c<=g+m.nodeSize;u.push(L0({editor:t,isEmptyDoc:d,dataAttribute:n,hasAnchor:y,placeholder:e.placeholder,classes:f,node:m,pos:g}))}}else{const p=aa.getState(t.state),m=(i=p==null?void 0:p.topPos)!=null?i:0,g=(o=p==null?void 0:p.bottomPos)!=null?o:r.content.size;r.nodesBetween(m,g,(y,x)=>{const v=c>=x&&c<=x+y.nodeSize,b=!y.isLeaf&&sa(y);return y.type.isTextblock&&(v||!e.showOnlyCurrent)&&b&&u.push(L0({editor:t,isEmptyDoc:d,dataAttribute:n,hasAnchor:v,placeholder:e.placeholder,classes:f,node:y,pos:x})),e.includeChildren})}return me.create(r,u)}function TP(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function AP(t){const e=getComputedStyle(t),n=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(n)}function MP(t){let e=t;for(;e;){if(AP(e))return e;const n=e.parentElement;if(!n){const r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=n}return window}function OP(t){return t===window?{top:0,bottom:window.innerHeight}:t.getBoundingClientRect()}function PP({doc:t,view:e,scrollContainer:n}){const r=e.dom.getBoundingClientRect(),s=n?OP(n):{top:0,bottom:window.innerHeight},i=Math.max(r.top,s.top)-R0,o=Math.min(r.bottom,s.bottom)+R0;if(i>=o)return{top:0,bottom:t.content.size};const c=getComputedStyle(e.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,u=e.posAtCoords({left:c,top:i+2}),d=e.posAtCoords({left:c,top:o-2});return{top:u?u.pos:0,bottom:d?d.pos:t.content.size}}var IP={init(){return{topPos:null,bottomPos:null}},apply(t,e){const n=t.getMeta(aa);return n!=null&&n.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:t.docChanged?{topPos:e.topPos!==null?t.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?t.mapping.map(e.bottomPos):null}:e}};function RP(t){const e=MP(t.dom),n=()=>{const a=PP({view:t,doc:t.state.doc,scrollContainer:e}),c=aa.getState(t.state);if((c==null?void 0:c.topPos)===a.top&&(c==null?void 0:c.bottomPos)===a.bottom)return;const u=t.state.tr.setMeta(aa,{positions:a});t.dispatch(u)};let r=null,s=0;const i=150,o=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const a=performance.now();a-s>=i?(s=a,n()):o()}))};return e.addEventListener("scroll",o,{passive:!0}),n(),{update(a,c){t.state.doc.content.size!==c.doc.content.size&&o()},destroy:()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("scroll",o)}}}function LP({editor:t,options:e}){const n=e.dataAttribute?`data-${TP(e.dataAttribute)}`:`data-${W3}`;return new ye({key:aa,state:IP,view:RP,props:{decorations:({doc:r,selection:s})=>EP({editor:t,options:e,dataAttribute:n,doc:r,selection:s})}})}Ne.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:W3,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[LP({editor:this.editor,options:this.options})]}});Ne.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ye({key:new De("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Ww(n.selection)||t.view.dragging?null:me.create(n.doc,[lt.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var DP="skipTrailingNode";function D0({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var $P=Ne.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new De(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new ye({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:c,schema:u}=o,d=e.getState(o),f=a.content.size,h=u.nodes[n];if(!s.some(p=>p.getMeta(DP))&&d)return c.insert(f,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!D0({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!D0({node:o,types:r})}}})]}}),zP=Ne.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>H3(t,e),redo:()=>({state:t,dispatch:e})=>q3(t,e)}},addProseMirrorPlugins(){return[_P(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),BP=Ne.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(QM.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(KM.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(A3.configure(this.options.bulletList)),this.options.code!==!1&&s.push(tO.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(sO.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(iO.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(SP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(CP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(oO.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(aO.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(zP.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(lO.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(hO.configure(this.options.italic)),this.options.listItem!==!1&&s.push(M3.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(D3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(T3.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(z3.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(nP.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(iP.configure(this.options.strike)),this.options.text!==!1&&s.push(oP.configure(this.options.text)),this.options.underline!==!1&&s.push(B3.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push($P.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),FP=BP,UP=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,VP=jt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",_e(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,o;const a=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",c=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",u=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return u?`![${c}](${a} "${u}")`:`![${c}](${a})`}
687,addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o,editor:a})=>{const c=document.createElement("img");Object.entries(o).forEach(([f,h])=>{if(h!=null)switch(f){case"width":case"height":break;default:c.setAttribute(f,h);break}}),c.src=o.src;const u=new EA({element:c,editor:a,node:s,getPos:i,onResize:(f,h)=>{c.style.width=`${f}px`,c.style.height=`${h}px`},onCommit:(f,h)=>{const p=i();p!==void 0&&this.editor.chain().setNodeSelection(p).updateAttributes(this.name,{width:f,height:h}).run()},onUpdate:(f,h,p)=>f.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",c.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[c3({find:UP,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),HP=VP,qP=Ne.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),WP=qP;const KP=({value:t,onChange:e,placeholder:n="Start typing..."})=>{const r=UM({extensions:[FP,zO.configure({openOnClick:!1}),HP,WP.configure({types:["heading","paragraph"]}),aP],content:t,onUpdate:({editor:a})=>e(a.getHTML())});if(!r)return null;const s=()=>{const a=prompt("Enter URL:");a&&r.chain().focus().setLink({href:a}).run()},i=()=>{const a=prompt("Enter image URL:");a&&r.chain().focus().setImage({src:a}).run()},o=({onClick:a,isActive:c,icon:u,title:d})=>l.jsx("button",{onClick:a,title:d,className:`p-2 rounded transition-colors ${c?"bg-[#c79a55] text-[#0a0b0c]":"bg-[#22272c] text-[#c4cacf] hover:bg-[#33393f] hover:text-[#eef1f3]"}`,children:l.jsx(u,{size:16})});return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-wrap gap-1 bg-[#15181b] p-2 rounded border border-[#33393f]",children:[l.jsx(o,{onClick:()=>r.chain().focus().toggleBold().run(),isActive:r.isActive("bold"),icon:iC,title:"Bold"}),l.jsx(o,{onClick:()=>r.chain().focus().toggleItalic().run(),isActive:r.isActive("italic"),icon:bC,title:"Italic"}),l.jsx(o,{onClick:()=>r.chain().focus().toggleUnderline().run(),isActive:r.isActive("underline"),icon:UC,title:"Underline"}),l.jsx(o,{onClick:()=>r.chain().focus().toggleStrike().run(),isActive:r.isActive("strike"),icon:$C,title:"Strike"}),l.jsx("div",{className:"w-px bg-[#33393f]"}),l.jsx(o,{onClick:()=>r.chain().focus().toggleHeading({level:2}).run(),isActive:r.isActive("heading",{level:2}),icon:xC,title:"Heading 2"}),l.jsx(o,{onClick:()=>r.chain().focus().toggleHeading({level:3}).run(),isActive:r.isActive("heading",{level:3}),icon:yC,title:"Heading 3"}),l.jsx("div",{className:"w-px bg-[#33393f]"}),l.jsx(o,{onClick:()=>r.chain().focus().toggleBulletList().run(),isActive:r.isActive("bulletList"),icon:_C,title:"Bullet List"}),l.jsx(o,{onClick:()=>r.chain().focus().toggleOrderedList().run(),isActive:r.isActive("orderedList"),icon:jC,title:"Ordered List"}),l.jsx("div",{className:"w-px bg-[#33393f]"}),l.jsx(o,{onClick:s,isActive:r.isActive("link"),icon:NC,title:"Add Link"}),l.jsx(o,{onClick:i,icon:Mi,title:"Add Image"}),l.jsx("div",{className:"w-px bg-[#33393f]"}),l.jsx(o,{onClick:()=>r.chain().focus().setTextAlign("left").run(),isActive:r.isActive({textAlign:"left"}),icon:nC,title:"Align Left"}),l.jsx(o,{onClick:()=>r.chain().focus().setTextAlign("center").run(),isActive:r.isActive({textAlign:"center"}),icon:tC,title:"Align Center"}),l.jsx(o,{onClick:()=>r.chain().focus().setTextAlign("right").run(),isActive:r.isActive({textAlign:"right"}),icon:rC,title:"Align Right"}),l.jsx("div",{className:"w-px bg-[#33393f]"}),l.jsx(o,{onClick:()=>
687r.chain().focus().undo().run(),icon:PC,title:"Undo"}),l.jsx(o,{onClick:()=>r.chain().focus().redo().run(),icon:IC,title:"Redo"})]}),l.jsx("div",{className:"bg-[#0a0b0c] border border-[#33393f] rounded overflow-hidden",children:l.jsx(p3,{editor:r,className:"prose prose-invert min-h-[120px] p-4 text-[#eef1f3] focus:outline-none [&_.ProseMirror]:text-[#eef1f3] [&_.ProseMirror]:focus:outline-none [&_.ProseMirror]:placeholder:[color:#8e979e]"})})]})},vm=[{type:"info_bar",label:"Info Bar",icon:Qb},{type:"hero",label:"Hero",icon:wa},{type:"image",label:"Image",icon:Mi},{type:"text",label:"Text",icon:FC},{type:"three_col",label:"Three Columns",icon:gC},{type:"testimonials",label:"Testimonials",icon:CC},{type:"faq",label:"FAQ",icon:vC},{type:"letter",label:"Letter",icon:SC},{type:"video",label:"Video",icon:OC},{type:"gallery",label:"Gallery",icon:nc},{type:"slider",label:"Slider",icon:ns},{type:"cta",label:"CTA",icon:BC},{type:"optin_form",label:"Opt-in Form",icon:uC},{type:"order_form",label:"Order Form",icon:LC}],JP={info_bar:{text:"",background:"#22272c"},hero:{headline:"",subheadline:"",image_url:"",cta_text:"",cta_action:"",cta_url:""},image:{url:"",alt:"",caption:"",full_width:!1},text:{html:""},three_col:{columns:[{icon:"",title:"",text:""}]},testimonials:{items:[{name:"",text:"",rating:5}]},faq:{items:[{question:"",answer:""}]},letter:{html:"",signature_name:"",signature_title:""},video:{url:"",poster_url:""},gallery:{images:[{url:"",alt:""}]},slider:{slides:[{image_url:"",headline:"",text:""}]},cta:{text:"",action:"next_step",url:"",style:"primary"},optin_form:{headline:"",fields:["email"],button_text:"Sign Up"},order_form:{headline:"",button_text:"Order Now",show_bumps:!1}},GP=t=>{const e=vm.find(n=>n.type===t);return(e==null?void 0:e.icon)||Qb},XP=({onSelect:t,onClose:e})=>l.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:l.jsxs("div",{className:"bg-[#15181b] rounded-lg p-6 max-w-2xl w-full mx-4 border border-[#33393f]",children:[l.jsxs("div",{className:"flex justify-between items-center mb-4",children:[l.jsx("h3",{className:"text-[#eef1f3] font-semibold",children:"Add Section"}),l.jsx("button",{onClick:e,className:"text-[#8e979e] hover:text-[#eef1f3] transition-colors",children:l.jsx(_r,{size:20})})]}),l.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:vm.map(({type:n,label:r,icon:s})=>l.jsxs("button",{onClick:()=>{t(n),e()},className:"flex flex-col items-center justify-center p-4 bg-[#0a0b0c] border border-[#33393f] rounded hover:bg-[#22272c] hover:border-[#c79a55] transition-all",children:[l.jsx(s,{size:24,className:"text-[#c79a55] mb-2"}),l.jsx("span",{className:"text-xs text-[#c4cacf] text-center",children:r})]},n))})]})}),YP=({section:t,onChange:e,renderRichEditor:n})=>{const r=(i,o)=>{e({...t,content:{...t.content,[i]:o}})},s=()=>{switch(t.section_type){case"info_bar":return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-[#c4cacf] mb-1",children:"Text"}),l.jsx("input",{type:"text",value:t.content.text||"",onChange:i=>r("text",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-[#c4cacf] mb-1",children:"Backgroun
687d Color"}),l.jsx("input",{type:"color",value:t.content.background||"#22272c",onChange:i=>r("background",i.target.value),className:"w-full h-10 rounded cursor-pointer"})]})]});case"hero":return l.jsxs("div",{className:"space-y-3",children:[l.jsx("input",{type:"text",placeholder:"Headline",value:t.content.headline||"",onChange:i=>r("headline",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Subheadline",value:t.content.subheadline||"",onChange:i=>r("subheadline",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Image URL",value:t.content.image_url||"",onChange:i=>r("image_url",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"CTA Text",value:t.content.cta_text||"",onChange:i=>r("cta_text",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsxs("select",{value:t.content.cta_action||"",onChange:i=>r("cta_action",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm",children:[l.jsx("option",{value:"",children:"Select CTA Action"}),l.jsx("option",{value:"next_step",children:"Next Step"}),l.jsx("option",{value:"scroll",children:"Scroll"}),l.jsx("option",{value:"external",children:"External Link"}),l.jsx("option",{value:"optin",children:"Opt-in"})]}),l.jsx("input",{type:"text",placeholder:"CTA URL",value:t.content.cta_url||"",onChange:i=>r("cta_url",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]});case"image":return l.jsxs("div",{className:"space-y-3",children:[l.jsx("input",{type:"text",placeholder:"Image URL",value:t.content.url||"",onChange:i=>r("url",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Alt Text",value:t.content.alt||"",onChange:i=>r("alt",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Caption",value:t.content.caption||"",onChange:i=>r("caption",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsxs("label",{className:"flex items-center text-sm text-[#c4cacf]",children:[l.jsx("input",{type:"checkbox",checked:t.content.full_width||!1,onChange:i=>r("full_width",i.target.checked),className:"mr-2"}),"Full Width"]})]});case"text":return l.jsx("div",{className:"space-y-3",children:n?n(t.content.html||"",i=>r("html",i)):l.jsx("textarea",{value:t.content.html||"",onChange:i=>r("html",i.target.value),placeholder:"HTML content",rows:6,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm font-mono"})});case"three_col":return l.jsx("div",{className:"space-y-3",children:(t.content.columns||[]).map((i,o)=>l.jsxs("div",{className:"p-3 bg-[#0a0b0c] border border-[#33393f] rounded space-y-2",children:[l.jsx("input",{type:"text",placeholder:"Icon",value:i.icon||"",onChange:a=>{const c=[...t.content.columns||[]];c[o]={...c[o],icon:a.target.value},r("columns",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Title",value:i.title||"",onChange:a=>{const c=[...t.content.columns||[]];c[o]={...c[o],title:a.target.value},r("columns",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("textarea",{placeholder:"Text",value:i.text||"",onChange:a=>{const c=[...t.content.columns||[]];c[o]={...c[o],text:a.target.value},r("columns",c)},rows:2,className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]},o))});case"testimonials":return l.jsx("div",{className:"space-y-3",children:(t.content.items||[]).map((i,o)=>l.jsxs("div",{className:"p-3 bg-[#0a0b0c] border border-[#33393f] rounded space-y-2",children:[l.jsx("input",{type:"text",placeholder:"Name",value:i.name||"",onChange:a=>{const c=[...t.content.items||[]];c[o]={...c[o],name:a.target.value},r("items",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("textarea",{placeholder:"Testimonial",value:i.text||"",onChange:a=>{const c=[...t.content.items||[]];c[o]={...c[o],text:a.target.value},r("items",c)},rows:2,className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("select",{value:i.rating||5,onChange:a=>{const c=[...t.content.items||[]];c[o]={...c[o],rating:parseInt(a.target.value)},r("items",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm",children:[1,2,3,4,5].map(a=>l.jsxs("option",{value:a,children:[a," Stars"]},a))})]},o))});case"faq":return l.jsx("div",{className:"space-y-3",children:(t.content.items||[]).map((i,o)=>l.jsxs("div",{className:"p-3 bg-[#0a0b0c] border border-[#33393f] rounded space-y-2",children:[l.jsx("input",{type:"text",placeholder:"Question",value:i.question||"",onChange:a=>{const c=[...t.content.items||[]];c[o]={...c[o],question:a.target.value},r("items",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("textarea",{placeholder:"Answer",value:i.answer||"",onChange:a=>{const c=[...t.content.items||[]];c[o]={...c[o],answer:a.target.value},r("items",c)},rows:2,className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]},o))});case"letter":return l.jsxs("div",{className:"space-y-3",children:[n?n(t.content.html||"",i=>r("html",i)):l.jsx("textarea",{value:t.content.html||"",onChange:i=>r("html",i.target.value),placeholder:"Letter HTML content",rows:6,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm font-mono"}),l.jsx("input",{type:"text",placeholder:"Signature Name",value:t.content.signature_name||"",onChange:i=>r("signature_name",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Signature Title",value:t.content.signature_title||"",onChange:i=>r("signature_title",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]});case"video":return l.jsxs("div",{className:"space-y-3",children:[l.jsx("input",{type:"text",placeholder:"Video URL",value:t.content.url||"",onChange:i=>r("url",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Poster URL",value:t.content.poster_url||"",onChange:i=>r("poster_url",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]});case"gallery":return l.jsx("div",{className:"space-y-3",children:(t.content.images||[]).map((i,o)=>l.jsxs("div",{className:"p-3 bg-[#0a0b0c] border border-[#33393f] rounded space-y-2",children:[l.jsx("input",{type:"text",placeholder:"Image URL",value:i.url||"",onChange:a=>{const c=[...t.content.images||[]];c[o]={...c[o],url:a.target.value},r("images",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Alt Text",value:i.alt||"",onChange:a=>{const c=[...t.content.images||[]];c[o]={...c[o],alt:a.target.value},r("images",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]},o))});case"slider":return l.jsx("div",{className:"space-y-3",children:(t.content.slides||[]).map((i,o)=>l.jsxs("div",{className:"p-3 bg-[#0a0b0c] border border-[#33393f] rounded space-y-2",children:[l.jsx("input",{type:"text",placeholder:"Image URL",value:i.image_url||"",onChange:a=>{const c=[...t.content.slides||[]];c[o]={...c[o],image_url:a.target.value},r("slides",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Headline",value:i.headline||"",onChange:a=>{const c=[...t.content.slides||[]];c[o]={...c[o],headline:a.target.value},r("slides",c)},className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("textarea",{placeholder:"Text",value:i.text||"",onChange:a=>{const c=[...t.content.slides||[]];c[o]={...c[o],text:a.target.value},r("slides",c)},rows:2,className:"w-full bg-[#15181b] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]},o))});case"cta":return l.jsxs("div",{className:"space-y-3",children:[l.jsx("input",{type:"text",placeholder:"CTA Text",value:t.content.text||"",onChange:i=>r("text",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsxs("select",{value:t.content.action||"next_step",onChange:i=>r("action",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm",children:[l.jsx("option",{value:"next_step",children:"Next Step"}),l.jsx("option",{value:"scroll",children:"Scroll"}
687),l.jsx("option",{value:"external",children:"External Link"}),l.jsx("option",{value:"optin",children:"Opt-in"})]}),l.jsx("input",{type:"text",placeholder:"URL",value:t.content.url||"",onChange:i=>r("url",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsxs("select",{value:t.content.style||"primary",onChange:i=>r("style",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm",children:[l.jsx("option",{value:"primary",children:"Primary"}),l.jsx("option",{value:"secondary",children:"Secondary"}),l.jsx("option",{value:"ghost",children:"Ghost"})]})]});case"optin_form":return l.jsxs("div",{className:"space-y-3",children:[l.jsx("input",{type:"text",placeholder:"Headline",value:t.content.headline||"",onChange:i=>r("headline",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-[#c4cacf] mb-1",children:"Form Fields"}),l.jsx("div",{className:"space-y-1",children:["name","email","phone"].map(i=>l.jsxs("label",{className:"flex items-center text-sm text-[#c4cacf]",children:[l.jsx("input",{type:"checkbox",checked:(t.content.fields||[]).includes(i),onChange:o=>{const a=t.content.fields||[];o.target.checked?r("fields",[...a,i]):r("fields",a.filter(c=>c!==i))},className:"mr-2"}),i.charAt(0).toUpperCase()+i.slice(1)]},i))})]}),l.jsx("input",{type:"text",placeholder:"Button Text",value:t.content.button_text||"",onChange:i=>r("button_text",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"})]});case"order_form":return l.jsxs("div",{className:"space-y-3",children:[l.jsx("input",{type:"text",placeholder:"Headline",value:t.content.headline||"",onChange:i=>r("headline",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsx("input",{type:"text",placeholder:"Button Text",value:t.content.button_text||"",onChange:i=>r("button_text",i.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm"}),l.jsxs("label",{className:"flex items-center text-sm text-[#c4cacf]",children:[l.jsx("input",{type:"checkbox",checked:t.content.show_bumps||!1,onChange:i=>r("show_bumps",i.target.checked),className:"mr-2"}),"Show Bumps"]})]});default:return null}};return l.jsx("div",{className:"space-y-3",children:s()})},QP=({sections:t,onChange:e,stepType:n,renderRichEditor:r})=>{const[s,i]=N.useState(null),[o,a]=N.useState(!1),c=(p,m)=>{if(m==="up"&&p===0||m==="down"&&p===t.length-1)return;const g=[...t],y=m==="up"?p-1:p+1;[g[p],g[y]]=[g[y],g[p]];const x=g.map((v,b)=>({...v,sort_order:b}));e(x)},u=p=>{const m=t.filter((g,y)=>y!==p).map((g,y)=>({...g,sort_order:y}));e(m)},d=p=>{const m=[...t];m[p]={...m[p],visible:!m[p].visible},e(m)},f=(p,m)=>{const g=[...t];g[p]=m,e(g)},h=p=>{const m={section_type:p,content:{...JP[p]},sort_order:t.length,visible:!0,settings:{}};e([...t,m])};return l.jsxs("div",{className:"space-y-3",children:[t.map((p,m)=>{var v;const g=GP(p.section_type),y=s===`${m}`,x=((v=vm.find(b=>b.type===p.section_type))==null?void 0:v.label)||p.section_type;return l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded overflow-hidden transition-all",children:[l.jsxs("button",{onClick:()=>i(y?null:`${m}`),className:"w-full px-4 py-3 flex items-center justify-between hover:bg-[#1f242a] transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(g,{size:18,className:"text-[#c79a55]"}),l.jsx("span",{className:"text-[#eef1f3] font-medium text-sm",children:x}),!p.visible&&l.jsx("span",{className:"text-xs text-[#8e979e]",children:"(hidden)"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:b=>{b.stopPropagation(),c(m,"up")},className:"p-1 hover:bg-[#22272c] rounded transition-colors",children:l.jsx(cC,{size:16,className:"text-[#8e979e]"})}),l.jsx("button",{onClick:b=>{b.stopPropagation(),c(m,"down")},className:"p-1 hover:bg-[#22272c] rounded transition-colors",children:l.jsx(ts,{size:16,className:"text-[#8e979e]"})}),l.jsx("button",{onClick:b=>{b.stopPropagation(),d(m)},className:"p-1 hover:bg-[#22272c] rounded transition-colors",children:p.visible?l.jsx(Yb,{size:16,className:"text-[#8e979e]"}):l.jsx(dC,{size:16,className:"text-[#8e979e]"})}),l.jsx("button",{onClick:b=>{b.stopPropagation(),u(m)},className:"p-1 hover:bg-[#22272c] rounded transition-colors",children:l.jsx(at,{size:16,className:"text-[#c79a55]"})})]})]}),y&&l.jsx("div",{className:"px-4 py-3 bg-[#0a0b0c] border-t border-[#33393f]",children:l.jsx(YP,{section:p,onChange:b=>f(m,b),renderRichEditor:r})})]},`${m}`)}),l.jsxs("button",{onClick:()=>a(!0),className:"w-full py-3 border border-dashed border-[#33393f] rounded flex items-center justify-center gap-2 text-[#c79a55] hover:bg-[#0a0b0c] transition-colors",children:[l.jsx(et,{size:18}),l.jsx("span",{children:"Add Section"})]}),o&&l.jsx(XP,{onSelect:h,onClose:()=>a(!1)})]})},$0=[{value:"optin",label:"Opt-In Page",color:"text-emerald-400"},{value:"sales",label:"Sales Page",color:"text-blue-400"},{value:"order_form",label:"Order Form",color:"text-[#c79a55]"},{value:"upsell",label:"Upsell",color:"text-orange-400"},{value:"downsell",label:"Downsell",color:"text-rose-400"},{value:"thank_you",label:"Thank You",color:"text-teal-400"}];function ZP(){const[t,e]=N.useState("list"),[n,r]=N.useState([]),[s,i]=N.useState(null),[o,a]=N.useState([]),[c,u]=N.useState(null),[d,f]=N.useState([]),[h,p]=N.useState([]);N.useEffect(()=>{m(),g()},[]);async function m(){const{data:j}=await T.from("funnels").select("*").order("created_at",{ascending:!1});j&&r(j)}async function g(){const{data:j}=await T.from("store_products").select("id, name").order("name");j&&p(j)}async function y(j){const{data:A}=await T.from("funnel_steps").select("*").eq("funnel_id",j).order("sort_order");A&&a(A)}async function x(j){const{data:A}=await T.from("funnel_sections").select("*").eq("step_id",j).order("sort_order");A&&f(A)}async function v(){var A;if(!s)return;const j={name:s.name||"",slug:s.slug||((A=s.name)==null?void 0:A.toLowerCase().replace(/[^a-z0-9]+/g,"-"))||"",description:s.description||"",status:s.status||"draft",facebook_pixel_id:s.facebook_pixel_id||""};
687if(s.id)await T.from("funnels").update(j).eq("id",s.id);else{const{data:z}=await T.from("funnels").insert(j).select().single();z&&(i(z),await y(z.id))}m()}async function b(j){confirm("Delete this funnel and all its pages?")&&(await T.from("funnels").delete().eq("id",j),m())}async function _(j){j?(i(j),await y(j.id)):(i({status:"draft"}),a([])),e("edit_funnel")}async function C(){if(!(s!=null&&s.id))return;const j={funnel_id:s.id,name:`Step ${o.length+1}`,slug:`step-${o.length+1}`,step_type:o.length===0?"optin":"sales",sort_order:o.length,product_id:null,price_override_cents:null,bump_ids:[],upsell_headline:"",upsell_price_cents:0,settings:{}},{data:A}=await T.from("funnel_steps").insert(j).select().single();A&&a([...o,A])}async function w(){if(!c)return;const j={name:c.name,slug:c.slug,step_type:c.step_type,sort_order:c.sort_order,product_id:c.product_id||null,price_override_cents:c.price_override_cents||null,bump_ids:c.bump_ids||[],upsell_headline:c.upsell_headline||"",upsell_price_cents:c.upsell_price_cents||0,settings:c.settings||{}};c.id&&await T.from("funnel_steps").update(j).eq("id",c.id),c.id&&(await T.from("funnel_sections").delete().eq("step_id",c.id),d.length>0&&await T.from("funnel_sections").insert(d.map((A,z)=>({step_id:c.id,section_type:A.section_type,content:A.content,sort_order:z,visible:A.visible,settings:A.settings||{}})))),s!=null&&s.id&&await y(s.id),e("edit_funnel"),u(null)}async function k(j){confirm("Delete this step?")&&(await T.from("funnel_steps").delete().eq("id",j),s!=null&&s.id&&await y(s.id))}function E(j){u(j),j.id?x(j.id):f([]),e("edit_step")}function S(j,A){return l.jsx(KP,{value:j,onChange:A})}return t==="list"?l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:"Funnel Builder"}),l.jsxs("button",{onClick:()=>_(),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," New Funnel"]})]}),l.jsxs("div",{className:"space-y-2",children:[n.map(j=>l.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsx("div",{className:"w-10 h-10 rounded bg-[#0a0b0c] border border-[#33393f] flex items-center justify-center shrink-0",children:l.jsx(nc,{className:"w-5 h-5 text-[#c79a55]"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-[#eef1f3] font-medium",children:j.name}),l.jsx("span",{className:`text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded font-bold ${j.status==="active"?"bg-emerald-500/10 text-emerald-400":"bg-[#c79a55]/10 text-[#c79a55]"}`,children:j.status})]}),l.jsxs("p",{className:"text-xs text-[#8e979e] mt-0.5",children:["/f/",j.slug]})]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/f/${j.slug}`),className:"p-2 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(tc,{className:"w-4 h-4"})}),l.jsx("button",{onClick:()=>_(j),className:"p-2 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(Nr,{className:"w-4 h-4"})}),l.jsx("button",{onClick:()=>b(j.id),className:"p-2 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-4 h-4"})})]})]},j.id)),n.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-8",children:"No funnels yet. Create your first funnel to build opt-in pages, sales pages, and more."})]})]}):t==="edit_step"&&c?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>{e("edit_funnel"),u(null)},className:"text-[#8e979e] hover:text-[#c4cacf]",children:l.jsx(ns,{className:"w-5 h-5 rotate-180"})}),l.jsxs("h3",{className:"text-[#eef1f3] font-medium",children:["Edit: ",c.name]})]}),l.jsx("button",{onClick:()=>{e("edit_funnel"),u(null)},className:"text-[#8e979e] hover:text-[#c4cacf]",children:l.jsx(_r,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"p-4 rounded-lg bg-[#15181b] border border-[#33393f] space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Step Name"}),l.jsx("input",{value:c.name,onChange:j=>u({...c,name:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"URL Slug"}),l.jsx("input",{value:c.slug,onChange:j=>u({...c,slug:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Page Type"}
687),l.jsx("select",{value:c.step_type,onChange:j=>u({...c,step_type:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:$0.map(j=>l.jsx("option",{value:j.value,children:j.label},j.value))})]})]}),c.step_type==="order_form"&&l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Product"}),l.jsxs("select",{value:c.product_id||"",onChange:j=>u({...c,product_id:j.target.value||null}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"",children:"None"}),h.map(j=>l.jsx("option",{value:j.id,children:j.name},j.id))]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Price Override (pence)"}),l.jsx("input",{type:"number",value:c.price_override_cents||"",onChange:j=>u({...c,price_override_cents:+j.target.value||null}),placeholder:"Use product price",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),(c.step_type==="upsell"||c.step_type==="downsell")&&l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Upsell Headline"}),l.jsx("input",{value:c.upsell_headline,onChange:j=>u({...c,upsell_headline:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Price (pence)"}),l.jsx("input",{type:"number",value:c.upsell_price_cents,onChange:j=>u({...c,upsell_price_cents:+j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]})]}),l.jsxs("div",{className:"border-t border-[#33393f] pt-4",children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[#8e979e] mb-3 font-bold",children:"Page Sections"}),l.jsx(QP,{sections:d,onChange:f,stepType:c.step_type,renderRichEditor:S})]}),l.jsxs("div",{className:"flex gap-2 pt-4 border-t border-[#33393f]",children:[l.jsxs("button",{onClick:w,className:"flex items-center gap-1.5 px-4 py-2 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3.5 h-3.5"})," Save Step"]}),l.jsx("button",{onClick:()=>{e("edit_funnel"),u(null)},className:"px-4 py-2 rounded text-xs text-[#8e979e] hover:text-[#c4cacf] border border-[#33393f]",children:"Cancel"})]})]}):t==="edit_funnel"&&s?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>{e("list"),i(null)},className:"text-[#8e979e] hover:text-[#c4cacf]",children:l.jsx(ns,{className:"w-5 h-5 rotate-180"})}),l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:s.id?s.name:"New Funnel"})]}),l.jsx("button",{onClick:()=>{e("list"),i(null)},className:"text-[#8e979e] hover:text-[#c4cacf]",children:l.jsx(_r,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"p-4 rounded-lg bg-[#15181b] border border-[#33393f] space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Funnel Name"}),l.jsx("input",{value:s.name||"",onChange:j=>i({...s,name:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"URL Slug"}),l.jsx("input",{value:s.slug||"",onChange:j=>i({...s,slug:j.target.value}),placeholder:"auto",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Status"}),l.jsxs("select",{value:s.status||"draft",onChange:j=>i({...s,status:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none",children:[l.jsx("option",{value:"draft",children:"Draft"}),l.jsx("option",{value:"active",children:"Active"}),l.jsx("option",{value:"archived",children:"Archived"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Description"}),l.jsx("input",{value:s.description||"",onChange:j=>i({...s,description:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Facebook Pixel ID"}),l.jsx("input",{value:s.facebook_pixel_id||"",onChange:j=>i({...s,facebook_pixel_id:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("button",{onClick:v,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-[#c79a55] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3 h-3"})," ",s.id?"Update":"Create"," Funnel"]})]}),s.id&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-[#8e979e] font-bold",children:["Funnel Steps (",o.length,")"]}),l.jsxs("button",{onClick:C,className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9
687cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," Add Step"]})]}),l.jsxs("div",{className:"space-y-1",children:[o.map((j,A)=>{const z=$0.find(R=>R.value===j.step_type);return l.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-[#15181b] border border-[#33393f] group",children:[l.jsx("div",{className:"w-6 h-6 rounded-full bg-[#0a0b0c] border border-[#33393f] flex items-center justify-center text-[10px] text-[#8e979e] font-mono shrink-0",children:A+1}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-[#eef1f3]",children:j.name}),l.jsx("span",{className:`text-[9px] uppercase tracking-wider font-bold ${(z==null?void 0:z.color)||"text-[#8e979e]"}`,children:z==null?void 0:z.label})]}),l.jsxs("p",{className:"text-xs text-[#8e979e] mt-0.5",children:["/f/",s.slug,"/",j.slug]})]}),A<o.length-1&&l.jsx(kr,{className:"w-3.5 h-3.5 text-[#33393f] shrink-0"}),l.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:()=>E(j),className:"p-1.5 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(Nr,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:()=>j.id&&k(j.id),className:"p-1.5 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]})]},j.id)}),o.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-6",children:"Add steps to define your funnel flow. Each step is a page visitors will see."})]}),s.slug&&o.length>0&&l.jsxs("div",{className:"mt-4 p-3 rounded-lg bg-[#0a0b0c] border border-[#33393f]",children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Funnel URL"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("code",{className:"text-xs text-[#c79a55] font-mono",children:[window.location.origin,"/f/",s.slug]}),l.jsx("button",{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/f/${s.slug}`),className:"text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(tc,{className:"w-3.5 h-3.5"})})]})]})]})]}):null}function eI(){const[t,e]=N.useState([]),[n,r]=N.useState(null),[s,i]=N.useState(!1);N.useEffect(()=>{o()},[]);async function o(){const{data:d}=await T.from("member_cards").select("*").order("sort_order");d&&e(d)}async function a(){if(!n)return;const d={title:n.title||"",description:n.description||"",image_url:n.image_url||"",image_opacity:n.image_opacity??.4,cta_text:n.cta_text||"Visit",cta_url:n.cta_url||"",sort_order:n.sort_order??t.length,active:n.active!==!1};n.id?await T.from("member_cards").update(d).eq("id",n.id):await T.from("member_cards").insert(d),r(null),o()}async function c(d){confirm("Delete this card?")&&(await T.from("member_cards").delete().eq("id",d),o())}async function u(d){var g;const f=(g=d.target.files)==null?void 0:g[0];if(!f)return;i(!0);const h=f.name.split(".").pop(),p=`cards/${crypto.randomUUID()}.${h}`,{error:m}=await T.storage.from("site-images").upload(p,f);if(!m){const{data:y}=T.storage.from("site-images").getPublicUrl(p);r({...n,image_url:y.publicUrl})}i(!1)}return n?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:n.id?"Edit Card":"New Card"}),l.jsx("button",{onClick:()=>r(null),className:"text-[#8e979e] hover:text-[#c4cacf]",children:l.jsx(_r,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Title"}),l.jsx("input",{value:n.title||"",onChange:d=>r({...n,title:d.target.value}),placeholder:"Wrap App",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"CTA Button Text"}),l.jsx("input",{value:n.cta_text||"",onChange:d=>r({...n,cta_text:d.target.value}),placeholder:"Visit",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Description"}),l.jsx("textarea",{value:n.description||"",onChange:d=>r({...n,description:d.target.value}),rows:2,placeholder:"Our carp fishing swim record system",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"CTA URL"}),l.jsx("input",{value:n.cta_url||"",onChange:d=>r({...n,cta_url:d.target.value}),placeholder:"https://wrappapp.co.uk",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Backgroun
687d Image (16:9)"}),l.jsxs("div",{className:"flex gap-3 items-start",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("input",{value:n.image_url||"",onChange:d=>r({...n,image_url:d.target.value}),placeholder:"Image URL",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none mb-2"}),l.jsxs("label",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded text-xs bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] cursor-pointer transition-colors",children:[s?"Uploading...":"Upload Image",l.jsx("input",{type:"file",accept:"image/*",onChange:u,className:"hidden"})]})]}),n.image_url&&l.jsx("div",{className:"w-32 aspect-video rounded border border-[#33393f] overflow-hidden shrink-0",children:l.jsx("img",{src:n.image_url,alt:"",className:"w-full h-full object-cover"})})]})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{children:[l.jsxs("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:["Image Opacity (",Math.round((n.image_opacity??.4)*100),"%)"]}),l.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:n.image_opacity??.4,onChange:d=>r({...n,image_opacity:+d.target.value}),className:"w-full accent-[#c79a55]"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1",children:"Sort Order"}),l.jsx("input",{type:"number",value:n.sort_order??0,onChange:d=>r({...n,sort_order:+d.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"})]}),l.jsx("div",{className:"flex items-end",children:l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.active!==!1,onChange:d=>r({...n,active:d.target.checked}),className:"rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55]"}),l.jsx("span",{className:"text-xs text-[#c4cacf]",children:"Active"})]})})]}),n.image_url&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-2",children:"Preview"}),l.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden border border-[#33393f] max-w-sm",children:[l.jsx("img",{src:n.image_url,alt:"",className:"absolute inset-0 w-full h-full object-cover",style:{opacity:n.image_opacity??.4}}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[#0a0b0c]/90 via-[#0a0b0c]/40 to-transparent"}),l.jsxs("div",{className:"relative h-full flex flex-col justify-end p-5",children:[l.jsx("h3",{className:"text-[#eef1f3] font-serif text-lg font-medium",children:n.title||"Title"}),l.jsx("p",{className:"text-xs text-[#c4cacf] mt-1",children:n.description||"Description"}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 mt-3 px-4 py-2 rounded-lg bg-[#c79a55] text-[#0a0b0c] text-xs font-mono uppercase font-bold w-fit",children:[n.cta_text||"Visit"," ",l.jsx(Xb,{className:"w-3 h-3"})]})]})]})]}),l.jsxs("div",{className:"flex gap-2 pt-4 border-t border-[#33393f]",children:[l.jsxs("button",{onClick:a,className:"flex items-center gap-1.5 px-4 py-2 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] text-xs font-bold",children:[l.jsx(jr,{className:"w-3.5 h-3.5"})," Save Card"]}),l.jsx("button",{onClick:()=>r(null),className:"px-4 py-2 rounded text-xs text-[#8e979e] hover:text-[#c4cacf] border border-[#33393f]",children:"Cancel"})]})]}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:"Member Area Cards"}),l.jsxs("button",{onClick:()=>r({active:!0,image_opacity:.4,sort_order:t.length}),className:"flex items-center gap-1.5 text-xs text-[#c79a55] hover:text-[#e9cd97]",children:[l.jsx(et,{className:"w-3.5 h-3.5"})," New Card"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.map(d=>l.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsx("div",{className:"w-20 aspect-video rounded overflow-hidden border border-[#33393f] shrink-0 relative",children:d.image_url?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:d.image_url,alt:"",className:"absolute inset-0 w-full h-full object-cover",style:{opacity:d.image_opacity}}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[#0a0b0c]/80 to-transparent"})]}):l.jsx("div",{className:"w-full h-full bg-[#0a0b0c]"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-[#eef1f3] font-medium",children:d.title}),!d.active&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-[#33393f] text-[#8e979e] font-bold",children:"Hidden"})]}),l.jsx("p",{className:"text-xs text-[#8e979e] truncate",children:d.cta_url})]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:()=>r(d),className:"p-2 text-[#8e979e] hover:text-[#c79a55]",children:l.jsx(Nr,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:()=>c(d.id),className:"p-2 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-3.5 h-3.5"})})]})]},d.id)),t.length===0&&l.jsx("p",{className:"text-sm text-[#8e979e] text-center py-8",children:"No cards yet. Add cards to showcase apps, links, and resources in the members area."})]})]})}function tI(){const{session:t,profile:e,loading:n,signOut:r}=Nt(),[s,i]=N.useState("store"),[o,a]=N.useState(!1),[c,u]=N.useState(!0),[d,f]=N.useState(!1);if(n)return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent roun
687ded-full animate-spin"})});if(!t)return l.jsx(jp,{to:"/admin/login",replace:!0});if(e!=null&&e.must_change_password)return l.jsx(r5,{});const h=[{key:"settings",label:"Site Settings",icon:l.jsx(n1,{className:"w-4 h-4"})},{key:"images",label:"Images",icon:l.jsx(Mi,{className:"w-4 h-4"})},{key:"navigation",label:"Navigation",icon:l.jsx(TC,{className:"w-4 h-4"})},{key:"sections",label:"Index Items",icon:l.jsx(fC,{className:"w-4 h-4"})},{key:"pillars",label:"Hub Pillars",icon:l.jsx(nc,{className:"w-4 h-4"})},{key:"materials",label:"Materials",icon:l.jsx(oC,{className:"w-4 h-4"})},{key:"member_cards",label:"Member Cards",icon:l.jsx(kC,{className:"w-4 h-4"})},{key:"tracking",label:"Tracking",icon:l.jsx(Wb,{className:"w-4 h-4"})},{key:"waitlist",label:"Waitlist",icon:l.jsx(va,{className:"w-4 h-4"})}],p=[{key:"store",label:"Store",icon:l.jsx(ot,{className:"w-4 h-4"})},{key:"funnels",label:"Funnels",icon:l.jsx(nc,{className:"w-4 h-4"})},{key:"sales",label:"Sales",icon:l.jsx(s1,{className:"w-4 h-4"})},{key:"credits",label:"Credits",icon:l.jsx(mu,{className:"w-4 h-4"})},{key:"features",label:"Feature Gates",icon:l.jsx(e1,{className:"w-4 h-4"})}],m=[{key:"giveaways",label:"Giveaways",icon:l.jsx(nn,{className:"w-4 h-4"})},{key:"carptoon",label:"Carptoon",icon:l.jsx(Pp,{className:"w-4 h-4"})}],g=h.some(v=>v.key===s),y=p.some(v=>v.key===s),x=m.some(v=>v.key===s);return l.jsxs("div",{className:"min-h-screen bg-[#0a0b0c] flex",children:[l.jsxs("aside",{className:"w-64 bg-[#15181b] border-r border-[#33393f] flex flex-col shrink-0",children:[l.jsxs("div",{className:"p-6 border-b border-[#33393f]",children:[l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"font-serif font-bold text-[#eef1f3] text-lg",children:"CFA"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.22em] text-[#0a0b0c] bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] px-[6px] py-[2px] rounded-[2px]",children:"ADMIN"})]}),l.jsx("p",{className:"text-[#8e979e] text-xs mt-1 truncate",children:e==null?void 0:e.email})]}),l.jsxs("nav",{className:"flex-1 p-3 space-y-1 overflow-y-auto",children:[l.jsxs("button",{onClick:()=>a(!o),className:`w-full flex items-center gap-3 px-4 py-2.5 rounded text-sm transition-colors ${g?"text-[#c79a55]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[l.jsx(MC,{className:"w-4 h-4"}),"Site Content",o?l.jsx(ts,{className:"w-3 h-3 ml-auto"}):l.jsx(ns,{className:"w-3 h-3 ml-auto"})]}),o&&l.jsx("div",{className:"ml-3 pl-3 border-l border-[#33393f] space-y-0.5",children:h.map(v=>l.jsxs("button",{onClick:()=>i(v.key),className:`w-full flex items-center gap-3 px-3 py-2 rounded text-sm transition-colors ${s===v.key?"bg-[#22272c] text-[#eef1f3] border border-[#33393f]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[v.icon,v.label]},v.key))}),l.jsxs("button",{onClick:()=>f(!d),className:`w-full flex items-center gap-3 px-4 py-2.5 rounded text-sm transition-colors ${x?"text-[#c79a55]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[l.jsx(VC,{className:"w-4 h-4"}),"Tools",d?l.jsx(ts,{className:"w-3 h-3 ml-auto"}):l.jsx(ns,{className:"w-3 h-3 ml-auto"})]}),d&&l.jsx("div",{className:"ml-3 pl-3 border-l border-[#33393f] space-y-0.5",children:m.map(v=>l.jsxs("button",{onClick:()=>i(v.key),className:`w-full flex items-center gap-3 px-3 py-2 rounded text-sm transition-colors ${s===v.key?"bg-[#22272c] text-[#eef1f3] border border-[#33393f]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[v.icon,v.label]},v.key))}),l.jsxs("button",{onClick:()=>u(!c),className:`w-full flex items-center gap-3 px-4 py-2.5 rounded text-sm transition-colors ${y?"text-[#c79a55]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[l.jsx(Gb,{className:"w-4 h-4"}),"Money",c?l.jsx(ts,{className:"w-3 h-3 ml-auto"}):l.jsx(ns,{className:"w-3 h-3 ml-auto"})]}),c&&l.jsx("div",{className:"ml-3 pl-3 border-l border-[#33393f] space-y-0.5",children:p.map(v=>l.jsxs("button",{onClick:()=>i(v.key),className:`w-full flex items-center gap-3 px-3 py-2 rounded text-sm transition-colors ${s===v.ke
687y?"bg-[#22272c] text-[#eef1f3] border border-[#33393f]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[v.icon,v.label]},v.key))}),l.jsxs("div",{className:"pt-2 space-y-1",children:[l.jsxs("button",{onClick:()=>i("subscribers"),className:`w-full flex items-center gap-3 px-4 py-2.5 rounded text-sm transition-colors ${s==="subscribers"?"bg-[#22272c] text-[#eef1f3] border border-[#33393f]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[l.jsx(ps,{className:"w-4 h-4"}),"Subscribers"]}),l.jsxs("button",{onClick:()=>i("account"),className:`w-full flex items-center gap-3 px-4 py-2.5 rounded text-sm transition-colors ${s==="account"?"bg-[#22272c] text-[#eef1f3] border border-[#33393f]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22]"}`,children:[l.jsx(Zb,{className:"w-4 h-4"}),"Account"]})]})]}),l.jsxs("div",{className:"p-3 border-t border-[#33393f]",children:[l.jsxs("a",{href:"/",className:"flex items-center gap-3 px-4 py-2.5 rounded text-sm text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22] transition-colors",children:[l.jsx(wC,{className:"w-4 h-4"}),"View Site"]}),l.jsxs("button",{onClick:r,className:"w-full flex items-center gap-3 px-4 py-2.5 rounded text-sm text-[#8e979e] hover:text-red-400 hover:bg-[#1a1e22] transition-colors",children:[l.jsx(Mp,{className:"w-4 h-4"}),"Sign Out"]})]})]}),l.jsx("main",{className:"flex-1 overflow-y-auto",children:l.jsxs("div",{className:"p-8",children:[s==="settings"&&l.jsx(rI,{}),s==="images"&&l.jsx(sI,{}),s==="navigation"&&l.jsx(iI,{}),s==="sections"&&l.jsx(oI,{}),s==="pillars"&&l.jsx(aI,{}),s==="materials"&&l.jsx(lI,{}),s==="features"&&l.jsx(s5,{}),s==="credits"&&l.jsx(o5,{}),s==="carptoon"&&l.jsx(nI,{}),s==="store"&&l.jsx(a5,{}),s==="funnels"&&l.jsx(ZP,{}),s==="member_cards"&&l.jsx(eI,{}),s==="giveaways"&&l.jsx(d5,{}),s==="tracking"&&l.jsx(f5,{}),s==="waitlist"&&l.jsx(cI,{}),s==="sales"&&l.jsx(i5,{}),s==="subscribers"&&l.jsx(uI,{}),s==="account"&&l.jsx(dI,{})]})})]})}function nI(){const[t,e]=N.useState([]),[n,r]=N.useState(!0);N.useEffect(()=>{s()},[]);async function s(){const{data:a}=await T.from("carptoon_generations").select("*").order("created_at",{ascending:!1}).limit(50);a&&e(a),r(!1)}const i=t.length,o=t.reduce((a,c)=>a+c.credits_spent,0);return n?l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Carptoon"}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-1",children:"AI-powered carp photo cartoon generator. Members access at /tools/carptoon."})]}),l.jsx("a",{href:"/tools/carptoon",target:"_blank",className:"font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:"Open Tool"})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 mb-8",children:[l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsx("div",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e] mb-1",children:"Total Generations"}),l.jsx("div",{className:"text-[#eef1f3] font-serif text-2xl font-medium",children:i})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsx("div",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e] mb-1",children:"Credits Consumed"}),l.jsx("div",{className:"text-[#eef1f3] font-serif text-2xl font-medium",children:o})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsx("div",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e] mb-1",children:"Cost per Generation"}),l.jsx("div",{className:"text-[#eef1f3] font-serif text-2xl font-medium",children:"1 credit"})]})]}),t.length>0&&l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg overflow-hidden",children:[l.jsx("div",{className:"px-4 py-3 border-b border-[#33393f]",children:l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:"Recent Generations"})}),l.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2 p-3",children:t.slice(0,20).map(a=>l.jsxs("div",{className:"relative aspect-[16/9] rounded overflow-hidden border border-[#33393f]",children:[a.generated_image_url?l.jsx("img",{src:a.generated_image_url,alt:"",className:"w-full h-full object-cover"}):l.jsx("div",{className:"w-full h-full bg-[#22272c] flex items-center justify-center text-[#8e979e] text-xs",children:"No image"}),l.jsx("div",{className:"absolute bottom-1 left-1",children:l.jsx("span",{className:"font-mono text-[8px] tracking-[.1em] uppercase px-1.5 py-0.5 rounded bg-[rgba(8,9,10,.85)] text-[#c4cacf]",children:a.style})})]},a.id))})]})]})}function rI(){const[t,e]=N.useState([]),[n,r]=N.useState(!0),[s,i]=N.useState(null),[o,a]=N.useState({});N.useEffect(()=>{c()},[]);async function c(){const{data:p}=await T.from("site_settings").select("*").order("key");if(p){const m=p.filter(y=>!y.key.endsWith("_image")&&!y.key.match(/_image_\d+$/));e(m);const g={};m.forEach(y=>{g[y.key]=typeof y.value=="string"?y.value:String(y.value??"")}),a(g)}r(!1)}async function u(p){i(p),await T.from("site_settings").update({value:o[p],updated_at:new Date().toISOString()}).eq("key",p),i(null)}if(n)return l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."});const d={"Hero Section":t.filter(p=>p.key.startsWith("hero_")),"Utility Bar":t.filter(p=>p.key.startsWith("util_")),"Software Section":t.filter(p=>p.key.startsWith("software_")),"Carptoon Section":t.filter(p=>p.key.startsWith("carptoon_")),"Join/Membership":t.filter(p=>p.key.startsWith("join_")),Footer:t.filter(p=>p.key.startsWith("footer_")),General:t.filter(p=>p.key.startsWith("site_"))},f={hero_kicker:"Kicker text",hero_heading:"Main heading (supports <em> for italic)",hero_lede:"Intro paragraph",hero_stat_1_value:"Stat 1 value",hero_stat_1_label:"Stat 1 label",hero_stat_2_value:"Stat 2 value",hero_stat_2_label:"Stat 2 label",hero_stat_3_value:"Stat 3 value",hero_stat_3_label:"Stat 3 label",hero_cta_primary_text:"Primary button text",hero_cta_primary_href:"Primary button link",hero_cta_secondary_text:"Secondary button text",hero_cta_secondary_href:"Secondary button link",util_bar_badge:"Badge text",util_bar_issue:"Issue number",util_bar_location:"Location",software_kicker:"Kicker text",software_heading:"Heading",software_description:"Description",software_stat_1_value:"Stat 1 value",software_stat_1_label:"Stat 1 label",software_stat_2_value:"Stat 2 value",software_stat_2_label:"Stat 2 label",software_stat_3_value:"Stat 3 value",software_stat_3_label:"Stat 3 label",software_link_1_label:"Link 1 label",software_link_1_href:"Link 1 URL",software_link_2_label:"Link 2 label",software_link_2_href:"Link 2 URL",carptoon_kicker:"Kicker text",carptoon_heading:"Heading",carptoon_description:"Description",carptoon_stat_1_value:"Stat 1 value",carptoon_stat_1_label:"Stat 1 label",carptoon_stat_2_value:"Stat 2 value",carptoon_stat_2_label:"Stat 2 label",carptoon_stat_3_value:"Stat 3 value",carptoon_stat_3_label:"Stat 3 label",carptoon_link_label:"Link text",carptoon_link_href:"Link URL",join_kicker:"Kicker text",join_heading:"Heading",join_description:"Description",join_fine_print:"Fine print",footer_colophon:"Colophon line",footer_description:"Description",site_title:"Site title",site_tagline:"Tagline"};function h(p){return f[p]||p}return l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium mb-6",children:"Site Settings"}),Object.entries(d).map(([p,m])=>m.length>0&&l.jsxs("div",{className:"mb-8",children:[l.jsx("h3",{className:"font-mono text-[11px] tracking-[.16em] uppercase text-[#c79a55] mb-4",children:p}),l.jsx("div",{className:"space-y-4",children:m.map(g=>{var y;return l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("label",{className:"text-sm text-[#c4cacf]",children:h(g.key)}),l.jsx("button",{onClick:()=>u(g.key),disabled:s===g.key,className:"font-mono text-[10px] tracking-[.14em] uppercase px-3 py-1 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors disabled:opacity-50",children:s===g.key?"Saving...":"Save"})]}),(((y=o[g.key])==null?void 0:y.length)||0)>80?l.jsx("textarea",{value:o[g.key]||"",onChange:x=>a({...o,[g.key]:x.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55] transition-colors resize-y min-h-[60
687px]",rows:3}):l.jsx("input",{value:o[g.key]||"",onChange:x=>a({...o,[g.key]:x.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55] transition-colors"})]},g.id)})})]},p))]})}const z0=[{key:"hero_image",label:"Hero Image",description:"Main hero visual on the right side"},{key:"software_image_1",label:"Software - WrapApp",description:"Left panel in the Software section"},{key:"software_image_2",label:"Software - Games",description:"Right panel in the Software section"},{key:"carptoon_image_1",label:"Carptoon - Before",description:"Left panel (original photo)"},{key:"carptoon_image_2",label:"Carptoon - After",description:"Right panel (cartoon result)"}];function sI(){const[t,e]=N.useState({}),[n,r]=N.useState(!0),[s,i]=N.useState(null);N.useEffect(()=>{o()},[]);async function o(){const{data:u}=await T.from("site_settings").select("*").in("key",z0.map(d=>d.key));if(u){const d={};u.forEach(f=>{d[f.key]=typeof f.value=="string"?f.value:""}),e(d)}r(!1)}async function a(u,d){i(u);const f=d.name.split(".").pop()||"jpg",h=`${u}-${Date.now()}.${f}`,{error:p}=await T.storage.from("site-images").upload(h,d,{cacheControl:"3600",upsert:!0});if(p){i(null);return}const{data:m}=T.storage.from("site-images").getPublicUrl(h),g=m.publicUrl;await T.from("site_settings").update({value:g,updated_at:new Date().toISOString()}).eq("key",u),e({...t,[u]:g}),i(null)}async function c(u){const d=t[u];if(d){const f=d.split("/").pop();f&&await T.storage.from("site-images").remove([f])}await T.from("site_settings").update({value:"",updated_at:new Date().toISOString()}).eq("key",u),e({...t,[u]:""})}return n?l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."}):l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium mb-2",children:"Site Images"}),l.jsx("p",{className:"text-[#8e979e] text-sm mb-6",children:"Upload images for homepage sections. Recommended: 1200x900px or larger."}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:z0.map(u=>l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"mb-3",children:[l.jsx("h4",{className:"text-sm text-[#eef1f3] font-medium",children:u.label}),l.jsx("p",{className:"text-[#8e979e] text-xs mt-0.5",children:u.description})]}),t[u.key]?l.jsxs("div",{className:"relative group",children:[l.jsx("img",{src:t[u.key],alt:u.label,className:"w-full aspect-[4/3] object-cover rounded border border-[#33393f]"}),l.jsxs("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center gap-3",children:[l.jsxs("label",{className:"cursor-pointer font-mono text-[10px] tracking-[.14em] uppercase px-3 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:["Replace",l.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:d=>{var f;(f=d.target.files)!=null&&f[0]&&a(u.key,d.target.files[0])}})]}),l.jsx("button",{onClick:()=>c(u.key),className:"font-mono text-[10px] tracking-[.14em] uppercase px-3 py-2 rounded bg-[#22272c] border border-red-800/50 text-red-400 hover:bg-red-900/30 transition-colors",children:"Remove"})]})]}):l.jsxs("label",{className:"cursor-pointer flex flex-col items-center justify-center w-full aspect-[4/3] rounded border-2 border-dashed border-[#33393f] hover:border-[#c79a55] transition-colors bg-[#0a0b0c]",children:[s===u.key?l.jsx("div",{className:"w-6 h-6 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"}):l.jsxs(l.Fragment,{children:[l.jsx(Mi,{className:"w-8 h-8 text-[#8e979e] mb-2"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#8e979e]",children:"Click to upload"})]}),l.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:d=>{var f;(f=d.target.files)!=null&&f[0]&&a(u.key,d.target.files[0])}})]})]},u.key))})]})}function iI(){const[t,e]=N.useState([]),[n,r]=N.useState(!0);N.useEffect(()=>{s()},[]);async function s(){const{data:u}=await T.from("nav_links").select("*").order("location").order("sort_order");u&&e(u),r(!1)}async function i(u,d,f){await T.from("nav_links").update({[d]:f,updated_at:new Date().toISOString()}).eq("id",u),e(t.map(h=>h.id===u?{...h,[d]:f}:h))}async function o(u){const d=Math.max(0,...t.filter(h=>h.location===u).map(h=>h.sort_order)),{data:f}=await T.from("nav_links").insert({label:"New Link",href:"#",location:u,sort_order:d+1}).select().maybeSingle();f&&e([...t,f])}async function a(u){await T.from("nav_links").delete().eq("id",u),e(t.filter(d=>d.id!==u))}if(n)return l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."});
687const c=["header","footer_hub","footer_software","footer_stay"];return l.jsxs("div",{children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium mb-6",children:"Navigation Links"}),c.map(u=>l.jsxs("div",{className:"mb-8",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"font-mono text-[11px] tracking-[.16em] uppercase text-[#c79a55]",children:u.replace("_"," ")}),l.jsx("button",{onClick:()=>o(u),className:"font-mono text-[10px] tracking-[.14em] uppercase px-3 py-1 rounded bg-[#22272c] border border-[#33393f] text-[#c4cacf] hover:text-[#c79a55] transition-colors",children:"+ Add"})]}),l.jsx("div",{className:"space-y-2",children:t.filter(d=>d.location===u).map(d=>l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded p-3 flex items-center gap-3 flex-wrap",children:[l.jsx("input",{value:d.label,onChange:f=>i(d.id,"label",f.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1 text-[#eef1f3] text-sm w-32 focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{value:d.href,onChange:f=>i(d.id,"href",f.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1 text-[#eef1f3] text-sm flex-1 min-w-[120px] focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{type:"number",value:d.sort_order,onChange:f=>i(d.id,"sort_order",parseInt(f.target.value)||0),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1 text-[#eef1f3] text-sm w-16 focus:outline-none focus:border-[#c79a55]"}),l.jsxs("label",{className:"flex items-center gap-1 text-[#8e979e] text-xs",children:[l.jsx("input",{type:"checkbox",checked:d.external,onChange:f=>i(d.id,"external",f.target.checked),className:"accent-[#c79a55]"}),"Ext"]}),l.jsxs("label",{className:"flex items-center gap-1 text-[#8e979e] text-xs",children:[l.jsx("input",{type:"checkbox",checked:d.visible,onChange:f=>i(d.id,"visible",f.target.checked),className:"accent-[#c79a55]"}),"Vis"]}),l.jsx("button",{onClick:()=>a(d.id),className:"text-red-400 hover:text-red-300 text-sm px-2",children:"x"})]},d.id))})]},u))]})}function oI(){const[t,e]=N.useState([]),[n,r]=N.useState(!0);N.useEffect(()=>{s()},[]);async function s(){const{data:a}=await T.from("sections").select("*").order("sort_order");a&&e(a),r(!1)}async function i(a,c,u){await T.from("sections").update({[c]:u,updated_at:new Date().toISOString()}).eq("id",a),e(t.map(d=>d.id===a?{...d,[c]:u}:d))}async function o(){const a=Math.max(0,...t.map(d=>d.sort_order)),c=`index_${String(a+1).padStart(2,"0")}`,{data:u}=await T.from("sections").insert({slug:c,title:"New Section",subtitle:String(a+1).padStart(2,"0"),content:{description:"",link_href:"#"},sort_order:a+1}).select().maybeSingle();u&&e([...t,u])}return n?l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Index Items"}),l.jsx("button",{onClick:o,className:"font-mono text-[11px] tracking-[.14em] uppercase px-4 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:"+ Add Item"})]}),l.jsx("div",{className:"space-y-3",children:t.map(a=>{const c=a.content;return l.jsx("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[80px_1fr_1fr_auto] gap-3 items-center",children:[l.jsx("input",{value:a.subtitle,onChange:u=>i(a.id,"subtitle",u.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c79a55] text-sm font-mono focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{value:a.title,onChange:u=>i(a.id,"title",u.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]"}),l.jsx("input",{value:c.description||"",onChange:u=>i(a.id,"content",{...c,description:u.target.value}),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c4cacf] text-sm focus:outline-none focus:border-[#c79a55]"}),l.jsxs("label",{className:"flex items-center gap-1 text-[#8e979e] text-xs",children:[l.jsx("input",{type:"checkbox",checked:a.visible,onChange:u=>i(a.id,"visible",u.target.checked),className:"accent-[#c79a55]"}),"Vis"]})]})},a.id)})})]})}function aI(){const[t,e]=N.useState([]),[n,r]=N.useState(!0);N.useEffect(()=>{s()},[]);async function s(){const{data:c}=await T.from("pillars").select("*").order("sort_order");c&&e(c),r(!1)}async function i(c,u,d){await T.from("pillars").update({[u]:d,updated_at:new Date().toISOString()}).eq("id",c),e(t.map(f=>f.id===c?{...f,[u]:d}:f))}async function o(){const c=Math.max(0,...t.map(d=>d.sort_order)),{data:u}=await T.from("pillars").insert({number:String(c+1).padStart(2,"0"),label:"New Pillar",title:"New Pillar",description:"Description here",link_text:"View →",link_href:"#",sort_order:c+1}).select().maybeSingle();u&&e([...t,u])}async function a(c){await T.from("pillars").delete().eq("id",c),e(t.filter(u=>u.id!==c))}return n?l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Hub Pillars"}),l.jsx("button",{onClick:o,className:"font-mono text-[11px] tracking-[.14em] uppercase px-4 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:"+ Add Pillar"})]}),l.jsx("div",{className:"space-y-3",children:t.map(c=>l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[60px_120px_1fr_auto] gap-3 items-start",children:[l.jsx("input",{value:c.number,onChange:u=>i(c.id,"number",u.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c79a55] text-sm font-mono focus:outline-none focus:border-[#c79a55]",placeholder:"#"}),l.jsx("input",{value:c.title,onChange:u=>i(c.id,"title",u.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]",placeholder:"Title"}),l.jsx("textarea",{value:c.description,onChange:u=>i(c.id,"description",u.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c4cacf] text-sm focus:outline-none focus:border-[#c79a55] resize-y",rows:2}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("label",{className:"flex items-center gap-1 text-[#8e979e] text-xs",children:[l.jsx("input",{type:"checkbox",checked:c.visible,onChange:u=>i(c.id,"visible",u.target.checked),className:"accent-[#c79a55]"}),"Vis"]}),l.jsx("button",{onClick:()=>a(c.id),className:"text-red-400 hover:text-red-300 text-xs px-2",children:"Del"})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 mt-3",children:[l.jsx("input",{value:c.link_text,onChange:u=>i(c.id,"link_text",u.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c4cacf] text-sm focus:outline-none focus:border-[#c79a55]",placeholder:"Link text"}
687),l.jsx("input",{value:c.link_href,onChange:u=>i(c.id,"link_href",u.target.value),className:"bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c4cacf] text-sm focus:outline-none focus:border-[#c79a55]",placeholder:"Link href"})]})]},c.id))})]})}function lI(){const[t,e]=N.useState([]),[n,r]=N.useState(!0);N.useEffect(()=>{s()},[]);async function s(){const{data:c}=await T.from("materials").select("*").order("sort_order");c&&e(c),r(!1)}async function i(c,u,d){await T.from("materials").update({[u]:d,updated_at:new Date().toISOString()}).eq("id",c),e(t.map(f=>f.id===c?{...f,[u]:d}:f))}async function o(){const c=Math.max(0,...t.map(d=>d.sort_order)),{data:u}=await T.from("materials").insert({name:"New Material",grade:"Grade",description:"Description",swatch_type:"steel",sort_order:c+1}).select().maybeSingle();u&&e([...t,u])}async function a(c){await T.from("materials").delete().eq("id",c),e(t.filter(u=>u.id!==c))}return n?l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:"Materials"}),l.jsx("button",{onClick:o,className:"font-mono text-[11px] tracking-[.14em] uppercase px-4 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:"+ Add Material"})]}),l.jsx("div",{className:"space-y-3",children:t.map(c=>l.jsx("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_1fr_auto] gap-3 items-start",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("input",{value:c.name,onChange:u=>i(c.id,"name",u.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55]",placeholder:"Name"}),l.jsx("input",{value:c.grade,onChange:u=>i(c.id,"grade",u.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c79a55] text-sm font-mono focus:outline-none focus:border-[#c79a55]",placeholder:"Grade"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:c.description,onChange:u=>i(c.id,"description",u.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c4cacf] text-sm focus:outline-none focus:border-[#c79a55] resize-y",rows:2}),l.jsxs("select",{value:c.swatch_type,onChange:u=>i(c.id,"swatch_type",u.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-2 py-1.5 text-[#c4cacf] text-sm focus:outline-none focus:border-[#c79a55]",children:[l.jsx("option",{value:"steel",children:"Steel"}),l.jsx("option",{value:"titanium",children:"Titanium"}),l.jsx("option",{value:"carbon",children:"Carbon"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("label",{className:"flex items-center gap-1 text-[#8e979e] text-xs",children:[l.jsx("input",{type:"checkbox",checked:c.visible,onChange:u=>i(c.id,"visible",u.target.checked),className:"accent-[#c79a55]"}),"Vis"]}),l.jsx("button",{onClick:()=>a(c.id),className:"text-red-400 hover:text-red-300 text-xs px-2",children:"Del"})]})]})},c.id))})]})}function cI(){const[t,e]=N.useState([]),[n,r]=N.useState(!1),[s,i]=N.useState(!1);N.useEffect(()=>{o()},[]);async function o(){const[u,d]=await Promise.all([T.from("waitlist").select("*").order("created_at",{ascending:!1}),T.from("site_settings").select("value").eq("key","coming_soon_enabled").maybeSingle()]);u.data&&e(u.data),d.data&&r(d.data.value===!0)}async function a(){i(!0);const u=!n;await T.from("site_settings").update({value:u,updated_at:new Date().toISOString()}).eq("key","coming_soon_enabled"),r(u),i(!1)}async function c(u){await T.from("waitlist").delete().eq("id",u),e(t.filter(d=>d.id!==u))}return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium",children:"Coming Soon / Waitlist"}),l.jsx("p",{className:"text-[#8e979e] text-xs mt-1",children:"When enabled, public visitors see a waitlist signup 
687instead of the site."})]}),l.jsx("button",{onClick:a,disabled:s,className:`relative inline-flex h-7 w-12 items-center rounded-full transition-colors ${n?"bg-[#c79a55]":"bg-[#33393f]"}`,children:l.jsx("span",{className:`inline-block h-5 w-5 rounded-full bg-white shadow transition-transform ${n?"translate-x-6":"translate-x-1"}`})})]}),l.jsxs("div",{className:`inline-flex items-center gap-2 px-3 py-1.5 rounded text-xs font-mono mb-6 ${n?"bg-[#c79a55]/10 text-[#c79a55] border border-[#c79a55]/20":"bg-[#22272c] text-[#8e979e] border border-[#33393f]"}`,children:[l.jsx("span",{className:`w-2 h-2 rounded-full ${n?"bg-[#c79a55] animate-pulse":"bg-[#5a6269]"}`}),n?"Coming Soon mode is ACTIVE":"Site is live (public can see full site)"]}),l.jsxs("div",{className:"border-t border-[#33393f] pt-6",children:[l.jsx("div",{className:"flex items-center justify-between mb-4",children:l.jsxs("h4",{className:"text-sm text-[#c4cacf] font-medium",children:["Waitlist Signups (",t.length,")"]})}),t.length===0?l.jsx("p",{className:"text-sm text-[#5a6269] text-center py-8",children:"No signups yet."}):l.jsx("div",{className:"space-y-2",children:t.map(u=>l.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-[#15181b] border border-[#33393f]",children:[u.photo_url?l.jsx("img",{src:u.photo_url,alt:"",className:"w-12 h-12 rounded-lg object-cover border border-[#33393f]"}):l.jsx("div",{className:"w-12 h-12 rounded-lg bg-[#22272c] border border-[#33393f] flex items-center justify-center",children:l.jsx(ps,{className:"w-4 h-4 text-[#5a6269]"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm text-[#eef1f3] font-medium",children:u.name}),l.jsx("p",{className:"text-xs text-[#8e979e] truncate",children:u.email})]}),l.jsx("span",{className:"text-[10px] text-[#5a6269] font-mono shrink-0",children:new Date(u.created_at).toLocaleDateString()}),l.jsx("button",{onClick:()=>c(u.id),className:"text-[#5a6269] hover:text-red-400 p-1",children:l.jsx(_r,{className:"w-3.5 h-3.5"})})]},u.id))})]})]})}function uI(){const[t,e]=N.useState([]),[n,r]=N.useState(!0);N.useEffect(()=>{s()},[]);async function s(){const{data:o}=await T.from("subscribers").select("*").order("created_at",{ascending:!1});o&&e(o),r(!1)}async function i(o){await T.from("subscribers").delete().eq("id",o),e(t.filter(a=>a.id!==o))}return n?l.jsx("div",{className:"text-[#8e979e]",children:"Loading..."}):l.jsxs("div",{children:[l.jsxs("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium mb-6",children:["Subscribers (",t.length,")"]}),t.length===0?l.jsx("p",{className:"text-[#8e979e] text-sm",children:"No subscribers yet."}):l.jsx("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg overflow-hidden",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[#33393f]",children:[l.jsx("th",{className:"text-left px-4 py-3 font-mono text-[11px] tracking-[.14em] uppercase text-[#8e979e]",children:"Email"}),l.jsx("th",{className:"text-left px-4 py-3 font-mono text-[11px] tracking-[.14em] uppercase text-[#8e979e]",children:"Date"}),l.jsx("th",{className:"px-4 py-3"})]})}),l.jsx("tbody",{children:t.map(o=>l.jsxs("tr",{className:"border-b border-[#33393f] last:border-0",children:[l.jsx("td",{className:"px-4 py-3 text-[#eef1f3] text-sm",children:o.email}),l.jsx("td",{className:"px-4 py-3 text-[#8e979e] text-sm",children:new Date(o.created_at).toLocaleDateString()}),l.jsx("td",{className:"px-4 py-3 text-right",children:l.jsx("button",{onClick:()=>i(o.id),className:"text-red-400 hover:text-red-300 text-xs",children:"Remove"})})]},o.id))})]})})]})}function dI(){const{updatePassword:t}=Nt(),[e,n]=N.useState(""),[r,s]=N.useState(""),[i,o]=N.useState(""),[a,c]=N.useState(""),[u,d]=N.useState(""),[f,h]=N.useState(!1);async function p(m){if(m.preventDefault(),c(""),d(""),r.length<8){c("New password must be at least 8 characters.");return}if(r!==i){c("New passwords do not match.");return}h(!0);const{error:g}=await t(r);g?c(g.message):(d("Password updated successfully."),n(""),s(""),o("")),h(!1)}return l.jsxs("div",{className:"max-w-lg",children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium mb-6",children:"Account Settings"}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-6",children:[l.jsx("h3",{className:"font-mono text-[11px] tracking-[.16em] uppercase text-[#c79a55] mb-5",children:"Change Password"}),a&&l.jsx("div",{className:"mb-4 p-3 rounded bg-red-900/30 border border-red-800/50 text-red-300 text-sm",children:a}),u&&l.jsx("div",{className:"mb-4 p-3 rounded bg-green-900/30 border border-green-800/50 text-green-300 text-sm",children:u}),l.jsxs("form",{onSubmit:p,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-[#8e979e] mb-1.5",children:"Current Password"}
vendor: 11,341 bytes, lines 687-688
687),l.jsx("input",{type:"password",value:e,onChange:m=>n(m.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2.5 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55] transition-colors",required:!0})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-[#8e979e] mb-1.5",children:"New Password"}),l.jsx("input",{type:"password",value:r,onChange:m=>s(m.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2.5 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55] transition-colors",required:!0,minLength:8})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-[#8e979e] mb-1.5",children:"Confirm New Password"}),l.jsx("input",{type:"password",value:i,onChange:m=>o(m.target.value),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded px-3 py-2.5 text-[#eef1f3] text-sm focus:outline-none focus:border-[#c79a55] transition-colors",required:!0,minLength:8})]}),l.jsx("button",{type:"submit",disabled:f,className:"mt-2 font-mono text-[11px] tracking-[.14em] uppercase px-5 py-2.5 rounded bg-gradient-to-br from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-semibold hover:opacity-90 transition-opacity disabled:opacity-50",children:f?"Updating...":"Update Password"})]})]})]})}function Sl(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Sl=function(e){return typeof e}:Sl=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sl(t)}var K3="dahlia",fI=function(e){return e===3?"v3":e},J3="https://js.stripe.com",hI="".concat(J3,"/").concat(K3,"/stripe.js"),pI=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,mI=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,B0="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",gI=function(e){return pI.test(e)||mI.test(e)},xI=function(){for(var e=document.querySelectorAll('script[src^="'.concat(J3,'"]')),n=0;n<e.length;n++){var r=e[n];if(gI(r.src))return r}return null},F0=function(e){var n="",r=document.createElement("script");r.src="".concat(hI).concat(n);var s=document.head||document.body;if(!s)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return s.appendChild(r),r},yI=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"9.7.0",startTime:n})},Wi=null,al=null,ll=null,vI=function(e){return function(n){e(new Error("Failed to load Stripe.js",{cause:n}))}},bI=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},wI=function(e){return Wi!==null?Wi:(Wi=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&e&&console.warn(B0),window.Stripe){n(window.Stripe);return}try{var s=xI();if(s&&e)console.warn(B0);else if(!s)s=F0(e);else if(s&&ll!==null&&al!==null){var i;s.removeEventListener("load",ll),s.removeEventListener("error",al),(i=s.parentNode)===null||i===void 0||i.removeChild(s),s=F0(e)}ll=bI(n,r),al=vI(r),s.addEventListener("load",ll),s.addEventListener("error",al)}catch(o){r(o);return}}),Wi.catch(function(n){return Wi=null,Promise.reject(n)}))},kI=function(e,n,r){if(e===null)return null;var s=n[0];if(typeof s!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(Sl(s)," instead."));var i=s.match(/^pk_test/),o=fI(e.version),a=K3;i&&o!==a&&console.warn("Stripe.js@".concat(o," was loaded on the page, but @stripe/stripe-js@").concat("9.7.0"," expected Stripe.js@").concat(a,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var c=e.apply(void 0,n);return yI(c,r),c},Ki,G3=!1,X3=function(){return Ki||(Ki=wI(null).catch(function(e){return Ki=null,Promise.reject(e)}),Ki)};Promise.resolve().then(function(){return X3()}).catch(function(t){G3||console.warn(t)});var Y3=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];G3=!0;var s=Date.now();return X3().then(function(i){return kI(i,n,s)})},Q3={exports:{}},NI="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",jI=NI,_I=jI;function Z3(){}function ek(){}ek.resetWarningCache=Z3;var SI=function(){function t(r,s,i,o,a,c){if(c!==_I){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:ek,resetWarningCache:Z3};return n.PropTypes=n,n};Q3.exports=SI();var CI=Q3.exports;const be=Sh(CI);function U0(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function V0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?U0(Object(n),!0).forEach(function(r){tk(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):U0(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Cl(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Cl=function(e){return typeof e}:Cl=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cl(t)}function tk(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function EI(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function TI(t,e){if(t==null)return{};var n=EI(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function nk(t,e){return AI(t)||MI(t,e)||OI(t,e)||PI()}function AI(t){if(Array.isArray(t))return t}function MI(t,e){var n=t&&(typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"]);if(n!=null){var r=[],s=!0,i=!1,o,a;try{for(n=n.call(t);!(s=(o=n.next()).done)&&(r.push(o.value),!(e&&r.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function OI(t,e){if(t){if(typeof t=="string")return H0(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H0(t,e)}}function H0(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function PI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
688In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Ye=function(e,n,r){var s=!!r,i=ee.useRef(r);ee.useEffect(function(){i.current=r},[r]),ee.useEffect(function(){if(!s||!e)return function(){};var o=function(){if(i.current)return i.current.apply(i,arguments)};return e.on(n,o),function(){e.off(n,o)}},[s,n,e,i])},jh=function(e){var n=ee.useRef(e);return ee.useEffect(function(){n.current=e},[e]),n.current},ji=function(e){return e!==null&&Cl(e)==="object"},II=function(e){return ji(e)&&typeof e.then=="function"},RI=function(e){return ji(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},q0="[object Object]",LI=function t(e,n){if(!ji(e)||!ji(n))return e===n;var r=Array.isArray(e),s=Array.isArray(n);if(r!==s)return!1;var i=Object.prototype.toString.call(e)===q0,o=Object.prototype.toString.call(n)===q0;if(i!==o)return!1;if(!i&&!r)return e===n;var a=Object.keys(e),c=Object.keys(n);if(a.length!==c.length)return!1;for(var u={},d=0;d<a.length;d+=1)u[a[d]]=!0;for(var f=0;f<c.length;f+=1)u[c[f]]=!0;var h=Object.keys(u);if(h.length!==a.length)return!1;var p=e,m=n,g=function(x){return t(p[x],m[x])};return h.every(g)},rk=function(e,n,r){return ji(e)?Object.keys(e).reduce(function(s,i){var o=!ji(n)||!LI(e[i],n[i]);return r.includes(i)?(o&&console.warn("Unsupported prop change: options.".concat(i," is not a mutable property.")),s):o?V0(V0({},s||{}),{},tk({},i,e[i])):s},null):null},sk="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",W0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sk;if(e===null||RI(e))return e;throw new Error(n)},DI=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sk;if(II(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(s){return W0(s,n)})};var r=W0(e,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},$I=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"6.5.0"}),e.registerAppInfo({name:"react-stripe-js",version:"6.5.0",url:"https://stripe.com/docs/stripe-js/react"}))},Mu=ee.createContext(null);Mu.displayName="ElementsContext";var ik=function(e,n){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return e},bm=function(e){var n=e.stripe,r=e.options,s=e.children,i=ee.useMemo(function(){return DI(n)},[n]),o=ee.useState(function(){return{stripe:i.tag==="sync"?i.stripe:null,elements:i.tag==="sync"?i.stripe.elements(r):null}}),a=nk(o,2),c=a[0],u=a[1];ee.useEffect(function(){var h=!0,p=function(g){u(function(y){return y.stripe?y:{stripe:g,elements:g.elements(r)}})};return i.tag==="async"&&!c.stripe?i.stripePromise.then(function(m){m&&h&&p(m)}):i.tag==="sync"&&!c.stripe&&p(i.stripe),function(){h=!1}},[i,c,r]);var d=jh(n);ee.useEffect(function(){d!==null&&d!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[d,n]);var f=jh(r);return ee.useEffect(function(){if(c.elements){var h=rk(r,f,["clientSecret","fonts"]);h&&c.elements.update(h)}},[r,f,c.elements]),ee.useEffect(function(){$I(c.stripe)},[c.stripe]),ee.createElement(Mu.Provider,{value:c},s)};bm.propTypes={stripe:be.any,options:be.object};var zI=function(e){var n=ee.useContext(Mu);return ik(n,e)},ok=function(){var e=zI("calls useElements()"),n=e.elements;return n};be.func.isRequired;var ak=ee.createContext(null);ak.displayName="CheckoutContext";var _h=function(e){var n=ee.useContext(ak),r=ee.useContext(Mu);if(n){if(r)throw new Error("You cannot wrap the part of your app that ".concat(e," in both a checkout provider and <Elements> provider."));return n}else return ik(r,e)},BI=["mode"],FI=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},Me=function(e,n,r){var s="".concat(FI(e),"Element"),i=function(u){var d=u.id,f=u.className,h=u.options,p=h===void 0?{}
688:h,m=u.onBlur,g=u.onFocus,y=u.onReady,x=u.onChange,v=u.onEscape,b=u.onClick,_=u.onLoadError,C=u.onLoaderStart,w=u.onNetworksChange,k=u.onConfirm,E=u.onCancel,S=u.onShippingAddressChange,j=u.onShippingRateChange,A=u.onSavedPaymentMethodRemove,z=u.onSavedPaymentMethodUpdate,R=u.onAvailablePaymentMethodsChange,O=_h("mounts <".concat(s,">")),D="elements"in O?O.elements:null,q="checkoutState"in O?O.checkoutState:null,K=(q==null?void 0:q.type)==="success"||(q==null?void 0:q.type)==="loading"?q.sdk:null,$=ee.useState(null),J=nk($,2),V=J[0],he=J[1],se=ee.useRef(null),Bn=ee.useRef(null);Ye(V,"blur",m),Ye(V,"focus",g),Ye(V,"escape",v),Ye(V,"click",b),Ye(V,"loaderror",_),Ye(V,"loaderstart",C),Ye(V,"networkschange",w),Ye(V,"confirm",k),Ye(V,"cancel",E),Ye(V,"shippingaddresschange",S),Ye(V,"shippingratechange",j),Ye(V,"savedpaymentmethodremove",A),Ye(V,"savedpaymentmethodupdate",z),Ye(V,"availablepaymentmethodschange",R),Ye(V,"change",x);var Kt;y&&(e==="expressCheckout"?Kt=y:Kt=function(){y(V)}),Ye(V,"ready",Kt),ee.useLayoutEffect(function(){if(se.current===null&&Bn.current!==null&&(D||K)){var oe=null;if(K){var Jt=K,uk=K;switch(e){case"paymentForm":oe=uk.createForm(p);break;case"payment":oe=Jt.createPaymentElement(p);break;case"address":if("mode"in p){var wm=p.mode,km=TI(p,BI);if(wm==="shipping")oe=Jt.createShippingAddressElement(km);else if(wm==="billing")oe=Jt.createBillingAddressElement(km);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":oe=Jt.createExpressCheckoutElement(p);break;case"currencySelector":oe=K.createCurrencySelectorElement();break;case"taxId":oe=Jt.createTaxIdElement(p);break;case"contactDetails":oe=Jt.createContactDetailsElement();break;default:throw new Error("<".concat(s,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else D&&(oe=D.create(e,p));se.current=oe,he(oe),oe&&oe.mount(Bn.current)}},[D,K,p]);var Ss=jh(p);return ee.useEffect(function(){if(se.current){var oe=rk(p,Ss,["paymentRequest"]);oe&&"update"in se.current&&se.current.update(oe)}},[p,Ss]),ee.useLayoutEffect(function(){return function(){if(se.current&&typeof se.current.destroy=="function")try{se.current.destroy(),se.current=null}catch{}}},[]),ee.createElement("div",{id:d,className:f,ref:Bn})},o=function(u){_h("mounts <".concat(s,">"));var d=u.id,f=u.className;return ee.createElement("div",{id:d,className:f})},a=n?o:i;return a.propTypes={id:be.string,className:be.string,onChange:be.func,onBlur:be.func,onFocus:be.func,onReady:be.func,onEscape:be.func,onClick:be.func,onLoadError:be.func,onLoaderStart:be.func,onNetworksChange:be.func,onConfirm:be.func,onCancel:be.func,onShippingAddressChange:be.func,onShippingRateChange:be.func,onSavedPaymentMethodRemove:be.func,onSavedPaymentMethodUpdate:be.func,onAvailablePaymentMethodsChange:be.func,options:be.object},a.displayName=s,a.__elementType=e,a},Oe=typeof window>"u",UI=ee.createContext(null);UI.displayName="EmbeddedCheckoutProviderContext";var lk=function(){var e=_h("calls useStripe()"),n=e.stripe;return n};Me("auBankAccount",Oe);Me("card",Oe);Me("cardNumber",Oe);Me("cardExpiry",Oe);Me("cardCvc",Oe);Me("iban",Oe);var ck=Me("payment",Oe);Me("expressCheckout",Oe);Me("paymentRequestButton",Oe);Me("linkAuthentication",Oe);Me("contactDetails",Oe);Me("address",Oe);Me("shippingAddress",Oe);Me("paymentMethodMessaging",Oe);Me("taxId",Oe);Me("issuingCardNumberDisplay",Oe);Me("issuingCardCvcDisplay",Oe);Me("issuingCardExpiryDisplay",Oe);Me("issuingCardPinDisplay",Oe);Me("issuingCardCopyButton",Oe);const VI=Y3("pk_live_51O7ELXGjXzas9XZKe0hyNBlE65Lv0jJXjFW2WbxKOIpsEWJLyVwy4JD8d7yYc5sELCDetNMPtBFGrwquSkuPSrMR00mDbXcACM");function HI(){const{user:t,profile:e}=Nt(),[n,r]=N.useState("select"),[s,i]=N.useState([]),[o,a]=N.useState(null),[c,u]=N.useState(""),[d,f]=N.useState(""),[h,p]=N.useState([]),[m,g]=N.useState(!0),[y,x]=N.useState([]);N.useEffect(()=>{v()},[]);async function v(){const{data:k}=await T.from("membership_tiers").select("*").eq("active",!0).order("sort_order");k&&i(k);const{data:E}=await T.from("upsell_offers").select("*").eq("active",!0).eq("trigger_after","signup").order("sort_order");E&&p(E),g(!1)}async function b(k){var E;if(a(k),k.price_cents===0){g(!0);const S=await T.auth.getSession();(await(await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/stripe-checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(E=S.data.session)==null?void 0:E.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({tier_slug:k.slug,bump_ids:[]})})).json()).status==="free_activated"&&(h.length>0?r("upsell"):r("complete")),g(!1)}else r("payment")}async function _(){var j;if(!o)return;g(!0);const k=await T.auth.getSession(),S=await(await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/stripe-checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(j=k.data.session)==null?void 0:j.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({tier_slug:o.slug,bump_ids:y}
688)})).json();S.client_secret&&(u(S.client_secret),f(S.order_id)),g(!1)}function C(k){return k==="carbon"?l.jsx(Ap,{className:"w-6 h-6"}):k==="titanium"?l.jsx(wa,{className:"w-6 h-6"}):l.jsx(ba,{className:"w-6 h-6"})}function w(k){return k==="carbon"?"from-[#e9cd97] via-[#c79a55] to-[#9c6f33]":k==="titanium"?"from-[#a8b8c0] via-[#7a9aa8] to-[#5a7a88]":"from-[#d0d4d8] via-[#a8aeb4] to-[#8e979e]"}return m&&s.length===0?l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx(Wt,{className:"w-8 h-8 text-[#c79a55] animate-spin"})}):l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center p-6",children:l.jsxs("div",{className:"w-full max-w-[1080px]",children:[l.jsx("div",{className:"flex items-center justify-center gap-2 mb-12",children:["select","payment","complete"].map((k,E)=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center font-mono text-xs ${n===k||k==="payment"&&n==="upsell"?"bg-gradient-to-br from-[#e9cd97] to-[#9c6f33] text-[#0a0b0c]":["select","payment","upsell","complete"].indexOf(n)>["select","payment","complete"].indexOf(k)?"bg-[#c79a55] text-[#0a0b0c]":"bg-[#22272c] text-[#8e979e] border border-[#33393f]"}`,children:E+1}),E<2&&l.jsx("div",{className:`w-16 h-[1px] ${["select","payment","upsell","complete"].indexOf(n)>E?"bg-[#c79a55]":"bg-[#33393f]"}`})]},k))}),n==="select"&&l.jsxs("div",{className:"animate-fadeIn",children:[l.jsxs("div",{className:"text-center mb-10",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-3",children:"Choose Your Level"}),l.jsx("h1",{className:"font-serif text-[clamp(28px,4vw,48px)] text-[#eef1f3] font-medium leading-tight",children:"Select your membership"}),l.jsx("p",{className:"text-[#8e979e] mt-3 max-w-[50ch] mx-auto",children:"Each tier unlocks progressively more features. You can upgrade anytime."})]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:s.map(k=>l.jsxs("div",{className:`relative bg-[#15181b] border rounded-lg p-6 transition-all hover:border-[#c79a55]/50 hover:-translate-y-1 cursor-pointer group ${k.slug==="titanium"?"border-[#c79a55]/40 ring-1 ring-[#c79a55]/20":"border-[#33393f]"}`,onClick:()=>b(k),children:[k.slug==="titanium"&&l.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 font-mono text-[9px] tracking-[.2em] uppercase bg-gradient-to-r from-[#e9cd97] to-[#c79a55] text-[#0a0b0c] px-3 py-1 rounded-full",children:"Most Popular"}),l.jsx("div",{className:`w-10 h-10 rounded-full bg-gradient-to-br ${w(k.slug)} flex items-center justify-center text-[#0a0b0c] mb-4`,children:C(k.slug)}),l.jsx("h3",{className:"font-serif text-xl text-[#eef1f3] font-medium",children:k.name}),l.jsx("p",{className:"text-[#8e979e] text-sm mt-1",children:k.description}),l.jsx("div",{className:"mt-4 mb-5",children:k.price_cents===0?l.jsx("span",{className:"text-[#eef1f3] text-2xl font-serif font-medium",children:"Free"}):l.jsxs("div",{className:"flex items-baseline gap-1",children:[l.jsxs("span",{className:"text-[#eef1f3] text-2xl font-serif font-medium",children:["£",(k.price_cents/100).toFixed(2)]}),l.jsx("span",{className:"text-[#8e979e] text-sm",children:"/month"})]})}),l.jsx("ul",{className:"space-y-2.5",children:k.features_summary.split(`
689`).filter(Boolean).map((E,S)=>l.jsxs("li",{className:"flex items-start gap-2 text-sm text-[#c4cacf]",children:[l.jsx(mr,{className:"w-4 h-4 text-[#c79a55] shrink-0 mt-0.5"}),E]},S))}),l.jsxs("button",{className:`w-full mt-6 py-3 px-4 rounded font-mono text-[11px] tracking-[.14em] uppercase transition-all flex items-center justify-center gap-2 ${k.slug==="titanium"?"bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] hover:opacity-90":"bg-[#22272c] border border-[#33393f] text-[#c4cacf] group-hover:border-[#c79a55]/50 group-hover:text-[#eef1f3]"}`,children:[k.price_cents===0?"Get Started":"Select Plan",l.jsx(kr,{className:"w-3.5 h-3.5"})]})]},k.id))})]}),n==="payment"&&o&&l.jsxs("div",{className:"max-w-[520px] mx-auto animate-fadeIn",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-3",children:"Payment"}
689),l.jsxs("h1",{className:"font-serif text-[clamp(24px,3.5vw,36px)] text-[#eef1f3] font-medium",children:["Complete your ",o.name," membership"]})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-5 mb-6",children:[l.jsx("h3",{className:"font-mono text-[10px] tracking-[.16em] uppercase text-[#c79a55] mb-3",children:"Order Summary"}),l.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-[#33393f]",children:[l.jsxs("span",{className:"text-[#c4cacf] text-sm",children:[o.name," Membership"]}),l.jsxs("span",{className:"text-[#eef1f3] text-sm font-medium",children:["£",(o.price_cents/100).toFixed(2),"/mo"]})]}),h.filter(k=>k.trigger_after==="signup").map(k=>l.jsxs("label",{className:"flex items-start gap-3 py-3 border-b border-[#33393f] cursor-pointer group",children:[l.jsx("input",{type:"checkbox",checked:y.includes(k.id),onChange:E=>{E.target.checked?x([...y,k.id]):x(y.filter(S=>S!==k.id))},className:"mt-0.5 w-4 h-4 rounded border-[#33393f] bg-[#0a0b0c] text-[#c79a55] focus:ring-[#c79a55]"}),l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{className:"text-[#c4cacf] text-sm group-hover:text-[#eef1f3] transition-colors",children:k.name}),l.jsxs("span",{className:"text-[#c79a55] text-sm font-medium",children:["+£",(k.price_cents/100).toFixed(2)]})]}),l.jsx("p",{className:"text-[#8e979e] text-xs mt-0.5",children:k.description})]})]},k.id)),l.jsxs("div",{className:"flex justify-between items-center pt-3 mt-1",children:[l.jsx("span",{className:"text-[#eef1f3] font-medium",children:"Total today"}),l.jsxs("span",{className:"text-[#eef1f3] font-serif text-lg font-medium",children:["£",((o.price_cents+y.reduce((k,E)=>{const S=h.find(j=>j.id===E);return k+((S==null?void 0:S.price_cents)||0)},0))/100).toFixed(2)]})]})]}),c?l.jsx(bm,{stripe:VI,options:{clientSecret:c,appearance:{theme:"night",variables:{colorPrimary:"#c79a55",colorBackground:"#15181b",colorText:"#eef1f3",colorTextSecondary:"#8e979e",borderRadius:"4px",fontFamily:"ui-monospace, monospace"},rules:{".Input":{border:"1px solid #33393f",backgroundColor:"#0a0b0c"},".Input:focus":{borderColor:"#c79a55",boxShadow:"none"},".Label":{color:"#8e979e",fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.14em"}}}},children:l.jsx(qI,{orderId:d,onSuccess:()=>{h.filter(k=>k.trigger_after!=="signup").length>0?r("upsell"):r("complete")}})}):l.jsx("button",{onClick:_,disabled:m,className:"w-full py-4 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-[12px] tracking-[.14em] uppercase font-bold hover:opacity-90 transition-opacity disabled:opacity-50 flex items-center justify-center gap-2",children:m?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):"Continue to Payment"}),l.jsx("button",{onClick:()=>{r("select"),u("")},className:"w-full mt-4 text-center text-[#8e979e] text-sm hover:text-[#c4cacf] transition-colors",children:"Back to plans"})]}),n==="upsell"&&l.jsx(WI,{userId:(t==null?void 0:t.id)||"",onComplete:()=>r("complete")}),n==="complete"&&l.jsxs("div",{className:"max-w-[480px] mx-auto text-center animate-fadeIn",children:[l.jsx("div",{className:"w-16 h-16 mx-auto mb-6 rounded-full bg-gradient-to-br from-[#e9cd97] to-[#9c6f33] flex items-center justify-center",children:l.jsx(mr,{className:"w-8 h-8 text-[#0a0b0c]"})}),l.jsx("h1",{className:"font-serif text-[clamp(28px,4vw,42px)] text-[#eef1f3] font-medium mb-3",children:"Welcome aboard"}),l.jsx("p",{className:"text-[#8e979e] mb-8",children:"Your membership is active. You now have access to all your tier features."}),l.jsxs("a",{href:"/",className:"inline-flex items-center gap-2 py-3 px-6 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-[11px] tracking-[.14em] uppercase font-bold hover:opacity-90 transition-opacity",children:["Enter the Hub ",l.jsx(kr,{className:"w-3.5 h-3.5"})]})]})]})})}function qI({orderId:t,onSuccess:e}){const n=lk(),r=ok(),[s,i]=N.useState(!1),[o,a]=N.useState("");async function c(u){if(u.preventDefault(),!n||!r)return;i(!0),a("");const{error:d}=await n.confirmPayment({elements:r,confirmParams:{return_url:window.location.origin+"/onboarding?step=complete"},redirect:"if_required"});d?(a(d.message||"Payment failed"),i(!1)):e()}return l.jsxs("form",{onSubmit:c,children:[l.jsx(ck,{}),o&&l.jsx("p",{className:"text-red-400 text-sm mt-3",children:o}),l.jsx("button",{type:"submit",disabled:!n||s,className:"w-full mt-6 py-4 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-[12px] tracking-[.14em] uppercase font-bold hover:opacity-90 transition-opacity disabled:opacity-50 flex items-center justify-center gap-2",children:s?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):"Pay Now"})]})}function WI({userId:t,onComplete:e}){const[n,r]=N.useState([]),[s,i]=N.useState(!1),[o,a]=N.useState(0);N.useEffect(()=>{c()},[]);async function c(){const{data:h}=await T.from("upsell_offers").select("*").eq("active",!0).neq("trigger_after","signup").order("sort_order");h&&h.length>0?r(h):e()}async function u(){var m;const h=n[o];if(!h)return;i(!0);const p=await T.auth.getSession();await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/stripe-upsell",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(m=p.data.session)==null?void 0:m.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({offer_id:h.id})}),i(!1),d()}function d(){o<n.length-1?a(o+1):e()}if(n.length===0)return null;const f=n[o];return f?l.jsxs("div",{className:"max-w-[520px] mx-auto text-center animate-fadeIn",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-3",children:"Special Offer"}
689),l.jsx("h2",{className:"font-serif text-[clamp(24px,3.5vw,36px)] text-[#eef1f3] font-medium mb-2",children:f.name}),l.jsx("p",{className:"text-[#8e979e] mb-6 max-w-[40ch] mx-auto",children:f.description}),l.jsxs("div",{className:"bg-[#15181b] border border-[#c79a55]/30 rounded-lg p-6 mb-6",children:[l.jsxs("div",{className:"text-[#eef1f3] font-serif text-3xl font-medium mb-1",children:["£",(f.price_cents/100).toFixed(2)]}),l.jsx("p",{className:"text-[#8e979e] text-sm",children:"One-time payment - charged to your card on file"})]}),l.jsx("button",{onClick:u,disabled:s,className:"w-full py-4 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-[12px] tracking-[.14em] uppercase font-bold hover:opacity-90 transition-opacity disabled:opacity-50 flex items-center justify-center gap-2",children:s?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):"Yes, Add This"}),l.jsx("button",{onClick:d,className:"w-full mt-3 py-3 text-[#8e979e] text-sm hover:text-[#c4cacf] transition-colors",children:"No thanks, skip this"})]}):null}const KI=Y3("pk_live_51O7ELXGjXzas9XZKe0hyNBlE65Lv0jJXjFW2WbxKOIpsEWJLyVwy4JD8d7yYc5sELCDetNMPtBFGrwquSkuPSrMR00mDbXcACM");function JI(){const{user:t,profile:e}=Nt(),[n,r]=N.useState([]),[s,i]=N.useState(null),[o,a]=N.useState(0),[c,u]=N.useState([]),[d,f]=N.useState(!0),[h,p]=N.useState(!1),[m,g]=N.useState(1),[y,x]=N.useState(!1),[v,b]=N.useState(""),[_,C]=N.useState(!1);N.useEffect(()=>{w()},[]);async function w(){const[j,A,z,R]=await Promise.all([T.from("orders").select("*").order("created_at",{ascending:!1}),e!=null&&e.membership_tier?T.from("membership_tiers").select("*").eq("slug",e.membership_tier).maybeSingle():Promise.resolve({data:null}),t?T.rpc("get_user_credit_balance",{p_user_id:t.id}):Promise.resolve({data:0}),T.from("credit_ledger").select("*").order("created_at",{ascending:!1}).limit(20)]);if(j.data){const O=j.data.map(K=>K.id),{data:D}=await T.from("order_items").select("*").in("order_id",O.length>0?O:["none"]),q=j.data.map(K=>({...K,items:(D||[]).filter($=>$.order_id===K.id)}));r(q)}A.data&&i(A.data),z.data!==null&&a(z.data),R.data&&u(R.data),f(!1)}async function k(j){var O,D;x(!0);const A=await T.auth.getSession(),R=await(await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/purchase-credits",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(O=A.data.session)==null?void 0:O.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({quantity:m,use_saved_payment:j})})).json();if(R.status==="credited")a(R.new_balance),p(!1),w();else if(R.client_secret)b(R.client_secret);else if(R.needs_payment_method){const K=await(await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/purchase-credits",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(D=A.data.session)==null?void 0:D.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({quantity:m,use_saved_payment:!1})})).json();K.client_secret&&b(K.client_secret)}x(!1)}function E(j){return j==="carbon"?l.jsx(Ap,{className:"w-5 h-5"}):j==="titanium"?l.jsx(wa,{className:"w-5 h-5"}):l.jsx(ba,{className:"w-5 h-5"})}function S(j){const A={completed:"bg-emerald-900/30 text-emerald-400 border-emerald-800/50",pending:"bg-amber-900/30 text-amber-400 border-amber-800/50",failed:"bg-red-900/30 text-red-400 border-red-800/50",refunded:"bg-[#22272c] text-[#8e979e] border-[#33393f]"};return l.jsx("span",{className:`inline-flex px-2 py-0.5 rounded text-[10px] font-mono tracking-[.1em] uppercase border ${A[j]||A.pending}`,children:j})}return d?l.jsx("div",{className:"flex items-center justify-center py-20",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent roun
689ded-full animate-spin"})}):l.jsx("div",{children:l.jsxs("div",{className:"max-w-[840px] mx-auto px-6 py-10",children:[l.jsx("h1",{className:"font-serif text-2xl text-[#eef1f3] font-medium mb-8",children:"My Account"}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-8",children:[l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-5",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${(e==null?void 0:e.membership_tier)==="carbon"?"bg-gradient-to-br from-[#e9cd97] to-[#9c6f33]":(e==null?void 0:e.membership_tier)==="titanium"?"bg-gradient-to-br from-[#a8b8c0] to-[#5a7a88]":"bg-gradient-to-br from-[#d0d4d8] to-[#8e979e]"} text-[#0a0b0c]`,children:E((e==null?void 0:e.membership_tier)||"stainless")}),l.jsxs("div",{children:[l.jsxs("h2",{className:"text-[#eef1f3] font-medium",children:[(s==null?void 0:s.name)||"Stainless"," Member"]}),l.jsx("p",{className:"text-[#8e979e] text-xs",children:e==null?void 0:e.email})]})]}),s&&s.price_cents>0&&l.jsxs("div",{className:"text-[#8e979e] text-xs mb-3",children:["£",(s.price_cents/100).toFixed(2),"/mo - Active"]}),l.jsx("a",{href:"/onboarding",className:"inline-block font-mono text-[10px] tracking-[.14em] uppercase px-3 py-1.5 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:s&&s.price_cents>0?"Change Plan":"Upgrade"})]}),l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx(mu,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:"Credits Balance"})]}),l.jsx("div",{className:"text-[#eef1f3] font-serif text-3xl font-medium mb-1",children:o}),l.jsx("p",{className:"text-[#8e979e] text-xs mb-4",children:"Use credits on tools, products, and services"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1.5 font-mono text-[10px] tracking-[.14em] uppercase px-3 py-1.5 rounded bg-gradient-to-r from-[#e9cd97] to-[#9c6f33] text-[#0a0b0c] font-bold hover:opacity-90 transition-opacity",children:[l.jsx(et,{className:"w-3 h-3"})," Buy Credits"]}),l.jsx("button",{onClick:()=>C(!_),className:"font-mono text-[10px] tracking-[.14em] uppercase px-3 py-1.5 rounded bg-[#22272c] border border-[#33393f] text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#2e343a] transition-colors",children:"History"})]})]})]}),h&&l.jsxs("div",{className:"bg-[#15181b] border border-[#c79a55]/30 rounded-lg p-6 mb-8 animate-fadeIn",children:[l.jsx("h3",{className:"font-mono text-[11px] tracking-[.14em] uppercase text-[#c79a55] mb-4",children:"Purchase Credits"}),l.jsx("p",{className:"text-[#8e979e] text-sm mb-4",children:"25 credits per pack at £25.00 each."}),v?l.jsx(bm,{stripe:KI,options:{clientSecret:v,appearance:{theme:"night",variables:{colorPrimary:"#c79a55",colorBackground:"#15181b",colorText:"#eef1f3",colorTextSecondary:"#8e979e",borderRadius:"4px"},rules:{".Input":{border:"1px solid #33393f",backgroundColor:"#0a0b0c"},".Input:focus":{borderColor:"#c79a55",boxShadow:"none"}}}},children:l.jsx(YI,{onSuccess:()=>{p(!1),b(""),w()},onCancel:()=>{p(!1),b("")}})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[l.jsx("label",{className:"text-[#c4cacf] text-sm",children:"Packs:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>g(Math.max(1,m-1)),className:"w-8 h-8 rounded bg-[#22272c] border border-[#33393f] text-[#c4cacf] hover:text-[#eef1f3] flex items-center justify-center",children:"-"}),l.jsx("span",{className:"text-[#eef1f3] font-mono w-8 text-center",children:m}),l.jsx("button",{onClick:()=>g(m+1),className:"w-8 h-8 rounded bg-[#22272c] border border-[#33393f] text-[#c4cacf] hover:text-[#eef1f3] flex items-center justify-center",children:"+"})]}),l.jsxs("div",{className:"ml-auto text-right",children:[l.jsxs("div",{className:"text-[#eef1f3] font-medium",children:[m*25," 
689credits"]}),l.jsxs("div",{className:"text-[#8e979e] text-xs",children:["£",(m*25).toFixed(2)]})]})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:()=>k(!0),disabled:y,className:"flex items-center gap-2 font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2.5 rounded bg-gradient-to-r from-[#e9cd97] to-[#9c6f33] text-[#0a0b0c] font-bold hover:opacity-90 transition-opacity disabled:opacity-50",children:y?l.jsx(Wt,{className:"w-3.5 h-3.5 animate-spin"}):"One-Click Buy"}),l.jsx("button",{onClick:()=>k(!1),disabled:y,className:"font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2.5 rounded bg-[#22272c] border border-[#33393f] text-[#c4cacf] hover:bg-[#2e343a] transition-colors disabled:opacity-50",children:"New Card"}),l.jsx("button",{onClick:()=>{p(!1),b("")},className:"font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2.5 text-[#8e979e] hover:text-[#c4cacf] transition-colors",children:"Cancel"})]})]})]}),_&&l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg overflow-hidden mb-8 animate-fadeIn",children:[l.jsx("div",{className:"px-4 py-3 border-b border-[#33393f]",children:l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:"Credit History"})}),c.length===0?l.jsx("div",{className:"p-6 text-center text-[#8e979e] text-sm",children:"No transactions yet."}):l.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:c.map(j=>l.jsxs("div",{className:"px-4 py-2.5 border-b border-[#33393f]/50 flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm text-[#c4cacf]",children:j.description}),l.jsxs("div",{className:"text-[10px] text-[#8e979e] font-mono",children:[new Date(j.created_at).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"2-digit"})," ","·"," ",l.jsx("span",{className:"capitalize",children:j.type.replace("_"," ")})]})]}),l.jsxs("span",{className:`font-mono text-sm font-medium ${j.amount>0?"text-emerald-400":"text-red-400"}`,children:[j.amount>0?"+":"",j.amount]})]},j.id))})]}),l.jsx(GI,{}),l.jsx(XI,{}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx(Jb,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("h2",{className:"font-mono text-[11px] tracking-[.16em] uppercase text-[#c79a55]",children:"Order History"})]}),n.length===0?l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-8 text-center",children:[l.jsx(Op,{className:"w-8 h-8 text-[#8e979e] mx-auto mb-3"}),l.jsx("p",{className:"text-[#8e979e] text-sm",children:"No orders yet"})]}):l.jsx("div",{className:"space-y-3",children:n.map(j=>l.jsxs("div",{className:"bg-[#15181b] border border-[#33393f] rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(va,{className:"w-3.5 h-3.5 text-[#8e979e]"}),l.jsx("span",{className:"text-[#8e979e] text-xs font-mono",children:new Date(j.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}),S(j.status)]}),l.jsxs("span",{className:"text-[#eef1f3] font-medium text-sm",children:["£",(j.total_cents/100).toFixed(2)]})]}),l.jsx("div",{className:"pl-6",children:j.items.map(A=>l.jsxs("div",{className:"flex justify-between text-sm py-1",children:[l.jsx("span",{className:"text-[#c4cacf]",children:A.description}),l.jsxs("span",{className:"text-[#8e979e]",children:[A.item_type!=="subscription"&&l.jsx("span",{className:"mr-2 text-[10px] font-mono tracking-[.1em] uppercase text-[#c79a55]",children:A.item_type}),"£",(A.amount_cents/100).toFixed(2)]})]},A.id))})]},j.id))})]})]})})}function GI(){const[t,e]=N.useState([]);return N.useEffect(()=>{T.from("member_cards").select("*").eq("active",!0).order("sort_order").then(({data:n})=>{n&&e(n)})},[]),t.length===0?null:l.jsx("div",{className:"mb-8",children:l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t.map(n=>l.jsxs("a",{href:n.cta_url,target:"_blank",rel:"noopener noreferrer",className:"group relative aspect-video rounded-xl overflow-hidden border border-[#33393f] hover:border-[#c79a55]/40 transition-all hover:-translate-y-0.5",children:[n.image_url&&l.jsx("img",{src:n.image_url,alt:"",className:"absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",style:{opacity:n.image_opacity}}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[#0a0b0c]/95 via-[#0a0b0c]/50 to-transparent"}),l.jsxs("div",{className:"relative h-full flex flex-col justify-end p-6",children:[l.jsx("h3",{className:"text-[#eef1f3] font-serif text-xl font-medium group-hover:text-[#c79a55] transition-colors",children:n.title}),n.description&&l.jsx("p",{className:"text-sm text-[#c4cacf] mt-1 line-clamp-2",children:n.description}),l.jsx("span",{className:"inline-flex items-center gap-1.5 mt-3 px-4 py-2 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] text-xs font-mono uppercase tracking-wider font-bold w-fit group-hover:opacity-90 transition-opacity",children:n.cta_text||"Visit"})]})]},n.id))})})}function XI(){const{user:t}
689=Nt(),[e,n]=N.useState([]);N.useEffect(()=>{t&&r()},[t]);async function r(){const{data:s}=await T.from("giveaway_entries").select("*, giveaways(slug, headline, prize_title, prize_image_url, status, draw_date)").eq("user_id",t.id).order("created_at",{ascending:!1});s&&n(s)}return e.length===0?null:l.jsxs("div",{className:"mb-8",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx(nn,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("h2",{className:"font-mono text-[11px] tracking-[.16em] uppercase text-[#c79a55]",children:"My Giveaways"})]}),l.jsx("div",{className:"space-y-2",children:e.map(s=>{var i,o,a,c,u,d;return l.jsxs("a",{href:`/giveaway/${(i=s.giveaways)==null?void 0:i.slug}`,className:"flex items-center gap-4 p-3 rounded-lg bg-[#15181b] border border-[#33393f] hover:border-[#c79a55]/30 transition-colors",children:[(o=s.giveaways)!=null&&o.prize_image_url?l.jsx("img",{src:s.giveaways.prize_image_url,alt:"",className:"w-10 h-10 rounded object-cover"}):l.jsx("div",{className:"w-10 h-10 rounded bg-[#0a0b0c] flex items-center justify-center",children:l.jsx(nn,{className:"w-4 h-4 text-[#c79a55]"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm text-[#eef1f3] truncate",children:((a=s.giveaways)==null?void 0:a.prize_title)||((c=s.giveaways)==null?void 0:c.headline)}),l.jsxs("p",{className:"text-xs text-[#8e979e]",children:[s.points," points earned"]})]}),l.jsx("span",{className:`text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded font-bold ${((u=s.giveaways)==null?void 0:u.status)==="active"?"bg-emerald-500/10 text-emerald-400":"bg-[#c79a55]/10 text-[#c79a55]"}`,children:(d=s.giveaways)==null?void 0:d.status})]},s.id)})})]})}function YI({onSuccess:t,onCancel:e}){const n=lk(),r=ok(),[s,i]=N.useState(!1),[o,a]=N.useState("");async function c(u){if(u.preventDefault(),!n||!r)return;i(!0),a("");const{error:d}=await n.confirmPayment({elements:r,confirmParams:{return_url:window.location.origin+"/account"},redirect:"if_required"});d?(a(d.message||"Payment failed"),i(!1)):t()}return l.jsxs("form",{onSubmit:c,children:[l.jsx(ck,{}),o&&l.jsx("p",{className:"text-red-400 text-sm mt-3",children:o}),l.jsxs("div",{className:"flex gap-3 mt-4",children:[l.jsx("button",{type:"submit",disabled:!n||s,className:"flex items-center gap-2 font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2.5 rounded bg-gradient-to-r from-[#e9cd97] to-[#9c6f33] text-[#0a0b0c] font-bold hover:opacity-90 transition-opacity disabled:opacity-50",children:s?l.jsx(Wt,{className:"w-3.5 h-3.5 animate-spin"}):"Pay Now"}),l.jsx("button",{type:"button",onClick:e,className:"font-mono text-[10px] tracking-[.14em] uppercase px-4 py-2.5 text-[#8e979e] hover:text-[#c4cacf]",children:"Cancel"})]})]})}const QI=[{key:"classic",name:"Classic Cartoon",description:"Bold outlines, vibrant flat colors, Saturday morning cartoon feel",preview:"linear-gradient(135deg, #FFD93D 0%, #FF6B6B 50%, #4ECDC4 100%)"},{key:"anime",name:"Anime",description:"Detailed cel-shading, dramatic lighting, Japanese manga style",preview:"linear-gradient(135deg, #667eea 0%, #f093fb 50%, #4fd1c5 100%)"},{key:"watercolor",name:"Watercolor",description:"Soft washes, bleeding edges, painterly brushstroke illustration",preview:"linear-gradient(135deg, #a8edea 0%, #fed6e3 50%, #d299c2 100%)"},{key:"comic",name:"Retro Comic",description:"Ben-Day dots, thick ink outlines, 1960s pop-art halftone",preview:"linear-gradient(135deg, #f7971e 0%, #ffd200 50%, #ff0844 100%)"}];function ZI(){const{user:t,profile:e}=Nt(),[n,r]=N.useState(0),[s,i]=N.useState("classic"),[o,a]=N.useState(null),[c,u]=N.useState(""),[d,f]=N.useState({width:0,height:0}),[h,p]=N.useState(!1),[m,g]=N.useState(null),[y,x]=N.useState(""),[v,b]=N.useState([]),[_,C]=N.useState(!1),w=N.useRef(null),k=(e==null?void 0:e.role)==="admin";N.useEffect(()=>{E(),S()},[]);async function E(){if(!t)return;const{data:O}=await T.rpc("get_user_credit_balance",{p_user_id:t.id});O!==null&&r(O)}async function S(){const{data:O}=await T.from("carptoon_generations").select("*").eq("status","completed").order("created_at",{ascending:!1}).limit(12);O&&b(O)}function j(O){var $;const D=($=O.target.files)==null?void 0:$[0];if(!D)return;if(!D.type.startsWith("image/")){x("Please upload an image file");return}if(D.size>20*1024*1024){x("Image must be under 20MB");return}const q=URL.createObjectURL(D),K=new Image;K.onload=()=>
689{f({width:K.naturalWidth,height:K.naturalHeight})},K.src=q,a(D),u(q),g(null),x("")}async function A(){var $;if(!o||!t)return;if(!k&&n<1){x("Insufficient credits. Purchase more from your account page.");return}p(!0),x(""),g(null);const O=await T.auth.getSession(),D=new FormData;D.append("image",o),D.append("style",s),D.append("width",String(d.width)),D.append("height",String(d.height));const q=await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/carptoon-generate",{method:"POST",headers:{Authorization:`Bearer ${($=O.data.session)==null?void 0:$.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:D}),K=await q.json();q.ok&&K.status==="completed"?(g({image_url:K.image_url,image_base64:K.image_base64,style:K.style}),r(K.credits_remaining),S()):(x(K.error||"Generation failed. Please try again."),K.balance!==void 0&&r(K.balance)),p(!1)}function z(){if(m)if(m.image_base64){const O=document.createElement("a");O.href=`data:image/png;base64,${m.image_base64}`,O.download=`carptoon_${s}_${Date.now()}.png`,O.click()}else m.image_url&&window.open(m.image_url,"_blank")}function R(){a(null),u(""),g(null),x(""),w.current&&(w.current.value="")}return l.jsx("div",{children:l.jsxs("div",{className:"max-w-[1080px] mx-auto px-6 py-10",children:[l.jsxs("div",{className:"text-center mb-10",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-2",children:"Carptoon"}),l.jsx("h1",{className:"font-serif text-[clamp(28px,4vw,42px)] text-[#eef1f3] font-medium leading-tight",children:"Turn your catches into art"}),l.jsx("p",{className:"text-[#8e979e] mt-2 max-w-[50ch] mx-auto",children:"Upload a photo of your carp and choose a cartoon style. Each generation costs 1 credit."})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_380px] gap-8",children:[l.jsxs("div",{children:[!c&&!m&&l.jsxs("label",{className:"block cursor-pointer group",children:[l.jsx("input",{ref:w,type:"file",accept:"image/*",onChange:j,className:"hidden"}),l.jsxs("div",{className:"aspect-video rounded-lg border-2 border-dashed border-[#33393f] bg-[#15181b] flex flex-col items-center justify-center transition-colors group-hover:border-[#c79a55]/50 group-hover:bg-[#1a1e22]",children:[l.jsx(i1,{className:"w-10 h-10 text-[#8e979e] mb-4 group-hover:text-[#c79a55] transition-colors"}),l.jsx("p",{className:"text-[#c4cacf] font-medium mb-1",children:"Upload your carp photo"}),l.jsx("p",{className:"text-[#8e979e] text-sm",children:"PNG, JPG up to 20MB"})]})]}),(c||m)&&l.jsxs("div",{className:"space-y-4",children:[m&&l.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-[#c79a55]/30 animate-fadeIn",children:[l.jsx("div",{className:"bg-[#15181b]",children:l.jsx("img",{src:m.image_base64?`data:image/png;base64,${m.image_base64}`:m.image_url,alt:"Generated Carptoon",className:"w-full h-auto"})}),l.jsx("div",{className:"absolute top-3 left-3 flex items-center gap-2",children:l.jsx("span",{className:"font-mono text-[9px] tracking-[.16em] uppercase px-2 py-1 rounded bg-[rgba(8,9,10,.85)] text-[#c79a55] border border-[#c79a55]/30",children:m.style})})]}),c&&l.jsxs("div",{className:`relative rounded-lg overflow-hidden border border-[#33393f] ${m?"h-24":""}`,children:[l.jsx("img",{src:c,alt:"Original",className:`w-full ${m?"h-full object-cover":"h-auto"}`}),!m&&l.jsx("div",{className:"absolute top-3 left-3",children:l.jsx("span",{className:"font-mono text-[9px] tracking-[.16em] uppercase px-2 py-1 rounded bg-[rgba(8,9,10,.85)] text-[#c4cacf]",children:"Original"})})]}),l.jsxs("div",{className:"flex gap-3",children:[m&&l.jsxs("button",{onClick:z,className:"flex items-center gap-2 font-mono text-[11px] tracking-[.14em] uppercase px-5 py-3 rounded bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-bold hover:opacity-90 transition-opacity",children:[l.jsx(ix,{className:"w-4 h-4"})," Download"]}
689),!h&&c&&l.jsxs("button",{onClick:A,disabled:!k&&n<1,className:`flex items-center gap-2 font-mono text-[11px] tracking-[.14em] uppercase px-5 py-3 rounded font-bold transition-opacity ${m?"bg-[#22272c] border border-[#33393f] text-[#c4cacf] hover:bg-[#2e343a]":"bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] hover:opacity-90"} disabled:opacity-50`,children:[l.jsx(DC,{className:"w-4 h-4"}),m?"Regenerate":"Generate"," ",k?"(free)":"(1 credit)"]}),l.jsxs("button",{onClick:R,className:"flex items-center gap-2 font-mono text-[10px] tracking-[.14em] uppercase px-4 py-3 text-[#8e979e] hover:text-[#c4cacf] transition-colors",children:[l.jsx(t1,{className:"w-3.5 h-3.5"})," New Image"]})]})]}),h&&l.jsxs("div",{className:"py-20 rounded-lg border border-[#33393f] bg-[#15181b] flex flex-col items-center justify-center",children:[l.jsx("div",{className:"relative mb-4",children:l.jsx(Wt,{className:"w-10 h-10 text-[#c79a55] animate-spin"})}),l.jsx("p",{className:"text-[#eef1f3] font-medium mb-1",children:"Creating your Carptoon..."}),l.jsx("p",{className:"text-[#8e979e] text-sm",children:"This typically takes 15-30 seconds"})]}),y&&l.jsx("div",{className:"mt-4 p-4 rounded-lg bg-red-900/20 border border-red-800/50",children:l.jsx("p",{className:"text-red-400 text-sm",children:y})})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55] mb-4",children:"Choose Style"}),l.jsx("div",{className:"space-y-3",children:QI.map(O=>l.jsx("button",{onClick:()=>i(O.key),className:`w-full text-left p-3 rounded-lg border transition-all ${s===O.key?"border-[#c79a55] bg-[#15181b] ring-1 ring-[#c79a55]/20":"border-[#33393f] bg-[#15181b] hover:border-[#c79a55]/30"}`,children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded shrink-0",style:{background:O.preview}}),l.jsxs("div",{children:[l.jsx("div",{className:`text-sm font-medium ${s===O.key?"text-[#eef1f3]":"text-[#c4cacf]"}`,children:O.name}),l.jsx("div",{className:"text-xs text-[#8e979e] mt-0.5",children:O.description})]})]})},O.key))}),l.jsxs("div",{className:"mt-6 p-4 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(mu,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("span",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55]",children:"Credits"})]}),l.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[l.jsx("span",{className:"text-[#8e979e]",children:"Balance"}),l.jsx("span",{className:"text-[#eef1f3] font-mono",children:k?"Unlimited":n})]}),l.jsxs("div",{className:"flex justify-between text-sm",children:[l.jsx("span",{className:"text-[#8e979e]",children:"Cost per generation"}),l.jsx("span",{className:"text-[#c79a55] font-mono",children:k?"Free":"1"})]}),!k&&n<1&&l.jsx("a",{href:"/account",className:"block mt-3 text-center font-mono text-[10px] tracking-[.12em] uppercase px-3 py-2 rounded bg-[#22272c] border border-[#33393f] text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:"Buy Credits"})]}),l.jsxs("button",{onClick:()=>C(!_),className:"mt-4 w-full font-mono text-[10px] tracking-[.12em] uppercase px-3 py-2 rounded bg-[#15181b] border border-[#33393f] text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#1a1e22] transition-colors flex items-center justify-center gap-2",children:[l.jsx(Mi,{className:"w-3.5 h-3.5"})," My Carptoons (",v.length,")"]})]})]}),_&&v.length>0&&l.jsxs("div",{className:"mt-10 animate-fadeIn",children:[l.jsx("h3",{className:"font-mono text-[10px] tracking-[.14em] uppercase text-[#c79a55] mb-4",children:"Previous Generations"}),l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:v.map(O=>l.jsxs("a",{href:O.generated_image_url,target:"_blank",rel:"noopener noreferrer",className:"group relative aspect-[4/3] rounded-lg overflow-hidden border border-[#33393f] hover:border-[#c79a55]/50 transition-colors",children:[l.jsx("img",{src:O.generated_image_url,alt:`Carptoon - ${O.style}`,className:"w-full h-full object-cover"}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgba(8,9,10,.8)] via-trans
689parent to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),l.jsx("div",{className:"absolute bottom-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity",children:l.jsx("span",{className:"font-mono text-[9px] tracking-[.12em] uppercase text-[#c4cacf] capitalize",children:O.style})}),l.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:l.jsx(ix,{className:"w-4 h-4 text-[#eef1f3]"})})]},O.id))})]})]})})}const e7=[{path:"/account",label:"Account",icon:o1},{path:"/store",label:"Store",icon:ot},{path:"/tools/carptoon",label:"Carptoon",icon:Pp}];function Ji({children:t}){const{session:e,profile:n,loading:r,signOut:s}=Nt(),i=ma();if(r)return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"})});if(!e)return l.jsx(jp,{to:"/",replace:!0});const o=(n==null?void 0:n.role)==="admin";return l.jsxs("div",{className:"min-h-screen bg-[#0a0b0c]",children:[l.jsx("header",{className:"border-b border-[#33393f]",children:l.jsxs("div",{className:"px-6 py-3 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-6",children:[l.jsxs("a",{href:"/",className:"flex items-center gap-2 text-[#8e979e] hover:text-[#eef1f3] transition-colors text-sm",children:[l.jsx(Kb,{className:"w-4 h-4"}),l.jsx("span",{className:"hidden sm:inline",children:"Back to site"})]}),l.jsx("nav",{className:"flex items-center gap-1",children:e7.map(a=>{const c=a.icon,u=i.pathname===a.path;return l.jsxs("a",{href:a.path,className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${u?"bg-[#22272c] text-[#eef1f3] border border-[#33393f]":"text-[#8e979e] hover:text-[#c4cacf] hover:bg-[#15181b]"}`,children:[l.jsx(c,{className:"w-3.5 h-3.5"}),l.jsx("span",{className:"hidden sm:inline",children:a.label})]},a.path)})})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[o&&l.jsxs("a",{href:"/admin",className:"flex items-center gap-1.5 font-mono text-[9px] tracking-[.14em] uppercase px-2.5 py-1.5 rounded bg-[#22272c] border border-[#c79a55]/30 text-[#c79a55] hover:bg-[#2e343a] transition-colors",children:[l.jsx(ba,{className:"w-3 h-3"})," Admin"]}),l.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 text-[#8e979e] hover:text-red-400 text-sm transition-colors",children:[l.jsx(Mp,{className:"w-3.5 h-3.5"}),l.jsx("span",{className:"hidden sm:inline",children:"Sign Out"})]})]})]})}),t]})}function t7(){var k,E,S;const{addItem:t,totalItems:e}=qb(),[n,r]=N.useState([]),[s,i]=N.useState([]),[o,a]=N.useState([]),[c,u]=N.useState(""),[d,f]=N.useState([]),[h,p]=N.useState(null),[m,g]=N.useState(0),[y,x]=N.useState(!0),[v,b]=N.useState("");N.useEffect(()=>{_()},[]);async function _(){const[j,A,z]=await Promise.all([T.from("store_products").select("*, store_product_images(*), store_product_tags(tag_id)").eq("status","active").order("featured",{ascending:!1}),T.from("store_categories").select("*").eq("active",!0).order("sort_order"),T.from("store_tags").select("*").order("name")]);j.data&&r(j.data),A.data&&i(A.data),z.data&&a(z.data),x(!1)}function C(j){var z,R;const A=((z=j.store_product_images)==null?void 0:z.find(O=>O.is_primary))||((R=j.store_product_images)==null?void 0:R[0]);t({product_id:j.id,name:j.name,price_cents:j.price_cents,image_url:(A==null?void 0:A.url)||"",quantity:1,slug:j.slug}),b(j.id),setTimeout(()=>b(""),1500)}const w=n.filter(j=>{var A;if(c&&j.category_id!==c)return!1;if(d.length>0){const z=((A=j.store_product_tags)==null?void 0:A.map(R=>R.tag_id))||[];if(!d.some(R=>z.includes(R)))return!1}return!0});if(h){const j=((k=h.store_product_images)==null?void 0:k.sort((z,R)=>z.sort_order-R.sort_order))||[],A=h.stock_qty===-1||h.stock_qty>0;return l.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 py-10",children:[l.jsxs("button",{onClick:()=>p(null),className:"flex items-center gap-2 text-sm text-[#8e979e] hover:text-[#c79a55] mb-6 transition-colors",children:[l.jsx(ns,{className:"w-4 h-4 rotate-180"})," Back to Store"]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-10",children:[l.jsx("div",{children:j.length>0?l.jsxs("div",{children:[l.jsx("div",{className:"aspect-square rounded-lg overflow-hidden border border-[#33393f] bg-[#15181b] mb
689-3",children:l.jsx("img",{src:(E=j[m])==null?void 0:E.url,alt:(S=j[m])==null?void 0:S.alt_text,className:"w-full h-full object-cover"})}),j.length>1&&l.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:j.map((z,R)=>l.jsx("button",{onClick:()=>g(R),className:`w-16 h-16 rounded-lg overflow-hidden border-2 shrink-0 transition-colors ${R===m?"border-[#c79a55]":"border-[#33393f] hover:border-[#c79a55]/40"}`,children:l.jsx("img",{src:z.url,alt:"",className:"w-full h-full object-cover"})},z.id))})]}):l.jsx("div",{className:"aspect-square rounded-lg border border-[#33393f] bg-[#15181b] flex items-center justify-center",children:l.jsx(ot,{className:"w-16 h-16 text-[#33393f]"})})}),l.jsxs("div",{children:[h.featured&&l.jsxs("div",{className:"flex items-center gap-1.5 text-[#c79a55] text-xs font-mono uppercase tracking-wider mb-2",children:[l.jsx(Ip,{className:"w-3.5 h-3.5 fill-current"})," Featured"]}),l.jsx("h1",{className:"font-serif text-3xl text-[#eef1f3] font-medium mb-3",children:h.name}),l.jsxs("div",{className:"flex items-baseline gap-3 mb-4",children:[l.jsxs("span",{className:"text-2xl font-mono text-[#c79a55] font-bold",children:["£",(h.price_cents/100).toFixed(2)]}),h.compare_at_cents&&l.jsxs("span",{className:"text-lg text-[#8e979e] line-through font-mono",children:["£",(h.compare_at_cents/100).toFixed(2)]})]}),l.jsx("p",{className:"text-[#c4cacf] leading-relaxed mb-6",children:h.description}),h.long_description&&l.jsx("div",{className:"text-sm text-[#8e979e] leading-relaxed mb-6 whitespace-pre-line",children:h.long_description}),l.jsxs("div",{className:"flex gap-3 mb-6",children:[l.jsxs("button",{onClick:()=>C(h),disabled:!A,className:"flex-1 flex items-center justify-center gap-2 py-3.5 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-sm tracking-wider uppercase font-bold hover:opacity-90 transition-opacity disabled:opacity-40",children:[l.jsx(ot,{className:"w-4 h-4"}),A?v===h.id?"Added!":"Add to Cart":"Out of Stock"]}),e>0&&l.jsxs("a",{href:"/cart",className:"flex items-center gap-2 px-5 py-3.5 rounded-lg border border-[#33393f] text-[#c4cacf] hover:border-[#c79a55]/40 transition-colors font-mono text-sm uppercase",children:["Cart (",e,")"]})]}),!A&&l.jsx("p",{className:"text-sm text-red-400",children:"This product is currently out of stock."}),l.jsxs("div",{className:"border-t border-[#33393f] pt-4 space-y-2 text-xs text-[#8e979e]",children:[h.digital&&l.jsx("p",{children:"Digital product - instant delivery"}),h.stock_qty>0&&l.jsxs("p",{children:["Only ",h.stock_qty," left in stock"]})]})]})]})]})}return l.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 py-10",children:[l.jsxs("div",{className:"flex items-end justify-between mb-8",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-2",children:"Shop"}),l.jsx("h1",{className:"font-serif text-[clamp(28px,4vw,42px)] text-[#eef1f3] font-medium",children:"The Store"})]}),e>0&&l.jsxs("a",{href:"/cart",className:"flex items-center gap-2 px-4 py-2.5 rounded-lg border border-[#c79a55]/30 text-[#c79a55] hover:bg-[#c79a55]/5 transition-colors font-mono text-xs uppercase tracking-wider",children:[l.jsx(ot,{className:"w-4 h-4"}),"Cart (",e,")"]})]}),(s.length>0||o.length>0)&&l.jsxs("div",{className:"mb-8 p-4 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsxs("div",{className:"flex items-center gap-2 text-[#8e979e] mb-3",children:[l.jsx(hC,{className:"w-3.5 h-3.5"}),l.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider",children:"Filter"})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx("button",{onClick:()=>{u(""),f([])},className:`px-3 py-1.5 rounded-full text-xs transition-colors border ${!c&&d.length===0?"border-[#c79a55] text-[#c79a55] bg-[#c79a55]/10":"border-[#33393f] text-[#8e979e] hover:border-[#c79a55]/30"}`,children:"All"}),s.map(j=>l.jsx("button",{onClick:()=>u(c===j.id?"":j.id),className:`px-3 py-1.5 rounded-full text-xs transition-colors border ${c===j.id?"border-[#c79a55] text-[#c79a55] bg-[#c79a55]/10":"border-[#33393f] text-[#8e979e] hover:border-[#c79a55]/30"}`,children:j.name},j.id)),o.map(j=>l.jsxs("button",{onClick:()=>f(A=>
689A.includes(j.id)?A.filter(z=>z!==j.id):[...A,j.id]),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs transition-colors border ${d.includes(j.id)?"border-[#c79a55] text-[#c79a55] bg-[#c79a55]/10":"border-[#33393f] text-[#8e979e] hover:border-[#c79a55]/30"}`,children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:j.color}}),j.name]},j.id)),(c||d.length>0)&&l.jsx("button",{onClick:()=>{u(""),f([])},className:"px-2 py-1.5 text-xs text-[#8e979e] hover:text-red-400",children:l.jsx(_r,{className:"w-3.5 h-3.5"})})]})]}),y?l.jsx("div",{className:"flex justify-center py-20",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"})}):w.length===0?l.jsxs("div",{className:"text-center py-20",children:[l.jsx(ot,{className:"w-12 h-12 text-[#33393f] mx-auto mb-4"}),l.jsx("p",{className:"text-[#8e979e]",children:"No products found"})]}):l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:w.map(j=>{var R,O;const A=((R=j.store_product_images)==null?void 0:R.find(D=>D.is_primary))||((O=j.store_product_images)==null?void 0:O[0]),z=j.stock_qty===-1||j.stock_qty>0;return l.jsxs("div",{className:"group rounded-lg border border-[#33393f] bg-[#15181b] overflow-hidden hover:border-[#c79a55]/30 transition-all hover:-translate-y-0.5",children:[l.jsxs("button",{onClick:()=>{p(j),g(0)},className:"w-full text-left",children:[l.jsxs("div",{className:"aspect-[4/3] bg-[#0a0b0c] relative overflow-hidden",children:[A?l.jsx("img",{src:A.url,alt:A.alt_text,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):l.jsx("div",{className:"w-full h-full flex items-center justify-center",children:l.jsx(ot,{className:"w-10 h-10 text-[#33393f]"})}),j.compare_at_cents&&l.jsx("span",{className:"absolute top-3 left-3 px-2 py-1 rounded text-[10px] uppercase tracking-wider font-bold bg-red-600 text-white",children:"Sale"}),j.featured&&l.jsx("span",{className:"absolute top-3 right-3 px-2 py-1 rounded text-[10px] uppercase tracking-wider font-bold bg-[#c79a55] text-[#0a0b0c]",children:"Featured"}),!z&&l.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:l.jsx("span",{className:"px-3 py-1.5 rounded text-xs uppercase tracking-wider font-bold bg-[#0a0b0c] text-[#8e979e] border border-[#33393f]",children:"Sold Out"})})]}),l.jsxs("div",{className:"p-4",children:[l.jsx("h3",{className:"text-[#eef1f3] font-medium mb-1 group-hover:text-[#c79a55] transition-colors",children:j.name}),l.jsx("p",{className:"text-xs text-[#8e979e] line-clamp-2 mb-3",children:j.description}),l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsxs("span",{className:"font-mono text-[#c79a55] font-bold",children:["£",(j.price_cents/100).toFixed(2)]}),j.compare_at_cents&&l.jsxs("span",{className:"font-mono text-sm text-[#8e979e] line-through",children:["£",(j.compare_at_cents/100).toFixed(2)]})]})]})]}),z&&l.jsx("div",{className:"px-4 pb-4",children:l.jsxs("button",{onClick:()=>C(j),className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-lg border border-[#c79a55]/30 text-[#c79a55] text-xs font-mono uppercase tracking-wider hover:bg-[#c79a55]/5 transition-colors",children:[l.jsx(ot,{className:"w-3.5 h-3.5"}),v===j.id?"Added!":"Add to Cart"]})})]},j.id)})})]})}function n7(){const{items:t,removeItem:e,updateQuantity:n,totalCents:r,totalItems:s,clearCart:i}=qb(),{session:o}=Nt(),[a,c]=N.useState([]),[u,d]=N.useState([]),[f,h]=N.useState(!1),[p,m]=N.useState("");N.useEffect(()=>{g()},[]);async function g(){const{data:b}=await T.from("store_bumps").select("*").eq("active",!0).order("sort_order");b&&c(b)}const y=a.filter(b=>u.includes(b.id)).reduce((b,_)=>b+_.price_cents,0),x=r+y;async function v(){if(!o){window.location.href="/admin/login?redirect=/cart";return}h(!0),m("");const b=await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/store-checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({items:t.map(C=>({product_id:C.product_id,quantity:C.quantity})),bump_ids:u})}),_=await b.json();b.ok&&_.url?(i(),window.location.href=_.url):(m(_.error||"Checkout failed. Please try again."),h(!1))}return t.length===0?l.jsxs("div",{className:"max-w-[800px] mx-auto px-6 py-20 text-center",children:[l.jsx(ot,{className:"w-16 h-16 text-[#33393f] mx-auto mb-4"}),l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] mb-2",children:"Your cart is empty"}),l.jsx("p",{className:"text-[#8e979e] mb-6",children:"Browse our store to find something you love."}),l.jsxs("a",{href:"/store",className:"inline-flex items-center gap-2 px-5 py-3 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-xs uppercase tracking-wider font-bold hover:opacity-90 transition-opacity",children:[l.jsx(ot,{className:"w-4 h-4"})," Browse Store"]})]}):l.jsxs("div",{className:"max-w-[1000px] mx-auto px-6 py-10",children:[l.jsxs("a",{href:"/store",className:"flex items-center gap-2 text-sm text-[#8e979e] hover:text-[#c79a55] mb-6 transition-colors",children:[l.jsx(Kb,{className:"w-4 h-4"})," Continue Shopping"]}),l.jsxs("h1",{className:"font-serif text-3xl text-[#eef1f3] font-medium mb-8",children:["Your Cart (",s,")"]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_380px] gap-8",children:[l.jsx("div",{className:"space-y-3",children:t.map(b=>l.jsxs("div",{className:"flex gap-4 p-4 rounded-lg bg-[#15181b] border border-[#33393f]",children:[l.jsx("div",{className:"w-20 h-20 rounded-lg overflow-hidden bg-[#0a0b0c] border border-[#33393f] shrink-0",children:b.image_url?l.jsx("img",{src:b.image_url,alt:b.name,className:"w-full h-full object-cover"}):l.jsx("div",{className:"w-full h-full flex items-center justify-center",children:l.jsx(ot,{className:"w-6 h-6 text-[#33393f]"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-sm text-[#eef1f3] font-medium truncate",children:b.name}),l.jsxs("p",{className:"text-xs text-[#c79a55] font-mono mt-0.5",children:["£",(b.price_cents/100).toFixed(2)]}),l.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[l.jsx("button",{onClick:()=>n(b.product_id,b.quantity-1),className:"p-1 rounded border border-[#33393f] text-[#8e979e] hover:text-[#eef1f3] hover:border-[#c79a55]/30",children:l.jsx(EC,{className:"w-3 h-3"})}),l.jsx("span",{className:"text-sm text-[#eef1f3] font-mono w-6 text-center",children:b.quantity}),l.jsx("button",{onClick:()=>n(b.product_id,b.quantity+1),className:"p-1 rounded border border-[#33393f] text-[#8e979e] hover:text-[#eef1f3] hover:border-[#c79a55]/30",children:l.jsx(et,{className:"w-3 h-3"})})]})]}),l.jsxs("div",{className:"flex flex-col items-end justify-between",children:[l.jsxs("span",{className:"text-sm text-[#eef1f3] font-mono",children:["£",(b.price_cents*b.quantity/100).toFixed(2)]}),l.jsx("button",{onClick:()=>e(b.product_id),className:"p-1.5 text-[#8e979e] hover:text-red-400",children:l.jsx(at,{className:"w-4 h-4"})})]})]},b.product_id))}),l.jsxs("div",{className:"space-y-4",children:[a.length>0&&l.jsxs("div",{className:"rounded-lg border border-[#c79a55]/30 bg-[#15181b] overflow-hidden",children:[l.jsx("div",{className:"px-4 py-3 bg-gradient-to-r from-[#c79a55]/10 to-transparent border-b border-[#c79a55]/20",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(wa,{className:"w-4 h-4 text-[#c79a55]"}),l.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-[#c79a55] font-bold",children:"Special Offers"})]})}),l.jsx("div",{className:"p-3 space-y-2",children:a.map(b=>{const _=u.includes(b.id);return l.jsxs("button",{onClick:()=>d(C=>_?C.filter(w=>w!==b.id):[...C,b.id]),className:`w-full flex items-start gap-3 p-3 rounded-lg border text-left transition-all ${_?"border-[#c79a55] bg-[#c79a55]/5":"border-[#33393f] hover:border-[#c79a55]/30"}`,children:[l.jsx("div",{className:`w-5 h-5 rounded border-2 shrink-0 mt-0.5 flex items-center justify-center transition-colors ${_?"border-[#c79a55] bg-[#c79a55]":"border-[#33393f]"}`,children:_&&l.jsx(mr,{className:"w-3 h-3 text-[#0a0b0c]"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm text-[#eef1f3] font-medium",children:b.name}),l.jsx("p",{className:"text-xs text-[#8e979e] mt-0.5",children:b.description}),l.jsxs("p",{className:"text-xs text-[#c79a55] font-mono mt-1 font-bold",children:["+","£",(b.price_cents/100).toFixed(2)]})]}),b.image_url&&l.jsx("img",{src:b.image_url,alt:"",className:"w-10 h-10 rounded object-cover shrink-0"})]},b.id)})})]}),l.jsxs("div",{className:"rounded-lg border border-[#33393f] bg-[#15181b] p-5",children:[l.jsx("h3",{className:"font-mono text-[10px] uppercase tracking-wider text-[#c79a55] mb-4",children:"Order Summary"}),l.jsxs("div",{className:"space-y-2 text-sm",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{className:"text-[#8e979e]",children:"Subtotal"}),l.jsxs("span",{className:"text-[#eef1f3] font-mono",children:["£",(r/100).toFixed(2)]})]}),y>0&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{className:"text-[#8e979e]",children:"Add-ons"}),l.jsxs("span",{className:"text-[#c79a55] font-mono",children:["£",(y/100).toFixed(2)]})]}),l.jsxs("div",{className:"border-t border-[#33393f] pt-2 flex justify-between",children:[l.jsx("span",{className:"text-[#eef1f3] font-medium",children:"Total"}),l.jsxs("span",{className:"text-[#eef1f3] font-mono font-bold text-lg",children:["£",(x/100).toFixed(2)]})]})]}),p&&l.jsx("p",{className:"text-xs text-red-400 mt-3",children:p}),l.jsx("button",{onClick:v,disabled:f,className:"w-full mt-5 flex items-center justify-center gap-2 py-3.5 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-sm tracking-wider up
689percase font-bold hover:opacity-90 transition-opacity disabled:opacity-50",children:f?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):l.jsxs(l.Fragment,{children:[l.jsx(Jb,{className:"w-4 h-4"}),o?"Checkout":"Sign In to Checkout"]})}),l.jsx("p",{className:"text-[10px] text-[#8e979e] text-center mt-3",children:"Secure checkout powered by Stripe"})]})]})]})]})}function r7(){const{session:t}=Nt(),[e,n]=N.useState([]),[r,s]=N.useState(0),[i,o]=N.useState(0),[a,c]=N.useState(!1),[u,d]=N.useState([]),[f,h]=N.useState(!1),[p,m]=N.useState(""),g=N.useRef();N.useEffect(()=>(y(),()=>{g.current&&clearInterval(g.current)}),[]);async function y(){const{data:k}=await T.from("store_upsells").select("*").eq("active",!0).order("sort_order");k&&k.length>0?(n(k),x(k[0].timer_seconds)):h(!0)}function x(k){o(k),g.current&&clearInterval(g.current),g.current=window.setInterval(()=>{o(E=>E<=1?(clearInterval(g.current),0):E-1)},1e3)}function v(k){const E=Math.floor(k/60),S=k%60;return`${E}:${S.toString().padStart(2,"0")}`}async function b(){if(!t||!e[r])return;c(!0),m("");const k=e[r],E=await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/store-upsell",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({offer_id:k.id})}),S=await E.json();c(!1),E.ok&&S.status==="charged"?(d([...u,k.id]),C()):m(S.error||"Payment failed. Your card was not charged.")}function _(){C()}function C(){if(g.current&&clearInterval(g.current),r<e.length-1){const k=r+1;s(k),m(""),x(e[k].timer_seconds)}else h(!0)}if(f)return l.jsxs("div",{className:"max-w-[600px] mx-auto px-6 py-20 text-center",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 border-2 border-emerald-500 flex items-center justify-center mx-auto mb-6",children:l.jsx(mr,{className:"w-8 h-8 text-emerald-500"})}),l.jsx("h1",{className:"font-serif text-3xl text-[#eef1f3] font-medium mb-3",children:"Order Complete!"}),l.jsx("p",{className:"text-[#8e979e] mb-8",children:"Thank you for your purchase. You'll receive a confirmation email shortly."}),u.length>0&&l.jsxs("p",{className:"text-sm text-[#c79a55] mb-4",children:[u.length," extra item",u.length>1?"s":""," added to your order."]}),l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsx("a",{href:"/store",className:"px-5 py-3 rounded-lg border border-[#33393f] text-[#c4cacf] hover:border-[#c79a55]/40 transition-colors font-mono text-xs uppercase",children:"Continue Shopping"}),l.jsx("a",{href:"/account",className:"px-5 py-3 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-xs uppercase font-bold hover:opacity-90 transition-opacity",children:"My Account"})]})]});if(e.length===0)return l.jsx("div",{className:"flex justify-center py-20",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"})});const w=e[r];return l.jsxs("div",{className:"max-w-[700px] mx-auto px-6 py-10",children:[e.length>1&&l.jsx("div",{className:"flex gap-1.5 mb-6",children:e.map((k,E)=>l.jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${E<r?"bg-emerald-500":E===r?"bg-[#c79a55]":"bg-[#33393f]"}`},E))}),i>0&&l.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6 text-[#c79a55]",children:[l.jsx(va,{className:"w-4 h-4"}),l.jsxs("span",{className:"font-mono text-sm",children:["Offer expires in ",v(i)]})]}),l.jsxs("div",{className:"rounded-xl border border-[#c79a55]/30 bg-[#15181b] overflow-hidden",children:[l.jsxs("div",{className:"px-6 py-4 bg-gradient-to-r from-[#c79a55]/10 to-transparent border-b border-[#c79a55]/20 text-center",children:[l.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[.2em] text-[#c79a55] mb-1",children:"Wait - One Time Offer"}),l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] font-medium",children:w.headline})]}),l.jsxs("div",{className:"p-6",children:[w.image_url&&l.jsx("div",{className:"rounded-lg overflow-hidden mb-6 border border-[#33393f]",children:l.jsx("img",{src:w.image_url,alt:w.name,className:"w-full h-48 object-cover"})}),l.jsx("p",{className:"text-[#c4cacf] leading-relaxed mb-6 text-center",children:w.description}),l.jsxs("div",{className:"text-center mb-6",children:[l.jsxs("div",{className:"flex items-baseline justify-center gap-3",children:[l.jsxs("span",{className:"text-3xl font-mono text-[#c79a55] font-bold",children:["£",(w.price_cents/100).toFixed(2)]}),w.compare_at_cents&&l.jsxs("span",{className:"text-xl text-[#8e979e] line-through font-mono",children:["£",(w.compare_at_cents/100).toFixed(2)]})]}),w.compare_at_cents&&l.jsxs("p",{className:"text-xs text-emerald-400 mt-1",children:["You save ","£",((w.compare_at_cents-w.price_cents)/100).toFixed(2)]})]}),p&&l.jsx("p",{className:"text-xs text-red-400 text-center mb-4",children:p}),l.jsx("button",{onClick:b,disabled:a||i===0,className:"w-full flex items-center justify-center gap-2 py-4 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-sm tracking-wider up
689percase font-bold hover:opacity-90 transition-opacity disabled:opacity-50 mb-3",children:a?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):l.jsxs(l.Fragment,{children:[l.jsx(ox,{className:"w-5 h-5"}),"Yes! Add This To My Order",l.jsx(kr,{className:"w-4 h-4"})]})}),l.jsx("button",{onClick:_,disabled:a,className:"w-full py-3 text-center text-xs text-[#8e979e] hover:text-[#c4cacf] transition-colors",children:"No thanks, I'll pass on this offer"}),l.jsxs("p",{className:"text-[9px] text-[#8e979e] text-center mt-4 flex items-center justify-center gap-1.5",children:[l.jsx(ox,{className:"w-3 h-3"}),"One-click charge to your card on file. Secure & instant."]})]})]})]})}function s7(){const{slug:t}=Np(),e=cu(),[n,r]=N.useState(null),[s,i]=N.useState([]),[o,a]=N.useState([]),[c,u]=N.useState(!0),[d,f]=N.useState(!1),[h,p]=N.useState(!1),[m,g]=N.useState(""),[y,x]=N.useState(null),[v,b]=N.useState({name:"",email:"",phone:""});N.useEffect(()=>{t&&_(t)},[t]);async function _(j){const{data:A}=await T.from("giveaways").select("*").eq("slug",j).maybeSingle();if(!A||A.status!=="active"&&A.status!=="ended"){u(!1);return}r(A);const[z,R]=await Promise.all([T.from("giveaway_faqs").select("*").eq("giveaway_id",A.id).order("sort_order"),T.from("giveaway_testimonials").select("*").eq("giveaway_id",A.id).order("sort_order")]);i(z.data||[]),a(R.data||[]),u(!1),A.facebook_pixel_id&&typeof window<"u"&&C(A.facebook_pixel_id)}function C(j){if(document.getElementById("fb-pixel-script"))return;const A=document.createElement("script");A.id="fb-pixel-script",A.innerHTML=`!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init','${j}');fbq('track','PageView');`,document.head.appendChild(A)}function w(j){typeof window<"u"&&window.fbq&&window.fbq("track",j)}async function k(j){if(j.preventDefault(),!n)return;if(!v.name||!v.email){g("Name and email are required.");return}if(n.phone_required&&!v.phone){g("Phone number is required.");return}f(!0),g("");const A=`${v.name.split(" ")[0].toLowerCase()}-${Math.random().toString(36).slice(2,8)}`,R=new URLSearchParams(window.location.search).get("ref")||"",{error:O}=await T.from("giveaway_entries").insert({giveaway_id:n.id,name:v.name,email:v.email,phone:v.phone,referral_code:A,referred_by:R,points:0,completed_steps:[]});if(O){g("Something went wrong. Please try again."),f(!1);return}if(await T.from("giveaways").update({entry_count:(n.entry_count||0)+1}).eq("id",n.id),w("Lead"),n.create_membership){const{data:D,error:q}=await T.auth.signUp({email:v.email,password:crypto.randomUUID().slice(0,12),options:{data:{name:v.name}}});!q&&D.user&&await T.from("giveaway_entries").update({user_id:D.user.id}).eq("giveaway_id",n.id).eq("email",v.email)}p(!0),f(!1),n.post_optin_type==="funnel"&&n.post_optin_funnel_url?window.location.href=n.post_optin_funnel_url:e(`/giveaway/${t}/thank-you?ref=${A}&email=${encodeURIComponent(v.email)}`)}if(c)return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"})});if(!n)return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(nn,{className:"w-12 h-12 text-[#33393f] mx-auto mb-4"}),l.jsx("h1",{className:"text-xl text-[#eef1f3] font-serif",children:"Giveaway Not Found"}),l.jsx("a",{href:"/",className:"text-sm text-[#c79a55] mt-3 inline-block hover:underline",children:"Back to Home"})]})});if(n.status==="ended")return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center px-6",children:l.jsxs("div",{className:"text-center max-w-md",children:[l.jsx(nn,{className:"w-12 h-12 text-[#c79a55] mx-auto mb-4"}),l.jsx("h1",{className:"text-2xl text-[#eef1f3] font-serif mb-2",children:"This Giveaway Has Ended"}),l.jsx("p",{className:"text-[#8e979e]",children:"Check out our other active giveaways."}),l.jsx("a",{href:"/",className:"inline-block mt-4 px-5 py-2.5 rounded-lg bg-[#c79a55] text-[#0a0b0c] font-mono text-xs uppercase font-bold",children:"View All Giveaways"})]})});const E=n.draw_date?Math.max(0,new Date(n.draw_date).getTime()-Date.now()):0,S=Math.ceil(E/(1e3*60*60*24));return l.jsxs("div",{className:"min-h-screen bg-[#0a0b0c]",children:[l.jsx("div",{className:"max-w-[1100px] mx-auto px-6 py-12 lg:py-20",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-10 items-center",children:[l.jsxs("div",{className:"relative",children:[n.prize_image_url?l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute -inset-4 rounded-2xl bg-gradient-to-br from-[#c79a55]/20 to-transparent blur-xl"}),l.jsx("img",{src:n.prize_image_url,alt:n.prize_title,className:"relative w-full rounded-xl border border-[#c79a55]/20 shadow-2xl"})]}):l.jsx("div",{className:"aspect-square rounded-xl bg-[#15181b] border border-[#33393f] flex items-center justify-center",children:l.jsx(nn,{className:"w-24 h-24 text-[#c79a55]/30"})}),n.prize_value&&l.jsx("div",{className:"absolute top-4 right-4 px-3 py-1.5 rounded-lg bg-[#c79a55] text-[#0a0b0c] font-mono text-xs font-bold uppercase",children:n.prize_value})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("p",{className:"font-mono text-[11px] tracking-[.32em] uppercase text-[#c79a55] mb-3",children:"Free Giveaway"}
689),l.jsx("h1",{className:"font-serif text-[clamp(24px,3.5vw,40px)] text-[#eef1f3] font-medium leading-tight mb-3",children:n.headline}),n.subheadline&&l.jsx("p",{className:"text-[#c4cacf] text-lg leading-relaxed",children:n.subheadline})]}),S>0&&l.jsxs("div",{className:"flex items-center gap-2 mb-5 text-sm text-[#8e979e]",children:[l.jsx(va,{className:"w-4 h-4 text-[#c79a55]"}),l.jsxs("span",{children:["Drawing in ",l.jsxs("strong",{className:"text-[#eef1f3]",children:[S," day",S!==1?"s":""]})]}),l.jsx("span",{className:"text-[#33393f]",children:"|"}),l.jsxs("span",{children:[n.entry_count.toLocaleString()," entries"]})]}),h?l.jsxs("div",{className:"p-6 rounded-xl bg-emerald-500/5 border border-emerald-500/30 text-center",children:[l.jsx(mr,{className:"w-10 h-10 text-emerald-500 mx-auto mb-3"}),l.jsx("p",{className:"text-[#eef1f3] font-medium",children:"You're in! Redirecting..."})]}):l.jsxs("form",{onSubmit:k,className:"p-6 rounded-xl bg-[#15181b] border border-[#33393f] space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1.5",children:"Your Name"}),l.jsx("input",{value:v.name,onChange:j=>b({...v,name:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none transition-colors",placeholder:"John Smith"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1.5",children:"Email Address"}),l.jsx("input",{type:"email",value:v.email,onChange:j=>b({...v,email:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none transition-colors",placeholder:"[email protected]"})]}),n.phone_required&&l.jsxs("div",{children:[l.jsxs("label",{className:"block text-[10px] uppercase tracking-wider text-[#8e979e] mb-1.5",children:["Phone ",!n.phone_required&&"(optional)"]}),l.jsx("input",{type:"tel",value:v.phone,onChange:j=>b({...v,phone:j.target.value}),className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none transition-colors",placeholder:"+44 7..."})]}),m&&l.jsx("p",{className:"text-xs text-red-400",children:m}),l.jsxs("button",{type:"submit",disabled:d,className:"w-full py-4 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-sm tracking-wider uppercase font-bold hover:opacity-90 transition-opacity disabled:opacity-50 flex items-center justify-center gap-2",children:[d?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):l.jsx(nn,{className:"w-4 h-4"}),d?"Entering...":"Enter to Win - Free!"]}),l.jsx("p",{className:"text-[10px] text-[#8e979e] text-center",children:"No purchase necessary. We respect your privacy."})]})]})]})}),n.prize_description&&l.jsxs("div",{className:"max-w-[800px] mx-auto px-6 py-12 text-center",children:[l.jsx("h2",{className:"font-serif text-2xl text-[#eef1f3] mb-4",children:n.prize_title}),l.jsx("p",{className:"text-[#c4cacf] leading-relaxed whitespace-pre-line",children:n.prize_description})]}),o.length>0&&l.jsxs("div",{className:"max-w-[900px] mx-auto px-6 py-12",children:[l.jsx("h2",{className:"font-serif text-xl text-[#eef1f3] text-center mb-8",children:"What People Are Saying"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(j=>l.jsxs("div",{className:"p-5 rounded-xl bg-[#15181b] border border-[#33393f]",children:[l.jsx("div",{className:"flex gap-0.5 mb-3",children:[1,2,3,4,5].map(A=>l.jsx(Ip,{className:`w-4 h-4 ${A<=j.rating?"text-[#c79a55] fill-current":"text-[#33393f]"}`},A))}),l.jsxs("p",{className:"text-sm text-[#c4cacf] leading-relaxed mb-3",children:['"',j.text,'"']}),l.jsxs("div",{className:"flex items-center gap-2",children:[j.avatar_url?l.jsx("img",{src:j.avatar_url,alt:"",className:"w-7 h-7 rounded-full object-cover"}):l.jsx("div",{className:"w-7 h-7 rounded-full bg-[#c79a55]/20 flex items-center justify-center text-[#c79a55] text-xs font-bold",children:j.name[0]}),l.jsx("span",{className:"text-xs text-[#8e979e]",children:j.name})]})]},j.id))})]}),s.length>0&&l.jsxs("div",{className:"max-w-[700px] mx-auto px-6 py-12",children:[l.jsx("h2",{className:"font-serif text-xl text-[#eef1f3] text-center mb-8",children:"Frequently Asked Questions"}),l.jsx("div",{className:"space-y-2",children:s.map(j=>l.jsxs("div",{className:"rounded-lg border border-[#33393f] overflow-hidden",children:[l.jsxs("button",{onClick:()=>x(y===j.id?null:j.id),className:"w-full flex items-center justify-between px-5 py-4 text-left text-sm text-[#eef1f3] hover:bg-[#15181b] transition-colors",children:[l.jsx("span",{children:j.question}),l.jsx(ts,{className:`w-4 h-4 text-[#8e979e] transition-transform ${y===j.id?"rotate-180":""}`})]}),y===j.id&&l.jsx("div",{className:"px-5 pb-4 text-sm text-[#8e979e] leading-relaxed",children:j.answer})]},j.id))})]}),n.footer_text&&l.jsx("div",{className:"max-w-[700px] mx-auto px-6 py-8 border-t border-[#33393f]",children:l.jsx("p",{className:"text-xs text-[#8e979e] text-center leading-relaxed",children:n.footer_text})})]})}const i7={share:r1,community:ps,carptoon:Pp,store:ot,custom:nn};function o7(){const{slug:t}=Np(),[e]=P_(),[n,r]=N.useState(null),[s,i]=N.useState([]),[o,a]=N.useState(null),[c,u]=N.useState(!0),[d,f]=N.useState(!1),[h,p]=N.useState([]),m=e.get("ref")||"",g=e.get("email")||"";N.useEffect(()=>{t&&y()},[t]);async function y(){const{data:k}=await T.from("giveaways").select("id, slug, headline, prize_title, discount_percent, discount_code, free_carptoon_credits, community_url").eq("slug",t).maybeSingle();if(!k){u(!1);return}r(k);const{data:E}=await T.from("giveaway_thank_you_steps").select("*").eq("giveaway_id",k.id).order("sort_order");if(i(E||[]),g){const{data:S}=await T.from("giveaway_entries").select("id, referral_code, points, completed_steps").eq("giveaway_id",k.id).eq("email",g).maybeSingle();S&&(a(S),p(Array.isArray(S.completed_steps)?S.completed_steps:[]))}u(!1)}async function x(k){if(!o||h.includes(k.id))return;const E=[...h,k.id],S=(o.points||0)+k.points;p(E),a({...o,points:S,completed_steps:E}),await T.from("giveaway_entries").update({completed_steps:E,points:S}
689).eq("id",o.id),k.action_url&&(k.action_url.startsWith("http")?window.open(k.action_url,"_blank"):window.location.href=k.action_url)}function v(){const k=`${window.location.origin}/giveaway/${t}?ref=${m}`;navigator.clipboard.writeText(k),f(!0),setTimeout(()=>f(!1),2e3)}async function b(){const k=`${window.location.origin}/giveaway/${t}?ref=${m}`,E=`Enter this amazing giveaway - ${n==null?void 0:n.prize_title}!`;navigator.share?await navigator.share({title:n==null?void 0:n.headline,text:E,url:k}):window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(k)}`,"_blank","width=600,height=400");const S=s.find(j=>j.step_type==="share");S&&x(S)}if(c)return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"})});if(!n)return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("p",{className:"text-[#8e979e]",children:"Giveaway not found."})});const _=(o==null?void 0:o.points)||0,C=h.length,w=s.length;return l.jsx("div",{className:"min-h-screen bg-[#0a0b0c]",children:l.jsxs("div",{className:"max-w-[700px] mx-auto px-6 py-12",children:[l.jsxs("div",{className:"text-center mb-10",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 border-2 border-emerald-500 flex items-center justify-center mx-auto mb-5",children:l.jsx(mr,{className:"w-8 h-8 text-emerald-500"})}),l.jsx("h1",{className:"font-serif text-3xl text-[#eef1f3] font-medium mb-2",children:"You're Entered!"}),l.jsxs("p",{className:"text-[#8e979e]",children:["You've been entered into the ",l.jsx("span",{className:"text-[#c79a55]",children:n.prize_title})," giveaway."]})]}),l.jsxs("div",{className:"p-5 rounded-xl bg-[#15181b] border border-[#c79a55]/20 mb-8",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ax,{className:"w-5 h-5 text-[#c79a55]"}),l.jsxs("span",{className:"font-mono text-sm text-[#c79a55] font-bold",children:[_," points"]})]}),l.jsxs("span",{className:"text-xs text-[#8e979e]",children:[C,"/",w," steps completed"]})]}),l.jsx("div",{className:"h-2 rounded-full bg-[#0a0b0c] overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#c79a55] to-[#e9cd97] transition-all duration-500",style:{width:w>0?`${C/w*100}%`:"0%"}})}),l.jsx("p",{className:"text-[10px] text-[#8e979e] mt-2",children:"Complete steps below to earn bonus entries and rewards!"})]}),m&&l.jsxs("div",{className:"p-5 rounded-xl bg-[#15181b] border border-[#33393f] mb-6",children:[l.jsx("p",{className:"text-xs text-[#8e979e] uppercase tracking-wider mb-2 font-mono",children:"Your Referral Link"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{readOnly:!0,value:`${window.location.origin}/giveaway/${t}?ref=${m}`,className:"flex-1 bg-[#0a0b0c] border border-[#33393f] rounded-lg px-3 py-2.5 text-xs text-[#c4cacf] font-mono"}),l.jsxs("button",{onClick:v,className:"px-4 py-2.5 rounded-lg border border-[#c79a55]/30 text-[#c79a55] hover:bg-[#c79a55]/5 transition-colors flex items-center gap-2 text-xs",children:[d?l.jsx(mr,{className:"w-3.5 h-3.5"}):l.jsx(tc,{className:"w-3.5 h-3.5"}),d?"Copied!":"Copy"]}),l.jsxs("button",{onClick:b,className:"px-4 py-2.5 rounded-lg bg-[#c79a55] text-[#0a0b0c] hover:opacity-90 transition-opacity flex items-center gap-2 text-xs font-bold",children:[l.jsx(r1,{className:"w-3.5 h-3.5"})," Share"]})]})]}),l.jsx("div",{className:"space-y-3",children:s.map(k=>{const E=h.includes(k.id),S=i7[k.step_type]||nn;let j=k.action_url;return k.step_type==="community"&&n.community_url&&(j=n.community_url),k.step_type==="store"&&n.discount_code&&(j=`/store?code=${n.discount_code}`),l.jsxs("div",{className:`flex items-center gap-4 p-4 rounded-xl border transition-all ${E?"bg-emerald-500/5 border-emerald-500/20":"bg-[#15181b] border-[#33393f] hover:border-[#c79a55]/30"}`,children:[l.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center shrink-0 ${E?"bg-emerald-500/10 text-emerald-500":"bg-[#0a0b0c] text-[#c79a55]"}`,children:E?l.jsx(mr,{className:"w-5 h-5"}):l.jsx(S,{className:"w-5 h-5"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-sm text-[#eef1f3] font-medium",children:k.title}),l.jsx("p",{className:"text-xs text-[#8e979e] mt-0.5",children:k.description}),k.step_type==="store"&&n.discount_percent>0&&n.discount_code&&l.jsxs("p",{className:"text-xs text-[#c79a55] mt-1 font-mono",children:["Use code: ",n.discount_code," for ",n.discount_percent,"% off"]})]}),l.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[l.jsxs("span",{className:"text-[10px] text-[#c79a55] font-mono",children:["+",k.points," pts"]}),!E&&l.jsxs("button",{onClick:()=>x(k),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-[#c79a55]/30 text-[#c79a55] text-xs hover:bg-[#c79a55]/5 transition-colors",children:[k.action_label,j&&l.jsx(Xb,{className:"w-3 h-3"})]})]})]},k.id)})}),C===w&&w>0&&l.jsxs("div",{className:"mt-8 p-6 rounded-xl bg-gradient-to-br from-[#c79a55]/10 to-transparent border border-[#c79a55]/20 text-center",children:[l.jsx(ax,{className:"w-10 h-10 text-[#c79a55] mx-auto mb-3"}),l.jsx("h3",{className:"font-serif text-xl text-[#eef1f3] mb-2",children:"All Steps Complete!"}),l.jsx("p",{className:"text-sm text-[#8e979e] mb-4",children:"You've maximized your entries. Good luck in the draw!"}),l.jsx("a",{href:"/account",className:"inline-flex items-center gap-2 px-5 py-3 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-xs uppercase font-bold hover:opacity-90 transition-opacity",children:"Go to Members Area"})]})]})})}function K0(){const{slug:t,stepSlug:e}=Np(),n=cu(),{session:r}=Nt(),[s,i]=N.useState(null),[o,a]=N.useState([]),[c,u]=N.useState(null),[d,f]=N.useState([]),[h,p]=N.useState(!0),[m,g]=N.useState({name:"",email:"",ph
689one:""}),[y,x]=N.useState(!1),[v,b]=N.useState(null),[_,C]=N.useState(null);N.useEffect(()=>{t&&w()},[t,e]);async function w(){p(!0);const{data:R}=await T.from("funnels").select("*").eq("slug",t).eq("status","active").maybeSingle();if(!R){p(!1);return}i(R);const{data:O}=await T.from("funnel_steps").select("*").eq("funnel_id",R.id).order("sort_order");if(!O||O.length===0){p(!1);return}a(O);const D=e?O.find(K=>K.slug===e):O[0];if(!D){p(!1);return}u(D);const{data:q}=await T.from("funnel_sections").select("*").eq("step_id",D.id).order("sort_order");if(f(q||[]),D.product_id){const{data:K}=await T.from("store_products").select("*, store_product_images(*)").eq("id",D.product_id).maybeSingle();C(K)}R.facebook_pixel_id&&k(R.facebook_pixel_id),p(!1)}function k(R){if(document.getElementById(`fb-funnel-${R}`))return;const O=document.createElement("script");O.id=`fb-funnel-${R}`,O.innerHTML=`!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init','${R}');fbq('track','PageView');`,document.head.appendChild(O)}function E(){if(!s||!c)return;const R=o.findIndex(O=>O.id===c.id);R<o.length-1&&n(`/f/${s.slug}/${o[R+1].slug}`)}async function S(R){R.preventDefault(),!(!m.email||!s||!c)&&(x(!0),await T.from("funnel_leads").insert({funnel_id:s.id,step_id:c.id,name:m.name,email:m.email,phone:m.phone}),window.fbq&&window.fbq("track","Lead"),x(!1),E())}async function j(){if(!r||!(c!=null&&c.product_id)||!_)return;x(!0);const R=await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/store-checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({items:[{product_id:c.product_id,quantity:1}],bump_ids:c.bump_ids||[]})}),O=await R.json();x(!1),R.ok&&O.url&&(window.location.href=O.url)}async function A(){!r||!s||!c||(x(!0),await fetch("https://lodiuknjmwjyxmdovzcs.supabase.co/functions/v1/store-upsell",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.access_token}`,Apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxvZGl1a25qbXdqeXhtZG92emNzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAzMDIwNjgsImV4cCI6MjA5NTg3ODA2OH0.5P9KmPVmAbvO_9pRgSauE2lul_FXB9bS-l4tFTV5KyM"},body:JSON.stringify({offer_id:c.id})}),x(!1),E())}function z(R,O){var D,q;R==="next_step"?E():R==="scroll"&&O?(D=document.getElementById(O))==null||D.scrollIntoView({behavior:"smooth"}):R==="external"&&O?window.open(O,"_blank"):R==="optin"&&((q=document.getElementById("optin-form"))==null||q.scrollIntoView({behavior:"smooth"}))}return h?l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("div",{className:"w-8 h-8 border-2 border-[#c79a55] border-t-transparent rounded-full animate-spin"})}):!s||!c?l.jsx("div",{className:"min-h-screen bg-[#0a0b0c] flex items-center justify-center",children:l.jsx("p",{className:"text-[#8e979e]",children:"Page not found"})}):l.jsx("div",{className:"min-h-screen bg-[#0a0b0c]",children:d.map(R=>l.jsx(a7,{section:R,onCta:z,formData:m,setFormData:g,onOptinSubmit:S,onOrderSubmit:j,onUpsellAccept:A,onUpsellDecline:E,submitting:y,product:_,step:c,openFaq:v,setOpenFaq:b},R.id))})}function a7({section:t,onCta:e,formData:n,setFormData:r,onOptinSubmit:s,onOrderSubmit:i,onUpsellAccept:o,onUpsellDecline:a,submitting:c,product:u,step:d,openFaq:f,setOpenFaq:h}){var g,y,x,v,b;const{section_type:p,content:m}=t;if(p==="info_bar")return l.jsx("div",{className:"py-2.5 px-4 text-center text-sm",style:{backgroundColor:m.background||"#c79a55",color:"#0a0b0c"},children:l.jsx("span",{className:"font-medium",children:m.text})});if(p==="hero")return l.jsx("section",{className:"relative py-16 lg:py-24 px-6",children:l.jsxs("div",{className:"max-w-[900px] mx-auto text-center",children:[m.image_url&&l.jsx("img",{src:m.image_url,alt:"",className:"max-h-48 mx-auto mb-8 rounded-lg"}),l.jsx("h1",{className:"font-serif text-[clamp(28px,4vw,48px)] text-[#eef1f3] font-medium leading-tight mb-4",children:m.headline}),m.subheadline&&l.jsx("p",{className:"text-lg text-[#c4cacf] leading-relaxed max-w-[600px] mx-auto mb-8",children:m.subheadline}),m.cta_text&&l.jsxs("button",{onClick:()=>e(m.cta_action||"scroll",m.cta_url||"optin-form"),className:"inline-flex items-center gap-2 px-8 py-4 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-sm tracking-wider up
689percase font-bold hover:opacity-90 transition-opacity",children:[m.cta_text," ",l.jsx(kr,{className:"w-4 h-4"})]})]})});if(p==="image")return l.jsxs("section",{className:`px-6 py-8 ${m.full_width?"":"max-w-[900px] mx-auto"}`,children:[l.jsx("img",{src:m.url,alt:m.alt||"",className:"w-full rounded-lg border border-[#33393f]"}),m.caption&&l.jsx("p",{className:"text-xs text-[#8e979e] text-center mt-2",children:m.caption})]});if(p==="text")return l.jsx("section",{className:"max-w-[800px] mx-auto px-6 py-8",children:l.jsx("div",{className:"prose prose-invert prose-sm max-w-none text-[#c4cacf] [&_h2]:text-[#eef1f3] [&_h2]:font-serif [&_h3]:text-[#eef1f3] [&_a]:text-[#c79a55] [&_strong]:text-[#eef1f3]",dangerouslySetInnerHTML:{__html:m.html||""}})});if(p==="three_col"){const _=m.columns||[];return l.jsx("section",{className:"max-w-[1000px] mx-auto px-6 py-12",children:l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:_.map((C,w)=>l.jsxs("div",{className:"text-center p-6 rounded-xl bg-[#15181b] border border-[#33393f]",children:[C.icon&&l.jsx("div",{className:"text-[#c79a55] text-2xl mb-3",children:C.icon}),l.jsx("h3",{className:"text-[#eef1f3] font-medium mb-2",children:C.title}),l.jsx("p",{className:"text-sm text-[#8e979e]",children:C.text})]},w))})})}if(p==="testimonials"){const _=m.items||[];return l.jsx("section",{className:"max-w-[1000px] mx-auto px-6 py-12",children:l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:_.map((C,w)=>l.jsxs("div",{className:"p-5 rounded-xl bg-[#15181b] border border-[#33393f]",children:[l.jsx("div",{className:"flex gap-0.5 mb-3",children:[1,2,3,4,5].map(k=>l.jsx(Ip,{className:`w-4 h-4 ${k<=(C.rating||5)?"text-[#c79a55] fill-current":"text-[#33393f]"}`},k))}),l.jsxs("p",{className:"text-sm text-[#c4cacf] leading-relaxed mb-3",children:['"',C.text,'"']}),l.jsx("p",{className:"text-xs text-[#8e979e] font-medium",children:C.name})]},w))})})}if(p==="faq"){const _=m.items||[];return l.jsx("section",{className:"max-w-[700px] mx-auto px-6 py-12",children:l.jsx("div",{className:"space-y-2",children:_.map((C,w)=>l.jsxs("div",{className:"rounded-lg border border-[#33393f] overflow-hidden",children:[l.jsxs("button",{onClick:()=>h(f===w?null:w),className:"w-full flex items-center justify-between px-5 py-4 text-left text-sm text-[#eef1f3] hover:bg-[#15181b] transition-colors",children:[l.jsx("span",{children:C.question}),l.jsx(ts,{className:`w-4 h-4 text-[#8e979e] transition-transform ${f===w?"rotate-180":""}`})]}),f===w&&l.jsx("div",{className:"px-5 pb-4 text-sm text-[#8e979e]",children:C.answer})]},w))})})}if(p==="letter")return l.jsx("section",{className:"max-w-[700px] mx-auto px-6 py-12",children:l.jsxs("div",{className:"p-8 rounded-xl bg-[#15181b] border border-[#33393f]",children:[l.jsx("div",{className:"prose prose-invert prose-sm max-w-none text-[#c4cacf] [&_h2]:text-[#eef1f3] [&_h2]:font-serif [&_a]:text-[#c79a55] [&_strong]:text-[#eef1f3]",dangerouslySetInnerHTML:{__html:m.html||""}}),m.signature_name&&l.jsxs("div",{className:"mt-6 pt-4 border-t border-[#33393f]",children:[l.jsx("p",{className:"text-[#eef1f3] font-medium",children:m.signature_name}),m.signature_title&&l.jsx("p",{className:"text-xs text-[#8e979e]",children:m.signature_title})]})]})});if(p==="video")return l.jsx("section",{className:"max-w-[900px] mx-auto px-6 py-12",children:l.jsx("div",{className:"aspect-video rounded-xl overflow-hidden border border-[#33393f] bg-[#15181b]",children:(g=m.url)!=null&&g.includes("youtube")||(y=m.url)!=null&&y.includes("youtu.be")?l.jsx("iframe",{src:m.url.replace("watch?v=","embed/").replace("youtu.be/","youtube.com/embed/"),className:"w-full h-full",allowFullScreen:!0}):(x=m.url)!=null&&x.includes("vimeo")?l.jsx("iframe",{src:m.url.replace("vimeo.com/","player.vimeo.com/video/"),className:"w-full h-full",allowFullScreen:!0}):l.jsx("video",{src:m.url,poster:m.poster_url,controls:!0,className:"w-full h-full object-cover"})})});if(p==="gallery"){const _=m.images||[];return l.jsx("section",{className:"max-w-[1000px] mx-auto px-6 py-12",children:l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:_.map((C,w)=>l.jsx("div",{className:"aspect-square rounded-lg overflow-hidden border border-[#33393f]",children:l.jsx("img",{src:C.url,alt:C.alt||"",className:"w-full h-full object-cover"})},w))})})}if(p==="slider")return l.jsx(l7,{content:m});if(p==="cta")return l.jsx("section",{className:"max-w-[600px] mx-auto px-6 py-10 text-center",children:l.jsxs("button",{onClick:()=>e(m.action||"next_step",m.url||""),className:`inline-flex items-center gap-2 px-8 py-4 rounded-lg font-mono text-sm tracking-wider up
689percase font-bold transition-opacity hover:opacity-90 ${m.style==="outline"?"border-2 border-[#c79a55] text-[#c79a55]":"bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c]"}`,children:[m.text||"Continue"," ",l.jsx(kr,{className:"w-4 h-4"})]})});if(p==="optin_form"){const _=m.fields||["name","email"];return l.jsx("section",{id:"optin-form",className:"max-w-[500px] mx-auto px-6 py-12",children:l.jsxs("div",{className:"p-8 rounded-xl bg-[#15181b] border border-[#33393f]",children:[m.headline&&l.jsx("h2",{className:"font-serif text-xl text-[#eef1f3] text-center mb-6",children:m.headline}),l.jsxs("form",{onSubmit:s,className:"space-y-4",children:[_.includes("name")&&l.jsx("input",{value:n.name,onChange:C=>r({...n,name:C.target.value}),placeholder:"Your Name",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),_.includes("email")&&l.jsx("input",{type:"email",value:n.email,onChange:C=>r({...n,email:C.target.value}),placeholder:"Email Address",required:!0,className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),_.includes("phone")&&l.jsx("input",{type:"tel",value:n.phone,onChange:C=>r({...n,phone:C.target.value}),placeholder:"Phone (optional)",className:"w-full bg-[#0a0b0c] border border-[#33393f] rounded-lg px-4 py-3 text-sm text-[#eef1f3] focus:border-[#c79a55] outline-none"}),l.jsx("button",{type:"submit",disabled:c,className:"w-full py-4 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-sm tracking-wider uppercase font-bold hover:opacity-90 transition-opacity disabled:opacity-50 flex items-center justify-center gap-2",children:c?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):l.jsx(l.Fragment,{children:m.button_text||"Get Access"})})]})]})})}return p==="order_form"?l.jsx("section",{id:"order-form",className:"max-w-[600px] mx-auto px-6 py-12",children:l.jsxs("div",{className:"p-8 rounded-xl bg-[#15181b] border border-[#c79a55]/20",children:[m.headline&&l.jsx("h2",{className:"font-serif text-xl text-[#eef1f3] text-center mb-6",children:m.headline}),u&&l.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-[#0a0b0c] border border-[#33393f] mb-6",children:[((b=(v=u.store_product_images)==null?void 0:v[0])==null?void 0:b.url)&&l.jsx("img",{src:u.store_product_images[0].url,alt:"",className:"w-16 h-16 rounded object-cover"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm text-[#eef1f3] font-medium",children:u.name}),l.jsx("p",{className:"text-xs text-[#8e979e] mt-0.5",children:u.description})]}),l.jsxs("span",{className:"text-lg font-mono text-[#c79a55] font-bold",children:["£",((d.price_override_cents||u.price_cents)/100).toFixed(2)]})]}),l.jsx("button",{onClick:i,disabled:c,className:"w-full py-4 rounded-lg bg-gradient-to-r from-[#e9cd97] via-[#c79a55] to-[#9c6f33] text-[#0a0b0c] font-mono text-sm tracking-wider uppercase font-bold hover:opacity-90 transition-opacity disabled:opacity-50 flex items-center justify-center gap-2",children:c?l.jsx(Wt,{className:"w-4 h-4 animate-spin"}):l.jsxs(l.Fragment,{children:[l.jsx(ot,{className:"w-4 h-4"})," ",m.button_text||"Buy Now"]})})]})}):null}function l7({content:t}){const[e,n]=N.useState(0),r=t.slides||[];if(r.length===0)return null;const s=r[e];return l.jsx("section",{className:"max-w-[900px] mx-auto px-6 py-12",children:l.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-[#33393f]",children:[s.image_url&&l.jsx("img",{src:s.image_url,alt:"",className:"w-full aspect-[16/7] object-cover"}),l.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 to-transparent flex items-end p-8",children:l.jsxs("div",{children:[s.headline&&l.jsx("h3",{className:"text-[#eef1f3] text-xl font-serif mb-1",children:s.headline}),s.text&&l.jsx("p",{className:"text-sm text-[#c4cacf]",children:s.text})]})}),r.length>1&&l.jsx("div",{className:"absolute bottom-3 right-3 flex gap-1",children:r.map((i,o)=>l.jsx("button",{onClick:()=>n(o),className:`w-2 h-2 rounded-full ${o===e?"bg-[#c79a55]":"bg-white/30"}`},o))})]})})}function c7(){N.useEffect(()=>{t()},[]);async function t(){const{data:e}=await T.from("tracking_pixels").select("pixel_type, pixel_id").eq("active",!0);if(e)for(const n of e)n.pixel_type==="facebook"&&n.pixel_id?u7(n.pixel_id):n.pixel_type==="google"&&n.pixel_id?d7(n.pixel_id):n.pixel_type==="tiktok"&&n.pixel_id&&f7(n.pixel_id)}return null}function u7(t){if(document.getElementById(`fb-pixel-${t}`))return;const e=document.createElement("script");e.id=`fb-pixel-${t}`,e.innerHTML=`!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init','${t}');fbq('track','PageView');`,document.head.appendChild(e)}function d7(t){if(document.getElementById(`gtag-${t}`))return;const e=document.createElement("script");e.id=`gtag-${t}
689`,e.async=!0,e.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,document.head.appendChild(e);const n=document.createElement("script");n.innerHTML=`window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','${t}');`,document.head.appendChild(n)}function f7(t){if(document.getElementById(`tt-pixel-${t}`))return;const e=document.createElement("script");e.id=`tt-pixel-${t}`,e.innerHTML=`!function(w,d,t){w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"];ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e};ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{};ttq._i[e]=[];ttq._i[e]._u=i;ttq._t=ttq._t||{};ttq._t[e]=+new Date;ttq._o=ttq._o||{};ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript";o.async=!0;o.src=i+"?sdkid="+e+"&lib="+t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};ttq.load('${t}');ttq.page();}(window,document,'ttq');`,document.head.appendChild(e)}function h7(){return l.jsx(Y2,{children:l.jsxs(Q2,{children:[l.jsx(c7,{}),l.jsx(O_,{children:l.jsxs(E_,{children:[l.jsx(pt,{path:"/",element:l.jsx(t5,{})}),l.jsx(pt,{path:"/admin/login",element:l.jsx(n5,{})}),l.jsx(pt,{path:"/admin",element:l.jsx(tI,{})}),l.jsx(pt,{path:"/onboarding",element:l.jsx(HI,{})}),l.jsx(pt,{path:"/account",element:l.jsx(Ji,{children:l.jsx(JI,{})})}),l.jsx(pt,{path:"/tools/carptoon",element:l.jsx(Ji,{children:l.jsx(ZI,{})})}),l.jsx(pt,{path:"/store",element:l.jsx(Ji,{children:l.jsx(t7,{})})}),l.jsx(pt,{path:"/cart",element:l.jsx(Ji,{children:l.jsx(n7,{})})}),l.jsx(pt,{path:"/order-complete",element:l.jsx(Ji,{children:l.jsx(r7,{})})}),l.jsx(pt,{path:"/giveaway/:slug",element:l.jsx(s7,{})}),l.jsx(pt,{path:"/giveaway/:slug/thank-you",element:l.jsx(o7,{})}),l.jsx(pt,{path:"/f/:slug",element:l.jsx(K0,{})}),l.jsx(pt,{path:"/f/:slug/:stepSlug",element:l.jsx(K0,{})})]})})]})})}ab(document.getElementById("root")).render(l.jsx(N.StrictMode,{children:l.jsx(h7,{})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.