datocms-plugin-record-comments 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -4
- package/dist/assets/index-D7VcKz6i.css +1 -0
- package/dist/assets/index-UKydYRNj.js +251 -0
- package/dist/index.html +17 -0
- package/package.json +43 -43
- package/build/asset-manifest.json +0 -13
- package/build/index.html +0 -1
- package/build/robots.txt +0 -3
- package/build/static/css/main.19c0232f.css +0 -2
- package/build/static/css/main.19c0232f.css.map +0 -1
- package/build/static/js/main.255a6b09.js +0 -3
- package/build/static/js/main.255a6b09.js.LICENSE.txt +0 -59
- package/build/static/js/main.255a6b09.js.map +0 -1
- package/public/index.html +0 -11
- package/public/robots.txt +0 -3
- package/src/entrypoints/CommentsBar.tsx +0 -254
- package/src/entrypoints/NoLogModal.tsx +0 -43
- package/src/entrypoints/components/Comment.tsx +0 -260
- package/src/entrypoints/styles/comment.module.css +0 -134
- package/src/entrypoints/styles/commentbar.module.css +0 -3
- package/src/entrypoints/styles/modal.module.css +0 -13
- package/src/index.tsx +0 -45
- package/src/react-app-env.d.ts +0 -1
- package/src/utils/render.tsx +0 -6
- package/tsconfig.json +0 -26
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var it=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function di(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ob={exports:{}},vd={},ib={exports:{}},ve={};/**
|
|
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 vl=Symbol.for("react.element"),GT=Symbol.for("react.portal"),JT=Symbol.for("react.fragment"),YT=Symbol.for("react.strict_mode"),QT=Symbol.for("react.profiler"),XT=Symbol.for("react.provider"),ZT=Symbol.for("react.context"),eC=Symbol.for("react.forward_ref"),tC=Symbol.for("react.suspense"),nC=Symbol.for("react.memo"),rC=Symbol.for("react.lazy"),Fg=Symbol.iterator;function oC(t){return t===null||typeof t!="object"?null:(t=Fg&&t[Fg]||t["@@iterator"],typeof t=="function"?t:null)}var sb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ab=Object.assign,lb={};function Cs(t,e,n){this.props=t,this.context=e,this.refs=lb,this.updater=n||sb}Cs.prototype.isReactComponent={};Cs.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")};Cs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function ub(){}ub.prototype=Cs.prototype;function Im(t,e,n){this.props=t,this.context=e,this.refs=lb,this.updater=n||sb}var Pm=Im.prototype=new ub;Pm.constructor=Im;ab(Pm,Cs.prototype);Pm.isPureReactComponent=!0;var $g=Array.isArray,cb=Object.prototype.hasOwnProperty,Rm={current:null},db={key:!0,ref:!0,__self:!0,__source:!0};function fb(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)cb.call(e,r)&&!db.hasOwnProperty(r)&&(o[r]=e[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var u=Array(a),l=0;l<a;l++)u[l]=arguments[l+2];o.children=u}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:vl,type:t,key:i,ref:s,props:o,_owner:Rm.current}}function iC(t,e){return{$$typeof:vl,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Dm(t){return typeof t=="object"&&t!==null&&t.$$typeof===vl}function sC(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var zg=/\/+/g;function lf(t,e){return typeof t=="object"&&t!==null&&t.key!=null?sC(""+t.key):e.toString(36)}function gu(t,e,n,r,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case vl:case GT:s=!0}}if(s)return s=t,o=o(s),t=r===""?"."+lf(s,0):r,$g(o)?(n="",t!=null&&(n=t.replace(zg,"$&/")+"/"),gu(o,e,n,"",function(l){return l})):o!=null&&(Dm(o)&&(o=iC(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(zg,"$&/")+"/")+t)),e.push(o)),1;if(s=0,r=r===""?".":r+":",$g(t))for(var a=0;a<t.length;a++){i=t[a];var u=r+lf(i,a);s+=gu(i,e,n,u,o)}else if(u=oC(t),typeof u=="function")for(t=u.call(t),a=0;!(i=t.next()).done;)i=i.value,u=r+lf(i,a++),s+=gu(i,e,n,u,o);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 s}function Ol(t,e,n){if(t==null)return t;var r=[],o=0;return gu(t,r,"","",function(i){return e.call(n,i,o++)}),r}function aC(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 Ut={current:null},vu={transition:null},lC={ReactCurrentDispatcher:Ut,ReactCurrentBatchConfig:vu,ReactCurrentOwner:Rm};function pb(){throw Error("act(...) is not supported in production builds of React.")}ve.Children={map:Ol,forEach:function(t,e,n){Ol(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Ol(t,function(){e++}),e},toArray:function(t){return Ol(t,function(e){return e})||[]},only:function(t){if(!Dm(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};ve.Component=Cs;ve.Fragment=JT;ve.Profiler=QT;ve.PureComponent=Im;ve.StrictMode=YT;ve.Suspense=tC;ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lC;ve.act=pb;ve.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=ab({},t.props),o=t.key,i=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,s=Rm.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(u in e)cb.call(e,u)&&!db.hasOwnProperty(u)&&(r[u]=e[u]===void 0&&a!==void 0?a[u]:e[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){a=Array(u);for(var l=0;l<u;l++)a[l]=arguments[l+2];r.children=a}return{$$typeof:vl,type:t.type,key:o,ref:i,props:r,_owner:s}};ve.createContext=function(t){return t={$$typeof:ZT,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:XT,_context:t},t.Consumer=t};ve.createElement=fb;ve.createFactory=function(t){var e=fb.bind(null,t);return e.type=t,e};ve.createRef=function(){return{current:null}};ve.forwardRef=function(t){return{$$typeof:eC,render:t}};ve.isValidElement=Dm;ve.lazy=function(t){return{$$typeof:rC,_payload:{_status:-1,_result:t},_init:aC}};ve.memo=function(t,e){return{$$typeof:nC,type:t,compare:e===void 0?null:e}};ve.startTransition=function(t){var e=vu.transition;vu.transition={};try{t()}finally{vu.transition=e}};ve.unstable_act=pb;ve.useCallback=function(t,e){return Ut.current.useCallback(t,e)};ve.useContext=function(t){return Ut.current.useContext(t)};ve.useDebugValue=function(){};ve.useDeferredValue=function(t){return Ut.current.useDeferredValue(t)};ve.useEffect=function(t,e){return Ut.current.useEffect(t,e)};ve.useId=function(){return Ut.current.useId()};ve.useImperativeHandle=function(t,e,n){return Ut.current.useImperativeHandle(t,e,n)};ve.useInsertionEffect=function(t,e){return Ut.current.useInsertionEffect(t,e)};ve.useLayoutEffect=function(t,e){return Ut.current.useLayoutEffect(t,e)};ve.useMemo=function(t,e){return Ut.current.useMemo(t,e)};ve.useReducer=function(t,e,n){return Ut.current.useReducer(t,e,n)};ve.useRef=function(t){return Ut.current.useRef(t)};ve.useState=function(t){return Ut.current.useState(t)};ve.useSyncExternalStore=function(t,e,n){return Ut.current.useSyncExternalStore(t,e,n)};ve.useTransition=function(){return Ut.current.useTransition()};ve.version="18.3.1";ib.exports=ve;var _=ib.exports;const ue=di(_);/**
|
|
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 uC=_,cC=Symbol.for("react.element"),dC=Symbol.for("react.fragment"),fC=Object.prototype.hasOwnProperty,pC=uC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,hC={key:!0,ref:!0,__self:!0,__source:!0};function hb(t,e,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)fC.call(e,r)&&!hC.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:cC,type:t,key:i,ref:s,props:o,_owner:pC.current}}vd.Fragment=dC;vd.jsx=hb;vd.jsxs=hb;ob.exports=vd;var g=ob.exports,Ep={exports:{}},nt={};Object.defineProperty(nt,"__esModule",{value:!0});nt.DATA_CLONE_ERROR=nt.MESSAGE=nt.REJECTED=nt.FULFILLED=nt.REPLY=nt.CALL=nt.HANDSHAKE_REPLY=nt.HANDSHAKE=void 0;const mC="handshake";nt.HANDSHAKE=mC;const yC="handshake-reply";nt.HANDSHAKE_REPLY=yC;const gC="call";nt.CALL=gC;const vC="reply";nt.REPLY=vC;const wC="fulfilled";nt.FULFILLED=wC;const bC="rejected";nt.REJECTED=bC;const _C="message";nt.MESSAGE=_C;const SC="DataCloneError";nt.DATA_CLONE_ERROR=SC;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.ERR_NO_IFRAME_SRC=Dn.ERR_NOT_IN_IFRAME=Dn.ERR_CONNECTION_TIMEOUT=Dn.ERR_CONNECTION_DESTROYED=void 0;const kC="ConnectionDestroyed";Dn.ERR_CONNECTION_DESTROYED=kC;const xC="ConnectionTimeout";Dn.ERR_CONNECTION_TIMEOUT=xC;const EC="NotInIframe";Dn.ERR_NOT_IN_IFRAME=EC;const TC="NoIframeSrc";Dn.ERR_NO_IFRAME_SRC=TC;var Tp={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=()=>{const r=[];let o=!1;return{destroy(){o=!0,r.forEach(i=>{i()})},onDestroy(i){o?i():r.push(i)}}};e.default=n,t.exports=e.default})(Tp,Tp.exports);var CC=Tp.exports,Cp={exports:{}},Jo={};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.deserializeError=Jo.serializeError=void 0;const MC=t=>{let e=t.name,n=t.message,r=t.stack;return{name:e,message:n,stack:r}};Jo.serializeError=MC;const OC=t=>{const e=new Error;return Object.keys(t).forEach(n=>e[n]=t[n]),e};Jo.deserializeError=OC;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=nt,r=Jo,o=(i,s,a)=>{const u=i.localName,l=i.local,c=i.remote,d=i.originForSending,f=i.originForReceiving;let p=!1;a(`${u}: Connecting call receiver`);const h=m=>{if(m.source!==c||m.data.penpal!==n.CALL)return;if(m.origin!==f){a(`${u} received message from origin ${m.origin} which did not match expected origin ${f}`);return}const v=m.data,y=v.methodName,w=v.args,b=v.id;a(`${u}: Received ${y}() call`);const S=k=>E=>{if(a(`${u}: Sending ${y}() reply`),p){a(`${u}: Unable to send ${y}() reply due to destroyed connection`);return}const x={penpal:n.REPLY,id:b,resolution:k,returnValue:E};k===n.REJECTED&&E instanceof Error&&(x.returnValue=(0,r.serializeError)(E),x.returnValueIsError=!0);try{c.postMessage(x,d)}catch(T){throw T.name===n.DATA_CLONE_ERROR&&c.postMessage({penpal:n.REPLY,id:b,resolution:n.REJECTED,returnValue:(0,r.serializeError)(T),returnValueIsError:!0},d),T}};new Promise(k=>k(s[y].apply(s,w))).then(S(n.FULFILLED),S(n.REJECTED))};return l.addEventListener(n.MESSAGE,h),()=>{p=!0,l.removeEventListener(n.MESSAGE,h)}};e.default=o,t.exports=e.default})(Cp,Cp.exports);var NC=Cp.exports,Mp={exports:{}},Op={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;let n=0;var r=()=>++n;e.default=r,t.exports=e.default})(Op,Op.exports);var AC=Op.exports;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=nt,r=Dn,o=s(AC),i=Jo;function s(u){return u&&u.__esModule?u:{default:u}}var a=(u,l,c,d,f)=>{const p=l.localName,h=l.local,m=l.remote,v=l.originForSending,y=l.originForReceiving;let w=!1;f(`${p}: Connecting call sender`);const b=S=>function(){for(var k=arguments.length,E=new Array(k),x=0;x<k;x++)E[x]=arguments[x];f(`${p}: Sending ${S}() call`);let T;try{m.closed&&(T=!0)}catch{T=!0}if(T&&d(),w){const O=new Error(`Unable to send ${S}() call due to destroyed connection`);throw O.code=r.ERR_CONNECTION_DESTROYED,O}return new Promise((O,N)=>{const $=(0,o.default)(),P=D=>{if(D.source!==m||D.data.penpal!==n.REPLY||D.data.id!==$)return;if(D.origin!==y){f(`${p} received message from origin ${D.origin} which did not match expected origin ${y}`);return}f(`${p}: Received ${S}() reply`),h.removeEventListener(n.MESSAGE,P);let q=D.data.returnValue;D.data.returnValueIsError&&(q=(0,i.deserializeError)(q)),(D.data.resolution===n.FULFILLED?O:N)(q)};h.addEventListener(n.MESSAGE,P),m.postMessage({penpal:n.CALL,id:$,methodName:S,args:E},v)})};return c.reduce((S,k)=>(S[k]=b(k),S),u),()=>{w=!0}};e.default=a,t.exports=e.default})(Mp,Mp.exports);var IC=Mp.exports,Np={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r=>function(){if(r){for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];console.log("[Penpal]",...i)}};e.default=n,t.exports=e.default})(Np,Np.exports);var PC=Np.exports;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=nt,r=Dn,o=u(CC),i=u(NC),s=u(IC),a=u(PC);function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},f=d.parentOrigin,p=f===void 0?"*":f,h=d.methods,m=h===void 0?{}:h,v=d.timeout,y=d.debug;const w=(0,a.default)(y);if(window===window.top){const O=new Error("connectToParent() must be called within an iframe");throw O.code=r.ERR_NOT_IN_IFRAME,O}const b=(0,o.default)(),S=b.destroy,k=b.onDestroy,E=window,x=E.parent;return{promise:new Promise((O,N)=>{let $;v!==void 0&&($=setTimeout(()=>{const D=new Error(`Connection to parent timed out after ${v}ms`);D.code=r.ERR_CONNECTION_TIMEOUT,N(D),S()},v));const P=D=>{try{clearTimeout()}catch{return}if(D.source!==x||D.data.penpal!==n.HANDSHAKE_REPLY)return;if(p!=="*"&&p!==D.origin){w(`Child received handshake reply from origin ${D.origin} which did not match expected origin ${p}`);return}w("Child: Received handshake reply"),E.removeEventListener(n.MESSAGE,P);const q={localName:"Child",local:E,remote:x,originForSending:D.origin==="null"?"*":D.origin,originForReceiving:D.origin},B={},z=(0,i.default)(q,m,w);k(z);const K=(0,s.default)(B,q,D.data.methodNames,S,w);k(K),clearTimeout($),O(B)};E.addEventListener(n.MESSAGE,P),k(()=>{E.removeEventListener(n.MESSAGE,P);const D=new Error("Connection destroyed");D.code=r.ERR_CONNECTION_DESTROYED,N(D)}),w("Child: Sending handshake"),x.postMessage({penpal:n.HANDSHAKE,methodNames:Object.keys(m)},p)}),destroy:S}};e.default=l,t.exports=e.default})(Ep,Ep.exports);var RC=Ep.exports;const DC=di(RC);var Xn=function(){return Xn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Xn.apply(this,arguments)};function Ug(t,e){for(var n=Xn({},t),r=0,o=e;r<o.length;r++){var i=o[r];delete n[i]}return n}function uf(t){return function(e,n){if(t){for(var r={},o=0,i=e;o<i.length;o++){var s=i[o],a=n.itemTypes[s.relationships.item_type.data.id];r[s.id]=t(s,Xn(Xn({},n),{itemType:a}))}return r}}}function Cr(t,e){var n=function(r,o,i){if(i.mode===t){var s=LC(o),a=function(u){e(r,Xn(Xn(Xn({},o),u),s))};return a(i),a}};return n.mode=t,n}function wl(t,e){var n=function(r,o,i){if(i.mode===t){var s=function(a){e(r,Xn(Xn({},o),a))};return s(i),s}};return n.mode=t,n}function jC(){for(var t=document.querySelectorAll("body *"),e=0,n=0;n<t.length;n++)e=Math.max(t[n].getBoundingClientRect().bottom,e);return e}var LC=function(t){var e=null,n=function(l){var c=l===void 0?Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.getBoundingClientRect().height,jC()):l;c!==e&&(t.setHeight(c),e=c)},r=null,o=null,i=function(){return n()},s=function(){n(),r||(r=new ResizeObserver(i),r.observe(document.documentElement)),o||(o=new MutationObserver(i),o.observe(window.document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}))},a=function(){r&&(r.disconnect(),r=null),o&&(o.disconnect(),o=null)},u=function(){return!!r};return{updateHeight:n,startAutoResizer:s,stopAutoResizer:a,isAutoResizerActive:u}},BC=Cr("renderAssetSource",function(t,e){t.renderAssetSource&&t.renderAssetSource(e.assetSourceId,e)}),FC=Cr("renderConfigScreen",function(t,e){t.renderConfigScreen&&t.renderConfigScreen(e)}),$C=Cr("renderFieldExtension",function(t,e){t.renderFieldExtension&&t.renderFieldExtension(e.fieldExtensionId,e)}),zC=wl("renderInspector",function(t,e){t.renderInspector&&t.renderInspector(e.inspectorId,e)}),UC=wl("renderInspectorPanel",function(t,e){t.renderInspectorPanel&&t.renderInspectorPanel(e.panelId,e)}),VC=Cr("renderItemCollectionOutlet",function(t,e){t.renderItemCollectionOutlet&&t.renderItemCollectionOutlet(e.itemCollectionOutletId,e)}),qC=Cr("renderItemFormOutlet",function(t,e){t.renderItemFormOutlet&&t.renderItemFormOutlet(e.itemFormOutletId,e)}),HC=wl("renderItemFormSidebar",function(t,e){t.renderItemFormSidebar&&t.renderItemFormSidebar(e.sidebarId,e)}),WC=Cr("renderItemFormSidebarPanel",function(t,e){t.renderItemFormSidebarPanel&&t.renderItemFormSidebarPanel(e.sidebarPaneId,e)}),KC=Cr("renderManualFieldExtensionConfigScreen",function(t,e){t.renderManualFieldExtensionConfigScreen&&t.renderManualFieldExtensionConfigScreen(e.fieldExtensionId,e)}),GC=Cr("renderModal",function(t,e){t.renderModal&&t.renderModal(e.modalId,e)}),JC=wl("renderPage",function(t,e){t.renderPage&&t.renderPage(e.pageId,e)}),YC=wl("renderUploadSidebar",function(t,e){t.renderUploadSidebar&&t.renderUploadSidebar(e.sidebarId,e)}),QC=Cr("renderUploadSidebarPanel",function(t,e){t.renderUploadSidebarPanel&&t.renderUploadSidebarPanel(e.sidebarPaneId,e)}),fn=function(){return fn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},fn.apply(this,arguments)},XC=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},ZC=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Vg=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};function eM(){return XC(this,arguments,void 0,function(t){var e,n,r,o,i,s,a,u,l,c,d,f;return t===void 0&&(t={}),ZC(this,function(p){switch(p.label){case 0:return e=null,n=null,r=fn(fn({},t),{overrideFieldExtensions:uf(t.overrideFieldExtensions),customMarksForStructuredTextField:uf(t.customMarksForStructuredTextField),customBlockStylesForStructuredTextField:uf(t.customBlockStylesForStructuredTextField)}),o=DC({methods:fn(fn({sdkVersion:function(){return"0.3.0"},implementedHooks:function(){return Object.fromEntries(Object.keys(t).map(function(h){return[h,!0]}))}},Object.fromEntries(Object.entries(r).filter(function(h){var m=h[0];return!m.startsWith("render")}))),{onChange:function(h){e&&e(h)},callMethodMergingBootCtx:function(h,m,v,y,w){return n?n(h,m,v,y,w):null}})}),[4,o.promise];case 1:return i=p.sent(),[4,i.getSettings()];case 2:for(s=p.sent(),s.mode==="onBoot"&&(a=s,e=function(h){a=h},n=function(h,m,v,y,w){var b;if(h in r)return(b=r)[h].apply(b,Vg(Vg([],m,!1),[fn(fn(fn(fn({},Ug(i,["getSettings","setHeight"])),Ug(a,["mode","bodyPadding"])),Object.fromEntries(y.map(function(S){return[S,function(){for(var E=[],x=0;x<arguments.length;x++)E[x]=arguments[x];return i.callAdditionalCtxMethod(w,S,E)}]}))),v)],!1))},r.onBoot&&r.onBoot(fn(fn({},i),a))),u={renderAssetSource:BC,renderConfigScreen:FC,renderFieldExtension:$C,renderItemCollectionOutlet:VC,renderItemFormOutlet:qC,renderItemFormSidebar:HC,renderItemFormSidebarPanel:WC,renderManualFieldExtensionConfigScreen:KC,renderModal:GC,renderPage:JC,renderInspector:zC,renderInspectorPanel:UC,renderUploadSidebar:YC,renderUploadSidebarPanel:QC},l=0,c=Object.values(u);l<c.length;l++)if(d=c[l],f=d(r,i,s),f){e=f;break}return[2]}})})}var Mo=function(){return Mo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Mo.apply(this,arguments)};function tM(t){return typeof t=="object"&&!!t&&"data"in t}function _r(t){var e=t.id,n=t.type,r=t.attributes,o=t.relationships,i=t.meta;return Mo(Mo(Mo(Mo(Mo({},e?{id:e}:{}),n?{type:n}:{}),r||{}),o?Object.fromEntries(Object.entries(o).map(function(s){var a=s[0],u=s[1];return[a,u==null?void 0:u.data]})):{}),i?{meta:i}:{})}function M(t){if(!tM(t))throw new Error("Invalid body!");return Array.isArray(t.data)?t.data.map(_r):_r(t.data)}var mb=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();function nM(t){if(typeof t!="object"||t===null||!("data"in t))return!1;var e=t;if(!Array.isArray(e.data))return!1;var n=e;if(n.data.length===0)return!1;var r=n.data[0];return!(typeof r!="object"||r===null||!("id"in r)||!("type"in r)||!("attributes"in r)||r.type!=="api_error")}var rM=function(t){mb(e,t);function e(n){var r=this.constructor,o=t.call(this,"API Error!")||this;return Object.setPrototypeOf(o,r.prototype),"captureStackTrace"in Error?Error.captureStackTrace(o,qi):o.stack=new Error().stack,o.request=n.request,o.preCallStack=n.preCallStack,o.message="".concat(n.request.method," ").concat(n.request.url,": Timeout error"),o.preCallStack&&(o.stack+=`
|
|
18
|
+
Caused By:
|
|
19
|
+
`.concat(o.preCallStack)),o}return e}(Error),qi=function(t){mb(e,t);function e(n){var r=this.constructor,o=t.call(this,"API Error!")||this;Object.setPrototypeOf(o,r.prototype),"captureStackTrace"in Error?Error.captureStackTrace(o,e):o.stack=new Error().stack,o.request=n.request,o.response=n.response,o.preCallStack=n.preCallStack;var i="".concat(n.request.method," ").concat(n.request.url,": ").concat(o.response.status," ").concat(o.response.statusText);return o.errors.length>0&&(i+=`
|
|
20
|
+
|
|
21
|
+
`.concat(JSON.stringify(o.errors,null,2))),o.message=i,o.preCallStack&&(o.stack+=`
|
|
22
|
+
Caused By:
|
|
23
|
+
`.concat(o.preCallStack)),o}return Object.defineProperty(e.prototype,"errors",{get:function(){return nM(this.response.body)?this.response.body.data:[]},enumerable:!1,configurable:!0}),e.prototype.findError=function(n,r){var o=Array.isArray(n)?n:[n];return this.errors.find(function(i){return o.includes(i.attributes.code)&&(!r||(typeof r=="function"?r(i.attributes.details):Object.entries(r).every(function(s){var a=s[0],u=s[1];return i.attributes.details[a]===u})))})},e}(Error),oM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),wd=function(t){oM(e,t);function e(){var n=this.constructor,r=t.call(this,"Promise canceled!")||this;return Object.setPrototypeOf(r,n.prototype),r}return e}(Error);function bd(t,e){var n=null,r=new Promise(function(o,i){n=function(){try{e&&e(),i(new wd)}catch(a){i(a)}};var s=typeof t=="function"?t():t;s.then(o,i)});return n&&(r.cancel=n),r}function wu(t){return new Promise(function(e){setTimeout(e,t)})}var iM=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},sM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};function aM(t){return iM(this,void 0,void 0,function(){var e,n,r;return sM(this,function(o){switch(o.label){case 0:n=0,o.label=1;case 1:return o.trys.push([1,4,,5]),n+=1,[4,wu(n*1e3)];case 2:return o.sent(),[4,t()];case 3:return e=o.sent(),[3,5];case 4:if(r=o.sent(),!(r instanceof qi)||r.response.status!==404)throw r;return[3,5];case 5:if(!e)return[3,1];o.label=6;case 6:return[2,e]}})})}var yb={},jm={},Lm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TaskCollisionStrategy=void 0,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.KEEP_THIS=1]="KEEP_THIS",e[e.KEEP_OTHER=2]="KEEP_OTHER",e[e.KEEP_BOTH=3]="KEEP_BOTH",e[e.RESOLVE_THIS=4]="RESOLVE_THIS",e[e.RESOLVE_OTHER=5]="RESOLVE_OTHER"}(t.TaskCollisionStrategy||(t.TaskCollisionStrategy={}))})(Lm);var _d={};Object.defineProperty(_d,"__esModule",{value:!0});class lM{constructor(e,n){this._code=e,this._message=n}get code(){return this._code}get message(){return this._message}}_d.default=lM;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.mutexEquality=Yo.mutexBitwiseAnd=void 0;function uM(t,e){return(t&e)!==0}Yo.mutexBitwiseAnd=uM;function cM(t,e){return t===e}Yo.mutexEquality=cM;var Bm={};Object.defineProperty(Bm,"__esModule",{value:!0});class dM{constructor(e,n){this._meta=void 0,this._task=e,this._scheduler=n}withDescriptor(e){return this._descriptor=e,this}withMutex(e){return this._mutex=e,this}withMeta(e){return this._meta=e,this}runBeforeExecuting(e){return this._onPreExecute=e,this}handleCollisions(e){return this._onTaskCollision=e,this}execute(e){return this._scheduler.enqueue({priority:e,mutex:this._mutex,descriptor:this._descriptor,meta:this._meta,execute:this._task,onPreExecute:this._onPreExecute,onTaskCollision:this._onTaskCollision})}}Bm.default=dM;var fM=it&&it.__awaiter||function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},gb=it&&it.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jm,"__esModule",{value:!0});const Un=Lm,pM=gb(_d),hM=Yo,mM=gb(Bm);var pn;(function(t){t[t.PENDING=0]="PENDING",t[t.EXECUTING=1]="EXECUTING",t[t.TERMINATED=2]="TERMINATED"})(pn||(pn={}));function qg(t,e){for(let n of t.listeners)n.reject(e)}class yM{constructor(e,n={}){this._queue=[],this._isExecuting=!1,this._idleListeners=[],this._maxConcurrentTasks=e,this._samePriorityMutex=!!n.samePriorityMutex,this._mutexStrategy=n.mutexStrategy||hM.mutexEquality,n.disableLogging?this._errorLog=()=>{}:this._errorLog=console.error}enqueue(e){return new Promise((n,r)=>{typeof e=="function"&&(e={priority:0,execute:e});const o=this._checkMutexes(e,n,r);o.task?this._addTask(o.task):o.canceled&&r(this.createCanceledError())})}prepare(e){return new mM.default(e,this)}_addTask(e){this._queue.push(e),this._applyPriorities(),this._isExecuting||(this._isExecuting=!0,setTimeout(this._executeNextTasks.bind(this)))}get executingTasks(){return this._queue.reduce((e,n)=>n.state===pn.EXECUTING?e+1:e,0)}createCanceledError(){return new pM.default(50,"Task has been canceled in favor of another task")}_findFirstPendingTask(){return this._queue.find(e=>e.state===pn.PENDING)}_isIdle(){return this._queue.length===0||!this._queue.find(e=>e.state!==pn.TERMINATED)}_removeTaskAt(e){this._queue.splice(e,1)}_executeTask(e){return fM(this,void 0,void 0,function*(){try{return e.task.onPreExecute&&e.task.onPreExecute(),yield e.task.execute()}catch(n){throw n}finally{e.state=pn.TERMINATED;let n=this._queue.indexOf(e);this._removeTaskAt(n),this._executeNextTasks()}})}_executeNextTasks(){let e=this.executingTasks;if(e>=this._maxConcurrentTasks)return;let n=this._maxConcurrentTasks-e;for(let r=0;r<n;r++){const o=this._findFirstPendingTask();if(!o){this._isIdle()&&this._switchToIdle();return}o.state=pn.EXECUTING,this._executeTask(o).then(i=>{for(const{resolve:s}of o.listeners)try{s(i)}catch(a){this._errorLog("An error occurred while resolving listener",a)}}).catch(i=>{for(const{reject:s}of o.listeners)try{s(i)}catch(a){this._errorLog("An error occurred while rejecting listener",a)}})}}_switchToIdle(){this._isExecuting=!1;const e=this._idleListeners;this._idleListeners=[];for(const{resolve:n}of e)try{n()}catch{}}waitForIdle(){return this._isExecuting?new Promise((e,n)=>{this._idleListeners.push({resolve:e,reject:n})}):Promise.resolve()}_applyPriorities(){this._queue.sort((e,n)=>n.task.priority-e.task.priority)}_checkMutexes(e,n,r){for(let o=0;o<this._queue.length;o++){let i=this._queue[o];if(i.state===pn.TERMINATED||this._samePriorityMutex&&i.task.priority!=e.priority||!i.task.mutex||!e.mutex||!this._mutexStrategy(i.task.mutex,e.mutex))continue;let s,a;if(i.task.onTaskCollision)if(s=i.task.onTaskCollision(e),s===Un.TaskCollisionStrategy.KEEP_OTHER&&i.state!==pn.EXECUTING){this._removeTaskAt(o--),qg(i,this.createCanceledError());continue}else{if(s===Un.TaskCollisionStrategy.KEEP_THIS)return{canceled:!0};if(s===Un.TaskCollisionStrategy.RESOLVE_OTHER)return this._removeTaskAt(o--),{canceled:!1,task:{task:e,state:pn.PENDING,listeners:[{resolve:n,reject:r},...i.listeners]}};if(s===Un.TaskCollisionStrategy.RESOLVE_THIS)return i.listeners=[...i.listeners,{resolve:n,reject:r}],{canceled:!1}}if(e.onTaskCollision){if(a=e.onTaskCollision(i.task),a===Un.TaskCollisionStrategy.KEEP_OTHER)return{canceled:!0};if(a===Un.TaskCollisionStrategy.KEEP_THIS){this._removeTaskAt(o--),qg(i,this.createCanceledError());continue}else{if(a===Un.TaskCollisionStrategy.RESOLVE_OTHER)return i.listeners=[...i.listeners,{resolve:n,reject:r}],{canceled:!1};if(a===Un.TaskCollisionStrategy.RESOLVE_THIS)return this._removeTaskAt(o--),{canceled:!1,task:{task:e,state:pn.PENDING,listeners:[{resolve:n,reject:r},...i.listeners]}}}}if(!(s===Un.TaskCollisionStrategy.KEEP_BOTH&&a===Un.TaskCollisionStrategy.KEEP_BOTH))return{canceled:!0}}return{canceled:!1,task:{task:e,state:pn.PENDING,listeners:[{resolve:n,reject:r}]}}}}jm.default=yM;(function(t){var e=it&&it.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(t,"__esModule",{value:!0}),t.mutexEquality=t.mutexBitwiseAnd=t.SchedulerError=t.TaskCollisionStrategy=t.Scheduler=void 0;const n=e(jm);t.Scheduler=n.default;const r=Lm;Object.defineProperty(t,"TaskCollisionStrategy",{enumerable:!0,get:function(){return r.TaskCollisionStrategy}});const o=e(_d);t.SchedulerError=o.default;const i=Yo;Object.defineProperty(t,"mutexBitwiseAnd",{enumerable:!0,get:function(){return i.mutexBitwiseAnd}}),Object.defineProperty(t,"mutexEquality",{enumerable:!0,get:function(){return i.mutexEquality}})})(yb);var gM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Io=function(t){return this instanceof Io?(this.v=t,this):new Io(t)},vM=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Io?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}};function fi(t,e,n){return vM(this,arguments,function(){var o,i,s,a,u,y,l,c,d,f,p,h,m,v,y;return gM(this,function(w){switch(w.label){case 0:if(o=(n==null?void 0:n.perPage)||t.defaultLimit,o>t.maxLimit)throw new Error("perPage option cannot exceed maximum value of ".concat(t.maxLimit));if(i=(n==null?void 0:n.concurrency)||1,i>10)throw new Error("concurrency option cannot exceed maximum value of 10");return[4,Io(e({limit:o,offset:0}))];case 1:s=w.sent(),a=0,u=s.data,w.label=2;case 2:return a<u.length?(y=u[a],[4,Io(y)]):[3,6];case 3:return[4,w.sent()];case 4:w.sent(),w.label=5;case 5:return a++,[3,2];case 6:for(l=s.meta.total_count,c=new yb.Scheduler(i),d=[],f=function(b){d.push(c.enqueue(function(){return e({limit:o,offset:b})}))},p=o;p<l;p+=o)f(p);w.label=7;case 7:return d.length>0?[4,Io(d.shift())]:[3,14];case 8:h=w.sent(),m=0,v=h.data,w.label=9;case 9:return m<v.length?(y=v[m],[4,Io(y)]):[3,13];case 10:return[4,w.sent()];case 11:w.sent(),w.label=12;case 12:return m++,[3,9];case 13:return[3,7];case 14:return[2]}})})}function pi(t){t&&"page"in t&&console.warn("Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.")}var Nl=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))},vb="__ARRAY_INDEX__";function wM(t){return t.reduce(function(e,n,r){return r===0?n:n===vb?"".concat(e,"[]"):"".concat(e,"[").concat(n,"]")},"")}function bM(t){if(typeof t=="number"||typeof t=="string")return t.toString();if(t===!0)return"true";if(t===!1)return"false";throw"Don't know how to serialize param value ".concat(JSON.stringify(t))}function Ap(t,e){e===void 0&&(e=[]);var n=[];if(typeof t=="number"||typeof t=="string"||typeof t=="boolean")n.push([wM(e),bM(t)]);else if(typeof t=="object"){if(Array.isArray(t))for(var r=0,o=t;r<o.length;r++)for(var i=o[r],s=0,a=Ap(i,Nl(Nl([],e,!0),[vb],!1));s<a.length;s++){var u=a[s];n.push(u)}else if(t)for(var l=0,c=Object.entries(t);l<c.length;l++)for(var d=c[l],f=d[0],i=d[1],p=0,h=Ap(i,Nl(Nl([],e,!0),[f],!1));p<h.length;p++){var u=h[p];n.push(u)}}return n}var lr=function(){return lr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},lr.apply(this,arguments)},_M=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},SM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},kM=typeof window<"u"&&typeof window.document<"u",xM=5,hn;(function(t){t[t.NONE=0]="NONE",t[t.BASIC=1]="BASIC",t[t.BODY=2]="BODY",t[t.BODY_AND_HEADERS=3]="BODY_AND_HEADERS"})(hn||(hn={}));function EM(t){var e={};return t.forEach(function(n,r){e[r]=n}),e}function Hg(t,e,n,r,o,i,s){return{request:{url:e,method:t,headers:n,body:r},response:{status:o.status,statusText:o.statusText,headers:EM(o.headers),body:i},preCallStack:s}}function TM(t,e,n,r,o){return{request:{url:e,method:t,headers:n,body:r},preCallStack:o}}function CM(t,e,n,r,o,i,s){return{request:{url:e,method:t,headers:n,body:r},response:{status:o,statusText:"N/A",headers:{},body:i},preCallStack:s}}function MM(t){return typeof t=="object"&&!!t&&"code"in t}function OM(t){return Object.fromEntries(Object.entries(t).map(function(e){var n=e[0],r=e[1];return[n.toLowerCase(),r]}))}var Wg=1;function bu(t){var e;return _M(this,void 0,void 0,function(){var n,r,o,i,s,a,u,l,c,d,f,p,h,m,v,y,N,$,w,b,S,k,E,x,T,O,N,$,P,D,q,B,z,K;return SM(this,function(I){switch(I.label){case 0:if(n=Wg,Wg+=1,r=t.fetchFn||(typeof fetch>"u"?void 0:fetch)||(typeof globalThis>"u"?void 0:globalThis.fetch),typeof r>"u")throw new Error("fetch() is not available: either polyfill it globally, or provide it as fetchFn option.");if(o=t.preCallStack,i=t.userAgent||"@datocms/rest-client-utils",s=t.retryCount||1,a=t.logLevel||hn.NONE,u="autoRetry"in t?t.autoRetry:!0,l=t.logFn||function(){return!0},c=lr({"content-type":"application/json",accept:"application/json",authorization:"Bearer ".concat(t.apiToken),"user-agent":i},t.extraHeaders?OM(t.extraHeaders):{}),kM&&delete c["user-agent"],d=t.baseUrl.replace(/\/$/,""),f=t.body?JSON.stringify(t.body,null,2):void 0,p=t.queryParams&&Object.keys(t.queryParams).length>0?"?".concat(new URLSearchParams(Ap(t.queryParams)).toString()):"",h="".concat(d).concat(t.url).concat(p),a>=hn.BASIC){if(l("[".concat(n,"] ").concat(t.method," ").concat(h)),a>=hn.BODY_AND_HEADERS)for(m=0,v=Object.entries(c||{});m<v.length;m++)y=v[m],N=y[0],$=y[1],l("[".concat(n,"] ").concat(N,": ").concat($));a>=hn.BODY&&f&&l("[".concat(n,"] ").concat(f))}I.label=1;case 1:return I.trys.push([1,12,,16]),w=bd(r(h,{method:t.method,headers:c,body:f})),b=setTimeout(function(){w.cancel()},t.requestTimeout||3e4),[4,w];case 2:if(S=I.sent(),clearTimeout(b),k=S.headers.get("Content-Type"),E=k&&!k.includes("application/json"),!(S.status===429||E))return[3,4];if(!u||E&&t.method!=="GET")throw new qi(Hg(t.method,h,c,t.body,S,void 0,o));return x=S.headers.has("X-RateLimit-Reset")?Number.parseInt(S.headers.get("X-RateLimit-Reset"),10):s,a>=hn.BASIC&&(S.status===429?l("[".concat(n,"] Rate limit exceeded, wait ").concat(x," seconds then retry...")):l("[".concat(n,'] Invalid response content type "').concat(k,'" (status ').concat(S.status,"). Wait ").concat(x," seconds then retry..."))),[4,wu(x*1e3)];case 3:return I.sent(),[2,bu(lr(lr({},t),{retryCount:s+1}))];case 4:if(a>=hn.BASIC&&(l("[".concat(n,"] Status: ").concat(S.status," (").concat(S.statusText,")")),a>=hn.BODY_AND_HEADERS))for(T=0,O=["x-api-version","x-environment","x-queue-time","x-ratelimit-remaining","x-request-id","cf-ray"];T<O.length;T++)N=O[T],$=S.headers.get(N),$&&l("[".concat(n,"] ").concat(N,": ").concat($));return S.status!==204?[3,5]:(D=void 0,[3,7]);case 5:return[4,S.json()];case 6:D=I.sent(),I.label=7;case 7:return P=D,a>=hn.BODY&&P&&l("[".concat(n,"] ").concat(JSON.stringify(P,null,2))),S.status!==202?[3,9]:[4,t.fetchJobResult(P.data.id)];case 8:if(q=I.sent(),q.status<200||q.status>=300)throw new qi(CM(t.method,h,c,t.body,q.status,q.payload,o));P=q.payload,I.label=9;case 9:return S.status>=200&&S.status<300?[2,P]:(B=new qi(Hg(t.method,h,c,t.body,S,P,o)),z=(e=B.errors.find(function(L){return L.attributes.transient}))===null||e===void 0?void 0:e.attributes.code,u&&z?(a>=hn.BASIC&&l("[".concat(n,"] ").concat(z,", wait ").concat(s," seconds then retry...")),[4,wu(s*1e3)]):[3,11]);case 10:return I.sent(),[2,bu(lr(lr({},t),{retryCount:s+1}))];case 11:throw B;case 12:return K=I.sent(),K instanceof wd||MM(K)&&K.code.includes("ETIMEDOUT")?u&&s<xM?(a>=hn.BASIC&&l("[".concat(n,"] Timeout error, wait ").concat(s," seconds then retry...")),[4,wu(s*1e3)]):[3,14]:[3,15];case 13:return I.sent(),[2,bu(lr(lr({},t),{retryCount:s+1}))];case 14:throw new rM(TM(t.method,h,c,t.body,o));case 15:throw K;case 16:return[2]}})})}var Oo=function(){return Oo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Oo.apply(this,arguments)},NM=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 o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function _u(t){return typeof t=="object"&&!!t&&"id"in t&&"type"in t}function cf(t){return Array.isArray(t)&&t.every(_u)}function X(t,e){if(typeof t!="object"||!t)throw new Error("Invalid body!");if(Array.isArray(t))return{data:t.map(function(T){var O;return(O=X(T,e))===null||O===void 0?void 0:O.data})};var n=t,r=n.id,o=n.type,i=n.meta,s=NM(n,["id","type","meta"]),a={},u={};if(e.attributes==="*")for(var l=0,c=Object.entries(s);l<c.length;l++){var d=c[l],f=d[0],p=d[1];if(e.relationships.includes(f))if(_u(p)){var h=p.id,m=p.type;u[f]={data:{id:h,type:m}}}else cf(p)?u[f]={data:p.map(function(T){var O=T.id,N=T.type;return{id:O,type:N}})}:u[f]={data:null};else a[f]=p}else if(e.relationships==="*")for(var v=0,y=Object.entries(s);v<y.length;v++){var w=y[v],f=w[0],p=w[1];if(e.attributes.includes(f))a[f]=p;else if(_u(p)){var b=p.id,m=p.type;u[f]={data:{id:b,type:m}}}else cf(p)?u[f]={data:p.map(function(N){var $=N.id,P=N.type;return{id:$,type:P}})}:u[f]={data:null}}else{for(var S=0,k=Object.entries(s);S<k.length;S++){var E=k[S],f=E[0],p=E[1];if(e.attributes.includes(f))a[f]=p;else if(e.relationships.includes(f))if(_u(p)){var x=p.id,m=p.type;u[f]={data:{id:x,type:m}}}else cf(p)?u[f]={data:p.map(function(N){var $=N.id,P=N.type;return{id:$,type:P}})}:u[f]={data:null}}e.attributes.includes("type")&&(a.type=o)}return{data:Oo(Oo(Oo(Oo(Oo({},r||e.id?{id:r||e.id}:{}),{type:e.type}),Object.keys(a).length>0?{attributes:a}:{}),Object.keys(u).length>0?{relationships:u}:{}),i?{meta:i}:{})}}function R(t){return typeof t=="string"?t:t.id}var de=function(){function t(e){this.client=e}return t}(),AM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),IM=function(t){AM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions"],relationships:["inherits_permissions_from"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/roles",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions"],relationships:["inherits_permissions_from"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/roles/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/roles"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/roles/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/roles/".concat(n)})},e.prototype.duplicate=function(n){return this.rawDuplicate(R(n)).then(function(r){return M(r)})},e.prototype.rawDuplicate=function(n){return this.client.request({method:"POST",url:"/roles/".concat(n,"/duplicate")})},e.TYPE="role",e}(de),PM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),$o=function(){return $o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},$o.apply(this,arguments)},RM=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},DM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Kg=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};function Gg(t,e){return t==null&&e==null?!0:t===e}function jM(t,e){for(var n in t)if(!Gg(t[n],e[n]))return!1;for(var n in e)if(!Gg(t[n],e[n]))return!1;return!0}function Al(t,e,n,r){if(!e)return t;var o=e.add,i=e.remove;return Kg(Kg([],i?i.reduce(function(s,a){var u=$o($o({},a),{environment:n}),l=s.find(function(c){return jM(c,u)});if(!l)throw new Error("Cannot find rule ".concat(JSON.stringify(u)," to remove in ").concat(r,"!"));return s.filter(function(c){return c!==l})},t):t,!0),o?o.map(function(s){return $o({environment:n},s)}):[],!0)}var LM=function(t){PM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.updateCurrentEnvironmentPermissions=function(n,r){return RM(this,void 0,void 0,function(){var o,i,s,a,u,l;return DM(this,function(c){switch(c.label){case 0:return i=this.client.config.environment,i?[3,2]:[4,this.client.environments.list()];case 1:i=c.sent().find(function(d){return d.meta.primary}).id,c.label=2;case 2:return o=i,[4,this.find(n)];case 3:return s=c.sent(),a=!!(r.positive_item_type_permissions||r.negative_item_type_permissions),u=!!(r.positive_upload_permissions||r.negative_upload_permissions),l=$o($o({},a?{positive_item_type_permissions:Al(s.positive_item_type_permissions,r.positive_item_type_permissions,o,"positive_item_type_permissions"),negative_item_type_permissions:Al(s.negative_item_type_permissions,r.negative_item_type_permissions,o,"negative_item_type_permissions")}:{}),u?{positive_upload_permissions:Al(s.positive_upload_permissions,r.positive_upload_permissions,o,"positive_upload_permissions"),negative_upload_permissions:Al(s.negative_upload_permissions,r.negative_upload_permissions,o,"negative_upload_permissions")}:{}),[2,this.update(n,l)]}})})},e}(IM),BM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),FM=function(t){BM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"user",attributes:["is_active"],relationships:["role"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/users/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/users"})},e.prototype.find=function(n,r){return this.rawFind(R(n),r).then(function(o){return M(o)})},e.prototype.rawFind=function(n,r){return this.client.request({method:"GET",url:"/users/".concat(n),queryParams:r})},e.prototype.findMe=function(n){return this.rawFindMe(n).then(function(r){return M(r)})},e.prototype.rawFindMe=function(n){return this.client.request({method:"GET",url:"/users/me",queryParams:n})},e.prototype.destroy=function(n,r){return this.rawDestroy(R(n),r).then(function(o){return M(o)})},e.prototype.rawDestroy=function(n,r){return this.client.request({method:"DELETE",url:"/users/".concat(n),queryParams:r})},e.TYPE="user",e}(de),$M=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),zM=function(t){$M(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/sso-users"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/sso-users/".concat(n)})},e.prototype.copyUsers=function(){return this.rawCopyUsers().then(function(n){return M(n)})},e.prototype.rawCopyUsers=function(){return this.client.request({method:"POST",url:"/sso-users/copy-users"})},e.prototype.destroy=function(n,r){return this.rawDestroy(R(n),r).then(function(o){return M(o)})},e.prototype.rawDestroy=function(n,r){return this.client.request({method:"DELETE",url:"/sso-users/".concat(n),queryParams:r})},e.TYPE="sso_user",e}(de),UM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),VM=function(t){UM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.query=function(n){return this.rawQuery(X(n,{type:"audit_log_query",attributes:["filter","next_token","detailed_log"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawQuery=function(n){return this.client.request({method:"POST",url:"/audit-log-events/query",body:n})},e.TYPE="audit_log_event",e}(de),qM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),HM=function(t){qM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/menu-items",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/menu-items/".concat(n),body:r})},e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/menu-items",queryParams:n})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/menu-items/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/menu-items/".concat(n)})},e.prototype.reorder=function(n){return this.rawReorder(X(n,{type:"menu_item",attributes:["position"],relationships:["parent"]})).then(function(r){return M(r)})},e.prototype.rawReorder=function(n){return this.client.request({method:"POST",url:"/menu-items/reorder",body:n})},e.TYPE="menu_item",e}(de),WM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),KM=function(t){WM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/schema-menu-items",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent","children"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/schema-menu-items/".concat(n),body:r})},e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/schema-menu-items",queryParams:n})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/schema-menu-items/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/schema-menu-items/".concat(n)})},e.prototype.reorder=function(n){return this.rawReorder(X(n,{type:"schema_menu_item",attributes:["position"],relationships:["parent"]})).then(function(r){return M(r)})},e.prototype.rawReorder=function(n){return this.client.request({method:"POST",url:"/schema-menu-items/reorder",body:n})},e.TYPE="schema_menu_item",e}(de),GM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),JM=function(t){GM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"upload_collection",attributes:["label","position"],relationships:["parent"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/upload-collections",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"upload_collection",attributes:["label","position"],relationships:["parent","children"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/upload-collections/".concat(n),body:r})},e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/upload-collections",queryParams:n})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/upload-collections/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/upload-collections/".concat(n)})},e.prototype.reorder=function(n){return this.rawReorder(X(n,{type:"upload_collection",attributes:["position"],relationships:["parent"]})).then(function(r){return M(r)})},e.prototype.rawReorder=function(n){return this.client.request({method:"POST",url:"/upload-collections/reorder",body:n})},e.TYPE="upload_collection",e}(de),YM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),QM=function(t){YM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n,r){return this.rawCreate(X(n,{type:"item_type",attributes:["name","api_key","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","collection_appeareance","collection_appearance","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]}),r).then(function(o){return M(o)})},e.prototype.rawCreate=function(n,r){return this.client.request({method:"POST",url:"/item-types",body:n,queryParams:r})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"item_type",attributes:["name","api_key","collection_appeareance","collection_appearance","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","has_singleton_item","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/item-types/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/item-types"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/item-types/".concat(n)})},e.prototype.duplicate=function(n){return this.rawDuplicate(R(n)).then(function(r){return M(r)})},e.prototype.rawDuplicate=function(n){return this.client.request({method:"POST",url:"/item-types/".concat(n,"/duplicate")})},e.prototype.destroy=function(n,r){return this.rawDestroy(R(n),r).then(function(o){return M(o)})},e.prototype.rawDestroy=function(n,r){return this.client.request({method:"DELETE",url:"/item-types/".concat(n),queryParams:r})},e.prototype.rawReorderFieldsAndFieldsets=function(n,r){return this.client.request({method:"POST",url:"/item-types/".concat(n,"/reorder-fields-and-fieldsets"),body:r})},e.TYPE="item_type",e}(de),XM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ZM=function(t){XM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n,r){return this.rawCreate(R(n),X(r,{type:"field",attributes:["label","field_type","api_key","localized","validators","appeareance","appearance","position","hint","default_value","deep_filtering_enabled"],relationships:["fieldset"]})).then(function(o){return M(o)})},e.prototype.rawCreate=function(n,r){return this.client.request({method:"POST",url:"/item-types/".concat(n,"/fields"),body:r})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"field",attributes:["default_value","label","api_key","localized","validators","appeareance","appearance","position","field_type","hint","deep_filtering_enabled"],relationships:["fieldset"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/fields/".concat(n),body:r})},e.prototype.list=function(n){return this.rawList(R(n)).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/item-types/".concat(n,"/fields")})},e.prototype.referencing=function(n){return this.rawReferencing(R(n)).then(function(r){return M(r)})},e.prototype.rawReferencing=function(n){return this.client.request({method:"GET",url:"/item-types/".concat(n,"/fields/referencing")})},e.prototype.related=function(n){return this.rawRelated(R(n)).then(function(r){return M(r)})},e.prototype.rawRelated=function(n){return this.client.request({method:"GET",url:"/item-types/".concat(n,"/fields/related")})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/fields/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/fields/".concat(n)})},e.prototype.duplicate=function(n){return this.rawDuplicate(R(n)).then(function(r){return M(r)})},e.prototype.rawDuplicate=function(n){return this.client.request({method:"POST",url:"/fields/".concat(n,"/duplicate")})},e.TYPE="field",e}(de),eO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),tO=function(t){eO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n,r){return this.rawCreate(R(n),X(r,{type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawCreate=function(n,r){return this.client.request({method:"POST",url:"/item-types/".concat(n,"/fieldsets"),body:r})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/fieldsets/".concat(n),body:r})},e.prototype.list=function(n){return this.rawList(R(n)).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/item-types/".concat(n,"/fieldsets")})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/fieldsets/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/fieldsets/".concat(n)})},e.TYPE="fieldset",e}(de),nO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),rO=function(t){nO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"email_credentials",attributes:["email","password","otp_code"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/sessions",body:n})},e.TYPE="session",e}(de),oO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),iO=function(t){oO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/access_tokens",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/access_tokens/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/access_tokens"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/access_tokens/".concat(n)})},e.prototype.regenerateToken=function(n){return this.rawRegenerateToken(R(n)).then(function(r){return M(r)})},e.prototype.rawRegenerateToken=function(n){return this.client.request({method:"POST",url:"/access_tokens/".concat(n,"/regenerate_token")})},e.prototype.destroy=function(n,r){return this.rawDestroy(R(n),r).then(function(o){return M(o)})},e.prototype.rawDestroy=function(n,r){return this.client.request({method:"DELETE",url:"/access_tokens/".concat(n),queryParams:r})},e.TYPE="access_token",e}(de),sO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),aO=function(t){sO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"plugin",attributes:["package_name","name","description","url","permissions","plugin_type","field_types","parameter_definitions","package_version"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/plugins",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"plugin",attributes:["name","description","url","parameters","package_version","permissions"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/plugins/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/plugins"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/plugins/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/plugins/".concat(n)})},e.prototype.fields=function(n){return this.rawFields(R(n)).then(function(r){return M(r)})},e.prototype.rawFields=function(n){return this.client.request({method:"GET",url:"/plugins/".concat(n,"/fields")})},e.TYPE="plugin",e}(de),lO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),uO=function(t){lO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/job-results/".concat(n)})},e.TYPE="job_result",e}(de),cO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),dO=function(t){cO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/subscription-limits"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/subscription-limits/".concat(n)})},e.TYPE="subscription_limit",e}(de),fO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),pO=function(t){fO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/subscription-features"})},e.TYPE="subscription_feature",e}(de),hO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),mO=function(t){hO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/build-events"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/build-events/".concat(n)})},e.TYPE="build_event",e}(de),yO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fu=function(){return Fu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Fu.apply(this,arguments)},gO=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},vO=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(l){i({value:l,done:a})},s)}},Hi=function(t){return this instanceof Hi?(this.v=t,this):new Hi(t)},wO=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Hi?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}},bO=function(t){yO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/items",queryParams:n})},e.prototype.listPagedIterator=function(n,r){return wO(this,arguments,function(){var i,s,a,u,l,c,d,f,p;return gO(this,function(h){switch(h.label){case 0:h.trys.push([0,9,10,15]),i=!0,s=vO(this.rawListPagedIterator(n,r)),h.label=1;case 1:return[4,Hi(s.next())];case 2:if(a=h.sent(),c=a.done,!!c)return[3,8];p=a.value,i=!1,h.label=3;case 3:return h.trys.push([3,,6,7]),u=p,[4,Hi(_r(u))];case 4:return[4,h.sent()];case 5:return h.sent(),[3,7];case 6:return i=!0,[7];case 7:return[3,1];case 8:return[3,15];case 9:return l=h.sent(),d={error:l},[3,15];case 10:return h.trys.push([10,,13,14]),!i&&!c&&(f=s.return)?[4,Hi(f.call(s))]:[3,12];case 11:h.sent(),h.label=12;case 12:return[3,14];case 13:if(d)throw d.error;return[7];case 14:return[7];case 15:return[2]}})})},e.prototype.rawListPagedIterator=function(n,r){var o=this;return pi(n),fi({defaultLimit:30,maxLimit:500},function(i){return o.rawList(Fu(Fu({},n),{page:i}))},r)},e.prototype.validateExisting=function(n,r){return this.rawValidateExisting(R(n),X(r,{id:R(n),type:"item",attributes:"*",relationships:["item_type","creator"]}))},e.prototype.rawValidateExisting=function(n,r){return this.client.request({method:"POST",url:"/items/".concat(n,"/validate"),body:r})},e.prototype.validateNew=function(n){return this.rawValidateNew(X(n,{type:"item",attributes:"*",relationships:["item_type","creator"]}))},e.prototype.rawValidateNew=function(n){return this.client.request({method:"POST",url:"/items/validate",body:n})},e.prototype.create=function(n){return this.rawCreate(X(n,{type:"item",attributes:"*",relationships:["item_type","creator"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/items",body:n})},e.prototype.duplicate=function(n){return this.rawDuplicate(R(n)).then(function(r){return M(r)})},e.prototype.rawDuplicate=function(n){return this.client.request({method:"POST",url:"/items/".concat(n,"/duplicate")})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"item",attributes:"*",relationships:["item_type","creator"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/items/".concat(n),body:r})},e.prototype.references=function(n,r){return this.rawReferences(R(n),r).then(function(o){return M(o)})},e.prototype.rawReferences=function(n,r){return this.client.request({method:"GET",url:"/items/".concat(n,"/references"),queryParams:r})},e.prototype.find=function(n,r){return this.rawFind(R(n),r).then(function(o){return M(o)})},e.prototype.rawFind=function(n,r){return this.client.request({method:"GET",url:"/items/".concat(n),queryParams:r})},e.prototype.currentVsPublishedState=function(n){return this.rawCurrentVsPublishedState(R(n)).then(function(r){return M(r)})},e.prototype.rawCurrentVsPublishedState=function(n){return this.client.request({method:"GET",url:"/items/".concat(n,"/current-vs-published-state")})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/items/".concat(n)})},e.prototype.batchDestroy=function(n){return this.rawBatchDestroy(n).then(function(r){return M(r)})},e.prototype.rawBatchDestroy=function(n){return this.client.request({method:"DELETE",url:"/items",queryParams:n})},e.prototype.batchPublish=function(n){return this.rawBatchPublish(n).then(function(r){return M(r)})},e.prototype.rawBatchPublish=function(n){return this.client.request({method:"PUT",url:"/items/publish",queryParams:n})},e.prototype.batchUnpublish=function(n){return this.rawBatchUnpublish(n).then(function(r){return M(r)})},e.prototype.rawBatchUnpublish=function(n){return this.client.request({method:"PUT",url:"/items/unpublish",queryParams:n})},e.prototype.publish=function(n,r,o){return this.rawPublish(R(n),r?X(r,{type:"selective_publish_operation",attributes:["content_in_locales","non_localized_content"],relationships:[]}):null,o).then(function(i){return M(i)})},e.prototype.rawPublish=function(n,r,o){return this.client.request({method:"PUT",url:"/items/".concat(n,"/publish"),body:r,queryParams:o})},e.prototype.unpublish=function(n,r,o){return this.rawUnpublish(R(n),r?X(r,{type:"selective_unpublish_operation",attributes:["content_in_locales"],relationships:[]}):null,o).then(function(i){return M(i)})},e.prototype.rawUnpublish=function(n,r,o){return this.client.request({method:"PUT",url:"/items/".concat(n,"/unpublish"),body:r,queryParams:o})},e.prototype.bulkPublish=function(n){return this.rawBulkPublish(X(n,{type:"item_bulk_publish_operation",attributes:[],relationships:["items"]})).then(function(r){return M(r)})},e.prototype.rawBulkPublish=function(n){return this.client.request({method:"POST",url:"/items/bulk/publish",body:n})},e.prototype.bulkUnpublish=function(n){return this.rawBulkUnpublish(X(n,{type:"item_bulk_unpublish_operation",attributes:[],relationships:["items"]})).then(function(r){return M(r)})},e.prototype.rawBulkUnpublish=function(n){return this.client.request({method:"POST",url:"/items/bulk/unpublish",body:n})},e.prototype.bulkDestroy=function(n){return this.rawBulkDestroy(X(n,{type:"item_bulk_destroy_operation",attributes:[],relationships:["items"]})).then(function(r){return M(r)})},e.prototype.rawBulkDestroy=function(n){return this.client.request({method:"POST",url:"/items/bulk/destroy",body:n})},e.prototype.bulkMoveToStage=function(n){return this.rawBulkMoveToStage(X(n,{type:"item_bulk_move_to_stage_operation",attributes:["stage"],relationships:["items"]})).then(function(r){return M(r)})},e.prototype.rawBulkMoveToStage=function(n){return this.client.request({method:"POST",url:"/items/bulk/move-to-stage",body:n})},e.TYPE="item",e}(de),_O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),$u=function(){return $u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},$u.apply(this,arguments)},SO=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},kO=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(l){i({value:l,done:a})},s)}},Wi=function(t){return this instanceof Wi?(this.v=t,this):new Wi(t)},xO=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Wi?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}},EO=function(t){_O(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.restore=function(n){return this.rawRestore(R(n)).then(function(r){return M(r)})},e.prototype.rawRestore=function(n){return this.client.request({method:"POST",url:"/versions/".concat(n,"/restore")})},e.prototype.list=function(n,r){return this.rawList(R(n),r).then(function(o){return M(o)})},e.prototype.rawList=function(n,r){return this.client.request({method:"GET",url:"/items/".concat(n,"/versions"),queryParams:r})},e.prototype.listPagedIterator=function(n,r,o){return xO(this,arguments,function(){var s,a,u,l,c,d,f,p,h;return SO(this,function(m){switch(m.label){case 0:m.trys.push([0,9,10,15]),s=!0,a=kO(this.rawListPagedIterator(R(n),r,o)),m.label=1;case 1:return[4,Wi(a.next())];case 2:if(u=m.sent(),d=u.done,!!d)return[3,8];h=u.value,s=!1,m.label=3;case 3:return m.trys.push([3,,6,7]),l=h,[4,Wi(_r(l))];case 4:return[4,m.sent()];case 5:return m.sent(),[3,7];case 6:return s=!0,[7];case 7:return[3,1];case 8:return[3,15];case 9:return c=m.sent(),f={error:c},[3,15];case 10:return m.trys.push([10,,13,14]),!s&&!d&&(p=a.return)?[4,Wi(p.call(a))]:[3,12];case 11:m.sent(),m.label=12;case 12:return[3,14];case 13:if(f)throw f.error;return[7];case 14:return[7];case 15:return[2]}})})},e.prototype.rawListPagedIterator=function(n,r,o){var i=this;return pi(r),fi({defaultLimit:15,maxLimit:50},function(s){return i.rawList(n,$u($u({},r),{page:s}))},o)},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/versions/".concat(n)})},e.TYPE="item_version",e}(de),TO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),zu=function(){return zu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},zu.apply(this,arguments)},CO=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},MO=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(l){i({value:l,done:a})},s)}},Ki=function(t){return this instanceof Ki?(this.v=t,this):new Ki(t)},OO=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Ki?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}},wb=function(t){TO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"upload",attributes:["path","copyright","author","notes","default_field_metadata","tags"],relationships:["upload_collection"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/uploads",body:n})},e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/uploads",queryParams:n})},e.prototype.listPagedIterator=function(n,r){return OO(this,arguments,function(){var i,s,a,u,l,c,d,f,p;return CO(this,function(h){switch(h.label){case 0:h.trys.push([0,9,10,15]),i=!0,s=MO(this.rawListPagedIterator(n,r)),h.label=1;case 1:return[4,Ki(s.next())];case 2:if(a=h.sent(),c=a.done,!!c)return[3,8];p=a.value,i=!1,h.label=3;case 3:return h.trys.push([3,,6,7]),u=p,[4,Ki(_r(u))];case 4:return[4,h.sent()];case 5:return h.sent(),[3,7];case 6:return i=!0,[7];case 7:return[3,1];case 8:return[3,15];case 9:return l=h.sent(),d={error:l},[3,15];case 10:return h.trys.push([10,,13,14]),!i&&!c&&(f=s.return)?[4,Ki(f.call(s))]:[3,12];case 11:h.sent(),h.label=12;case 12:return[3,14];case 13:if(d)throw d.error;return[7];case 14:return[7];case 15:return[2]}})})},e.prototype.rawListPagedIterator=function(n,r){var o=this;return pi(n),fi({defaultLimit:30,maxLimit:500},function(i){return o.rawList(zu(zu({},n),{page:i}))},r)},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/uploads/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/uploads/".concat(n)})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"upload",attributes:["path","basename","copyright","author","notes","tags","default_field_metadata"],relationships:["creator","upload_collection"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/uploads/".concat(n),body:r})},e.prototype.batchAddTags=function(n,r){return this.rawBatchAddTags(X(n,{type:"upload",attributes:["tags"],relationships:[]}),r).then(function(o){return M(o)})},e.prototype.rawBatchAddTags=function(n,r){return this.client.request({method:"PUT",url:"/uploads/batch-add-tags",body:n,queryParams:r})},e.prototype.batchDestroy=function(n){return this.rawBatchDestroy(n).then(function(r){return M(r)})},e.prototype.rawBatchDestroy=function(n){return this.client.request({method:"DELETE",url:"/uploads/batch-destroy",queryParams:n})},e.prototype.references=function(n,r){return this.rawReferences(R(n),r).then(function(o){return M(o)})},e.prototype.rawReferences=function(n,r){return this.client.request({method:"GET",url:"/uploads/".concat(n,"/references"),queryParams:r})},e.prototype.bulkTag=function(n){return this.rawBulkTag(X(n,{type:"upload_bulk_tag_operation",attributes:["tags"],relationships:["uploads"]})).then(function(r){return M(r)})},e.prototype.rawBulkTag=function(n){return this.client.request({method:"POST",url:"/uploads/bulk/tag",body:n})},e.prototype.bulkSetUploadCollection=function(n){return this.rawBulkSetUploadCollection(X(n,{type:"upload_bulk_set_upload_collection_operation",attributes:[],relationships:["upload_collection","uploads"]})).then(function(r){return M(r)})},e.prototype.rawBulkSetUploadCollection=function(n){return this.client.request({method:"POST",url:"/uploads/bulk/set-upload-collection",body:n})},e.prototype.bulkDestroy=function(n){return this.rawBulkDestroy(X(n,{type:"upload_bulk_destroy_operation",attributes:[],relationships:["uploads"]})).then(function(r){return M(r)})},e.prototype.rawBulkDestroy=function(n){return this.client.request({method:"POST",url:"/uploads/bulk/destroy",body:n})},e.TYPE="upload",e}(de),NO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),AO=function(t){NO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"upload_request",attributes:["filename"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/upload-requests",body:n})},e.TYPE="upload_request",e}(de),IO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),PO=function(t){IO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n,r){return this.rawCreate(R(n),X(r,{type:"upload_track",attributes:["url_or_upload_request_id","type","name","language_code","closed_captions"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawCreate=function(n,r){return this.client.request({method:"POST",url:"/uploads/".concat(n,"/tracks"),body:r})},e.prototype.list=function(n){return this.rawList(R(n)).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/uploads/".concat(n,"/tracks")})},e.prototype.destroy=function(n,r){return this.rawDestroy(R(n),R(r)).then(function(o){return M(o)})},e.prototype.rawDestroy=function(n,r){return this.client.request({method:"DELETE",url:"/uploads/".concat(n,"/tracks/").concat(r)})},e.prototype.generateSubtitles=function(n,r){return this.rawGenerateSubtitles(R(n),X(r,{type:"upload_track",attributes:["name","language_code"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawGenerateSubtitles=function(n,r){return this.client.request({method:"POST",url:"/uploads/".concat(n,"/tracks/generate-subtitles"),body:r})},e.TYPE="upload_track",e}(de),RO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),DO=function(t){RO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n,r){return this.rawCreate(R(n),X(r,{type:"scheduled_publication",attributes:["publication_scheduled_at","selective_publication"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawCreate=function(n,r){return this.client.request({method:"POST",url:"/items/".concat(n,"/scheduled-publication"),body:r})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/items/".concat(n,"/scheduled-publication")})},e.TYPE="scheduled_publication",e}(de),jO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),LO=function(t){jO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n,r){return this.rawCreate(R(n),X(r,{type:"scheduled_unpublishing",attributes:["unpublishing_scheduled_at","content_in_locales"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawCreate=function(n,r){return this.client.request({method:"POST",url:"/items/".concat(n,"/scheduled-unpublishing"),body:r})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/items/".concat(n,"/scheduled-unpublishing")})},e.TYPE="scheduled_unpublishing",e}(de),BO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Uu=function(){return Uu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Uu.apply(this,arguments)},FO=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},$O=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(l){i({value:l,done:a})},s)}},Gi=function(t){return this instanceof Gi?(this.v=t,this):new Gi(t)},zO=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Gi?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}},UO=function(t){BO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/search-results",queryParams:n})},e.prototype.listPagedIterator=function(n,r){return zO(this,arguments,function(){var i,s,a,u,l,c,d,f,p;return FO(this,function(h){switch(h.label){case 0:h.trys.push([0,9,10,15]),i=!0,s=$O(this.rawListPagedIterator(n,r)),h.label=1;case 1:return[4,Gi(s.next())];case 2:if(a=h.sent(),c=a.done,!!c)return[3,8];p=a.value,i=!1,h.label=3;case 3:return h.trys.push([3,,6,7]),u=p,[4,Gi(_r(u))];case 4:return[4,h.sent()];case 5:return h.sent(),[3,7];case 6:return i=!0,[7];case 7:return[3,1];case 8:return[3,15];case 9:return l=h.sent(),d={error:l},[3,15];case 10:return h.trys.push([10,,13,14]),!i&&!c&&(f=s.return)?[4,Gi(f.call(s))]:[3,12];case 11:h.sent(),h.label=12;case 12:return[3,14];case 13:if(d)throw d.error;return[7];case 14:return[7];case 15:return[2]}})})},e.prototype.rawListPagedIterator=function(n,r){var o=this;return pi(n),fi({defaultLimit:20,maxLimit:100},function(i){return o.rawList(Uu(Uu({},n),{page:i}))},r)},e.TYPE="search_result",e}(de),VO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),qO=function(t){VO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.fork=function(n,r,o){return this.rawFork(R(n),X(r,{id:R(n),type:"environment",attributes:[],relationships:[]}),o).then(function(i){return M(i)})},e.prototype.rawFork=function(n,r,o){return this.client.request({method:"POST",url:"/environments/".concat(n,"/fork"),body:r,queryParams:o})},e.prototype.promote=function(n){return this.rawPromote(R(n)).then(function(r){return M(r)})},e.prototype.rawPromote=function(n){return this.client.request({method:"PUT",url:"/environments/".concat(n,"/promote")})},e.prototype.rename=function(n,r){return this.rawRename(R(n),X(r,{id:R(n),type:"environment",attributes:[],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawRename=function(n,r){return this.client.request({method:"PUT",url:"/environments/".concat(n,"/rename"),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/environments"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/environments/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/environments/".concat(n)})},e.TYPE="environment",e}(de),HO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),WO=function(t){HO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(){return this.rawFind().then(function(n){return M(n)})},e.prototype.rawFind=function(){return this.client.request({method:"GET",url:"/maintenance-mode"})},e.prototype.activate=function(n){return this.rawActivate(n).then(function(r){return M(r)})},e.prototype.rawActivate=function(n){return this.client.request({method:"PUT",url:"/maintenance-mode/activate",queryParams:n})},e.prototype.deactivate=function(){return this.rawDeactivate().then(function(n){return M(n)})},e.prototype.rawDeactivate=function(){return this.client.request({method:"PUT",url:"/maintenance-mode/deactivate"})},e.TYPE="maintenance_mode",e}(de),KO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),GO=function(t){KO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/webhooks",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/webhooks/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/webhooks"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/webhooks/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/webhooks/".concat(n)})},e.TYPE="webhook",e}(de),JO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Vu=function(){return Vu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Vu.apply(this,arguments)},YO=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},QO=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(l){i({value:l,done:a})},s)}},Ji=function(t){return this instanceof Ji?(this.v=t,this):new Ji(t)},XO=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Ji?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}},ZO=function(t){JO(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/webhook_calls",queryParams:n})},e.prototype.listPagedIterator=function(n,r){return XO(this,arguments,function(){var i,s,a,u,l,c,d,f,p;return YO(this,function(h){switch(h.label){case 0:h.trys.push([0,9,10,15]),i=!0,s=QO(this.rawListPagedIterator(n,r)),h.label=1;case 1:return[4,Ji(s.next())];case 2:if(a=h.sent(),c=a.done,!!c)return[3,8];p=a.value,i=!1,h.label=3;case 3:return h.trys.push([3,,6,7]),u=p,[4,Ji(_r(u))];case 4:return[4,h.sent()];case 5:return h.sent(),[3,7];case 6:return i=!0,[7];case 7:return[3,1];case 8:return[3,15];case 9:return l=h.sent(),d={error:l},[3,15];case 10:return h.trys.push([10,,13,14]),!i&&!c&&(f=s.return)?[4,Ji(f.call(s))]:[3,12];case 11:h.sent(),h.label=12;case 12:return[3,14];case 13:if(d)throw d.error;return[7];case 14:return[7];case 15:return[2]}})})},e.prototype.rawListPagedIterator=function(n,r){var o=this;return pi(n),fi({defaultLimit:30,maxLimit:500},function(i){return o.rawList(Vu(Vu({},n),{page:i}))},r)},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/webhook_calls/".concat(n)})},e.prototype.resendWebhook=function(n){return this.rawResendWebhook(R(n))},e.prototype.rawResendWebhook=function(n){return this.client.request({method:"POST",url:"/webhook_calls/".concat(n,"/resend_webhook")})},e.TYPE="webhook_call",e}(de),eN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),tN=function(t){eN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/build-triggers"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/build-triggers/".concat(n)})},e.prototype.create=function(n){return this.rawCreate(X(n,{type:"build_trigger",attributes:["name","webhook_token","adapter","indexing_enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/build-triggers",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"build_trigger",attributes:["name","adapter","indexing_enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/build-triggers/".concat(n),body:r})},e.prototype.trigger=function(n){return this.rawTrigger(R(n))},e.prototype.rawTrigger=function(n){return this.client.request({method:"POST",url:"/build-triggers/".concat(n,"/trigger")})},e.prototype.abort=function(n){return this.rawAbort(R(n))},e.prototype.rawAbort=function(n){return this.client.request({method:"DELETE",url:"/build-triggers/".concat(n,"/abort")})},e.prototype.abortIndexing=function(n){return this.rawAbortIndexing(R(n))},e.prototype.rawAbortIndexing=function(n){return this.client.request({method:"DELETE",url:"/build-triggers/".concat(n,"/abort_indexing")})},e.prototype.reindex=function(n){return this.rawReindex(R(n))},e.prototype.rawReindex=function(n){return this.client.request({method:"PUT",url:"/build-triggers/".concat(n,"/reindex")})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/build-triggers/".concat(n)})},e.TYPE="build_trigger",e}(de),nN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),rN=function(t){nN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"item_type_filter",attributes:["name","filter","columns","order_by","shared"],relationships:["item_type"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/item-type-filters",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"item_type_filter",attributes:["name","columns","order_by","shared","filter"],relationships:["item_type"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/item-type-filters/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/item-type-filters"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/item-type-filters/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/item-type-filters/".concat(n)})},e.TYPE="item_type_filter",e}(de),oN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),iN=function(t){oN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"upload_filter",attributes:["name","filter","shared"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/upload-filters",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"upload_filter",attributes:["name","shared","filter"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/upload-filters/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/upload-filters"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/upload-filters/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/upload-filters/".concat(n)})},e.TYPE="upload_filter",e}(de),sN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),aN=function(t){sN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"site_invitation",attributes:["email"],relationships:["role"]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/site-invitations",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"site_invitation",attributes:[],relationships:["role"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/site-invitations/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/site-invitations"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/site-invitations/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/site-invitations/".concat(n)})},e.prototype.resend=function(n){return this.rawResend(R(n)).then(function(r){return M(r)})},e.prototype.rawResend=function(n){return this.client.request({method:"POST",url:"/site-invitations/".concat(n,"/resend")})},e.TYPE="site_invitation",e}(de),lN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),uN=function(t){lN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/editing-sessions"})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/editing-sessions/".concat(n),body:r})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/editing-sessions/".concat(n)})},e.TYPE="editing_session",e}(de),cN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),dN=function(t){cN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/sso-groups"})},e.prototype.copyRoles=function(n){return this.rawCopyRoles(R(n)).then(function(r){return M(r)})},e.prototype.rawCopyRoles=function(n){return this.client.request({method:"POST",url:"/sso-groups/".concat(n,"/copy-roles")})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"sso_group",attributes:["priority"],relationships:["role"]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/sso-groups/".concat(n),body:r})},e.prototype.destroy=function(n){return this.rawDestroy(R(n)).then(function(r){return M(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/sso-groups/".concat(n)})},e.TYPE="sso_group",e}(de),fN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),pN=function(t){fN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(){return this.rawFind().then(function(n){return M(n)})},e.prototype.rawFind=function(){return this.client.request({method:"GET",url:"/sso-settings"})},e.prototype.generateToken=function(){return this.rawGenerateToken().then(function(n){return M(n)})},e.prototype.rawGenerateToken=function(){return this.client.request({method:"PUT",url:"/sso-settings/generate-token"})},e.prototype.update=function(n){return this.rawUpdate(X(n,{type:"sso_settings",attributes:["idp_saml_metadata_url","idp_saml_metadata_xml"],relationships:["default_role"]})).then(function(r){return M(r)})},e.prototype.rawUpdate=function(n){return this.client.request({method:"PUT",url:"/sso-settings",body:n})},e.TYPE="sso_settings",e}(de),hN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),mN=function(t){hN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(n){return this.rawFind(n).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/emoji-suggestions",queryParams:n})},e.TYPE="emoji_suggestions",e}(de),yN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),gN=function(t){yN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(){return this.rawFind().then(function(n){return M(n)})},e.prototype.rawFind=function(){return this.client.request({method:"GET",url:"/white-label-settings"})},e.prototype.update=function(n){return this.rawUpdate(X(n,{type:"white_label_settings",attributes:["custom_i18n_messages_template_url"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawUpdate=function(n){return this.client.request({method:"PUT",url:"/white-label-settings",body:n})},e.TYPE="white_label_settings",e}(de),vN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),wN=function(t){vN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(){return this.rawFind().then(function(n){return M(n)})},e.prototype.rawFind=function(){return this.client.request({method:"GET",url:"/public-info"})},e.TYPE="public_info",e}(de),bN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),_N=function(t){bN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/daily-site-usages"})},e.TYPE="daily_usage",e}(de),SN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),kN=function(t){SN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(n,r){return this.rawFind(R(n),r).then(function(o){return M(o)})},e.prototype.rawFind=function(n,r){return this.client.request({method:"GET",url:"/usage-log-counters/".concat(n),queryParams:r})},e.TYPE="usage_counter",e}(de),xN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),qu=function(){return qu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},qu.apply(this,arguments)},EN=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},TN=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(l){i({value:l,done:a})},s)}},Yi=function(t){return this instanceof Yi?(this.v=t,this):new Yi(t)},CN=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Yi?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}},MN=function(t){xN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/upload-tags",queryParams:n})},e.prototype.listPagedIterator=function(n,r){return CN(this,arguments,function(){var i,s,a,u,l,c,d,f,p;return EN(this,function(h){switch(h.label){case 0:h.trys.push([0,9,10,15]),i=!0,s=TN(this.rawListPagedIterator(n,r)),h.label=1;case 1:return[4,Yi(s.next())];case 2:if(a=h.sent(),c=a.done,!!c)return[3,8];p=a.value,i=!1,h.label=3;case 3:return h.trys.push([3,,6,7]),u=p,[4,Yi(_r(u))];case 4:return[4,h.sent()];case 5:return h.sent(),[3,7];case 6:return i=!0,[7];case 7:return[3,1];case 8:return[3,15];case 9:return l=h.sent(),d={error:l},[3,15];case 10:return h.trys.push([10,,13,14]),!i&&!c&&(f=s.return)?[4,Yi(f.call(s))]:[3,12];case 11:h.sent(),h.label=12;case 12:return[3,14];case 13:if(d)throw d.error;return[7];case 14:return[7];case 15:return[2]}})})},e.prototype.rawListPagedIterator=function(n,r){var o=this;return pi(n),fi({defaultLimit:50,maxLimit:500},function(i){return o.rawList(qu(qu({},n),{page:i}))},r)},e.prototype.create=function(n){return this.rawCreate(X(n,{type:"upload_tag",attributes:["name"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/upload-tags",body:n})},e.TYPE="upload_tag",e}(de),ON=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Hu=function(){return Hu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Hu.apply(this,arguments)},NN=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},AN=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(l){i({value:l,done:a})},s)}},Qi=function(t){return this instanceof Qi?(this.v=t,this):new Qi(t)},IN=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||a(f,p)})})}function a(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Qi?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){a("next",f)}function c(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}},PN=function(t){ON(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.list=function(n){return this.rawList(n).then(function(r){return M(r)})},e.prototype.rawList=function(n){return this.client.request({method:"GET",url:"/upload-smart-tags",queryParams:n})},e.prototype.listPagedIterator=function(n,r){return IN(this,arguments,function(){var i,s,a,u,l,c,d,f,p;return NN(this,function(h){switch(h.label){case 0:h.trys.push([0,9,10,15]),i=!0,s=AN(this.rawListPagedIterator(n,r)),h.label=1;case 1:return[4,Qi(s.next())];case 2:if(a=h.sent(),c=a.done,!!c)return[3,8];p=a.value,i=!1,h.label=3;case 3:return h.trys.push([3,,6,7]),u=p,[4,Qi(_r(u))];case 4:return[4,h.sent()];case 5:return h.sent(),[3,7];case 6:return i=!0,[7];case 7:return[3,1];case 8:return[3,15];case 9:return l=h.sent(),d={error:l},[3,15];case 10:return h.trys.push([10,,13,14]),!i&&!c&&(f=s.return)?[4,Qi(f.call(s))]:[3,12];case 11:h.sent(),h.label=12;case 12:return[3,14];case 13:if(d)throw d.error;return[7];case 14:return[7];case 15:return[2]}})})},e.prototype.rawListPagedIterator=function(n,r){var o=this;return pi(n),fi({defaultLimit:50,maxLimit:500},function(i){return o.rawList(Hu(Hu({},n),{page:i}))},r)},e.TYPE="upload_smart_tag",e}(de),RN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),DN=function(t){RN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.find=function(n){return this.rawFind(n).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/site",queryParams:n})},e.prototype.update=function(n){return this.rawUpdate(X(n,{type:"site",attributes:["no_index","favicon","global_seo","name","theme","locales","timezone","require_2fa","ip_tracking_enabled","force_use_of_sandbox_environments"],relationships:["sso_default_role"]})).then(function(r){return M(r)})},e.prototype.rawUpdate=function(n){return this.client.request({method:"PUT",url:"/site",body:n})},e.prototype.activateImprovedTimezoneManagement=function(){return this.rawActivateImprovedTimezoneManagement().then(function(n){return M(n)})},e.prototype.rawActivateImprovedTimezoneManagement=function(){return this.client.request({method:"PUT",url:"/site/activate-improved-timezone-management"})},e.prototype.activateImprovedHexManagement=function(){return this.rawActivateImprovedHexManagement().then(function(n){return M(n)})},e.prototype.rawActivateImprovedHexManagement=function(){return this.client.request({method:"PUT",url:"/site/activate-improved-hex-management"})},e.prototype.activateImprovedGqlMultilocaleFields=function(){return this.rawActivateImprovedGqlMultilocaleFields().then(function(n){return M(n)})},e.prototype.rawActivateImprovedGqlMultilocaleFields=function(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-multilocale-fields"})},e.prototype.activateImprovedGqlVisibilityControl=function(){return this.rawActivateImprovedGqlVisibilityControl().then(function(n){return M(n)})},e.prototype.rawActivateImprovedGqlVisibilityControl=function(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-visibility-control"})},e.prototype.activateImprovedBooleanFields=function(){return this.rawActivateImprovedBooleanFields().then(function(n){return M(n)})},e.prototype.rawActivateImprovedBooleanFields=function(){return this.client.request({method:"PUT",url:"/site/activate-improved-boolean-fields"})},e.prototype.activateDraftModeAsDefault=function(){return this.rawActivateDraftModeAsDefault().then(function(n){return M(n)})},e.prototype.rawActivateDraftModeAsDefault=function(){return this.client.request({method:"PUT",url:"/site/activate-draft-mode-as-default"})},e.prototype.activateImprovedValidationAtPublishing=function(){return this.rawActivateImprovedValidationAtPublishing().then(function(n){return M(n)})},e.prototype.rawActivateImprovedValidationAtPublishing=function(){return this.client.request({method:"PUT",url:"/site/activate-improved-validation-at-publishing"})},e.prototype.updateAssetsCdnDefaultSettings=function(n){return this.rawUpdateAssetsCdnDefaultSettings(X(n,{type:"assets-cdn-default-settings",attributes:["assets_cdn_default_settings"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawUpdateAssetsCdnDefaultSettings=function(n){return this.client.request({method:"PUT",url:"/site/assets-cdn-default-settings",body:n})},e.TYPE="site",e}(de),jN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),LN=function(t){jN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(function(r){return M(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/workflows",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(R(n),X(r,{id:R(n),type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(function(o){return M(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/workflows/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return M(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/workflows"})},e.prototype.find=function(n){return this.rawFind(R(n)).then(function(r){return M(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/workflows/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(R(n))},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/workflows/".concat(n)})},e.TYPE="workflow",e}(de),Dr=function(){return Dr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Dr.apply(this,arguments)},BN=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},FN=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},$N=function(){function t(e){this.config=e,this.roles=new LM(this),this.users=new FM(this),this.ssoUsers=new zM(this),this.auditLogEvents=new VM(this),this.menuItems=new HM(this),this.schemaMenuItems=new KM(this),this.uploadCollections=new JM(this),this.itemTypes=new QM(this),this.fields=new ZM(this),this.fieldsets=new tO(this),this.session=new rO(this),this.accessTokens=new iO(this),this.plugins=new aO(this),this.jobResults=new uO(this),this.subscriptionLimits=new dO(this),this.subscriptionFeatures=new pO(this),this.buildEvents=new mO(this),this.items=new bO(this),this.itemVersions=new EO(this),this.uploads=new wb(this),this.uploadRequest=new AO(this),this.uploadTracks=new PO(this),this.scheduledPublication=new DO(this),this.scheduledUnpublishing=new LO(this),this.searchResults=new UO(this),this.environments=new qO(this),this.maintenanceMode=new WO(this),this.webhooks=new GO(this),this.webhookCalls=new ZO(this),this.buildTriggers=new tN(this),this.itemTypeFilters=new rN(this),this.uploadFilters=new iN(this),this.siteInvitations=new aN(this),this.editingSessions=new uN(this),this.ssoGroups=new dN(this),this.ssoSettings=new pN(this),this.emojiSuggestions=new mN(this),this.whiteLabelSettings=new gN(this),this.publicInfo=new wN(this),this.dailyUsages=new _N(this),this.usageCounters=new kN(this),this.uploadTags=new MN(this),this.uploadSmartTags=new PN(this),this.site=new DN(this),this.workflows=new LN(this)}return Object.defineProperty(t.prototype,"baseUrl",{get:function(){return this.config.baseUrl||t.defaultBaseUrl},enumerable:!1,configurable:!0}),t.prototype.request=function(e){var n=this;return bu(Dr(Dr(Dr({},this.config),e),{logFn:this.config.logFn||console.log,userAgent:"@datocms/cma-client v3.4.5",baseUrl:this.baseUrl,preCallStack:new Error().stack,extraHeaders:Dr(Dr(Dr({},this.config.extraHeaders||{}),this.config.environment?{"X-Environment":this.config.environment}:{}),{"X-API-Version":"3"}),fetchJobResult:function(r){return n.jobResultsFetcher?n.jobResultsFetcher(r):aM(function(){return n.jobResults.find(r)})}}))},t.prototype.eventsChannelName=function(){return BN(this,void 0,void 0,function(){var e;return FN(this,function(n){switch(n.label){case 0:return this.cachedEventsChannelName?[2,this.cachedEventsChannelName]:[4,this.site.rawFind()];case 1:return e=n.sent().data,this.cachedEventsChannelName=this.config.environment?"private-site-".concat(e.id,"-environment-").concat(this.config.environment):"private-site-".concat(e.id),[2,this.cachedEventsChannelName]}})})},t.defaultBaseUrl="https://site-api.datocms.com",t}();function zN(t,e,n){var r=n===void 0?{}:n,o=r.onProgress,i=r.additionalHeaders,s=new XMLHttpRequest;return bd(new Promise(function(a,u){if(o&&s.upload&&(s.upload.onprogress=function(h){h.lengthComputable&&o({type:"UPLOADING_FILE",payload:{progress:Math.round(h.loaded/h.total*100)}})}),s.onreadystatechange=function(){s.readyState===4&&(s.status===200?a():u(new Error("Status ".concat(s.status))))},s.addEventListener("error",u,!1),s.open("PUT",e,!0),i)for(var l=0,c=Object.entries(i);l<c.length;l++){var d=c[l],f=d[0],p=d[1];s.setRequestHeader(f,p)}s.send(t)}),function(){s.onreadystatechange=null,s.abort()})}var Wu=function(){return Wu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Wu.apply(this,arguments)},UN=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},VN=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};function qN(t,e,n){var r=this;n===void 0&&(n={});var o=n.filename||("name"in e?e.name:void 0);if(!o)throw new Error("Missing filename, please provide it as an option!");var i=!1,s=void 0;return bd(function(){return UN(r,void 0,void 0,function(){var a,u,l,c;return VN(this,function(d){switch(d.label){case 0:return n.onProgress&&(n==null||n.onProgress({type:"REQUESTING_UPLOAD_URL",payload:{filename:o}})),[4,t.uploadRequest.create({filename:o})];case 1:if(a=d.sent(),u=a.id,l=a.url,c=a.request_headers,i)throw new wd;return n.onProgress&&n.onProgress({type:"UPLOADING_FILE",payload:{progress:0}}),s=zN(e,l,Wu(Wu({},n),{additionalHeaders:c})),[4,s];case 2:return d.sent(),[2,u]}})})},function(){s?s.cancel():i=!0})}var HN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ku=function(){return Ku=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Ku.apply(this,arguments)},WN=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},KN=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},GN=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 o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n},JN=function(t){HN(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.createFromFileOrBlob=function(n){var r=this,o=!1,i;return bd(function(){return WN(r,void 0,void 0,function(){var s,a,u,l,c;return KN(this,function(d){switch(d.label){case 0:if(o)throw new wd;return s=n.fileOrBlob,a=n.filename,u=n.onProgress,l=GN(n,["fileOrBlob","filename","onProgress"]),i=qN(this.client,s,{filename:a,onProgress:u}),[4,i];case 1:return c=d.sent(),u&&u({type:"CREATING_UPLOAD_OBJECT"}),[2,this.create(Ku(Ku({},l),{path:c}))]}})})},function(){i?i.cancel():o=!0})},e}(wb),YN=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),QN=function(t){YN(e,t);function e(n){var r=t.call(this,n)||this;return r.uploads=new JN(r),r}return e}($N);function Sd(t){return new QN(t)}var bb={exports:{}},un={},_b={exports:{}},Sb={};/**
|
|
24
|
+
* @license React
|
|
25
|
+
* scheduler.production.min.js
|
|
26
|
+
*
|
|
27
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the MIT license found in the
|
|
30
|
+
* LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/(function(t){function e(I,L){var F=I.length;I.push(L);e:for(;0<F;){var Z=F-1>>>1,ie=I[Z];if(0<o(ie,L))I[Z]=L,I[F]=ie,F=Z;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var L=I[0],F=I.pop();if(F!==L){I[0]=F;e:for(var Z=0,ie=I.length,ke=ie>>>1;Z<ke;){var fe=2*(Z+1)-1,Ne=I[fe],pe=fe+1,Ae=I[pe];if(0>o(Ne,F))pe<ie&&0>o(Ae,Ne)?(I[Z]=Ae,I[pe]=F,Z=pe):(I[Z]=Ne,I[fe]=F,Z=fe);else if(pe<ie&&0>o(Ae,F))I[Z]=Ae,I[pe]=F,Z=pe;else break e}}return L}function o(I,L){var F=I.sortIndex-L.sortIndex;return F!==0?F:I.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var u=[],l=[],c=1,d=null,f=3,p=!1,h=!1,m=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=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(I){for(var L=n(l);L!==null;){if(L.callback===null)r(l);else if(L.startTime<=I)r(l),L.sortIndex=L.expirationTime,e(u,L);else break;L=n(l)}}function S(I){if(m=!1,b(I),!h)if(n(u)!==null)h=!0,z(k);else{var L=n(l);L!==null&&K(S,L.startTime-I)}}function k(I,L){h=!1,m&&(m=!1,y(T),T=-1),p=!0;var F=f;try{for(b(L),d=n(u);d!==null&&(!(d.expirationTime>L)||I&&!$());){var Z=d.callback;if(typeof Z=="function"){d.callback=null,f=d.priorityLevel;var ie=Z(d.expirationTime<=L);L=t.unstable_now(),typeof ie=="function"?d.callback=ie:d===n(u)&&r(u),b(L)}else r(u);d=n(u)}if(d!==null)var ke=!0;else{var fe=n(l);fe!==null&&K(S,fe.startTime-L),ke=!1}return ke}finally{d=null,f=F,p=!1}}var E=!1,x=null,T=-1,O=5,N=-1;function $(){return!(t.unstable_now()-N<O)}function P(){if(x!==null){var I=t.unstable_now();N=I;var L=!0;try{L=x(!0,I)}finally{L?D():(E=!1,x=null)}}else E=!1}var D;if(typeof w=="function")D=function(){w(P)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,B=q.port2;q.port1.onmessage=P,D=function(){B.postMessage(null)}}else D=function(){v(P,0)};function z(I){x=I,E||(E=!0,D())}function K(I,L){T=v(function(){I(t.unstable_now())},L)}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(I){I.callback=null},t.unstable_continueExecution=function(){h||p||(h=!0,z(k))},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(I){switch(f){case 1:case 2:case 3:var L=3;break;default:L=f}var F=f;f=L;try{return I()}finally{f=F}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(I,L){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var F=f;f=I;try{return L()}finally{f=F}},t.unstable_scheduleCallback=function(I,L,F){var Z=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?Z+F:Z):F=Z,I){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=F+ie,I={id:c++,callback:L,priorityLevel:I,startTime:F,expirationTime:ie,sortIndex:-1},F>Z?(I.sortIndex=F,e(l,I),n(u)===null&&I===n(l)&&(m?(y(T),T=-1):m=!0,K(S,F-Z))):(I.sortIndex=ie,e(u,I),h||p||(h=!0,z(k))),I},t.unstable_shouldYield=$,t.unstable_wrapCallback=function(I){var L=f;return function(){var F=f;f=L;try{return I.apply(this,arguments)}finally{f=F}}}})(Sb);_b.exports=Sb;var XN=_b.exports;/**
|
|
32
|
+
* @license React
|
|
33
|
+
* react-dom.production.min.js
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/var ZN=_,ln=XN;function W(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 kb=new Set,Ma={};function hi(t,e){cs(t,e),cs(t+"Capture",e)}function cs(t,e){for(Ma[t]=e,t=0;t<e.length;t++)kb.add(e[t])}var Sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ip=Object.prototype.hasOwnProperty,eA=/^[: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]*$/,Jg={},Yg={};function tA(t){return Ip.call(Yg,t)?!0:Ip.call(Jg,t)?!1:eA.test(t)?Yg[t]=!0:(Jg[t]=!0,!1)}function nA(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 rA(t,e,n,r){if(e===null||typeof e>"u"||nA(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 Vt(t,e,n,r,o,i,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=s}var Ct={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ct[t]=new Vt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ct[e]=new Vt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ct[t]=new Vt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ct[t]=new Vt(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){Ct[t]=new Vt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ct[t]=new Vt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ct[t]=new Vt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ct[t]=new Vt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ct[t]=new Vt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Fm=/[\-:]([a-z])/g;function $m(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-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(Fm,$m);Ct[e]=new Vt(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(Fm,$m);Ct[e]=new Vt(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(Fm,$m);Ct[e]=new Vt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ct[t]=new Vt(t,1,!1,t.toLowerCase(),null,!1,!1)});Ct.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ct[t]=new Vt(t,1,!1,t.toLowerCase(),null,!0,!0)});function zm(t,e,n,r){var o=Ct.hasOwnProperty(e)?Ct[e]:null;(o!==null?o.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(rA(e,n,o,r)&&(n=null),r||o===null?tA(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):o.mustUseProperty?t[o.propertyName]=n===null?o.type===3?!1:"":n:(e=o.attributeName,r=o.attributeNamespace,n===null?t.removeAttribute(e):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Mr=ZN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Il=Symbol.for("react.element"),Oi=Symbol.for("react.portal"),Ni=Symbol.for("react.fragment"),Um=Symbol.for("react.strict_mode"),Pp=Symbol.for("react.profiler"),xb=Symbol.for("react.provider"),Eb=Symbol.for("react.context"),Vm=Symbol.for("react.forward_ref"),Rp=Symbol.for("react.suspense"),Dp=Symbol.for("react.suspense_list"),qm=Symbol.for("react.memo"),jr=Symbol.for("react.lazy"),Tb=Symbol.for("react.offscreen"),Qg=Symbol.iterator;function Is(t){return t===null||typeof t!="object"?null:(t=Qg&&t[Qg]||t["@@iterator"],typeof t=="function"?t:null)}var Ge=Object.assign,df;function Ys(t){if(df===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);df=e&&e[1]||""}return`
|
|
40
|
+
`+df+t}var ff=!1;function pf(t,e){if(!t||ff)return"";ff=!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(l){var r=l}Reflect.construct(t,[],e)}else{try{e.call()}catch(l){r=l}t.call(e.prototype)}else{try{throw Error()}catch(l){r=l}t()}}catch(l){if(l&&r&&typeof l.stack=="string"){for(var o=l.stack.split(`
|
|
41
|
+
`),i=r.stack.split(`
|
|
42
|
+
`),s=o.length-1,a=i.length-1;1<=s&&0<=a&&o[s]!==i[a];)a--;for(;1<=s&&0<=a;s--,a--)if(o[s]!==i[a]){if(s!==1||a!==1)do if(s--,a--,0>a||o[s]!==i[a]){var u=`
|
|
43
|
+
`+o[s].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=s&&0<=a);break}}}finally{ff=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ys(t):""}function oA(t){switch(t.tag){case 5:return Ys(t.type);case 16:return Ys("Lazy");case 13:return Ys("Suspense");case 19:return Ys("SuspenseList");case 0:case 2:case 15:return t=pf(t.type,!1),t;case 11:return t=pf(t.type.render,!1),t;case 1:return t=pf(t.type,!0),t;default:return""}}function jp(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 Ni:return"Fragment";case Oi:return"Portal";case Pp:return"Profiler";case Um:return"StrictMode";case Rp:return"Suspense";case Dp:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Eb:return(t.displayName||"Context")+".Consumer";case xb:return(t._context.displayName||"Context")+".Provider";case Vm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case qm:return e=t.displayName||null,e!==null?e:jp(t.type)||"Memo";case jr:e=t._payload,t=t._init;try{return jp(t(e))}catch{}}return null}function iA(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 jp(e);case 8:return e===Um?"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 co(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Cb(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function sA(t){var e=Cb(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 o=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Pl(t){t._valueTracker||(t._valueTracker=sA(t))}function Mb(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Cb(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Gu(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 Lp(t,e){var n=e.checked;return Ge({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Xg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=co(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 Ob(t,e){e=e.checked,e!=null&&zm(t,"checked",e,!1)}function Bp(t,e){Ob(t,e);var n=co(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")?Fp(t,e.type,n):e.hasOwnProperty("defaultValue")&&Fp(t,e.type,co(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Zg(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 Fp(t,e,n){(e!=="number"||Gu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Qs=Array.isArray;function Xi(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o<n.length;o++)e["$"+n[o]]=!0;for(n=0;n<t.length;n++)o=e.hasOwnProperty("$"+t[n].value),t[n].selected!==o&&(t[n].selected=o),o&&r&&(t[n].defaultSelected=!0)}else{for(n=""+co(n),e=null,o=0;o<t.length;o++){if(t[o].value===n){t[o].selected=!0,r&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function $p(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(W(91));return Ge({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function e0(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(W(92));if(Qs(n)){if(1<n.length)throw Error(W(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:co(n)}}function Nb(t,e){var n=co(e.value),r=co(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 t0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Ab(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 zp(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Ab(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Rl,Ib=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,o){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,o)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Rl=Rl||document.createElement("div"),Rl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Rl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Oa(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var sa={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},aA=["Webkit","ms","Moz","O"];Object.keys(sa).forEach(function(t){aA.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),sa[e]=sa[t]})});function Pb(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||sa.hasOwnProperty(t)&&sa[t]?(""+e).trim():e+"px"}function Rb(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Pb(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var lA=Ge({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 Up(t,e){if(e){if(lA[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function Vp(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 qp=null;function Hm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Hp=null,Zi=null,es=null;function n0(t){if(t=Sl(t)){if(typeof Hp!="function")throw Error(W(280));var e=t.stateNode;e&&(e=Cd(e),Hp(t.stateNode,t.type,e))}}function Db(t){Zi?es?es.push(t):es=[t]:Zi=t}function jb(){if(Zi){var t=Zi,e=es;if(es=Zi=null,n0(t),e)for(t=0;t<e.length;t++)n0(e[t])}}function Lb(t,e){return t(e)}function Bb(){}var hf=!1;function Fb(t,e,n){if(hf)return t(e,n);hf=!0;try{return Lb(t,e,n)}finally{hf=!1,(Zi!==null||es!==null)&&(Bb(),jb())}}function Na(t,e){var n=t.stateNode;if(n===null)return null;var r=Cd(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(W(231,e,typeof n));return n}var Wp=!1;if(Sr)try{var Ps={};Object.defineProperty(Ps,"passive",{get:function(){Wp=!0}}),window.addEventListener("test",Ps,Ps),window.removeEventListener("test",Ps,Ps)}catch{Wp=!1}function uA(t,e,n,r,o,i,s,a,u){var l=Array.prototype.slice.call(arguments,3);try{e.apply(n,l)}catch(c){this.onError(c)}}var aa=!1,Ju=null,Yu=!1,Kp=null,cA={onError:function(t){aa=!0,Ju=t}};function dA(t,e,n,r,o,i,s,a,u){aa=!1,Ju=null,uA.apply(cA,arguments)}function fA(t,e,n,r,o,i,s,a,u){if(dA.apply(this,arguments),aa){if(aa){var l=Ju;aa=!1,Ju=null}else throw Error(W(198));Yu||(Yu=!0,Kp=l)}}function mi(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 $b(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 r0(t){if(mi(t)!==t)throw Error(W(188))}function pA(t){var e=t.alternate;if(!e){if(e=mi(t),e===null)throw Error(W(188));return e!==t?null:t}for(var n=t,r=e;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return r0(o),t;if(i===r)return r0(o),e;i=i.sibling}throw Error(W(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s){for(a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?t:e}function zb(t){return t=pA(t),t!==null?Ub(t):null}function Ub(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Ub(t);if(e!==null)return e;t=t.sibling}return null}var Vb=ln.unstable_scheduleCallback,o0=ln.unstable_cancelCallback,hA=ln.unstable_shouldYield,mA=ln.unstable_requestPaint,Ze=ln.unstable_now,yA=ln.unstable_getCurrentPriorityLevel,Wm=ln.unstable_ImmediatePriority,qb=ln.unstable_UserBlockingPriority,Qu=ln.unstable_NormalPriority,gA=ln.unstable_LowPriority,Hb=ln.unstable_IdlePriority,kd=null,Zn=null;function vA(t){if(Zn&&typeof Zn.onCommitFiberRoot=="function")try{Zn.onCommitFiberRoot(kd,t,void 0,(t.current.flags&128)===128)}catch{}}var Ln=Math.clz32?Math.clz32:_A,wA=Math.log,bA=Math.LN2;function _A(t){return t>>>=0,t===0?32:31-(wA(t)/bA|0)|0}var Dl=64,jl=4194304;function Xs(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 Xu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,o=t.suspendedLanes,i=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=Xs(a):(i&=s,i!==0&&(r=Xs(i)))}else s=n&~o,s!==0?r=Xs(s):i!==0&&(r=Xs(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&o)&&(o=r&-r,i=e&-e,o>=i||o===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-Ln(e),o=1<<n,r|=t[n],e&=~o;return r}function SA(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 kA(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var s=31-Ln(i),a=1<<s,u=o[s];u===-1?(!(a&n)||a&r)&&(o[s]=SA(a,e)):u<=e&&(t.expiredLanes|=a),i&=~a}}function Gp(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Wb(){var t=Dl;return Dl<<=1,!(Dl&4194240)&&(Dl=64),t}function mf(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function bl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Ln(e),t[e]=n}function xA(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 o=31-Ln(n),i=1<<o;e[o]=0,r[o]=-1,t[o]=-1,n&=~i}}function Km(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Ln(n),o=1<<r;o&e|t[r]&e&&(t[r]|=e),n&=~o}}var Oe=0;function Kb(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Gb,Gm,Jb,Yb,Qb,Jp=!1,Ll=[],Qr=null,Xr=null,Zr=null,Aa=new Map,Ia=new Map,zr=[],EA="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 i0(t,e){switch(t){case"focusin":case"focusout":Qr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Zr=null;break;case"pointerover":case"pointerout":Aa.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ia.delete(e.pointerId)}}function Rs(t,e,n,r,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},e!==null&&(e=Sl(e),e!==null&&Gm(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function TA(t,e,n,r,o){switch(e){case"focusin":return Qr=Rs(Qr,t,e,n,r,o),!0;case"dragenter":return Xr=Rs(Xr,t,e,n,r,o),!0;case"mouseover":return Zr=Rs(Zr,t,e,n,r,o),!0;case"pointerover":var i=o.pointerId;return Aa.set(i,Rs(Aa.get(i)||null,t,e,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ia.set(i,Rs(Ia.get(i)||null,t,e,n,r,o)),!0}return!1}function Xb(t){var e=Po(t.target);if(e!==null){var n=mi(e);if(n!==null){if(e=n.tag,e===13){if(e=$b(n),e!==null){t.blockedOn=e,Qb(t.priority,function(){Jb(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 Su(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Yp(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);qp=r,n.target.dispatchEvent(r),qp=null}else return e=Sl(n),e!==null&&Gm(e),t.blockedOn=n,!1;e.shift()}return!0}function s0(t,e,n){Su(t)&&n.delete(e)}function CA(){Jp=!1,Qr!==null&&Su(Qr)&&(Qr=null),Xr!==null&&Su(Xr)&&(Xr=null),Zr!==null&&Su(Zr)&&(Zr=null),Aa.forEach(s0),Ia.forEach(s0)}function Ds(t,e){t.blockedOn===e&&(t.blockedOn=null,Jp||(Jp=!0,ln.unstable_scheduleCallback(ln.unstable_NormalPriority,CA)))}function Pa(t){function e(o){return Ds(o,t)}if(0<Ll.length){Ds(Ll[0],t);for(var n=1;n<Ll.length;n++){var r=Ll[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Qr!==null&&Ds(Qr,t),Xr!==null&&Ds(Xr,t),Zr!==null&&Ds(Zr,t),Aa.forEach(e),Ia.forEach(e),n=0;n<zr.length;n++)r=zr[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<zr.length&&(n=zr[0],n.blockedOn===null);)Xb(n),n.blockedOn===null&&zr.shift()}var ts=Mr.ReactCurrentBatchConfig,Zu=!0;function MA(t,e,n,r){var o=Oe,i=ts.transition;ts.transition=null;try{Oe=1,Jm(t,e,n,r)}finally{Oe=o,ts.transition=i}}function OA(t,e,n,r){var o=Oe,i=ts.transition;ts.transition=null;try{Oe=4,Jm(t,e,n,r)}finally{Oe=o,ts.transition=i}}function Jm(t,e,n,r){if(Zu){var o=Yp(t,e,n,r);if(o===null)Ef(t,e,r,ec,n),i0(t,r);else if(TA(o,t,e,n,r))r.stopPropagation();else if(i0(t,r),e&4&&-1<EA.indexOf(t)){for(;o!==null;){var i=Sl(o);if(i!==null&&Gb(i),i=Yp(t,e,n,r),i===null&&Ef(t,e,r,ec,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Ef(t,e,r,null,n)}}var ec=null;function Yp(t,e,n,r){if(ec=null,t=Hm(r),t=Po(t),t!==null)if(e=mi(t),e===null)t=null;else if(n=e.tag,n===13){if(t=$b(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 ec=t,null}function Zb(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(yA()){case Wm:return 1;case qb:return 4;case Qu:case gA:return 16;case Hb:return 536870912;default:return 16}default:return 16}}var Wr=null,Ym=null,ku=null;function e_(){if(ku)return ku;var t,e=Ym,n=e.length,r,o="value"in Wr?Wr.value:Wr.textContent,i=o.length;for(t=0;t<n&&e[t]===o[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===o[i-r];r++);return ku=o.slice(t,1<r?1-r:void 0)}function xu(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 Bl(){return!0}function a0(){return!1}function cn(t){function e(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,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)?Bl:a0,this.isPropagationStopped=a0,this}return Ge(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=Bl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Bl)},persist:function(){},isPersistent:Bl}),e}var Ms={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qm=cn(Ms),_l=Ge({},Ms,{view:0,detail:0}),NA=cn(_l),yf,gf,js,xd=Ge({},_l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xm,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!==js&&(js&&t.type==="mousemove"?(yf=t.screenX-js.screenX,gf=t.screenY-js.screenY):gf=yf=0,js=t),yf)},movementY:function(t){return"movementY"in t?t.movementY:gf}}),l0=cn(xd),AA=Ge({},xd,{dataTransfer:0}),IA=cn(AA),PA=Ge({},_l,{relatedTarget:0}),vf=cn(PA),RA=Ge({},Ms,{animationName:0,elapsedTime:0,pseudoElement:0}),DA=cn(RA),jA=Ge({},Ms,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),LA=cn(jA),BA=Ge({},Ms,{data:0}),u0=cn(BA),FA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$A={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"},zA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function UA(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=zA[t])?!!e[t]:!1}function Xm(){return UA}var VA=Ge({},_l,{key:function(t){if(t.key){var e=FA[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=xu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?$A[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xm,charCode:function(t){return t.type==="keypress"?xu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?xu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),qA=cn(VA),HA=Ge({},xd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),c0=cn(HA),WA=Ge({},_l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xm}),KA=cn(WA),GA=Ge({},Ms,{propertyName:0,elapsedTime:0,pseudoElement:0}),JA=cn(GA),YA=Ge({},xd,{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}),QA=cn(YA),XA=[9,13,27,32],Zm=Sr&&"CompositionEvent"in window,la=null;Sr&&"documentMode"in document&&(la=document.documentMode);var ZA=Sr&&"TextEvent"in window&&!la,t_=Sr&&(!Zm||la&&8<la&&11>=la),d0=" ",f0=!1;function n_(t,e){switch(t){case"keyup":return XA.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ai=!1;function eI(t,e){switch(t){case"compositionend":return r_(e);case"keypress":return e.which!==32?null:(f0=!0,d0);case"textInput":return t=e.data,t===d0&&f0?null:t;default:return null}}function tI(t,e){if(Ai)return t==="compositionend"||!Zm&&n_(t,e)?(t=e_(),ku=Ym=Wr=null,Ai=!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 t_&&e.locale!=="ko"?null:e.data;default:return null}}var nI={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 p0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!nI[t.type]:e==="textarea"}function o_(t,e,n,r){Db(r),e=tc(e,"onChange"),0<e.length&&(n=new Qm("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ua=null,Ra=null;function rI(t){m_(t,0)}function Ed(t){var e=Ri(t);if(Mb(e))return t}function oI(t,e){if(t==="change")return e}var i_=!1;if(Sr){var wf;if(Sr){var bf="oninput"in document;if(!bf){var h0=document.createElement("div");h0.setAttribute("oninput","return;"),bf=typeof h0.oninput=="function"}wf=bf}else wf=!1;i_=wf&&(!document.documentMode||9<document.documentMode)}function m0(){ua&&(ua.detachEvent("onpropertychange",s_),Ra=ua=null)}function s_(t){if(t.propertyName==="value"&&Ed(Ra)){var e=[];o_(e,Ra,t,Hm(t)),Fb(rI,e)}}function iI(t,e,n){t==="focusin"?(m0(),ua=e,Ra=n,ua.attachEvent("onpropertychange",s_)):t==="focusout"&&m0()}function sI(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ed(Ra)}function aI(t,e){if(t==="click")return Ed(e)}function lI(t,e){if(t==="input"||t==="change")return Ed(e)}function uI(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Fn=typeof Object.is=="function"?Object.is:uI;function Da(t,e){if(Fn(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 o=n[r];if(!Ip.call(e,o)||!Fn(t[o],e[o]))return!1}return!0}function y0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function g0(t,e){var n=y0(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=y0(n)}}function a_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?a_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function l_(){for(var t=window,e=Gu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Gu(t.document)}return e}function ey(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 cI(t){var e=l_(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&a_(n.ownerDocument.documentElement,n)){if(r!==null&&ey(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 o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!t.extend&&i>r&&(o=r,r=i,i=o),o=g0(n,i);var s=g0(n,r);o&&s&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.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 dI=Sr&&"documentMode"in document&&11>=document.documentMode,Ii=null,Qp=null,ca=null,Xp=!1;function v0(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xp||Ii==null||Ii!==Gu(r)||(r=Ii,"selectionStart"in r&&ey(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ca&&Da(ca,r)||(ca=r,r=tc(Qp,"onSelect"),0<r.length&&(e=new Qm("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Ii)))}function Fl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Pi={animationend:Fl("Animation","AnimationEnd"),animationiteration:Fl("Animation","AnimationIteration"),animationstart:Fl("Animation","AnimationStart"),transitionend:Fl("Transition","TransitionEnd")},_f={},u_={};Sr&&(u_=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function Td(t){if(_f[t])return _f[t];if(!Pi[t])return t;var e=Pi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in u_)return _f[t]=e[n];return t}var c_=Td("animationend"),d_=Td("animationiteration"),f_=Td("animationstart"),p_=Td("transitionend"),h_=new Map,w0="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 mo(t,e){h_.set(t,e),hi(e,[t])}for(var Sf=0;Sf<w0.length;Sf++){var kf=w0[Sf],fI=kf.toLowerCase(),pI=kf[0].toUpperCase()+kf.slice(1);mo(fI,"on"+pI)}mo(c_,"onAnimationEnd");mo(d_,"onAnimationIteration");mo(f_,"onAnimationStart");mo("dblclick","onDoubleClick");mo("focusin","onFocus");mo("focusout","onBlur");mo(p_,"onTransitionEnd");cs("onMouseEnter",["mouseout","mouseover"]);cs("onMouseLeave",["mouseout","mouseover"]);cs("onPointerEnter",["pointerout","pointerover"]);cs("onPointerLeave",["pointerout","pointerover"]);hi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));hi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));hi("onBeforeInput",["compositionend","keypress","textInput","paste"]);hi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));hi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));hi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zs="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(" "),hI=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zs));function b0(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,fA(r,e,void 0,t),t.currentTarget=null}function m_(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],o=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var s=r.length-1;0<=s;s--){var a=r[s],u=a.instance,l=a.currentTarget;if(a=a.listener,u!==i&&o.isPropagationStopped())break e;b0(o,a,l),i=u}else for(s=0;s<r.length;s++){if(a=r[s],u=a.instance,l=a.currentTarget,a=a.listener,u!==i&&o.isPropagationStopped())break e;b0(o,a,l),i=u}}}if(Yu)throw t=Kp,Yu=!1,Kp=null,t}function Re(t,e){var n=e[rh];n===void 0&&(n=e[rh]=new Set);var r=t+"__bubble";n.has(r)||(y_(e,t,2,!1),n.add(r))}function xf(t,e,n){var r=0;e&&(r|=4),y_(n,t,r,e)}var $l="_reactListening"+Math.random().toString(36).slice(2);function ja(t){if(!t[$l]){t[$l]=!0,kb.forEach(function(n){n!=="selectionchange"&&(hI.has(n)||xf(n,!1,t),xf(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[$l]||(e[$l]=!0,xf("selectionchange",!1,e))}}function y_(t,e,n,r){switch(Zb(e)){case 1:var o=MA;break;case 4:o=OA;break;default:o=Jm}n=o.bind(null,e,n,t),o=void 0,!Wp||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),r?o!==void 0?t.addEventListener(e,n,{capture:!0,passive:o}):t.addEventListener(e,n,!0):o!==void 0?t.addEventListener(e,n,{passive:o}):t.addEventListener(e,n,!1)}function Ef(t,e,n,r,o){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var u=s.tag;if((u===3||u===4)&&(u=s.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;s=s.return}for(;a!==null;){if(s=Po(a),s===null)return;if(u=s.tag,u===5||u===6){r=i=s;continue e}a=a.parentNode}}r=r.return}Fb(function(){var l=i,c=Hm(n),d=[];e:{var f=h_.get(t);if(f!==void 0){var p=Qm,h=t;switch(t){case"keypress":if(xu(n)===0)break e;case"keydown":case"keyup":p=qA;break;case"focusin":h="focus",p=vf;break;case"focusout":h="blur",p=vf;break;case"beforeblur":case"afterblur":p=vf;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=l0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=IA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=KA;break;case c_:case d_:case f_:p=DA;break;case p_:p=JA;break;case"scroll":p=NA;break;case"wheel":p=QA;break;case"copy":case"cut":case"paste":p=LA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=c0}var m=(e&4)!==0,v=!m&&t==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var w=l,b;w!==null;){b=w;var S=b.stateNode;if(b.tag===5&&S!==null&&(b=S,y!==null&&(S=Na(w,y),S!=null&&m.push(La(w,S,b)))),v)break;w=w.return}0<m.length&&(f=new p(f,h,null,n,c),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&n!==qp&&(h=n.relatedTarget||n.fromElement)&&(Po(h)||h[kr]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(h=n.relatedTarget||n.toElement,p=l,h=h?Po(h):null,h!==null&&(v=mi(h),h!==v||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=l),p!==h)){if(m=l0,S="onMouseLeave",y="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(m=c0,S="onPointerLeave",y="onPointerEnter",w="pointer"),v=p==null?f:Ri(p),b=h==null?f:Ri(h),f=new m(S,w+"leave",p,n,c),f.target=v,f.relatedTarget=b,S=null,Po(c)===l&&(m=new m(y,w+"enter",h,n,c),m.target=b,m.relatedTarget=v,S=m),v=S,p&&h)t:{for(m=p,y=h,w=0,b=m;b;b=bi(b))w++;for(b=0,S=y;S;S=bi(S))b++;for(;0<w-b;)m=bi(m),w--;for(;0<b-w;)y=bi(y),b--;for(;w--;){if(m===y||y!==null&&m===y.alternate)break t;m=bi(m),y=bi(y)}m=null}else m=null;p!==null&&_0(d,f,p,m,!1),h!==null&&v!==null&&_0(d,v,h,m,!0)}}e:{if(f=l?Ri(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var k=oI;else if(p0(f))if(i_)k=lI;else{k=sI;var E=iI}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=aI);if(k&&(k=k(t,l))){o_(d,k,n,c);break e}E&&E(t,f,l),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&Fp(f,"number",f.value)}switch(E=l?Ri(l):window,t){case"focusin":(p0(E)||E.contentEditable==="true")&&(Ii=E,Qp=l,ca=null);break;case"focusout":ca=Qp=Ii=null;break;case"mousedown":Xp=!0;break;case"contextmenu":case"mouseup":case"dragend":Xp=!1,v0(d,n,c);break;case"selectionchange":if(dI)break;case"keydown":case"keyup":v0(d,n,c)}var x;if(Zm)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ai?n_(t,n)&&(T="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(t_&&n.locale!=="ko"&&(Ai||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ai&&(x=e_()):(Wr=c,Ym="value"in Wr?Wr.value:Wr.textContent,Ai=!0)),E=tc(l,T),0<E.length&&(T=new u0(T,t,null,n,c),d.push({event:T,listeners:E}),x?T.data=x:(x=r_(n),x!==null&&(T.data=x)))),(x=ZA?eI(t,n):tI(t,n))&&(l=tc(l,"onBeforeInput"),0<l.length&&(c=new u0("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:l}),c.data=x))}m_(d,e)})}function La(t,e,n){return{instance:t,listener:e,currentTarget:n}}function tc(t,e){for(var n=e+"Capture",r=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Na(t,n),i!=null&&r.unshift(La(t,i,o)),i=Na(t,e),i!=null&&r.push(La(t,i,o))),t=t.return}return r}function bi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function _0(t,e,n,r,o){for(var i=e._reactName,s=[];n!==null&&n!==r;){var a=n,u=a.alternate,l=a.stateNode;if(u!==null&&u===r)break;a.tag===5&&l!==null&&(a=l,o?(u=Na(n,i),u!=null&&s.unshift(La(n,u,a))):o||(u=Na(n,i),u!=null&&s.push(La(n,u,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var mI=/\r\n?/g,yI=/\u0000|\uFFFD/g;function S0(t){return(typeof t=="string"?t:""+t).replace(mI,`
|
|
44
|
+
`).replace(yI,"")}function zl(t,e,n){if(e=S0(e),S0(t)!==e&&n)throw Error(W(425))}function nc(){}var Zp=null,eh=null;function th(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 nh=typeof setTimeout=="function"?setTimeout:void 0,gI=typeof clearTimeout=="function"?clearTimeout:void 0,k0=typeof Promise=="function"?Promise:void 0,vI=typeof queueMicrotask=="function"?queueMicrotask:typeof k0<"u"?function(t){return k0.resolve(null).then(t).catch(wI)}:nh;function wI(t){setTimeout(function(){throw t})}function Tf(t,e){var n=e,r=0;do{var o=n.nextSibling;if(t.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){t.removeChild(o),Pa(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Pa(e)}function eo(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 x0(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 Os=Math.random().toString(36).slice(2),Jn="__reactFiber$"+Os,Ba="__reactProps$"+Os,kr="__reactContainer$"+Os,rh="__reactEvents$"+Os,bI="__reactListeners$"+Os,_I="__reactHandles$"+Os;function Po(t){var e=t[Jn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[kr]||n[Jn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=x0(t);t!==null;){if(n=t[Jn])return n;t=x0(t)}return e}t=n,n=t.parentNode}return null}function Sl(t){return t=t[Jn]||t[kr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ri(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(W(33))}function Cd(t){return t[Ba]||null}var oh=[],Di=-1;function yo(t){return{current:t}}function je(t){0>Di||(t.current=oh[Di],oh[Di]=null,Di--)}function Pe(t,e){Di++,oh[Di]=t.current,t.current=e}var fo={},Pt=yo(fo),Yt=yo(!1),Qo=fo;function ds(t,e){var n=t.type.contextTypes;if(!n)return fo;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Qt(t){return t=t.childContextTypes,t!=null}function rc(){je(Yt),je(Pt)}function E0(t,e,n){if(Pt.current!==fo)throw Error(W(168));Pe(Pt,e),Pe(Yt,n)}function g_(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in e))throw Error(W(108,iA(t)||"Unknown",o));return Ge({},n,r)}function oc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||fo,Qo=Pt.current,Pe(Pt,t),Pe(Yt,Yt.current),!0}function T0(t,e,n){var r=t.stateNode;if(!r)throw Error(W(169));n?(t=g_(t,e,Qo),r.__reactInternalMemoizedMergedChildContext=t,je(Yt),je(Pt),Pe(Pt,t)):je(Yt),Pe(Yt,n)}var dr=null,Md=!1,Cf=!1;function v_(t){dr===null?dr=[t]:dr.push(t)}function SI(t){Md=!0,v_(t)}function go(){if(!Cf&&dr!==null){Cf=!0;var t=0,e=Oe;try{var n=dr;for(Oe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}dr=null,Md=!1}catch(o){throw dr!==null&&(dr=dr.slice(t+1)),Vb(Wm,go),o}finally{Oe=e,Cf=!1}}return null}var ji=[],Li=0,ic=null,sc=0,gn=[],vn=0,Xo=null,pr=1,hr="";function To(t,e){ji[Li++]=sc,ji[Li++]=ic,ic=t,sc=e}function w_(t,e,n){gn[vn++]=pr,gn[vn++]=hr,gn[vn++]=Xo,Xo=t;var r=pr;t=hr;var o=32-Ln(r)-1;r&=~(1<<o),n+=1;var i=32-Ln(e)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,pr=1<<32-Ln(e)+o|n<<o|r,hr=i+t}else pr=1<<i|n<<o|r,hr=t}function ty(t){t.return!==null&&(To(t,1),w_(t,1,0))}function ny(t){for(;t===ic;)ic=ji[--Li],ji[Li]=null,sc=ji[--Li],ji[Li]=null;for(;t===Xo;)Xo=gn[--vn],gn[vn]=null,hr=gn[--vn],gn[vn]=null,pr=gn[--vn],gn[vn]=null}var sn=null,on=null,Be=!1,Pn=null;function b_(t,e){var n=bn(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 C0(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,sn=t,on=eo(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,sn=t,on=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Xo!==null?{id:pr,overflow:hr}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=bn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,sn=t,on=null,!0):!1;default:return!1}}function ih(t){return(t.mode&1)!==0&&(t.flags&128)===0}function sh(t){if(Be){var e=on;if(e){var n=e;if(!C0(t,e)){if(ih(t))throw Error(W(418));e=eo(n.nextSibling);var r=sn;e&&C0(t,e)?b_(r,n):(t.flags=t.flags&-4097|2,Be=!1,sn=t)}}else{if(ih(t))throw Error(W(418));t.flags=t.flags&-4097|2,Be=!1,sn=t}}}function M0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;sn=t}function Ul(t){if(t!==sn)return!1;if(!Be)return M0(t),Be=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!th(t.type,t.memoizedProps)),e&&(e=on)){if(ih(t))throw __(),Error(W(418));for(;e;)b_(t,e),e=eo(e.nextSibling)}if(M0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){on=eo(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}on=null}}else on=sn?eo(t.stateNode.nextSibling):null;return!0}function __(){for(var t=on;t;)t=eo(t.nextSibling)}function fs(){on=sn=null,Be=!1}function ry(t){Pn===null?Pn=[t]:Pn.push(t)}var kI=Mr.ReactCurrentBatchConfig;function Ls(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(W(309));var r=n.stateNode}if(!r)throw Error(W(147,t));var o=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},e._stringRef=i,e)}if(typeof t!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,t))}return t}function Vl(t,e){throw t=Object.prototype.toString.call(e),Error(W(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function O0(t){var e=t._init;return e(t._payload)}function S_(t){function e(y,w){if(t){var b=y.deletions;b===null?(y.deletions=[w],y.flags|=16):b.push(w)}}function n(y,w){if(!t)return null;for(;w!==null;)e(y,w),w=w.sibling;return null}function r(y,w){for(y=new Map;w!==null;)w.key!==null?y.set(w.key,w):y.set(w.index,w),w=w.sibling;return y}function o(y,w){return y=oo(y,w),y.index=0,y.sibling=null,y}function i(y,w,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<w?(y.flags|=2,w):b):(y.flags|=2,w)):(y.flags|=1048576,w)}function s(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,w,b,S){return w===null||w.tag!==6?(w=Rf(b,y.mode,S),w.return=y,w):(w=o(w,b),w.return=y,w)}function u(y,w,b,S){var k=b.type;return k===Ni?c(y,w,b.props.children,S,b.key):w!==null&&(w.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===jr&&O0(k)===w.type)?(S=o(w,b.props),S.ref=Ls(y,w,b),S.return=y,S):(S=Au(b.type,b.key,b.props,null,y.mode,S),S.ref=Ls(y,w,b),S.return=y,S)}function l(y,w,b,S){return w===null||w.tag!==4||w.stateNode.containerInfo!==b.containerInfo||w.stateNode.implementation!==b.implementation?(w=Df(b,y.mode,S),w.return=y,w):(w=o(w,b.children||[]),w.return=y,w)}function c(y,w,b,S,k){return w===null||w.tag!==7?(w=Uo(b,y.mode,S,k),w.return=y,w):(w=o(w,b),w.return=y,w)}function d(y,w,b){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Rf(""+w,y.mode,b),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Il:return b=Au(w.type,w.key,w.props,null,y.mode,b),b.ref=Ls(y,null,w),b.return=y,b;case Oi:return w=Df(w,y.mode,b),w.return=y,w;case jr:var S=w._init;return d(y,S(w._payload),b)}if(Qs(w)||Is(w))return w=Uo(w,y.mode,b,null),w.return=y,w;Vl(y,w)}return null}function f(y,w,b,S){var k=w!==null?w.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return k!==null?null:a(y,w,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Il:return b.key===k?u(y,w,b,S):null;case Oi:return b.key===k?l(y,w,b,S):null;case jr:return k=b._init,f(y,w,k(b._payload),S)}if(Qs(b)||Is(b))return k!==null?null:c(y,w,b,S,null);Vl(y,b)}return null}function p(y,w,b,S,k){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(b)||null,a(w,y,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Il:return y=y.get(S.key===null?b:S.key)||null,u(w,y,S,k);case Oi:return y=y.get(S.key===null?b:S.key)||null,l(w,y,S,k);case jr:var E=S._init;return p(y,w,b,E(S._payload),k)}if(Qs(S)||Is(S))return y=y.get(b)||null,c(w,y,S,k,null);Vl(w,S)}return null}function h(y,w,b,S){for(var k=null,E=null,x=w,T=w=0,O=null;x!==null&&T<b.length;T++){x.index>T?(O=x,x=null):O=x.sibling;var N=f(y,x,b[T],S);if(N===null){x===null&&(x=O);break}t&&x&&N.alternate===null&&e(y,x),w=i(N,w,T),E===null?k=N:E.sibling=N,E=N,x=O}if(T===b.length)return n(y,x),Be&&To(y,T),k;if(x===null){for(;T<b.length;T++)x=d(y,b[T],S),x!==null&&(w=i(x,w,T),E===null?k=x:E.sibling=x,E=x);return Be&&To(y,T),k}for(x=r(y,x);T<b.length;T++)O=p(x,y,T,b[T],S),O!==null&&(t&&O.alternate!==null&&x.delete(O.key===null?T:O.key),w=i(O,w,T),E===null?k=O:E.sibling=O,E=O);return t&&x.forEach(function($){return e(y,$)}),Be&&To(y,T),k}function m(y,w,b,S){var k=Is(b);if(typeof k!="function")throw Error(W(150));if(b=k.call(b),b==null)throw Error(W(151));for(var E=k=null,x=w,T=w=0,O=null,N=b.next();x!==null&&!N.done;T++,N=b.next()){x.index>T?(O=x,x=null):O=x.sibling;var $=f(y,x,N.value,S);if($===null){x===null&&(x=O);break}t&&x&&$.alternate===null&&e(y,x),w=i($,w,T),E===null?k=$:E.sibling=$,E=$,x=O}if(N.done)return n(y,x),Be&&To(y,T),k;if(x===null){for(;!N.done;T++,N=b.next())N=d(y,N.value,S),N!==null&&(w=i(N,w,T),E===null?k=N:E.sibling=N,E=N);return Be&&To(y,T),k}for(x=r(y,x);!N.done;T++,N=b.next())N=p(x,y,T,N.value,S),N!==null&&(t&&N.alternate!==null&&x.delete(N.key===null?T:N.key),w=i(N,w,T),E===null?k=N:E.sibling=N,E=N);return t&&x.forEach(function(P){return e(y,P)}),Be&&To(y,T),k}function v(y,w,b,S){if(typeof b=="object"&&b!==null&&b.type===Ni&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Il:e:{for(var k=b.key,E=w;E!==null;){if(E.key===k){if(k=b.type,k===Ni){if(E.tag===7){n(y,E.sibling),w=o(E,b.props.children),w.return=y,y=w;break e}}else if(E.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===jr&&O0(k)===E.type){n(y,E.sibling),w=o(E,b.props),w.ref=Ls(y,E,b),w.return=y,y=w;break e}n(y,E);break}else e(y,E);E=E.sibling}b.type===Ni?(w=Uo(b.props.children,y.mode,S,b.key),w.return=y,y=w):(S=Au(b.type,b.key,b.props,null,y.mode,S),S.ref=Ls(y,w,b),S.return=y,y=S)}return s(y);case Oi:e:{for(E=b.key;w!==null;){if(w.key===E)if(w.tag===4&&w.stateNode.containerInfo===b.containerInfo&&w.stateNode.implementation===b.implementation){n(y,w.sibling),w=o(w,b.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else e(y,w);w=w.sibling}w=Df(b,y.mode,S),w.return=y,y=w}return s(y);case jr:return E=b._init,v(y,w,E(b._payload),S)}if(Qs(b))return h(y,w,b,S);if(Is(b))return m(y,w,b,S);Vl(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(n(y,w.sibling),w=o(w,b),w.return=y,y=w):(n(y,w),w=Rf(b,y.mode,S),w.return=y,y=w),s(y)):n(y,w)}return v}var ps=S_(!0),k_=S_(!1),ac=yo(null),lc=null,Bi=null,oy=null;function iy(){oy=Bi=lc=null}function sy(t){var e=ac.current;je(ac),t._currentValue=e}function ah(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 ns(t,e){lc=t,oy=Bi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Jt=!0),t.firstContext=null)}function Tn(t){var e=t._currentValue;if(oy!==t)if(t={context:t,memoizedValue:e,next:null},Bi===null){if(lc===null)throw Error(W(308));Bi=t,lc.dependencies={lanes:0,firstContext:t}}else Bi=Bi.next=t;return e}var Ro=null;function ay(t){Ro===null?Ro=[t]:Ro.push(t)}function x_(t,e,n,r){var o=e.interleaved;return o===null?(n.next=n,ay(e)):(n.next=o.next,o.next=n),e.interleaved=n,xr(t,r)}function xr(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 Lr=!1;function ly(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function E_(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 gr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function to(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,xe&2){var o=r.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),r.pending=e,xr(t,n)}return o=r.interleaved,o===null?(e.next=e,ay(r)):(e.next=o.next,o.next=e),r.interleaved=e,xr(t,n)}function Eu(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,Km(t,n)}}function N0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=e:i=i.next=e}else o=i=e;n={baseState:r.baseState,firstBaseUpdate:o,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 uc(t,e,n,r){var o=t.updateQueue;Lr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var u=a,l=u.next;u.next=null,s===null?i=l:s.next=l,s=u;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==s&&(a===null?c.firstBaseUpdate=l:a.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;s=0,c=l=u=null,a=i;do{var f=a.lane,p=a.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var h=t,m=a;switch(f=e,p=n,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=Ge({},d,f);break e;case 2:Lr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,s|=f;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;f=a,a=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,e=o.shared.interleaved,e!==null){o=e;do s|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);ei|=s,t.lanes=s,t.memoizedState=d}}function A0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(W(191,o));o.call(r)}}}var kl={},er=yo(kl),Fa=yo(kl),$a=yo(kl);function Do(t){if(t===kl)throw Error(W(174));return t}function uy(t,e){switch(Pe($a,e),Pe(Fa,t),Pe(er,kl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:zp(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=zp(e,t)}je(er),Pe(er,e)}function hs(){je(er),je(Fa),je($a)}function T_(t){Do($a.current);var e=Do(er.current),n=zp(e,t.type);e!==n&&(Pe(Fa,t),Pe(er,n))}function cy(t){Fa.current===t&&(je(er),je(Fa))}var We=yo(0);function cc(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 Mf=[];function dy(){for(var t=0;t<Mf.length;t++)Mf[t]._workInProgressVersionPrimary=null;Mf.length=0}var Tu=Mr.ReactCurrentDispatcher,Of=Mr.ReactCurrentBatchConfig,Zo=0,Ke=null,dt=null,ht=null,dc=!1,da=!1,za=0,xI=0;function Mt(){throw Error(W(321))}function fy(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Fn(t[n],e[n]))return!1;return!0}function py(t,e,n,r,o,i){if(Zo=i,Ke=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Tu.current=t===null||t.memoizedState===null?MI:OI,t=n(r,o),da){i=0;do{if(da=!1,za=0,25<=i)throw Error(W(301));i+=1,ht=dt=null,e.updateQueue=null,Tu.current=NI,t=n(r,o)}while(da)}if(Tu.current=fc,e=dt!==null&&dt.next!==null,Zo=0,ht=dt=Ke=null,dc=!1,e)throw Error(W(300));return t}function hy(){var t=za!==0;return za=0,t}function Hn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?Ke.memoizedState=ht=t:ht=ht.next=t,ht}function Cn(){if(dt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=dt.next;var e=ht===null?Ke.memoizedState:ht.next;if(e!==null)ht=e,dt=t;else{if(t===null)throw Error(W(310));dt=t,t={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},ht===null?Ke.memoizedState=ht=t:ht=ht.next=t}return ht}function Ua(t,e){return typeof e=="function"?e(t):e}function Nf(t){var e=Cn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=dt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,u=null,l=i;do{var c=l.lane;if((Zo&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),r=l.hasEagerState?l.eagerState:t(r,l.action);else{var d={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(a=u=d,s=r):u=u.next=d,Ke.lanes|=c,ei|=c}l=l.next}while(l!==null&&l!==i);u===null?s=r:u.next=a,Fn(r,e.memoizedState)||(Jt=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=u,n.lastRenderedState=r}if(t=n.interleaved,t!==null){o=t;do i=o.lane,Ke.lanes|=i,ei|=i,o=o.next;while(o!==t)}else o===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Af(t){var e=Cn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=n.dispatch,o=n.pending,i=e.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=t(i,s.action),s=s.next;while(s!==o);Fn(i,e.memoizedState)||(Jt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function C_(){}function M_(t,e){var n=Ke,r=Cn(),o=e(),i=!Fn(r.memoizedState,o);if(i&&(r.memoizedState=o,Jt=!0),r=r.queue,my(A_.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||ht!==null&&ht.memoizedState.tag&1){if(n.flags|=2048,Va(9,N_.bind(null,n,r,o,e),void 0,null),gt===null)throw Error(W(349));Zo&30||O_(n,e,o)}return o}function O_(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function N_(t,e,n,r){e.value=n,e.getSnapshot=r,I_(e)&&P_(t)}function A_(t,e,n){return n(function(){I_(e)&&P_(t)})}function I_(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Fn(t,n)}catch{return!0}}function P_(t){var e=xr(t,1);e!==null&&Bn(e,t,1,-1)}function I0(t){var e=Hn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ua,lastRenderedState:t},e.queue=t,t=t.dispatch=CI.bind(null,Ke,t),[e.memoizedState,t]}function Va(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.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 R_(){return Cn().memoizedState}function Cu(t,e,n,r){var o=Hn();Ke.flags|=t,o.memoizedState=Va(1|e,n,void 0,r===void 0?null:r)}function Od(t,e,n,r){var o=Cn();r=r===void 0?null:r;var i=void 0;if(dt!==null){var s=dt.memoizedState;if(i=s.destroy,r!==null&&fy(r,s.deps)){o.memoizedState=Va(e,n,i,r);return}}Ke.flags|=t,o.memoizedState=Va(1|e,n,i,r)}function P0(t,e){return Cu(8390656,8,t,e)}function my(t,e){return Od(2048,8,t,e)}function D_(t,e){return Od(4,2,t,e)}function j_(t,e){return Od(4,4,t,e)}function L_(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 B_(t,e,n){return n=n!=null?n.concat([t]):null,Od(4,4,L_.bind(null,e,t),n)}function yy(){}function F_(t,e){var n=Cn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fy(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function $_(t,e){var n=Cn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fy(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function z_(t,e,n){return Zo&21?(Fn(n,e)||(n=Wb(),Ke.lanes|=n,ei|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Jt=!0),t.memoizedState=n)}function EI(t,e){var n=Oe;Oe=n!==0&&4>n?n:4,t(!0);var r=Of.transition;Of.transition={};try{t(!1),e()}finally{Oe=n,Of.transition=r}}function U_(){return Cn().memoizedState}function TI(t,e,n){var r=ro(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},V_(t))q_(e,n);else if(n=x_(t,e,n,r),n!==null){var o=Ft();Bn(n,t,r,o),H_(n,e,r)}}function CI(t,e,n){var r=ro(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(V_(t))q_(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Fn(a,s)){var u=e.interleaved;u===null?(o.next=o,ay(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}n=x_(t,e,o,r),n!==null&&(o=Ft(),Bn(n,t,r,o),H_(n,e,r))}}function V_(t){var e=t.alternate;return t===Ke||e!==null&&e===Ke}function q_(t,e){da=dc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function H_(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Km(t,n)}}var fc={readContext:Tn,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useInsertionEffect:Mt,useLayoutEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useMutableSource:Mt,useSyncExternalStore:Mt,useId:Mt,unstable_isNewReconciler:!1},MI={readContext:Tn,useCallback:function(t,e){return Hn().memoizedState=[t,e===void 0?null:e],t},useContext:Tn,useEffect:P0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Cu(4194308,4,L_.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Cu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cu(4,2,t,e)},useMemo:function(t,e){var n=Hn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Hn();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=TI.bind(null,Ke,t),[r.memoizedState,t]},useRef:function(t){var e=Hn();return t={current:t},e.memoizedState=t},useState:I0,useDebugValue:yy,useDeferredValue:function(t){return Hn().memoizedState=t},useTransition:function(){var t=I0(!1),e=t[0];return t=EI.bind(null,t[1]),Hn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ke,o=Hn();if(Be){if(n===void 0)throw Error(W(407));n=n()}else{if(n=e(),gt===null)throw Error(W(349));Zo&30||O_(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,P0(A_.bind(null,r,i,t),[t]),r.flags|=2048,Va(9,N_.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Hn(),e=gt.identifierPrefix;if(Be){var n=hr,r=pr;n=(r&~(1<<32-Ln(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=za++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=xI++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},OI={readContext:Tn,useCallback:F_,useContext:Tn,useEffect:my,useImperativeHandle:B_,useInsertionEffect:D_,useLayoutEffect:j_,useMemo:$_,useReducer:Nf,useRef:R_,useState:function(){return Nf(Ua)},useDebugValue:yy,useDeferredValue:function(t){var e=Cn();return z_(e,dt.memoizedState,t)},useTransition:function(){var t=Nf(Ua)[0],e=Cn().memoizedState;return[t,e]},useMutableSource:C_,useSyncExternalStore:M_,useId:U_,unstable_isNewReconciler:!1},NI={readContext:Tn,useCallback:F_,useContext:Tn,useEffect:my,useImperativeHandle:B_,useInsertionEffect:D_,useLayoutEffect:j_,useMemo:$_,useReducer:Af,useRef:R_,useState:function(){return Af(Ua)},useDebugValue:yy,useDeferredValue:function(t){var e=Cn();return dt===null?e.memoizedState=t:z_(e,dt.memoizedState,t)},useTransition:function(){var t=Af(Ua)[0],e=Cn().memoizedState;return[t,e]},useMutableSource:C_,useSyncExternalStore:M_,useId:U_,unstable_isNewReconciler:!1};function Nn(t,e){if(t&&t.defaultProps){e=Ge({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function lh(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ge({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Nd={isMounted:function(t){return(t=t._reactInternals)?mi(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Ft(),o=ro(t),i=gr(r,o);i.payload=e,n!=null&&(i.callback=n),e=to(t,i,o),e!==null&&(Bn(e,t,o,r),Eu(e,t,o))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Ft(),o=ro(t),i=gr(r,o);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=to(t,i,o),e!==null&&(Bn(e,t,o,r),Eu(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Ft(),r=ro(t),o=gr(n,r);o.tag=2,e!=null&&(o.callback=e),e=to(t,o,r),e!==null&&(Bn(e,t,r,n),Eu(e,t,r))}};function R0(t,e,n,r,o,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!Da(n,r)||!Da(o,i):!0}function W_(t,e,n){var r=!1,o=fo,i=e.contextType;return typeof i=="object"&&i!==null?i=Tn(i):(o=Qt(e)?Qo:Pt.current,r=e.contextTypes,i=(r=r!=null)?ds(t,o):fo),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Nd,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function D0(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&&Nd.enqueueReplaceState(e,e.state,null)}function uh(t,e,n,r){var o=t.stateNode;o.props=n,o.state=t.memoizedState,o.refs={},ly(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=Tn(i):(i=Qt(e)?Qo:Pt.current,o.context=ds(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(lh(t,e,i,n),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&Nd.enqueueReplaceState(o,o.state,null),uc(t,n,o,r),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function ms(t,e){try{var n="",r=e;do n+=oA(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
45
|
+
Error generating stack: `+i.message+`
|
|
46
|
+
`+i.stack}return{value:t,source:e,stack:o,digest:null}}function If(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function ch(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var AI=typeof WeakMap=="function"?WeakMap:Map;function K_(t,e,n){n=gr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){hc||(hc=!0,bh=r),ch(t,e)},n}function G_(t,e,n){n=gr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var o=e.value;n.payload=function(){return r(o)},n.callback=function(){ch(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){ch(t,e),typeof r!="function"&&(no===null?no=new Set([this]):no.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function j0(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new AI;var o=new Set;r.set(e,o)}else o=r.get(e),o===void 0&&(o=new Set,r.set(e,o));o.has(n)||(o.add(n),t=HI.bind(null,t,e,n),e.then(t,t))}function L0(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 B0(t,e,n,r,o){return t.mode&1?(t.flags|=65536,t.lanes=o,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=gr(-1,1),e.tag=2,to(n,e,1))),n.lanes|=1),t)}var II=Mr.ReactCurrentOwner,Jt=!1;function jt(t,e,n,r){e.child=t===null?k_(e,null,n,r):ps(e,t.child,n,r)}function F0(t,e,n,r,o){n=n.render;var i=e.ref;return ns(e,o),r=py(t,e,n,r,i,o),n=hy(),t!==null&&!Jt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Er(t,e,o)):(Be&&n&&ty(e),e.flags|=1,jt(t,e,r,o),e.child)}function $0(t,e,n,r,o){if(t===null){var i=n.type;return typeof i=="function"&&!xy(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,J_(t,e,i,r,o)):(t=Au(n.type,null,r,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Da,n(s,r)&&t.ref===e.ref)return Er(t,e,o)}return e.flags|=1,t=oo(i,r),t.ref=e.ref,t.return=e,e.child=t}function J_(t,e,n,r,o){if(t!==null){var i=t.memoizedProps;if(Da(i,r)&&t.ref===e.ref)if(Jt=!1,e.pendingProps=r=i,(t.lanes&o)!==0)t.flags&131072&&(Jt=!0);else return e.lanes=t.lanes,Er(t,e,o)}return dh(t,e,n,r,o)}function Y_(t,e,n){var r=e.pendingProps,o=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pe($i,nn),nn|=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,Pe($i,nn),nn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Pe($i,nn),nn|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Pe($i,nn),nn|=r;return jt(t,e,o,n),e.child}function Q_(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function dh(t,e,n,r,o){var i=Qt(n)?Qo:Pt.current;return i=ds(e,i),ns(e,o),n=py(t,e,n,r,i,o),r=hy(),t!==null&&!Jt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Er(t,e,o)):(Be&&r&&ty(e),e.flags|=1,jt(t,e,n,o),e.child)}function z0(t,e,n,r,o){if(Qt(n)){var i=!0;oc(e)}else i=!1;if(ns(e,o),e.stateNode===null)Mu(t,e),W_(e,n,r),uh(e,n,r,o),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var u=s.context,l=n.contextType;typeof l=="object"&&l!==null?l=Tn(l):(l=Qt(n)?Qo:Pt.current,l=ds(e,l));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||u!==l)&&D0(e,s,r,l),Lr=!1;var f=e.memoizedState;s.state=f,uc(e,r,s,o),u=e.memoizedState,a!==r||f!==u||Yt.current||Lr?(typeof c=="function"&&(lh(e,n,c,r),u=e.memoizedState),(a=Lr||R0(e,n,a,r,f,u,l))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=u),s.props=r,s.state=u,s.context=l,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,E_(t,e),a=e.memoizedProps,l=e.type===e.elementType?a:Nn(e.type,a),s.props=l,d=e.pendingProps,f=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=Tn(u):(u=Qt(n)?Qo:Pt.current,u=ds(e,u));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||f!==u)&&D0(e,s,r,u),Lr=!1,f=e.memoizedState,s.state=f,uc(e,r,s,o);var h=e.memoizedState;a!==d||f!==h||Yt.current||Lr?(typeof p=="function"&&(lh(e,n,p,r),h=e.memoizedState),(l=Lr||R0(e,n,l,r,f,h,u)||!1)?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,h,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,h,u)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=h),s.props=r,s.state=h,s.context=u,r=l):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return fh(t,e,n,r,i,o)}function fh(t,e,n,r,o,i){Q_(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return o&&T0(e,n,!1),Er(t,e,i);r=e.stateNode,II.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=ps(e,t.child,null,i),e.child=ps(e,null,a,i)):jt(t,e,a,i),e.memoizedState=r.state,o&&T0(e,n,!0),e.child}function X_(t){var e=t.stateNode;e.pendingContext?E0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&E0(t,e.context,!1),uy(t,e.containerInfo)}function U0(t,e,n,r,o){return fs(),ry(o),e.flags|=256,jt(t,e,n,r),e.child}var ph={dehydrated:null,treeContext:null,retryLane:0};function hh(t){return{baseLanes:t,cachePool:null,transitions:null}}function Z_(t,e,n){var r=e.pendingProps,o=We.current,i=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(o&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),Pe(We,o&1),t===null)return sh(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):(s=r.children,t=r.fallback,i?(r=e.mode,i=e.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Pd(s,r,0,null),t=Uo(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=hh(n),e.memoizedState=ph,t):gy(e,s));if(o=t.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return PI(t,e,s,r,a,o,n);if(i){i=r.fallback,s=e.mode,o=t.child,a=o.sibling;var u={mode:"hidden",children:r.children};return!(s&1)&&e.child!==o?(r=e.child,r.childLanes=0,r.pendingProps=u,e.deletions=null):(r=oo(o,u),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=oo(a,i):(i=Uo(i,s,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,s=t.child.memoizedState,s=s===null?hh(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=t.childLanes&~n,e.memoizedState=ph,r}return i=t.child,t=i.sibling,r=oo(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 gy(t,e){return e=Pd({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ql(t,e,n,r){return r!==null&&ry(r),ps(e,t.child,null,n),t=gy(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function PI(t,e,n,r,o,i,s){if(n)return e.flags&256?(e.flags&=-257,r=If(Error(W(422))),ql(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,o=e.mode,r=Pd({mode:"visible",children:r.children},o,0,null),i=Uo(i,o,s,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&ps(e,t.child,null,s),e.child.memoizedState=hh(s),e.memoizedState=ph,i);if(!(e.mode&1))return ql(t,e,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(W(419)),r=If(i,r,void 0),ql(t,e,s,r)}if(a=(s&t.childLanes)!==0,Jt||a){if(r=gt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,xr(t,o),Bn(r,t,o,-1))}return ky(),r=If(Error(W(421))),ql(t,e,s,r)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=WI.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,on=eo(o.nextSibling),sn=e,Be=!0,Pn=null,t!==null&&(gn[vn++]=pr,gn[vn++]=hr,gn[vn++]=Xo,pr=t.id,hr=t.overflow,Xo=e),e=gy(e,r.children),e.flags|=4096,e)}function V0(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ah(t.return,e,n)}function Pf(t,e,n,r,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function eS(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;if(jt(t,e,r.children,n),r=We.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&&V0(t,n,e);else if(t.tag===19)V0(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(Pe(We,r),!(e.mode&1))e.memoizedState=null;else switch(o){case"forwards":for(n=e.child,o=null;n!==null;)t=n.alternate,t!==null&&cc(t)===null&&(o=n),n=n.sibling;n=o,n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),Pf(e,!1,o,n,i);break;case"backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&cc(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}Pf(e,!0,n,null,i);break;case"together":Pf(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Mu(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Er(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ei|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(W(153));if(e.child!==null){for(t=e.child,n=oo(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=oo(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function RI(t,e,n){switch(e.tag){case 3:X_(e),fs();break;case 5:T_(e);break;case 1:Qt(e.type)&&oc(e);break;case 4:uy(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,o=e.memoizedProps.value;Pe(ac,r._currentValue),r._currentValue=o;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Pe(We,We.current&1),e.flags|=128,null):n&e.child.childLanes?Z_(t,e,n):(Pe(We,We.current&1),t=Er(t,e,n),t!==null?t.sibling:null);Pe(We,We.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return eS(t,e,n);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Pe(We,We.current),r)break;return null;case 22:case 23:return e.lanes=0,Y_(t,e,n)}return Er(t,e,n)}var tS,mh,nS,rS;tS=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}};mh=function(){};nS=function(t,e,n,r){var o=t.memoizedProps;if(o!==r){t=e.stateNode,Do(er.current);var i=null;switch(n){case"input":o=Lp(t,o),r=Lp(t,r),i=[];break;case"select":o=Ge({},o,{value:void 0}),r=Ge({},r,{value:void 0}),i=[];break;case"textarea":o=$p(t,o),r=$p(t,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=nc)}Up(n,r);var s;n=null;for(l in o)if(!r.hasOwnProperty(l)&&o.hasOwnProperty(l)&&o[l]!=null)if(l==="style"){var a=o[l];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Ma.hasOwnProperty(l)?i||(i=[]):(i=i||[]).push(l,null));for(l in r){var u=r[l];if(a=o!=null?o[l]:void 0,r.hasOwnProperty(l)&&u!==a&&(u!=null||a!=null))if(l==="style")if(a){for(s in a)!a.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&a[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(i||(i=[]),i.push(l,n)),n=u;else l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(i=i||[]).push(l,u)):l==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(l,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(Ma.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&Re("scroll",t),i||a===u||(i=[])):(i=i||[]).push(l,u))}n&&(i=i||[]).push("style",n);var l=i;(e.updateQueue=l)&&(e.flags|=4)}};rS=function(t,e,n,r){n!==r&&(e.flags|=4)};function Bs(t,e){if(!Be)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 Ot(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function DI(t,e,n){var r=e.pendingProps;switch(ny(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(e),null;case 1:return Qt(e.type)&&rc(),Ot(e),null;case 3:return r=e.stateNode,hs(),je(Yt),je(Pt),dy(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Ul(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Pn!==null&&(kh(Pn),Pn=null))),mh(t,e),Ot(e),null;case 5:cy(e);var o=Do($a.current);if(n=e.type,t!==null&&e.stateNode!=null)nS(t,e,n,r,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(W(166));return Ot(e),null}if(t=Do(er.current),Ul(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Jn]=e,r[Ba]=i,t=(e.mode&1)!==0,n){case"dialog":Re("cancel",r),Re("close",r);break;case"iframe":case"object":case"embed":Re("load",r);break;case"video":case"audio":for(o=0;o<Zs.length;o++)Re(Zs[o],r);break;case"source":Re("error",r);break;case"img":case"image":case"link":Re("error",r),Re("load",r);break;case"details":Re("toggle",r);break;case"input":Xg(r,i),Re("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Re("invalid",r);break;case"textarea":e0(r,i),Re("invalid",r)}Up(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&zl(r.textContent,a,t),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&zl(r.textContent,a,t),o=["children",""+a]):Ma.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Re("scroll",r)}switch(n){case"input":Pl(r),Zg(r,i,!0);break;case"textarea":Pl(r),t0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=nc)}r=o,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ab(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Jn]=e,t[Ba]=r,tS(t,e,!1,!1),e.stateNode=t;e:{switch(s=Vp(n,r),n){case"dialog":Re("cancel",t),Re("close",t),o=r;break;case"iframe":case"object":case"embed":Re("load",t),o=r;break;case"video":case"audio":for(o=0;o<Zs.length;o++)Re(Zs[o],t);o=r;break;case"source":Re("error",t),o=r;break;case"img":case"image":case"link":Re("error",t),Re("load",t),o=r;break;case"details":Re("toggle",t),o=r;break;case"input":Xg(t,r),o=Lp(t,r),Re("invalid",t);break;case"option":o=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},o=Ge({},r,{value:void 0}),Re("invalid",t);break;case"textarea":e0(t,r),o=$p(t,r),Re("invalid",t);break;default:o=r}Up(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var u=a[i];i==="style"?Rb(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Ib(t,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Oa(t,u):typeof u=="number"&&Oa(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ma.hasOwnProperty(i)?u!=null&&i==="onScroll"&&Re("scroll",t):u!=null&&zm(t,i,u,s))}switch(n){case"input":Pl(t),Zg(t,r,!1);break;case"textarea":Pl(t),t0(t);break;case"option":r.value!=null&&t.setAttribute("value",""+co(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Xi(t,!!r.multiple,i,!1):r.defaultValue!=null&&Xi(t,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=nc)}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 Ot(e),null;case 6:if(t&&e.stateNode!=null)rS(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(W(166));if(n=Do($a.current),Do(er.current),Ul(e)){if(r=e.stateNode,n=e.memoizedProps,r[Jn]=e,(i=r.nodeValue!==n)&&(t=sn,t!==null))switch(t.tag){case 3:zl(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&zl(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Jn]=e,e.stateNode=r}return Ot(e),null;case 13:if(je(We),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Be&&on!==null&&e.mode&1&&!(e.flags&128))__(),fs(),e.flags|=98560,i=!1;else if(i=Ul(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(W(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(W(317));i[Jn]=e}else fs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ot(e),i=!1}else Pn!==null&&(kh(Pn),Pn=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||We.current&1?ft===0&&(ft=3):ky())),e.updateQueue!==null&&(e.flags|=4),Ot(e),null);case 4:return hs(),mh(t,e),t===null&&ja(e.stateNode.containerInfo),Ot(e),null;case 10:return sy(e.type._context),Ot(e),null;case 17:return Qt(e.type)&&rc(),Ot(e),null;case 19:if(je(We),i=e.memoizedState,i===null)return Ot(e),null;if(r=(e.flags&128)!==0,s=i.rendering,s===null)if(r)Bs(i,!1);else{if(ft!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=cc(t),s!==null){for(e.flags|=128,Bs(i,!1),r=s.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,s=i.alternate,s===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=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,t=s.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Pe(We,We.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ze()>ys&&(e.flags|=128,r=!0,Bs(i,!1),e.lanes=4194304)}else{if(!r)if(t=cc(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Bs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Be)return Ot(e),null}else 2*Ze()-i.renderingStartTime>ys&&n!==1073741824&&(e.flags|=128,r=!0,Bs(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ze(),e.sibling=null,n=We.current,Pe(We,r?n&1|2:n&1),e):(Ot(e),null);case 22:case 23:return Sy(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?nn&1073741824&&(Ot(e),e.subtreeFlags&6&&(e.flags|=8192)):Ot(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function jI(t,e){switch(ny(e),e.tag){case 1:return Qt(e.type)&&rc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return hs(),je(Yt),je(Pt),dy(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return cy(e),null;case 13:if(je(We),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));fs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return je(We),null;case 4:return hs(),null;case 10:return sy(e.type._context),null;case 22:case 23:return Sy(),null;case 24:return null;default:return null}}var Hl=!1,At=!1,LI=typeof WeakSet=="function"?WeakSet:Set,Q=null;function Fi(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(t,e,r)}else n.current=null}function yh(t,e,n){try{n()}catch(r){Qe(t,e,r)}}var q0=!1;function BI(t,e){if(Zp=Zu,t=l_(),ey(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 o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,l=0,c=0,d=t,f=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(a=s+o),d!==i||r!==0&&d.nodeType!==3||(u=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++l===o&&(a=s),f===i&&++c===r&&(u=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(eh={focusedElem:t,selectionRange:n},Zu=!1,Q=e;Q!==null;)if(e=Q,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Q=t;else for(;Q!==null;){e=Q;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,v=h.memoizedState,y=e.stateNode,w=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:Nn(e.type,m),v);y.__reactInternalSnapshotBeforeUpdate=w}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(W(163))}}catch(S){Qe(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Q=t;break}Q=e.return}return h=q0,q0=!1,h}function fa(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&yh(e,n,i)}o=o.next}while(o!==r)}}function Ad(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 gh(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 oS(t){var e=t.alternate;e!==null&&(t.alternate=null,oS(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Jn],delete e[Ba],delete e[rh],delete e[bI],delete e[_I])),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 iS(t){return t.tag===5||t.tag===3||t.tag===4}function H0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||iS(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 vh(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=nc));else if(r!==4&&(t=t.child,t!==null))for(vh(t,e,n),t=t.sibling;t!==null;)vh(t,e,n),t=t.sibling}function wh(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(wh(t,e,n),t=t.sibling;t!==null;)wh(t,e,n),t=t.sibling}var St=null,In=!1;function Ir(t,e,n){for(n=n.child;n!==null;)sS(t,e,n),n=n.sibling}function sS(t,e,n){if(Zn&&typeof Zn.onCommitFiberUnmount=="function")try{Zn.onCommitFiberUnmount(kd,n)}catch{}switch(n.tag){case 5:At||Fi(n,e);case 6:var r=St,o=In;St=null,Ir(t,e,n),St=r,In=o,St!==null&&(In?(t=St,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):St.removeChild(n.stateNode));break;case 18:St!==null&&(In?(t=St,n=n.stateNode,t.nodeType===8?Tf(t.parentNode,n):t.nodeType===1&&Tf(t,n),Pa(t)):Tf(St,n.stateNode));break;case 4:r=St,o=In,St=n.stateNode.containerInfo,In=!0,Ir(t,e,n),St=r,In=o;break;case 0:case 11:case 14:case 15:if(!At&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&yh(n,e,s),o=o.next}while(o!==r)}Ir(t,e,n);break;case 1:if(!At&&(Fi(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Qe(n,e,a)}Ir(t,e,n);break;case 21:Ir(t,e,n);break;case 22:n.mode&1?(At=(r=At)||n.memoizedState!==null,Ir(t,e,n),At=r):Ir(t,e,n);break;default:Ir(t,e,n)}}function W0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new LI),e.forEach(function(r){var o=KI.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function On(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=t,s=e,a=s;e:for(;a!==null;){switch(a.tag){case 5:St=a.stateNode,In=!1;break e;case 3:St=a.stateNode.containerInfo,In=!0;break e;case 4:St=a.stateNode.containerInfo,In=!0;break e}a=a.return}if(St===null)throw Error(W(160));sS(i,s,o),St=null,In=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Qe(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)aS(e,t),e=e.sibling}function aS(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(On(e,t),Vn(t),r&4){try{fa(3,t,t.return),Ad(3,t)}catch(m){Qe(t,t.return,m)}try{fa(5,t,t.return)}catch(m){Qe(t,t.return,m)}}break;case 1:On(e,t),Vn(t),r&512&&n!==null&&Fi(n,n.return);break;case 5:if(On(e,t),Vn(t),r&512&&n!==null&&Fi(n,n.return),t.flags&32){var o=t.stateNode;try{Oa(o,"")}catch(m){Qe(t,t.return,m)}}if(r&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,s=n!==null?n.memoizedProps:i,a=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Ob(o,i),Vp(a,s);var l=Vp(a,i);for(s=0;s<u.length;s+=2){var c=u[s],d=u[s+1];c==="style"?Rb(o,d):c==="dangerouslySetInnerHTML"?Ib(o,d):c==="children"?Oa(o,d):zm(o,c,d,l)}switch(a){case"input":Bp(o,i);break;case"textarea":Nb(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Xi(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Xi(o,!!i.multiple,i.defaultValue,!0):Xi(o,!!i.multiple,i.multiple?[]:"",!1))}o[Ba]=i}catch(m){Qe(t,t.return,m)}}break;case 6:if(On(e,t),Vn(t),r&4){if(t.stateNode===null)throw Error(W(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(m){Qe(t,t.return,m)}}break;case 3:if(On(e,t),Vn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Pa(e.containerInfo)}catch(m){Qe(t,t.return,m)}break;case 4:On(e,t),Vn(t);break;case 13:On(e,t),Vn(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(by=Ze())),r&4&&W0(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(At=(l=At)||c,On(e,t),At=l):On(e,t),Vn(t),r&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&t.mode&1)for(Q=t,c=t.child;c!==null;){for(d=Q=c;Q!==null;){switch(f=Q,p=f.child,f.tag){case 0:case 11:case 14:case 15:fa(4,f,f.return);break;case 1:Fi(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(m){Qe(r,n,m)}}break;case 5:Fi(f,f.return);break;case 22:if(f.memoizedState!==null){G0(d);continue}}p!==null?(p.return=f,Q=p):G0(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,l?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=d.stateNode,u=d.memoizedProps.style,s=u!=null&&u.hasOwnProperty("display")?u.display:null,a.style.display=Pb("display",s))}catch(m){Qe(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(m){Qe(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:On(e,t),Vn(t),r&4&&W0(t);break;case 21:break;default:On(e,t),Vn(t)}}function Vn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(iS(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Oa(o,""),r.flags&=-33);var i=H0(t);wh(t,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=H0(t);vh(t,a,s);break;default:throw Error(W(161))}}catch(u){Qe(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function FI(t,e,n){Q=t,lS(t)}function lS(t,e,n){for(var r=(t.mode&1)!==0;Q!==null;){var o=Q,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Hl;if(!s){var a=o.alternate,u=a!==null&&a.memoizedState!==null||At;a=Hl;var l=At;if(Hl=s,(At=u)&&!l)for(Q=o;Q!==null;)s=Q,u=s.child,s.tag===22&&s.memoizedState!==null?J0(o):u!==null?(u.return=s,Q=u):J0(o);for(;i!==null;)Q=i,lS(i),i=i.sibling;Q=o,Hl=a,At=l}K0(t)}else o.subtreeFlags&8772&&i!==null?(i.return=o,Q=i):K0(t)}}function K0(t){for(;Q!==null;){var e=Q;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:At||Ad(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!At)if(n===null)r.componentDidMount();else{var o=e.elementType===e.type?n.memoizedProps:Nn(e.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&A0(e,i,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}A0(e,s,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&Pa(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}At||e.flags&512&&gh(e)}catch(f){Qe(e,e.return,f)}}if(e===t){Q=null;break}if(n=e.sibling,n!==null){n.return=e.return,Q=n;break}Q=e.return}}function G0(t){for(;Q!==null;){var e=Q;if(e===t){Q=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Q=n;break}Q=e.return}}function J0(t){for(;Q!==null;){var e=Q;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Ad(4,e)}catch(u){Qe(e,n,u)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var o=e.return;try{r.componentDidMount()}catch(u){Qe(e,o,u)}}var i=e.return;try{gh(e)}catch(u){Qe(e,i,u)}break;case 5:var s=e.return;try{gh(e)}catch(u){Qe(e,s,u)}}}catch(u){Qe(e,e.return,u)}if(e===t){Q=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Q=a;break}Q=e.return}}var $I=Math.ceil,pc=Mr.ReactCurrentDispatcher,vy=Mr.ReactCurrentOwner,_n=Mr.ReactCurrentBatchConfig,xe=0,gt=null,rt=null,Tt=0,nn=0,$i=yo(0),ft=0,qa=null,ei=0,Id=0,wy=0,pa=null,Wt=null,by=0,ys=1/0,ur=null,hc=!1,bh=null,no=null,Wl=!1,Kr=null,mc=0,ha=0,_h=null,Ou=-1,Nu=0;function Ft(){return xe&6?Ze():Ou!==-1?Ou:Ou=Ze()}function ro(t){return t.mode&1?xe&2&&Tt!==0?Tt&-Tt:kI.transition!==null?(Nu===0&&(Nu=Wb()),Nu):(t=Oe,t!==0||(t=window.event,t=t===void 0?16:Zb(t.type)),t):1}function Bn(t,e,n,r){if(50<ha)throw ha=0,_h=null,Error(W(185));bl(t,n,r),(!(xe&2)||t!==gt)&&(t===gt&&(!(xe&2)&&(Id|=n),ft===4&&Ur(t,Tt)),Xt(t,r),n===1&&xe===0&&!(e.mode&1)&&(ys=Ze()+500,Md&&go()))}function Xt(t,e){var n=t.callbackNode;kA(t,e);var r=Xu(t,t===gt?Tt:0);if(r===0)n!==null&&o0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&o0(n),e===1)t.tag===0?SI(Y0.bind(null,t)):v_(Y0.bind(null,t)),vI(function(){!(xe&6)&&go()}),n=null;else{switch(Kb(r)){case 1:n=Wm;break;case 4:n=qb;break;case 16:n=Qu;break;case 536870912:n=Hb;break;default:n=Qu}n=yS(n,uS.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function uS(t,e){if(Ou=-1,Nu=0,xe&6)throw Error(W(327));var n=t.callbackNode;if(rs()&&t.callbackNode!==n)return null;var r=Xu(t,t===gt?Tt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=yc(t,r);else{e=r;var o=xe;xe|=2;var i=dS();(gt!==t||Tt!==e)&&(ur=null,ys=Ze()+500,zo(t,e));do try{VI();break}catch(a){cS(t,a)}while(!0);iy(),pc.current=i,xe=o,rt!==null?e=0:(gt=null,Tt=0,e=ft)}if(e!==0){if(e===2&&(o=Gp(t),o!==0&&(r=o,e=Sh(t,o))),e===1)throw n=qa,zo(t,0),Ur(t,r),Xt(t,Ze()),n;if(e===6)Ur(t,r);else{if(o=t.current.alternate,!(r&30)&&!zI(o)&&(e=yc(t,r),e===2&&(i=Gp(t),i!==0&&(r=i,e=Sh(t,i))),e===1))throw n=qa,zo(t,0),Ur(t,r),Xt(t,Ze()),n;switch(t.finishedWork=o,t.finishedLanes=r,e){case 0:case 1:throw Error(W(345));case 2:Co(t,Wt,ur);break;case 3:if(Ur(t,r),(r&130023424)===r&&(e=by+500-Ze(),10<e)){if(Xu(t,0)!==0)break;if(o=t.suspendedLanes,(o&r)!==r){Ft(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=nh(Co.bind(null,t,Wt,ur),e);break}Co(t,Wt,ur);break;case 4:if(Ur(t,r),(r&4194240)===r)break;for(e=t.eventTimes,o=-1;0<r;){var s=31-Ln(r);i=1<<s,s=e[s],s>o&&(o=s),r&=~i}if(r=o,r=Ze()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*$I(r/1960))-r,10<r){t.timeoutHandle=nh(Co.bind(null,t,Wt,ur),r);break}Co(t,Wt,ur);break;case 5:Co(t,Wt,ur);break;default:throw Error(W(329))}}}return Xt(t,Ze()),t.callbackNode===n?uS.bind(null,t):null}function Sh(t,e){var n=pa;return t.current.memoizedState.isDehydrated&&(zo(t,e).flags|=256),t=yc(t,e),t!==2&&(e=Wt,Wt=n,e!==null&&kh(e)),t}function kh(t){Wt===null?Wt=t:Wt.push.apply(Wt,t)}function zI(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 o=n[r],i=o.getSnapshot;o=o.value;try{if(!Fn(i(),o))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 Ur(t,e){for(e&=~wy,e&=~Id,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Ln(e),r=1<<n;t[n]=-1,e&=~r}}function Y0(t){if(xe&6)throw Error(W(327));rs();var e=Xu(t,0);if(!(e&1))return Xt(t,Ze()),null;var n=yc(t,e);if(t.tag!==0&&n===2){var r=Gp(t);r!==0&&(e=r,n=Sh(t,r))}if(n===1)throw n=qa,zo(t,0),Ur(t,e),Xt(t,Ze()),n;if(n===6)throw Error(W(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Co(t,Wt,ur),Xt(t,Ze()),null}function _y(t,e){var n=xe;xe|=1;try{return t(e)}finally{xe=n,xe===0&&(ys=Ze()+500,Md&&go())}}function ti(t){Kr!==null&&Kr.tag===0&&!(xe&6)&&rs();var e=xe;xe|=1;var n=_n.transition,r=Oe;try{if(_n.transition=null,Oe=1,t)return t()}finally{Oe=r,_n.transition=n,xe=e,!(xe&6)&&go()}}function Sy(){nn=$i.current,je($i)}function zo(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,gI(n)),rt!==null)for(n=rt.return;n!==null;){var r=n;switch(ny(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&rc();break;case 3:hs(),je(Yt),je(Pt),dy();break;case 5:cy(r);break;case 4:hs();break;case 13:je(We);break;case 19:je(We);break;case 10:sy(r.type._context);break;case 22:case 23:Sy()}n=n.return}if(gt=t,rt=t=oo(t.current,null),Tt=nn=e,ft=0,qa=null,wy=Id=ei=0,Wt=pa=null,Ro!==null){for(e=0;e<Ro.length;e++)if(n=Ro[e],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}Ro=null}return t}function cS(t,e){do{var n=rt;try{if(iy(),Tu.current=fc,dc){for(var r=Ke.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}dc=!1}if(Zo=0,ht=dt=Ke=null,da=!1,za=0,vy.current=null,n===null||n.return===null){ft=1,qa=e,rt=null;break}e:{var i=t,s=n.return,a=n,u=e;if(e=Tt,a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=a,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=L0(s);if(p!==null){p.flags&=-257,B0(p,s,a,i,e),p.mode&1&&j0(i,l,e),e=p,u=l;var h=e.updateQueue;if(h===null){var m=new Set;m.add(u),e.updateQueue=m}else h.add(u);break e}else{if(!(e&1)){j0(i,l,e),ky();break e}u=Error(W(426))}}else if(Be&&a.mode&1){var v=L0(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),B0(v,s,a,i,e),ry(ms(u,a));break e}}i=u=ms(u,a),ft!==4&&(ft=2),pa===null?pa=[i]:pa.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=K_(i,u,e);N0(i,y);break e;case 1:a=u;var w=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(no===null||!no.has(b)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=G_(i,a,e);N0(i,S);break e}}i=i.return}while(i!==null)}pS(n)}catch(k){e=k,rt===n&&n!==null&&(rt=n=n.return);continue}break}while(!0)}function dS(){var t=pc.current;return pc.current=fc,t===null?fc:t}function ky(){(ft===0||ft===3||ft===2)&&(ft=4),gt===null||!(ei&268435455)&&!(Id&268435455)||Ur(gt,Tt)}function yc(t,e){var n=xe;xe|=2;var r=dS();(gt!==t||Tt!==e)&&(ur=null,zo(t,e));do try{UI();break}catch(o){cS(t,o)}while(!0);if(iy(),xe=n,pc.current=r,rt!==null)throw Error(W(261));return gt=null,Tt=0,ft}function UI(){for(;rt!==null;)fS(rt)}function VI(){for(;rt!==null&&!hA();)fS(rt)}function fS(t){var e=mS(t.alternate,t,nn);t.memoizedProps=t.pendingProps,e===null?pS(t):rt=e,vy.current=null}function pS(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=jI(n,e),n!==null){n.flags&=32767,rt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{ft=6,rt=null;return}}else if(n=DI(n,e,nn),n!==null){rt=n;return}if(e=e.sibling,e!==null){rt=e;return}rt=e=t}while(e!==null);ft===0&&(ft=5)}function Co(t,e,n){var r=Oe,o=_n.transition;try{_n.transition=null,Oe=1,qI(t,e,n,r)}finally{_n.transition=o,Oe=r}return null}function qI(t,e,n,r){do rs();while(Kr!==null);if(xe&6)throw Error(W(327));n=t.finishedWork;var o=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(W(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(xA(t,i),t===gt&&(rt=gt=null,Tt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Wl||(Wl=!0,yS(Qu,function(){return rs(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=_n.transition,_n.transition=null;var s=Oe;Oe=1;var a=xe;xe|=4,vy.current=null,BI(t,n),aS(n,t),cI(eh),Zu=!!Zp,eh=Zp=null,t.current=n,FI(n),mA(),xe=a,Oe=s,_n.transition=i}else t.current=n;if(Wl&&(Wl=!1,Kr=t,mc=o),i=t.pendingLanes,i===0&&(no=null),vA(n.stateNode),Xt(t,Ze()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)o=e[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(hc)throw hc=!1,t=bh,bh=null,t;return mc&1&&t.tag!==0&&rs(),i=t.pendingLanes,i&1?t===_h?ha++:(ha=0,_h=t):ha=0,go(),null}function rs(){if(Kr!==null){var t=Kb(mc),e=_n.transition,n=Oe;try{if(_n.transition=null,Oe=16>t?16:t,Kr===null)var r=!1;else{if(t=Kr,Kr=null,mc=0,xe&6)throw Error(W(331));var o=xe;for(xe|=4,Q=t.current;Q!==null;){var i=Q,s=i.child;if(Q.flags&16){var a=i.deletions;if(a!==null){for(var u=0;u<a.length;u++){var l=a[u];for(Q=l;Q!==null;){var c=Q;switch(c.tag){case 0:case 11:case 15:fa(8,c,i)}var d=c.child;if(d!==null)d.return=c,Q=d;else for(;Q!==null;){c=Q;var f=c.sibling,p=c.return;if(oS(c),c===l){Q=null;break}if(f!==null){f.return=p,Q=f;break}Q=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(m!==null)}}Q=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Q=s;else e:for(;Q!==null;){if(i=Q,i.flags&2048)switch(i.tag){case 0:case 11:case 15:fa(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,Q=y;break e}Q=i.return}}var w=t.current;for(Q=w;Q!==null;){s=Q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Q=b;else e:for(s=w;Q!==null;){if(a=Q,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ad(9,a)}}catch(k){Qe(a,a.return,k)}if(a===s){Q=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,Q=S;break e}Q=a.return}}if(xe=o,go(),Zn&&typeof Zn.onPostCommitFiberRoot=="function")try{Zn.onPostCommitFiberRoot(kd,t)}catch{}r=!0}return r}finally{Oe=n,_n.transition=e}}return!1}function Q0(t,e,n){e=ms(n,e),e=K_(t,e,1),t=to(t,e,1),e=Ft(),t!==null&&(bl(t,1,e),Xt(t,e))}function Qe(t,e,n){if(t.tag===3)Q0(t,t,n);else for(;e!==null;){if(e.tag===3){Q0(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(no===null||!no.has(r))){t=ms(n,t),t=G_(e,t,1),e=to(e,t,1),t=Ft(),e!==null&&(bl(e,1,t),Xt(e,t));break}}e=e.return}}function HI(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Ft(),t.pingedLanes|=t.suspendedLanes&n,gt===t&&(Tt&n)===n&&(ft===4||ft===3&&(Tt&130023424)===Tt&&500>Ze()-by?zo(t,0):wy|=n),Xt(t,e)}function hS(t,e){e===0&&(t.mode&1?(e=jl,jl<<=1,!(jl&130023424)&&(jl=4194304)):e=1);var n=Ft();t=xr(t,e),t!==null&&(bl(t,e,n),Xt(t,n))}function WI(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),hS(t,n)}function KI(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(e),hS(t,n)}var mS;mS=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Yt.current)Jt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Jt=!1,RI(t,e,n);Jt=!!(t.flags&131072)}else Jt=!1,Be&&e.flags&1048576&&w_(e,sc,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Mu(t,e),t=e.pendingProps;var o=ds(e,Pt.current);ns(e,n),o=py(null,e,r,t,o,n);var i=hy();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Qt(r)?(i=!0,oc(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ly(e),o.updater=Nd,e.stateNode=o,o._reactInternals=e,uh(e,r,t,n),e=fh(null,e,r,!0,i,n)):(e.tag=0,Be&&i&&ty(e),jt(null,e,o,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Mu(t,e),t=e.pendingProps,o=r._init,r=o(r._payload),e.type=r,o=e.tag=JI(r),t=Nn(r,t),o){case 0:e=dh(null,e,r,t,n);break e;case 1:e=z0(null,e,r,t,n);break e;case 11:e=F0(null,e,r,t,n);break e;case 14:e=$0(null,e,r,Nn(r.type,t),n);break e}throw Error(W(306,r,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),dh(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),z0(t,e,r,o,n);case 3:e:{if(X_(e),t===null)throw Error(W(387));r=e.pendingProps,i=e.memoizedState,o=i.element,E_(t,e),uc(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=ms(Error(W(423)),e),e=U0(t,e,r,n,o);break e}else if(r!==o){o=ms(Error(W(424)),e),e=U0(t,e,r,n,o);break e}else for(on=eo(e.stateNode.containerInfo.firstChild),sn=e,Be=!0,Pn=null,n=k_(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fs(),r===o){e=Er(t,e,n);break e}jt(t,e,r,n)}e=e.child}return e;case 5:return T_(e),t===null&&sh(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,th(r,o)?s=null:i!==null&&th(r,i)&&(e.flags|=32),Q_(t,e),jt(t,e,s,n),e.child;case 6:return t===null&&sh(e),null;case 13:return Z_(t,e,n);case 4:return uy(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ps(e,null,r,n):jt(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),F0(t,e,r,o,n);case 7:return jt(t,e,e.pendingProps,n),e.child;case 8:return jt(t,e,e.pendingProps.children,n),e.child;case 12:return jt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,o=e.pendingProps,i=e.memoizedProps,s=o.value,Pe(ac,r._currentValue),r._currentValue=s,i!==null)if(Fn(i.value,s)){if(i.children===o.children&&!Yt.current){e=Er(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=gr(-1,n&-n),u.tag=2;var l=i.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?u.next=u:(u.next=c.next,c.next=u),l.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ah(i.return,n,e),a.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(W(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),ah(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}jt(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,r=e.pendingProps.children,ns(e,n),o=Tn(o),r=r(o),e.flags|=1,jt(t,e,r,n),e.child;case 14:return r=e.type,o=Nn(r,e.pendingProps),o=Nn(r.type,o),$0(t,e,r,o,n);case 15:return J_(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),Mu(t,e),e.tag=1,Qt(r)?(t=!0,oc(e)):t=!1,ns(e,n),W_(e,r,o),uh(e,r,o,n),fh(null,e,r,!0,t,n);case 19:return eS(t,e,n);case 22:return Y_(t,e,n)}throw Error(W(156,e.tag))};function yS(t,e){return Vb(t,e)}function GI(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 bn(t,e,n,r){return new GI(t,e,n,r)}function xy(t){return t=t.prototype,!(!t||!t.isReactComponent)}function JI(t){if(typeof t=="function")return xy(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Vm)return 11;if(t===qm)return 14}return 2}function oo(t,e){var n=t.alternate;return n===null?(n=bn(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.deletions=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 Au(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")xy(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Ni:return Uo(n.children,o,i,e);case Um:s=8,o|=8;break;case Pp:return t=bn(12,n,e,o|2),t.elementType=Pp,t.lanes=i,t;case Rp:return t=bn(13,n,e,o),t.elementType=Rp,t.lanes=i,t;case Dp:return t=bn(19,n,e,o),t.elementType=Dp,t.lanes=i,t;case Tb:return Pd(n,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case xb:s=10;break e;case Eb:s=9;break e;case Vm:s=11;break e;case qm:s=14;break e;case jr:s=16,r=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=bn(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function Uo(t,e,n,r){return t=bn(7,t,r,e),t.lanes=n,t}function Pd(t,e,n,r){return t=bn(22,t,r,e),t.elementType=Tb,t.lanes=n,t.stateNode={isHidden:!1},t}function Rf(t,e,n){return t=bn(6,t,null,e),t.lanes=n,t}function Df(t,e,n){return e=bn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function YI(t,e,n,r,o){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=mf(0),this.expirationTimes=mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mf(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Ey(t,e,n,r,o,i,s,a,u){return t=new YI(t,e,n,a,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=bn(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ly(i),t}function QI(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Oi,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function gS(t){if(!t)return fo;t=t._reactInternals;e:{if(mi(t)!==t||t.tag!==1)throw Error(W(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Qt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(W(171))}if(t.tag===1){var n=t.type;if(Qt(n))return g_(t,n,e)}return e}function vS(t,e,n,r,o,i,s,a,u){return t=Ey(n,r,!0,t,o,i,s,a,u),t.context=gS(null),n=t.current,r=Ft(),o=ro(n),i=gr(r,o),i.callback=e??null,to(n,i,o),t.current.lanes=o,bl(t,o,r),Xt(t,r),t}function Rd(t,e,n,r){var o=e.current,i=Ft(),s=ro(o);return n=gS(n),e.context===null?e.context=n:e.pendingContext=n,e=gr(i,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=to(o,e,s),t!==null&&(Bn(t,o,s,i),Eu(t,o,s)),s}function gc(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 X0(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Ty(t,e){X0(t,e),(t=t.alternate)&&X0(t,e)}function XI(){return null}var wS=typeof reportError=="function"?reportError:function(t){console.error(t)};function Cy(t){this._internalRoot=t}Dd.prototype.render=Cy.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(W(409));Rd(t,e,null,null)};Dd.prototype.unmount=Cy.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ti(function(){Rd(null,t,null,null)}),e[kr]=null}};function Dd(t){this._internalRoot=t}Dd.prototype.unstable_scheduleHydration=function(t){if(t){var e=Yb();t={blockedOn:null,target:t,priority:e};for(var n=0;n<zr.length&&e!==0&&e<zr[n].priority;n++);zr.splice(n,0,t),n===0&&Xb(t)}};function My(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function jd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Z0(){}function ZI(t,e,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var l=gc(s);i.call(l)}}var s=vS(e,r,t,0,null,!1,!1,"",Z0);return t._reactRootContainer=s,t[kr]=s.current,ja(t.nodeType===8?t.parentNode:t),ti(),s}for(;o=t.lastChild;)t.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var l=gc(u);a.call(l)}}var u=Ey(t,0,!1,null,null,!1,!1,"",Z0);return t._reactRootContainer=u,t[kr]=u.current,ja(t.nodeType===8?t.parentNode:t),ti(function(){Rd(e,u,n,r)}),u}function Ld(t,e,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var u=gc(s);a.call(u)}}Rd(e,s,t,o)}else s=ZI(n,e,t,o,r);return gc(s)}Gb=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Xs(e.pendingLanes);n!==0&&(Km(e,n|1),Xt(e,Ze()),!(xe&6)&&(ys=Ze()+500,go()))}break;case 13:ti(function(){var r=xr(t,1);if(r!==null){var o=Ft();Bn(r,t,1,o)}}),Ty(t,1)}};Gm=function(t){if(t.tag===13){var e=xr(t,134217728);if(e!==null){var n=Ft();Bn(e,t,134217728,n)}Ty(t,134217728)}};Jb=function(t){if(t.tag===13){var e=ro(t),n=xr(t,e);if(n!==null){var r=Ft();Bn(n,t,e,r)}Ty(t,e)}};Yb=function(){return Oe};Qb=function(t,e){var n=Oe;try{return Oe=t,e()}finally{Oe=n}};Hp=function(t,e,n){switch(e){case"input":if(Bp(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 o=Cd(r);if(!o)throw Error(W(90));Mb(r),Bp(r,o)}}}break;case"textarea":Nb(t,n);break;case"select":e=n.value,e!=null&&Xi(t,!!n.multiple,e,!1)}};Lb=_y;Bb=ti;var e2={usingClientEntryPoint:!1,Events:[Sl,Ri,Cd,Db,jb,_y]},Fs={findFiberByHostInstance:Po,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},t2={bundleType:Fs.bundleType,version:Fs.version,rendererPackageName:Fs.rendererPackageName,rendererConfig:Fs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Mr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=zb(t),t===null?null:t.stateNode},findFiberByHostInstance:Fs.findFiberByHostInstance||XI,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 Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{kd=Kl.inject(t2),Zn=Kl}catch{}}un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=e2;un.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!My(e))throw Error(W(200));return QI(t,e,null,n)};un.createRoot=function(t,e){if(!My(t))throw Error(W(299));var n=!1,r="",o=wS;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Ey(t,1,!1,null,null,n,!1,r,o),t[kr]=e.current,ja(t.nodeType===8?t.parentNode:t),new Cy(e)};un.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(W(188)):(t=Object.keys(t).join(","),Error(W(268,t)));return t=zb(e),t=t===null?null:t.stateNode,t};un.flushSync=function(t){return ti(t)};un.hydrate=function(t,e,n){if(!jd(e))throw Error(W(200));return Ld(null,t,e,!0,n)};un.hydrateRoot=function(t,e,n){if(!My(t))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=wS;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=vS(e,null,t,1,n??null,o,!1,i,s),t[kr]=e.current,ja(t),r)for(t=0;t<r.length;t++)n=r[t],o=n._getVersion,o=o(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,o]:e.mutableSourceEagerHydrationData.push(n,o);return new Dd(e)};un.render=function(t,e,n){if(!jd(e))throw Error(W(200));return Ld(null,t,e,!1,n)};un.unmountComponentAtNode=function(t){if(!jd(t))throw Error(W(40));return t._reactRootContainer?(ti(function(){Ld(null,null,t,!1,function(){t._reactRootContainer=null,t[kr]=null})}),!0):!1};un.unstable_batchedUpdates=_y;un.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!jd(n))throw Error(W(200));if(t==null||t._reactInternals===void 0)throw Error(W(38));return Ld(t,e,n,!1,r)};un.version="18.3.1-next-f1338f8080-20240426";function bS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bS)}catch(t){console.error(t)}}bS(),bb.exports=un;var Oy=bb.exports;const n2=di(Oy);var _S,ev=Oy;_S=ev.createRoot,ev.hydrateRoot;const r2=document.getElementById("root"),o2=_S(r2);function jf(t){o2.render(g.jsx(_.StrictMode,{children:t}))}var SS={exports:{}};/*!
|
|
47
|
+
Copyright (c) 2018 Jed Watson.
|
|
48
|
+
Licensed under the MIT License (MIT), see
|
|
49
|
+
http://jedwatson.github.io/classnames
|
|
50
|
+
*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)e.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(SS);var i2=SS.exports;const yi=di(i2),s2="_button_474wk_1",a2="_disabled_474wk_30",l2="_fullWidth_474wk_118",u2="_button__leftIcon_474wk_124",c2="_button__rightIcon_474wk_125",ko={button:s2,disabled:a2,"buttonType-muted":"_buttonType-muted_474wk_34","buttonType-primary":"_buttonType-primary_474wk_50","buttonType-negative":"_buttonType-negative_474wk_71","buttonSize-xxs":"_buttonSize-xxs_474wk_88","buttonSize-xs":"_buttonSize-xs_474wk_93","buttonSize-s":"_buttonSize-s_474wk_98","buttonSize-m":"_buttonSize-m_474wk_103","buttonSize-l":"_buttonSize-l_474wk_108","buttonSize-xl":"_buttonSize-xl_474wk_113",fullWidth:l2,button__leftIcon:u2,button__rightIcon:c2};function _i(t){var e,n=t.children,r=t.className,o=t.disabled,i=t.buttonType,s=i===void 0?"muted":i,a=t.buttonSize,u=a===void 0?"m":a,l=t.fullWidth,c=t.onClick,d=t.style,f=t.leftIcon,p=t.rightIcon,h=t.type,m=h===void 0?"button":h;return ue.createElement("button",{type:m,className:yi(ko.button,ko["buttonType-".concat(s)],ko["buttonSize-".concat(u)],(e={},e[ko.disabled]=o,e[ko.fullWidth]=l,e),r),disabled:o,onClick:c,style:d},f&&ue.createElement("span",{className:ko.button__leftIcon},f),n&&ue.createElement("span",null,n),p&&ue.createElement("span",{className:ko.button__rightIcon},p))}var xh=function(){return xh=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},xh.apply(this,arguments)};function tv(t){return t===t.toLowerCase()?t:t.replace(/[A-Z]/g,function(e){return"-".concat(e.toLowerCase())})}function d2(t,e){return e===void 0&&(e=!1),xh({padding:e?void 0:t.bodyPadding.map(function(n){return"".concat(n,"px")}).join(" ")},Object.fromEntries(Object.entries(t.theme).flatMap(function(n){var r,o=n[0],i=n[1];return[["--".concat(tv(o)),i],["--".concat(tv("".concat(o,"RgbComponents"))),((r=i.match(/rgb\((\d+, \d+, \d+)\)/))===null||r===void 0?void 0:r[1])||void 0]]})))}const f2="_themeVariables_ovgoa_1",p2="_canvas_ovgoa_68",nv={themeVariables:f2,canvas:p2};var h2=_.createContext(null);function ma(t){var e=t.ctx,n=t.children,r=t.noAutoResizer,o=e.mode;return _.useEffect(function(){if(!r&&"startAutoResizer"in e){var i=e;return i.startAutoResizer(),function(){i.stopAutoResizer()}}},[o,r]),ue.createElement(h2.Provider,{value:e},ue.createElement("div",{className:yi(nv.themeVariables,nv.canvas),style:d2(e)},n))}const m2="_fieldError_qi0xk_1",y2={fieldError:m2};function kS(t){var e=t.children;return ue.createElement("div",{className:y2.fieldError},e)}const g2="_fieldHint_1avon_1",v2={fieldHint:g2};function xS(t){var e=t.children;return ue.createElement("div",{className:v2.fieldHint},e)}var Eh=function(){return Eh=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Eh.apply(this,arguments)};function w2(t){var e=t.id,n=t.label,r=t.hint,o=t.error,i=t.required,s=t.formLabelProps,a=t.children;return ue.createElement(ue.Fragment,null,ue.createElement(ES,Eh({},s,{htmlFor:e,required:i,error:!!o}),n),a,o&&ue.createElement(kS,null,o),r&&ue.createElement(xS,null,r))}const b2="_formLabel_tcjrv_1",_2="_formLabel__code_tcjrv_8",S2="_formLabel__label_tcjrv_18",k2="_formLabel__required_tcjrv_30",$s={formLabel:b2,formLabel__code:_2,"formLabel--error":"_formLabel--error_tcjrv_14",formLabel__label:S2,formLabel__required:k2};var Th=function(){return Th=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Th.apply(this,arguments)},x2=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 o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n},ES=function(t){var e,n=t.children,r=t.className,o=t.htmlFor,i=t.code,s=t.required,a=s===void 0?!1:s,u=t.error,l=u===void 0?!1:u,c=x2(t,["children","className","htmlFor","code","required","error"]),d=yi($s.formLabel,r,(e={},e[$s["formLabel--error"]]=l,e));return ue.createElement("label",Th({className:d,htmlFor:o},c),ue.createElement("span",{className:$s.formLabel__label},n,a&&ue.createElement("span",{className:$s.formLabel__required},"*")),i&&ue.createElement("span",{className:$s.formLabel__code},i))},rv=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function E2(t,e){return!!(t===e||rv(t)&&rv(e))}function T2(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!E2(t[n],e[n]))return!1;return!0}function C2(t,e){e===void 0&&(e=T2);var n=null;function r(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(n&&n.lastThis===this&&e(o,n.lastArgs))return n.lastResult;var s=t.apply(this,o);return n={lastResult:s,lastArgs:o,lastThis:this},s}return r.clear=function(){n=null},r}const M2="_Spinner__bar_oumod_13",Lf={"Spinner--inline":"_Spinner--inline_oumod_1","Spinner--centered":"_Spinner--centered_oumod_7",Spinner__bar:M2};var vc=function(){return vc=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},vc.apply(this,arguments)};function Ch(t){for(var e,n=t.size,r=n===void 0?32:n,o=t.placement,i=o===void 0?"inline":o,s=t.style,a=s===void 0?{}:s,u=[],l=0;l<12;l+=1){var c={};c.animationDelay="".concat((l-12)/10,"s"),c.transform="rotate(".concat(l*30,"deg) translate(146%)"),u.push(ue.createElement("div",{style:c,className:Lf.Spinner__bar,key:l}))}var d={width:r*.5,height:r*.5};return i==="inline"&&(d.marginLeft=r*.5,d.transform="translateY(33%)"),ue.createElement("div",{className:yi((e={},e[Lf["Spinner--inline"]]=i==="inline",e[Lf["Spinner--centered"]]=i==="centered",e)),style:vc(vc({},a),d)},u)}const O2="_switchField__flex_16z4j_1",N2="_switchField__switchInput_16z4j_6",A2="_switchField__label_16z4j_10",I2="_switchField__below_16z4j_22",Gl={switchField__flex:O2,switchField__switchInput:N2,switchField__label:A2,switchField__below:I2};var wc=function(){return wc=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},wc.apply(this,arguments)};function ov(t){var e=t.id,n=t.name,r=t.label,o=t.hint,i=t.error,s=t.required,a=t.formLabelProps,u=t.value,l=t.onChange,c=t.switchInputProps;return ue.createElement(ue.Fragment,null,ue.createElement("div",{className:Gl.switchField__flex},ue.createElement("div",{className:Gl.switchField__switchInput},ue.createElement(B2,wc({},c,{name:n,value:u,onChange:l}))),ue.createElement(ES,wc({},a,{htmlFor:e,required:s,className:yi(Gl.switchField__label,a==null?void 0:a.className),error:!!i}),r)),(o||i)&&ue.createElement("div",{className:Gl.switchField__below},i&&ue.createElement(kS,null,i),o&&ue.createElement(xS,null,o)))}const P2="_switchInput__inner_1knbg_1",R2="_switchInput_1knbg_1",D2="_switchInput__checked_1knbg_47",j2="_switchInput__disabled_1knbg_60",Jl={switchInput__inner:P2,switchInput:R2,switchInput__checked:D2,switchInput__disabled:j2};var Mh=function(){return Mh=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Mh.apply(this,arguments)},L2=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 o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function B2(t){var e,n=t.className,r=t.value,o=t.disabled,i=t.onClick,s=t.onChange,a=t.onKeyDown,u=L2(t,["className","value","disabled","onClick","onChange","onKeyDown"]);function l(p,h){!o&&s&&s(p,h)}function c(p){p.key==="ArrowLeft"?l(!1,p):p.key==="ArrowRight"&&l(!0,p),a==null||a(p)}function d(p){l(!r,p),i==null||i(p)}var f=yi(Jl.switchInput,n,(e={},e[Jl.switchInput__checked]=r,e[Jl.switchInput__disabled]=o,e));return ue.createElement("button",Mh({},u,{type:"button",role:"switch","aria-checked":r,disabled:o,className:f,onKeyDown:c,onClick:d}),ue.createElement("span",{className:Jl.switchInput__inner}))}var Oh=function(){return Oh=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Oh.apply(this,arguments)};function F2(t){var e=t.id,n=t.name,r=t.label,o=t.hint,i=t.error,s=t.required,a=t.placeholder,u=t.formLabelProps,l=t.value,c=t.onChange,d=t.textInputProps;return ue.createElement(w2,{formLabelProps:u,id:e,required:s,error:i,hint:o,label:r},ue.createElement(U2,Oh({},d,{id:e,name:n,value:l,placeholder:a,onChange:c,error:!!i})))}const $2="_TextInput_x2oj2_1",Yl={TextInput:$2,"TextInput--monospaced":"_TextInput--monospaced_x2oj2_30","TextInput--disabled":"_TextInput--disabled_x2oj2_35","TextInput--error":"_TextInput--error_x2oj2_41"};var Nh=function(){return Nh=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Nh.apply(this,arguments)},z2=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 o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n},U2=function(t){var e,n=t.className,r=t.disabled,o=r===void 0?!1:r,i=t.error,s=t.id,a=t.inputRef,u=t.maxLength,l=t.name,c=t.labelText,d=t.onBlur,f=t.onChange,p=t.placeholder,h=t.required,m=h===void 0?!1:h,v=t.type,y=t.value,w=t.monospaced,b=z2(t,["className","disabled","error","id","inputRef","maxLength","name","labelText","onBlur","onChange","placeholder","required","type","value","monospaced"]),S=_.useCallback(function(E){f&&f(E.target.value,E)},[f]),k=yi(Yl.TextInput,n,(e={},e[Yl["TextInput--disabled"]]=o,e[Yl["TextInput--error"]]=i,e[Yl["TextInput--monospaced"]]=w,e));return ue.createElement("input",Nh({className:k,"aria-label":c,id:s,name:l,required:m,placeholder:p,maxLength:u,disabled:o,onBlur:d,onChange:S,value:y,type:v,ref:a},b))};function V2(t,e){_.useEffect(()=>{t.current&&t.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[e])}function TS(t,e){const n=_.useRef(e);_.useLayoutEffect(()=>{n.current=e}),_.useEffect(()=>{const r=o=>{t.current&&!t.current.contains(o.target)&&n.current()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[t])}function ot(...t){return t.filter(Boolean).join(" ")}const q2="_comment_1tag8_2",H2="_commentBody_1tag8_7",W2="_reply_1tag8_22",K2="_avatarContainer_1tag8_27",G2="_avatar_1tag8_27",J2="_content_1tag8_39",Y2="_header_1tag8_46",Q2="_authorName_1tag8_53",X2="_timestamp_1tag8_60",Z2="_text_1tag8_67",eP="_editContainer_1tag8_77",tP="_footer_1tag8_111",nP="_reaction_1tag8_119",rP="_reactionActive_1tag8_139",oP="_reactionWrapper_1tag8_150",iP="_tooltip_1tag8_156 _tooltipBase_pq2lx_22",sP="_tooltipArrow_1tag8_160 _tooltipArrowDown_pq2lx_51",aP="_replyToggle_1tag8_170",lP="_replyText_1tag8_192",uP="_replyAvatars_1tag8_198",cP="_replyAvatar_1tag8_198",dP="_replyMeta_1tag8_223",fP="_chevron_1tag8_229",pP="_chevronExpanded_1tag8_242",hP="_actionsWrapper_1tag8_251",mP="_actions_1tag8_251",yP="_actionsTrigger_1tag8_287",gP="_actionBtn_1tag8_324",vP="_actionBtnActive_1tag8_343",wP="_actionBtnDanger_1tag8_352",bP="_replies_1tag8_358",_P="_mentionDropdown_1tag8_424",SP="_mentionDropdownAbove_1tag8_442",kP="_mentionHeader_1tag8_449",xP="_mentionList_1tag8_462",EP="_mentionOption_1tag8_499",TP="_mentionOptionSelected_1tag8_518",CP="_mentionFieldLabel_1tag8_527",MP="_mentionFieldApiKey_1tag8_532",OP="_mentionEmpty_1tag8_543",NP="_fieldMention_1tag8_555",AP="_fieldMentionDisabled_1tag8_583",IP="_fieldMentionWrapper_1tag8_593",PP="_fieldMentionTooltip_1tag8_599 _tooltipBase_pq2lx_22",RP="_fieldMentionTooltipArrow_1tag8_603 _tooltipArrowDown_pq2lx_51",DP="_mentionUserAvatar_1tag8_616",jP="_mentionUserName_1tag8_625",LP="_mentionModelInfo_1tag8_650",BP="_mentionModelName_1tag8_658",FP="_mentionModelBadge_1tag8_666",$P="_userMentionWrapper_1tag8_688",zP="_userMention_1tag8_688",UP="_userMentionDisabled_1tag8_721",VP="_userMentionTooltip_1tag8_731 _tooltipBase_pq2lx_22",qP="_userMentionTooltipArrow_1tag8_735 _tooltipArrowDown_pq2lx_51",HP="_assetMentionWrapper_1tag8_749",WP="_assetMention_1tag8_749",KP="_assetMentionNoThumb_1tag8_793",GP="_assetMentionName_1tag8_797",JP="_assetMentionTooltip_1tag8_801 _tooltipBase_pq2lx_22",YP="_assetMentionTooltipArrow_1tag8_805 _tooltipArrowDown_pq2lx_51",QP="_assetMentionBlockWrapper_1tag8_819",XP="_assetMentionBlock_1tag8_819",ZP="_assetMentionBlockThumb_1tag8_853",eR="_assetMentionBlockName_1tag8_861",tR="_assetMentionBlockFallback_1tag8_884",nR="_recordMentionWrapper_1tag8_906",rR="_recordMention_1tag8_906",oR="_recordMentionIcon_1tag8_944",iR="_recordMentionEmoji_1tag8_951",sR="_recordMentionThumb_1tag8_957",aR="_recordMentionTitle_1tag8_965",lR="_recordMentionFallback_1tag8_976",uR="_recordMentionTooltip_1tag8_987 _tooltipBase_pq2lx_22",cR="_recordMentionTooltipArrow_1tag8_991 _tooltipArrowDown_pq2lx_51",dR="_modelMentionWrapper_1tag8_1005",fR="_modelMention_1tag8_1005",pR="_modelMentionIcon_1tag8_1040",hR="_modelMentionEmoji_1tag8_1047",mR="_modelMentionTooltip_1tag8_1053 _tooltipBase_pq2lx_22",yR="_modelMentionTooltipArrow_1tag8_1057 _tooltipArrowDown_pq2lx_51",gR="_recordModelSearchWrapper_1tag8_1070",vR="_recordModelSearchInput_1tag8_1075",wR="_mentionBackButton_1tag8_1101",bR="_mentionLocaleBadge_1tag8_1127",_R="_mentionLocaleIndicator_1tag8_1148",SR="_mentionFieldMeta_1tag8_1161",kR="_fieldMentionLocaleBadge_1tag8_1172",xR="_mentionOptionEntireField_1tag8_1192",ER="_mentionBlockCount_1tag8_1205",TR="_mentionBlockBadge_1tag8_1216",CR="_mentionBlockIndicator_1tag8_1236",MR="_errorFallback_1tag8_1256",A={comment:q2,commentBody:H2,reply:W2,avatarContainer:K2,avatar:G2,content:J2,header:Y2,authorName:Q2,timestamp:X2,text:Z2,editContainer:eP,footer:tP,reaction:nP,reactionActive:rP,reactionWrapper:oP,tooltip:iP,tooltipArrow:sP,replyToggle:aP,replyText:lP,replyAvatars:uP,replyAvatar:cP,replyMeta:dP,chevron:fP,chevronExpanded:pP,actionsWrapper:hP,actions:mP,actionsTrigger:yP,actionBtn:gP,actionBtnActive:vP,actionBtnDanger:wP,replies:bP,mentionDropdown:_P,mentionDropdownAbove:SP,mentionHeader:kP,mentionList:xP,mentionOption:EP,mentionOptionSelected:TP,mentionFieldLabel:CP,mentionFieldApiKey:MP,mentionEmpty:OP,fieldMention:NP,fieldMentionDisabled:AP,fieldMentionWrapper:IP,fieldMentionTooltip:PP,fieldMentionTooltipArrow:RP,mentionUserAvatar:DP,mentionUserName:jP,mentionModelInfo:LP,mentionModelName:BP,mentionModelBadge:FP,userMentionWrapper:$P,userMention:zP,userMentionDisabled:UP,userMentionTooltip:VP,userMentionTooltipArrow:qP,assetMentionWrapper:HP,assetMention:WP,assetMentionNoThumb:KP,assetMentionName:GP,assetMentionTooltip:JP,assetMentionTooltipArrow:YP,assetMentionBlockWrapper:QP,assetMentionBlock:XP,assetMentionBlockThumb:ZP,assetMentionBlockName:eR,assetMentionBlockFallback:tR,recordMentionWrapper:nR,recordMention:rR,recordMentionIcon:oR,recordMentionEmoji:iR,recordMentionThumb:sR,recordMentionTitle:aR,recordMentionFallback:lR,recordMentionTooltip:uR,recordMentionTooltipArrow:cR,modelMentionWrapper:dR,modelMention:fR,modelMentionIcon:pR,modelMentionEmoji:hR,modelMentionTooltip:mR,modelMentionTooltipArrow:yR,recordModelSearchWrapper:gR,recordModelSearchInput:vR,mentionBackButton:wR,mentionLocaleBadge:bR,mentionLocaleIndicator:_R,mentionFieldMeta:SR,fieldMentionLocaleBadge:kR,mentionOptionEntireField:xR,mentionBlockCount:ER,mentionBlockBadge:TR,mentionBlockIndicator:CR,errorFallback:MR};function Ny({items:t,emptyMessage:e,headerText:n,selectedIndex:r,onClose:o,renderItem:i,keyExtractor:s,position:a="below",searchSlot:u}){const l=_.useRef(null),c=_.useRef(null);V2(c,r),TS(l,o);const d=ot(A.mentionDropdown,a==="above"&&A.mentionDropdownAbove);return t.length===0&&!u?g.jsx("div",{ref:l,className:d,children:g.jsx("div",{className:A.mentionEmpty,children:e})}):g.jsxs("div",{ref:l,className:d,children:[g.jsx("div",{className:A.mentionHeader,children:n}),u,t.length===0?g.jsx("div",{className:A.mentionEmpty,children:e}):g.jsx("div",{className:A.mentionList,children:t.map((f,p)=>g.jsx("div",{children:i(f,p,p===r,p===r?c:{current:null})},s(f)))})]})}const Ah=({models:t,onSelect:e,onClose:n,position:r="below"})=>{const o=_.useRef(null),[i,s]=_.useState(""),[a,u]=_.useState(0),l=_.useMemo(()=>t.filter(h=>!h.isBlockModel),[t]),c=_.useMemo(()=>{const h=i.toLowerCase();return l.filter(m=>m.name.toLowerCase().includes(h)||m.apiKey.toLowerCase().includes(h))},[i,l]);_.useEffect(()=>{u(0)},[i]),_.useEffect(()=>{var h;(h=o.current)==null||h.focus()},[]);const d=i?`No models matching "${i}"`:l.length===0?"No models available with read permission":"No models available",f=h=>{switch(h.key){case"ArrowDown":h.preventDefault(),u(m=>m<c.length-1?m+1:m);break;case"ArrowUp":h.preventDefault(),u(m=>m>0?m-1:m);break;case"Enter":h.preventDefault(),c.length>0&&e(c[a]);break;case"Tab":h.preventDefault(),c.length>0&&e(c[a]);break;case"Escape":h.preventDefault(),n();break}},p=g.jsx("div",{className:A.recordModelSearchWrapper,onKeyDown:f,children:g.jsx("input",{ref:o,type:"text",className:A.recordModelSearchInput,placeholder:"Search models...",value:i,onChange:h=>s(h.target.value)})});return g.jsx(Ny,{items:c,emptyMessage:d,headerText:"Select a Model",selectedIndex:a,onClose:n,position:r,keyExtractor:h=>h.id,searchSlot:p,renderItem:(h,m,v,y)=>g.jsxs("button",{ref:v?y:null,type:"button",className:ot(A.mentionOption,v&&A.mentionOptionSelected),onMouseDown:w=>{w.preventDefault(),e(h)},onMouseEnter:()=>u(m),children:[g.jsx("span",{className:A.mentionModelInfo,children:g.jsx("span",{className:A.mentionModelName,children:h.name})}),g.jsxs("span",{className:A.mentionFieldApiKey,children:["$",h.apiKey]})]})})};function OR(t){return g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",...t,children:g.jsx("path",{d:"M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"})})}function CS(t){return g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",...t,children:g.jsx("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})})}function NR(t){return g.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M6.598 5.013a.144.144 0 0 1 .202.134V6.3a.5.5 0 0 0 .5.5c.667 0 2.013.005 3.3.822.984.624 1.99 1.76 2.595 3.876-1.02-.983-2.185-1.516-3.205-1.799a8.74 8.74 0 0 0-1.921-.306 7.404 7.404 0 0 0-.798.008h-.013l-.005.001h-.001L7.3 9.9l-.05-.498a.5.5 0 0 0-.45.498v1.153c0 .108-.11.176-.202.134L3.614 8.146a.145.145 0 0 1 0-.292l2.984-2.841z"})})}function AR(t){return g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"})})}function IR(t){return g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"})})}function PR(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z"})})}function RR(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M8.39 12.648a1.32 1.32 0 0 0-.015.18c0 .305.21.508.5.508.266 0 .492-.172.555-.477l.554-2.703h1.204c.421 0 .617-.234.617-.547 0-.312-.188-.53-.617-.53h-.985l.516-2.524h1.265c.43 0 .618-.227.618-.547 0-.313-.188-.524-.618-.524h-1.046l.476-2.304a1.06 1.06 0 0 0 .016-.164.51.51 0 0 0-.516-.516.54.54 0 0 0-.539.43l-.523 2.554H7.617l.477-2.304c.008-.04.015-.118.015-.164a.512.512 0 0 0-.523-.516.539.539 0 0 0-.531.43L6.53 5.484H5.414c-.43 0-.617.22-.617.532 0 .312.187.539.617.539h.906l-.515 2.523H4.609c-.421 0-.609.219-.609.531 0 .313.188.547.61.547h.976l-.516 2.492c-.008.04-.015.125-.015.18 0 .305.21.508.5.508.265 0 .492-.172.554-.477l.555-2.703h2.242l-.515 2.492Zm-1-6.109h2.266l-.515 2.563H6.859l.532-2.563Z"})})}function DR(t){return g.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:[g.jsx("path",{d:"M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"}),g.jsx("path",{d:"M3 4h10v1H3V4zm0 3h10v1H3V7zm0 3h6v1H3v-1z"})]})}function iv(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.5L9.5 0H4zm0 1h5v3.5A1.5 1.5 0 0 0 10.5 6H13v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1z"})})}function jR(t){return g.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:[g.jsx("path",{d:"M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"}),g.jsx("path",{d:"M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"})]})}function MS(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M1 2.5A1.5 1.5 0 0 1 2.5 1h3A1.5 1.5 0 0 1 7 2.5v3A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5v-3zm8 0A1.5 1.5 0 0 1 10.5 1h3A1.5 1.5 0 0 1 15 2.5v3A1.5 1.5 0 0 1 13.5 7h-3A1.5 1.5 0 0 1 9 5.5v-3zm-8 8A1.5 1.5 0 0 1 2.5 9h3A1.5 1.5 0 0 1 7 10.5v3A1.5 1.5 0 0 1 5.5 15h-3A1.5 1.5 0 0 1 1 13.5v-3zm8 0A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 13.5v-3z"})})}function LR(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M15.964.686a.5.5 0 0 0-.65-.65L.767 5.855H.766l-.452.18a.5.5 0 0 0-.082.887l.41.26.001.002 4.995 3.178 3.178 4.995.002.002.26.41a.5.5 0 0 0 .886-.083l6-15Zm-1.833 1.89L6.637 10.07l-.215-.338a.5.5 0 0 0-.154-.154l-.338-.215 7.494-7.494 1.178-.471-.47 1.178Z"})})}function BR(t){return g.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z"})})}function FR(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"})})}function $R(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M14 1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-2.5a2 2 0 0 0-1.6.8L8 14.333 6.1 11.8a2 2 0 0 0-1.6-.8H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2.5a1 1 0 0 1 .8.4l1.9 2.533a1 1 0 0 0 1.6 0l1.9-2.533a1 1 0 0 1 .8-.4H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"})})}function zR(t){return g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4z"})})}function UR(t){return g.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor",...t,children:[g.jsx("path",{d:"M8 0a8 8 0 1 0 8 8 8.009 8.009 0 0 0-8-8Zm0 14.5A6.5 6.5 0 1 1 14.5 8 6.508 6.508 0 0 1 8 14.5Z"}),g.jsx("path",{d:"M8 4a3 3 0 0 0-3 3v1a3 3 0 1 0 6 0V7a3 3 0 0 0-3-3Z"})]})}function VR(t){return g.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:g.jsx("path",{d:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 0 0 5.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 0 1 .64-1.539 6.7 6.7 0 0 1 .597-.933A7.025 7.025 0 0 0 2.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 0 0-.656 2.5h2.49zM4.847 5a12.5 12.5 0 0 0-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 0 0-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 0 0 .337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 0 1-.597-.933A9.268 9.268 0 0 1 4.09 12H2.255a7.024 7.024 0 0 0 3.072 2.472zM3.82 11a13.652 13.652 0 0 1-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0 0 13.745 12H11.91a9.27 9.27 0 0 1-.64 1.539 6.688 6.688 0 0 1-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 0 1-.312 2.5zm2.802-3.5a6.959 6.959 0 0 0-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 0 0-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 0 0-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"})})}const qR="_container_13l7o_2",HR="_loading_13l7o_13",WR="_error_13l7o_21",KR="_header_13l7o_39",GR="_warning_13l7o_51",JR="_composer_13l7o_69",YR="_composerInputWrapper_13l7o_90",QR="_commentsList_13l7o_145",XR="_empty_13l7o_151",ZR="_composerToolbar_13l7o_176",eD="_toolbarMentions_13l7o_187",tD="_toolbarButtonWrapper_13l7o_196",nD="_toolbarButton_13l7o_196",rD="_toolbarButtonUser_13l7o_237",oD="_toolbarButtonField_13l7o_242",iD="_toolbarButtonRecord_13l7o_247",sD="_toolbarButtonAsset_13l7o_252",aD="_toolbarButtonModel_13l7o_257",lD="_toolbarButtonDisabled_13l7o_263",uD="_toolbarTooltip_13l7o_274",cD="_toolbarTooltipArrow_13l7o_293",dD="_sendButton_13l7o_308",fD="_loadMoreButton_13l7o_350",He={container:qR,loading:HR,error:WR,header:KR,warning:GR,composer:JR,composerInputWrapper:YR,commentsList:QR,empty:XR,composerToolbar:ZR,toolbarMentions:eD,toolbarButtonWrapper:tD,toolbarButton:nD,toolbarButtonUser:rD,toolbarButtonField:oD,toolbarButtonRecord:iD,toolbarButtonAsset:sD,toolbarButtonModel:aD,toolbarButtonDisabled:lD,toolbarTooltip:uD,toolbarTooltipArrow:cD,sendButton:dD,loadMoreButton:fD},pD="_dashboardContainer_1ttua_14",hD="_mainChannel_1ttua_29",mD="_sidebar_1ttua_38",yD="_sidebarInner_1ttua_49",gD="_channelContainer_1ttua_60",vD="_channelHeaderMinimal_1ttua_97",wD="_channelTitleMinimal_1ttua_104",bD="_commentsList_1ttua_110",_D="_commentsListEmpty_1ttua_120",SD="_emptyIcon_1ttua_131",kD="_emptyTitle_1ttua_138",xD="_emptyDescription_1ttua_145",ED="_newCommentsIndicator_1ttua_155",TD="_composer_1ttua_192",CD="_composerBox_1ttua_198",MD="_composerToolbar_1ttua_243",OD="_toolbarMentions_1ttua_252",ND="_toolbarButton_1ttua_258",AD="_sendButton_1ttua_288",ID="_compact_1ttua_327",PD="_sidebarSection_1ttua_359",RD="_sectionHeader_1ttua_371",DD="_sectionTitle_1ttua_378",jD="_sectionContent_1ttua_387",LD="_commentPreview_1ttua_396",BD="_previewAvatar_1ttua_418",FD="_previewContent_1ttua_425",$D="_previewHeader_1ttua_430",zD="_previewAuthor_1ttua_437",UD="_previewTime_1ttua_446",VD="_previewText_1ttua_452",qD="_previewContext_1ttua_461",HD="_previewContextIcon_1ttua_470",WD="_previewContextText_1ttua_476",KD="_previewMentionBadge_1ttua_482",GD="_loading_1ttua_501",JD="_loadingSpinner_1ttua_509",YD="_emptySmall_1ttua_537",QD="_error_1ttua_548",XD="_filterColumn_1ttua_572",ZD="_searchIcon_1ttua_611",ej="_searchClear_1ttua_642",tj="_filterDropdown_1ttua_670",nj="_filterDropdownDisabled_1ttua_674",rj="_filterDropdownTrigger_1ttua_679",oj="_filterDropdownActive_1ttua_700",ij="_filterDropdownLabel_1ttua_705",sj="_filterDropdownValue_1ttua_710",aj="_filterDropdownChevron_1ttua_718",lj="_filterDropdownMenu_1ttua_725",uj="_filterDropdownSearch_1ttua_739",cj="_filterDropdownSearchInput_1ttua_744",dj="_filterDropdownOptions_1ttua_761",fj="_filterDropdownOption_1ttua_761",pj="_filterDropdownOptionSelected_1ttua_787",hj="_filterDropdownOptionHighlighted_1ttua_795",mj="_filterDropdownOptionLabel_1ttua_799",yj="_filterDropdownOptionSublabel_1ttua_803",gj="_filterDropdownEmpty_1ttua_808",vj="_noResults_1ttua_1008",wj="_noResultsIcon_1ttua_1018",bj="_noResultsTitle_1ttua_1026",_j="_noResultsDescription_1ttua_1033",Sj="_filterSidebar_1ttua_1080",kj="_filterSidebarHeader_1ttua_1087",xj="_filterSidebarTitle_1ttua_1097",Ej="_filterSidebarContent_1ttua_1138",Tj="_filterSidebarFooter_1ttua_1144",Cj="_clearFiltersButton_1ttua_1154",Mj="_applyFiltersButton_1ttua_1182",Oj="_filterSection_1ttua_1212",Nj="_filterSectionLabel_1ttua_1220",Aj="_searchInputWrapperVertical_1ttua_1231",Ij="_searchInputVertical_1ttua_1237",Pj="_dateRangeVertical_1ttua_1262",Rj="_dateInputVerticalWrapper_1ttua_1268",Dj="_dateInputVerticalLabel_1ttua_1274",jj="_dateInputVertical_1ttua_1268",Lj="_filterToggleFab_1ttua_1329",Bj="_filterToggleFabActive_1ttua_1356",Fj="_filterToggleFabExpanded_1ttua_1365",$j="_filterToggleFabIcon_1ttua_1375",zj="_filterToggleFabBadge_1ttua_1380",Uj="_loadEarlierButton_1ttua_1401",j={dashboardContainer:pD,mainChannel:hD,sidebar:mD,sidebarInner:yD,channelContainer:gD,channelHeaderMinimal:vD,channelTitleMinimal:wD,commentsList:bD,commentsListEmpty:_D,emptyIcon:SD,emptyTitle:kD,emptyDescription:xD,newCommentsIndicator:ED,composer:TD,composerBox:CD,composerToolbar:MD,toolbarMentions:OD,toolbarButton:ND,sendButton:AD,compact:ID,sidebarSection:PD,sectionHeader:RD,sectionTitle:DD,sectionContent:jD,commentPreview:LD,previewAvatar:BD,previewContent:FD,previewHeader:$D,previewAuthor:zD,previewTime:UD,previewText:VD,previewContext:qD,previewContextIcon:HD,previewContextText:WD,previewMentionBadge:KD,loading:GD,loadingSpinner:JD,emptySmall:YD,error:QD,filterColumn:XD,searchIcon:ZD,searchClear:ej,filterDropdown:tj,filterDropdownDisabled:nj,filterDropdownTrigger:rj,filterDropdownActive:oj,filterDropdownLabel:ij,filterDropdownValue:sj,filterDropdownChevron:aj,filterDropdownMenu:lj,filterDropdownSearch:uj,filterDropdownSearchInput:cj,filterDropdownOptions:dj,filterDropdownOption:fj,filterDropdownOptionSelected:pj,filterDropdownOptionHighlighted:hj,filterDropdownOptionLabel:mj,filterDropdownOptionSublabel:yj,filterDropdownEmpty:gj,noResults:vj,noResultsIcon:wj,noResultsTitle:bj,noResultsDescription:_j,filterSidebar:Sj,filterSidebarHeader:kj,filterSidebarTitle:xj,filterSidebarContent:Ej,filterSidebarFooter:Tj,clearFiltersButton:Cj,applyFiltersButton:Mj,filterSection:Oj,filterSectionLabel:Nj,searchInputWrapperVertical:Aj,searchInputVertical:Ij,dateRangeVertical:Pj,dateInputVerticalWrapper:Rj,dateInputVerticalLabel:Dj,dateInputVertical:jj,filterToggleFab:Lj,filterToggleFabActive:Bj,filterToggleFabExpanded:Fj,filterToggleFabIcon:$j,filterToggleFabBadge:zj,loadEarlierButton:Uj};function Vj({icon:t,tooltipText:e,onClick:n,disabled:r=!1,ariaLabel:o,buttonClassName:i}){return g.jsxs("span",{className:He.toolbarButtonWrapper,children:[g.jsx("button",{type:"button",className:ot(i,r&&He.toolbarButtonDisabled),onClick:r?void 0:n,disabled:r,"aria-label":o,children:t}),g.jsxs("span",{className:He.toolbarTooltip,children:[e,g.jsx("span",{className:He.toolbarTooltipArrow})]})]})}const zs=_.memo(Vj),qj=g.jsx(PR,{}),Hj=g.jsx(RR,{}),Wj=g.jsx(DR,{}),Kj=g.jsx(jR,{}),Gj=g.jsx(MS,{}),Jj=g.jsx(LR,{}),Ay=({onUserClick:t,onFieldClick:e,onRecordClick:n,onAssetClick:r,onModelClick:o,onSendClick:i,isSendDisabled:s,canMentionAssets:a=!0,canMentionModels:u=!0,canMentionFields:l=!0,large:c=!1,accentColor:d})=>{const f=c?j:He,p=d?{backgroundColor:d}:void 0;return g.jsxs("div",{className:f.composerToolbar,children:[g.jsxs("div",{className:f.toolbarMentions,children:[g.jsx(zs,{icon:qj,tooltipText:"User",onClick:t,ariaLabel:"Mention user",buttonClassName:ot(f.toolbarButton,He.toolbarButtonUser)}),l&&g.jsx(zs,{icon:Hj,tooltipText:"Field",onClick:e,ariaLabel:"Mention field",buttonClassName:ot(f.toolbarButton,He.toolbarButtonField)}),g.jsx(zs,{icon:Wj,tooltipText:"Record",onClick:n,ariaLabel:"Mention record",buttonClassName:ot(f.toolbarButton,He.toolbarButtonRecord)}),g.jsx(zs,{icon:Kj,tooltipText:a?"Asset":"No upload permission",onClick:r,disabled:!a,ariaLabel:a?"Mention asset":"Asset mentions unavailable - no upload permissions",buttonClassName:ot(f.toolbarButton,He.toolbarButtonAsset)}),g.jsx(zs,{icon:Gj,tooltipText:u?"Model":"No schema access",onClick:o,disabled:!u,ariaLabel:u?"Mention model":"Model mentions unavailable - no schema access",buttonClassName:ot(f.toolbarButton,He.toolbarButtonModel)})]}),g.jsxs("span",{className:He.toolbarButtonWrapper,children:[g.jsx("button",{type:"button",className:f.sendButton,style:p,onClick:i,disabled:s,"aria-label":"Send comment",children:Jj}),g.jsxs("span",{className:He.toolbarTooltip,children:["Send",g.jsx("span",{className:He.toolbarTooltipArrow})]})]})]})};var OS={exports:{}},Yj="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Qj=Yj,Xj=Qj;function NS(){}function AS(){}AS.resetWarningCache=NS;var Zj=function(){function t(r,o,i,s,a,u){if(u!==Xj){var l=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 l.name="Invariant Violation",l}}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:AS,resetWarningCache:NS};return n.PropTypes=n,n};OS.exports=Zj();var eL=OS.exports;const Se=di(eL);var tL=["date","verboseDate","tooltip","children"];function Ih(){return Ih=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ih.apply(this,arguments)}function nL(t,e){if(t==null)return{};var n=rL(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function rL(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function bc(t,e){var n=t.date,r=t.verboseDate,o=t.tooltip,i=t.children,s=nL(t,tL),a=_.useMemo(function(){return n.toISOString()},[n]);return ue.createElement("time",Ih({ref:e},s,{dateTime:a,title:o?r:void 0}),i)}bc=ue.forwardRef(bc);bc.propTypes={date:Se.instanceOf(Date).isRequired,verboseDate:Se.string,tooltip:Se.bool.isRequired,children:Se.string.isRequired};var IS="en",Iy={},Ph={};function PS(){return IS}function RS(t){IS=t}function oL(t){return Iy[t]}function DS(t){if(!t)throw new Error("No locale data passed");Iy[t.locale]=t,Ph[t.locale.toLowerCase()]=t.locale}function sv(t){if(Iy[t])return t;if(Ph[t.toLowerCase()])return Ph[t.toLowerCase()]}function jS(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.localeMatcher||"lookup";switch(n){case"lookup":return av(t);case"best fit":return av(t);default:throw new RangeError('Invalid "localeMatcher" option: '.concat(n))}}function av(t){var e=sv(t);if(e)return e;for(var n=t.split("-");t.length>1;){n.pop(),t=n.join("-");var r=sv(t);if(r)return r}}var C={af:function(e){return e==1?"one":"other"},ak:function(e){return e==0||e==1?"one":"other"},am:function(e){return e>=0&&e<=1?"one":"other"},ar:function(e){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"},ast:function(e){var n=String(e).split("."),r=!n[1];return e==1&&r?"one":"other"},be:function(e){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return o==1&&i!=11?"one":o>=2&&o<=4&&(i<12||i>14)?"few":r&&o==0||o>=5&&o<=9||i>=11&&i<=14?"many":"other"},blo:function(e){return e==0?"zero":e==1?"one":"other"},br:function(e){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return o==1&&i!=11&&i!=71&&i!=91?"one":o==2&&i!=12&&i!=72&&i!=92?"two":(o==3||o==4||o==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":e!=0&&r&&s==0?"many":"other"},bs:function(e){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),u=o.slice(-1),l=o.slice(-2);return i&&s==1&&a!=11||u==1&&l!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||u>=2&&u<=4&&(l<12||l>14)?"few":"other"},ca:function(e){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-6);return e==1&&o?"one":r!=0&&i==0&&o?"many":"other"},ceb:function(e){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"},cs:function(e){var n=String(e).split("."),r=n[0],o=!n[1];return e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"},cy:function(e){return e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"},da:function(e){var n=String(e).split("."),r=n[0],o=Number(n[0])==e;return e==1||!o&&(r==0||r==1)?"one":"other"},dsb:function(e){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"},dz:function(e){return"other"},es:function(e){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-6);return e==1?"one":r!=0&&i==0&&o?"many":"other"},ff:function(e){return e>=0&&e<2?"one":"other"},fr:function(e){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-6);return e>=0&&e<2?"one":r!=0&&i==0&&o?"many":"other"},ga:function(e){var n=String(e).split("."),r=Number(n[0])==e;return e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"},gd:function(e){var n=String(e).split("."),r=Number(n[0])==e;return e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"},he:function(e){var n=String(e).split("."),r=n[0],o=!n[1];return r==1&&o||r==0&&!o?"one":r==2&&o?"two":"other"},is:function(e){var n=String(e).split("."),r=n[0],o=(n[1]||"").replace(/0+$/,""),i=Number(n[0])==e,s=r.slice(-1),a=r.slice(-2);return i&&s==1&&a!=11||o%10==1&&o%100!=11?"one":"other"},lt:function(e){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"},lv:function(e){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),u=r.slice(-2),l=r.slice(-1);return i&&s==0||a>=11&&a<=19||o==2&&u>=11&&u<=19?"zero":s==1&&a!=11||o==2&&l==1&&u!=11||o!=2&&l==1?"one":"other"},mk:function(e){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),u=o.slice(-1),l=o.slice(-2);return i&&s==1&&a!=11||u==1&&l!=11?"one":"other"},mt:function(e){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return e==1?"one":e==2?"two":e==0||o>=3&&o<=10?"few":o>=11&&o<=19?"many":"other"},pl:function(e){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return e==1&&o?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&r!=1&&(i==0||i==1)||o&&i>=5&&i<=9||o&&s>=12&&s<=14?"many":"other"},pt:function(e){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-6);return r==0||r==1?"one":r!=0&&i==0&&o?"many":"other"},ro:function(e){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return e==1&&r?"one":!r||e==0||e!=1&&i>=1&&i<=19?"few":"other"},ru:function(e){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return o&&i==1&&s!=11?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&i==0||o&&i>=5&&i<=9||o&&s>=11&&s<=14?"many":"other"},se:function(e){return e==1?"one":e==2?"two":"other"},si:function(e){var n=String(e).split("."),r=n[0],o=n[1]||"";return e==0||e==1||r==0&&o==1?"one":"other"},sl:function(e){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-2);return o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}};C.as=C.am;C.az=C.af;C.bal=C.af;C.bg=C.af;C.bn=C.am;C.brx=C.af;C.ce=C.af;C.chr=C.af;C.de=C.ast;C.doi=C.am;C.ee=C.af;C.el=C.af;C.en=C.ast;C.et=C.ast;C.eu=C.af;C.fa=C.am;C.fi=C.ast;C.fil=C.ceb;C.fo=C.af;C.fur=C.af;C.fy=C.ast;C.gl=C.ast;C.gu=C.am;C.ha=C.af;C.hi=C.am;C.hr=C.bs;C.hsb=C.dsb;C.hu=C.af;C.hy=C.ff;C.ia=C.ast;C.id=C.dz;C.ig=C.dz;C.ii=C.dz;C.it=C.ca;C.ja=C.dz;C.jgo=C.af;C.jv=C.dz;C.ka=C.af;C.kea=C.dz;C.kk=C.af;C.kl=C.af;C.km=C.dz;C.kn=C.am;C.ko=C.dz;C.ks=C.af;C.ksh=C.blo;C.ku=C.af;C.ky=C.af;C.lb=C.af;C.lkt=C.dz;C.lo=C.dz;C.ml=C.af;C.mn=C.af;C.mr=C.af;C.ms=C.dz;C.my=C.dz;C.nb=C.af;C.ne=C.af;C.nl=C.ast;C.nn=C.af;C.no=C.af;C.nqo=C.dz;C.om=C.af;C.or=C.af;C.pa=C.ak;C.pcm=C.am;C.ps=C.af;C.rm=C.af;C.sah=C.dz;C.sc=C.ast;C.sd=C.af;C.sk=C.cs;C.so=C.af;C.sq=C.af;C.sr=C.bs;C.su=C.dz;C.sv=C.ast;C.sw=C.ast;C.syr=C.af;C.ta=C.af;C.te=C.af;C.th=C.dz;C.ti=C.ak;C.tk=C.af;C.tn=C.af;C.to=C.dz;C.tr=C.af;C.ug=C.af;C.uk=C.ru;C.ur=C.ast;C.uz=C.af;C.vec=C.ca;C.vi=C.dz;C.wae=C.af;C.wo=C.dz;C.xh=C.af;C.yi=C.ast;C.yo=C.dz;C.yue=C.dz;C.zh=C.dz;C.zu=C.am;function lv(t){return t==="pt-PT"?t:sL(t)}var iL=/^([a-z0-9]+)/i;function sL(t){var e=t.match(iL);if(!e)throw new TypeError("Invalid locale: ".concat(t));return e[1]}function Ha(t){"@babel/helpers - typeof";return Ha=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ha(t)}function aL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,uL(r.key),r)}}function lL(t,e,n){return e&&uv(t.prototype,e),n&&uv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function uL(t){var e=cL(t,"string");return Ha(e)=="symbol"?e:e+""}function cL(t,e){if(Ha(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ha(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Rh=function(){function t(e,n){aL(this,t);var r=t.supportedLocalesOf(e);if(r.length===0)throw new RangeError("Unsupported locale: "+e);if(n&&n.type!=="cardinal")throw new RangeError('Only "cardinal" "type" is supported');this.$=C[lv(r[0])]}return lL(t,[{key:"select",value:function(n){return this.$(n)}}],[{key:"supportedLocalesOf",value:function(n){return typeof n=="string"&&(n=[n]),n.filter(function(r){return C[lv(r)]})}}]),t}();function gs(t){"@babel/helpers - typeof";return gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gs(t)}function cv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function dv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cv(Object(n),!0).forEach(function(r){dL(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dL(t,e,n){return(e=LS(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fv(t,e){return mL(t)||hL(t,e)||pL(t,e)||fL()}function fL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
51
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pL(t,e){if(t){if(typeof t=="string")return pv(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pv(t,e):void 0}}function pv(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hL(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,o,i,s,a=[],u=!0,l=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(c){l=!0,o=c}finally{try{if(!u&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw o}}return a}}function mL(t){if(Array.isArray(t))return t}function yL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gL(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,LS(r.key),r)}}function vL(t,e,n){return e&&gL(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function LS(t){var e=wL(t,"string");return gs(e)=="symbol"?e:e+""}function wL(t,e){if(gs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var bL=["second","minute","hour","day","week","month","quarter","year"],_L=["auto","always"],SL=["long","short","narrow"],kL=["lookup","best fit"],Tr=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};yL(this,t);var r=n.numeric,o=n.style,i=n.localeMatcher;if(this.numeric="always",this.style="long",this.localeMatcher="lookup",r!==void 0){if(_L.indexOf(r)<0)throw new RangeError('Invalid "numeric" option: '.concat(r));this.numeric=r}if(o!==void 0){if(SL.indexOf(o)<0)throw new RangeError('Invalid "style" option: '.concat(o));this.style=o}if(i!==void 0){if(kL.indexOf(i)<0)throw new RangeError('Invalid "localeMatcher" option: '.concat(i));this.localeMatcher=i}if(typeof e=="string"&&(e=[e]),e.push(PS()),this.locale=t.supportedLocalesOf(e,{localeMatcher:this.localeMatcher})[0],!this.locale)throw new Error("Unsupported locale");Rh.supportedLocalesOf(this.locale).length>0?this.pluralRules=new Rh(this.locale):console.warn('"'.concat(this.locale,'" locale is not supported')),typeof Intl<"u"&&Intl.NumberFormat?(this.numberFormat=new Intl.NumberFormat(this.locale),this.numberingSystem=this.numberFormat.resolvedOptions().numberingSystem):this.numberingSystem="latn",this.locale=jS(this.locale,{localeMatcher:this.localeMatcher})}return vL(t,[{key:"format",value:function(){var n=hv(arguments),r=fv(n,2),o=r[0],i=r[1];return this.getRule(o,i).replace("{0}",this.formatNumber(Math.abs(o)))}},{key:"formatToParts",value:function(){var n=hv(arguments),r=fv(n,2),o=r[0],i=r[1],s=this.getRule(o,i),a=s.indexOf("{0}");if(a<0)return[{type:"literal",value:s}];var u=[];return a>0&&u.push({type:"literal",value:s.slice(0,a)}),u=u.concat(this.formatNumberToParts(Math.abs(o)).map(function(l){return dv(dv({},l),{},{unit:i})})),a+3<s.length-1&&u.push({type:"literal",value:s.slice(a+3)}),u}},{key:"getRule",value:function(n,r){var o=oL(this.locale)[this.style][r];if(typeof o=="string")return o;if(this.numeric==="auto"){if(n===-2||n===-1){var i=o["previous".concat(n===-1?"":"-"+Math.abs(n))];if(i)return i}else if(n===1||n===2){var s=o["next".concat(n===1?"":"-"+Math.abs(n))];if(s)return s}else if(n===0&&o.current)return o.current}var a=o[ML(n)?"past":"future"];if(typeof a=="string")return a;var u=this.pluralRules&&this.pluralRules.select(Math.abs(n))||"other";return a[u]||a.other}},{key:"formatNumber",value:function(n){return this.numberFormat?this.numberFormat.format(n):String(n)}},{key:"formatNumberToParts",value:function(n){return this.numberFormat&&this.numberFormat.formatToParts?this.numberFormat.formatToParts(n):[{type:"integer",value:this.formatNumber(n)}]}},{key:"resolvedOptions",value:function(){return{locale:this.locale,style:this.style,numeric:this.numeric,numberingSystem:this.numberingSystem}}}]),t}();Tr.supportedLocalesOf=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t=="string")t=[t];else if(!Array.isArray(t))throw new TypeError('Invalid "locales" argument');return t.filter(function(n){return jS(n,e)})};Tr.addLocale=DS;Tr.addDefaultLocale=function(t){DS(t),RS(t.locale)};Tr.setDefaultLocale=RS;Tr.getDefaultLocale=PS;Tr.PluralRules=Rh;var Bf='Invalid "unit" argument';function xL(t){if(gs(t)==="symbol")throw new TypeError(Bf);if(typeof t!="string")throw new RangeError("".concat(Bf,": ").concat(t));if(t[t.length-1]==="s"&&(t=t.slice(0,t.length-1)),bL.indexOf(t)<0)throw new RangeError("".concat(Bf,": ").concat(t));return t}var EL='Invalid "number" argument';function TL(t){if(t=Number(t),Number.isFinite&&!Number.isFinite(t))throw new RangeError("".concat(EL,": ").concat(t));return t}function CL(t){return 1/t===-1/0}function ML(t){return t<0||t===0&&CL(t)}function hv(t){if(t.length<2)throw new TypeError('"unit" argument is required');return[TL(t[0]),xL(t[1])]}function ni(t){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ni(t)}function OL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function NL(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,IL(r.key),r)}}function AL(t,e,n){return e&&NL(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function IL(t){var e=PL(t,"string");return ni(e)=="symbol"?e:e+""}function PL(t,e){if(ni(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ni(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var mv=function(){function t(){OL(this,t),this.cache={}}return AL(t,[{key:"get",value:function(){for(var n=this.cache,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];for(var s=0,a=o;s<a.length;s++){var u=a[s];if(ni(n)!=="object")return;n=n[u]}return n}},{key:"put",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];for(var i=r.pop(),s=r.pop(),a=this.cache,u=0,l=r;u<l.length;u++){var c=l[u];ni(a[c])!=="object"&&(a[c]={}),a=a[c]}return a[s]=i}}]),t}();function Dh(t){"@babel/helpers - typeof";return Dh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dh(t)}function RL(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=DL(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
52
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DL(t,e){if(t){if(typeof t=="string")return yv(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yv(t,e):void 0}}function yv(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function jL(t,e){for(var n=RL(t),r;!(r=n()).done;){var o=r.value;if(e(o))return o;for(var i=o.split("-");i.length>1;)if(i.pop(),o=i.join("-"),e(o))return o}throw new Error("No locale data has been registered for any of the locales: ".concat(t.join(", ")))}function LL(){var t=(typeof Intl>"u"?"undefined":Dh(Intl))==="object";return t&&typeof Intl.DateTimeFormat=="function"}function jh(t){"@babel/helpers - typeof";return jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jh(t)}function BL(t){return $L(t)&&(Array.isArray(t.steps)||Array.isArray(t.gradation)||Array.isArray(t.flavour)||typeof t.flavour=="string"||Array.isArray(t.labels)||typeof t.labels=="string"||Array.isArray(t.units)||typeof t.custom=="function")}var FL={}.constructor;function $L(t){return jh(t)!==void 0&&t!==null&&t.constructor===FL}var fr=60,_c=60*fr,Vo=24*_c,Lh=7*Vo,Bh=30.44*Vo,BS=146097/400*Vo;function is(t){switch(t){case"second":return 1;case"minute":return fr;case"hour":return _c;case"day":return Vo;case"week":return Lh;case"month":return Bh;case"year":return BS}}function FS(t){return t.factor!==void 0?t.factor:is(t.unit||t.formatAs)||1}function Wa(t){switch(t){case"floor":return Math.floor;default:return Math.round}}function Py(t){switch(t){case"floor":return 1;default:return .5}}function Fh(t){"@babel/helpers - typeof";return Fh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fh(t)}function $S(t,e){var n=e.prevStep,r=e.timestamp,o=e.now,i=e.future,s=e.round,a;return n&&(n.id||n.unit)&&(a=t["threshold_for_".concat(n.id||n.unit)]),a===void 0&&t.threshold!==void 0&&(a=t.threshold,typeof a=="function"&&(a=a(o,i))),a===void 0&&(a=t.minTime),Fh(a)==="object"&&(n&&n.id&&a[n.id]!==void 0?a=a[n.id]:a=a.default),typeof a=="function"&&(a=a(r,{future:i,getMinTimeForUnit:function(l,c){return gv(l,c||n&&n.formatAs,{round:s})}})),a===void 0&&t.test&&(t.test(r,{now:o,future:i})?a=0:a=9007199254740991),a===void 0&&(n?t.formatAs&&n.formatAs&&(a=gv(t.formatAs,n.formatAs,{round:s})):a=0),a===void 0&&console.warn("[javascript-time-ago] A step should specify `minTime`:\n"+JSON.stringify(t,null,2)),a}function gv(t,e,n){var r=n.round,o=is(t),i;if(e==="now"?i=is(t):i=is(e),o!==void 0&&i!==void 0)return o-i*(1-Py(r))}function Ka(t){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ka(t)}function vv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function zL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vv(Object(n),!0).forEach(function(r){UL(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function UL(t,e,n){return(e=VL(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function VL(t){var e=qL(t,"string");return Ka(e)=="symbol"?e:e+""}function qL(t,e){if(Ka(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ka(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function HL(t,e,n){var r=n.now,o=n.future,i=n.round,s=n.units;t=KL(t,s);var a=WL(t,e,{now:r,future:o,round:i});{if(a){var u=t[t.indexOf(a)-1],l=t[t.indexOf(a)+1];return[u,a,l]}return[void 0,void 0,t[0]]}}function WL(t,e,n){var r=n.now,o=n.future,i=n.round;if(t.length!==0){var s=zS(t,e,{now:r,future:o||e<0,round:i});if(s!==-1){var a=t[s];if(a.granularity){var u=Wa(i)(Math.abs(e)/FS(a)/a.granularity)*a.granularity;if(u===0&&s>0)return t[s-1]}return a}}}function zS(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=$S(t[r],zL({prevStep:t[r-1],timestamp:n.now-e*1e3},n));return o===void 0||Math.abs(e)<o?r-1:r===t.length-1?r:zS(t,e,n,r+1)}function KL(t,e){return t.filter(function(n){var r=n.unit,o=n.formatAs;return r=r||o,r?e.indexOf(r)>=0:!0})}function GL(t,e,n){var r=n.now,o=n.round;if(is(t)){var i=is(t)*1e3,s=e>r,a=Math.abs(e-r),u=Wa(o)(a/i)*i;return s?u>0?a-u+YL(o,i):a-u+1:-(a-u)+JL(o,i)}}function JL(t,e){return Py(t)*e}function YL(t,e){return(1-Py(t))*e+1}var QL=365*24*60*60*1e3,US=1e3*QL;function XL(t,e,n){var r=n.prevStep,o=n.nextStep,i=n.now,s=n.future,a=n.round,u=t.getTime?t.getTime():t,l=function(h){return GL(h,u,{now:i,round:a})},c=e3(s?e:o,u,{future:s,now:i,round:a,prevStep:s?r:e});if(c!==void 0){var d;if(e&&(e.getTimeToNextUpdate&&(d=e.getTimeToNextUpdate(u,{getTimeToNextUpdateForUnit:l,getRoundFunction:Wa,now:i,future:s,round:a})),d===void 0)){var f=e.unit||e.formatAs;f&&(d=l(f))}return d===void 0?c:Math.min(d,c)}}function ZL(t,e,n){var r=n.now,o=n.future,i=n.round,s=n.prevStep,a=$S(t,{timestamp:e,now:r,future:o,round:i,prevStep:s});if(a!==void 0)return o?e-a*1e3+1:a===0&&e===r?US:e+a*1e3}function e3(t,e,n){var r=n.now,o=n.future,i=n.round,s=n.prevStep;if(t){var a=ZL(t,e,{now:r,future:o,round:i,prevStep:s});return a===void 0?void 0:a-r}else return o?e-r+1:US}var VS={};function zi(t){return VS[t]}function qS(t){if(!t)throw new Error("[javascript-time-ago] No locale data passed.");VS[t.locale]=t}const t3=[{formatAs:"now"},{formatAs:"second"},{formatAs:"minute"},{formatAs:"hour"},{formatAs:"day"},{formatAs:"week"},{formatAs:"month"},{formatAs:"year"}],$h={steps:t3,labels:"long"};function Ga(t){"@babel/helpers - typeof";return Ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ga(t)}function wv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function bv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wv(Object(n),!0).forEach(function(r){n3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function n3(t,e,n){return(e=r3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r3(t){var e=o3(t,"string");return Ga(e)=="symbol"?e:e+""}function o3(t,e){if(Ga(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ga(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const zh=bv(bv({},$h),{},{steps:$h.steps.filter(function(t){return t.formatAs!=="second"})}),HS=[{factor:1,unit:"now"},{threshold:1,threshold_for_now:45.5,factor:1,unit:"second"},{threshold:45.5,factor:fr,unit:"minute"},{threshold:2.5*fr,granularity:5,factor:fr,unit:"minute"},{threshold:22.5*fr,factor:.5*_c,unit:"half-hour"},{threshold:42.5*fr,threshold_for_minute:52.5*fr,factor:_c,unit:"hour"},{threshold:20.5/24*Vo,factor:Vo,unit:"day"},{threshold:5.5*Vo,factor:Lh,unit:"week"},{threshold:3.5*Lh,factor:Bh,unit:"month"},{threshold:10.5*Bh,factor:BS,unit:"year"}],_v={gradation:HS,flavour:"long",units:["now","minute","hour","day","week","month","year"]},i3={gradation:HS,flavour:"long-time",units:["now","minute","hour","day","week","month","year"]};function WS(t){return t instanceof Date?t:new Date(t)}var Uh=[{formatAs:"second"},{formatAs:"minute"},{formatAs:"hour"}],Yn={},s3={minTime:function(e,n){n.future;var r=n.getMinTimeForUnit;return r("day")},format:function(e,n){return Yn[n]||(Yn[n]={}),Yn[n].dayMonth||(Yn[n].dayMonth=new Intl.DateTimeFormat(n,{month:"short",day:"numeric"})),Yn[n].dayMonth.format(WS(e))}},a3={minTime:function(e,n){var r=n.future;if(r){var o=new Date(new Date(e).getFullYear(),0).getTime()-1;return(e-o)/1e3}else{var i=new Date(new Date(e).getFullYear()+1,0).getTime();return(i-e)/1e3}},format:function(e,n){return Yn[n]||(Yn[n]={}),Yn[n].dayMonthYear||(Yn[n].dayMonthYear=new Intl.DateTimeFormat(n,{year:"numeric",month:"short",day:"numeric"})),Yn[n].dayMonthYear.format(WS(e))}};LL()?Uh.push(s3,a3):Uh.push({formatAs:"day"},{formatAs:"week"},{formatAs:"month"},{formatAs:"year"});const ri={steps:Uh,labels:["mini","short-time","narrow","short"]};function Ja(t){"@babel/helpers - typeof";return Ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ja(t)}function Sv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function kv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sv(Object(n),!0).forEach(function(r){l3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function l3(t,e,n){return(e=u3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u3(t){var e=c3(t,"string");return Ja(e)=="symbol"?e:e+""}function c3(t,e){if(Ja(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ja(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const d3=kv(kv({},ri),{},{steps:[{formatAs:"now"}].concat(ri.steps)});function Ya(t){"@babel/helpers - typeof";return Ya=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ya(t)}function xv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Ev(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xv(Object(n),!0).forEach(function(r){f3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function f3(t,e,n){return(e=p3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p3(t){var e=h3(t,"string");return Ya(e)=="symbol"?e:e+""}function h3(t,e){if(Ya(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ya(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const Vh=Ev(Ev({},ri),{},{steps:ri.steps.filter(function(t){return t.formatAs!=="second"})});function Qa(t){"@babel/helpers - typeof";return Qa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qa(t)}function Tv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Cv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tv(Object(n),!0).forEach(function(r){m3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function m3(t,e,n){return(e=y3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y3(t){var e=g3(t,"string");return Qa(e)=="symbol"?e:e+""}function g3(t,e){if(Qa(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Qa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const v3=Cv(Cv({},Vh),{},{steps:[{formatAs:"now"}].concat(Vh.steps)});function Xa(t){"@babel/helpers - typeof";return Xa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xa(t)}function Mv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Ql(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Mv(Object(n),!0).forEach(function(r){w3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function w3(t,e,n){return(e=b3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function b3(t){var e=_3(t,"string");return Xa(e)=="symbol"?e:e+""}function _3(t,e){if(Xa(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Xa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const S3=Ql(Ql({},ri),{},{steps:ri.steps.filter(function(t){return t.formatAs!=="second"}).map(function(t){return t.formatAs==="minute"?Ql(Ql({},t),{},{minTime:fr}):t})}),Za={steps:[{formatAs:"second"},{formatAs:"minute"},{formatAs:"hour"},{formatAs:"day"},{formatAs:"month"},{formatAs:"year"}],labels:["mini","short-time","narrow","short"]};function el(t){"@babel/helpers - typeof";return el=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},el(t)}function Ov(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Nv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ov(Object(n),!0).forEach(function(r){k3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ov(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function k3(t,e,n){return(e=x3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x3(t){var e=E3(t,"string");return el(e)=="symbol"?e:e+""}function E3(t,e){if(el(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(el(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const T3=Nv(Nv({},Za),{},{steps:[{formatAs:"now"}].concat(Za.steps)});function tl(t){"@babel/helpers - typeof";return tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tl(t)}function Av(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Iv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Av(Object(n),!0).forEach(function(r){C3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Av(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function C3(t,e,n){return(e=M3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function M3(t){var e=O3(t,"string");return tl(e)=="symbol"?e:e+""}function O3(t,e){if(tl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(tl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const qh=Iv(Iv({},Za),{},{steps:Za.steps.filter(function(t){return t.formatAs!=="second"})});function nl(t){"@babel/helpers - typeof";return nl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nl(t)}function Pv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Rv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pv(Object(n),!0).forEach(function(r){N3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function N3(t,e,n){return(e=A3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function A3(t){var e=I3(t,"string");return nl(e)=="symbol"?e:e+""}function I3(t,e){if(nl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(nl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const P3=Rv(Rv({},qh),{},{steps:[{formatAs:"now"}].concat(qh.steps)});function R3(t){switch(t){case"default":case"round":return $h;case"round-minute":return zh;case"approximate":return _v;case"time":case"approximate-time":return i3;case"mini":return Za;case"mini-now":return T3;case"mini-minute":return qh;case"mini-minute-now":return P3;case"twitter":return ri;case"twitter-now":return d3;case"twitter-minute":return Vh;case"twitter-minute-now":return v3;case"twitter-first-minute":return S3;default:return _v}}function oi(t){"@babel/helpers - typeof";return oi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oi(t)}function D3(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=KS(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
53
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j3(t,e){return F3(t)||B3(t,e)||KS(t,e)||L3()}function L3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
54
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KS(t,e){if(t){if(typeof t=="string")return Dv(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dv(t,e):void 0}}function Dv(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function B3(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,o,i,s,a=[],u=!0,l=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(c){l=!0,o=c}finally{try{if(!u&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw o}}return a}}function F3(t){if(Array.isArray(t))return t}function $3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z3(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,V3(r.key),r)}}function U3(t,e,n){return e&&z3(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function V3(t){var e=q3(t,"string");return oi(e)=="symbol"?e:e+""}function q3(t,e){if(oi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(oi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Sn=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.polyfill;$3(this,t),typeof e=="string"&&(e=[e]),this.locale=jL(e.concat(t.getDefaultLocale()),zi),typeof Intl<"u"&&Intl.NumberFormat&&(this.numberFormat=new Intl.NumberFormat(this.locale)),r===!1?(this.IntlRelativeTimeFormat=Intl.RelativeTimeFormat,this.IntlPluralRules=Intl.PluralRules):(this.IntlRelativeTimeFormat=Tr,this.IntlPluralRules=Tr.PluralRules),this.relativeTimeFormatCache=new mv,this.pluralRulesCache=new mv}return U3(t,[{key:"format",value:function(n,r,o){o||(r&&!J3(r)?(o=r,r=void 0):o={}),r||(r=zh),typeof r=="string"&&(r=R3(r));var i=H3(n),s=this.getLabels(r.flavour||r.labels),a=s.labels,u=s.labelsType,l;r.now!==void 0&&(l=r.now),l===void 0&&o.now!==void 0&&(l=o.now),l===void 0&&(l=Date.now());var c=(l-i)/1e3,d=o.future||c<0,f=G3(a,zi(this.locale).now,zi(this.locale).long,d);if(r.custom){var p=r.custom({now:l,date:new Date(i),time:i,elapsed:c,locale:this.locale});if(p!==void 0)return p}var h=K3(r.units,a,f),m=o.round||r.round,v=HL(r.gradation||r.steps||zh.steps,c,{now:l,units:h,round:m,future:d}),y=j3(v,3),w=y[0],b=y[1],S=y[2],k=this.formatDateForStep(i,b,c,{labels:a,labelsType:u,nowLabel:f,now:l,future:d,round:m})||"";if(o.getTimeToNextUpdate){var E=XL(i,b,{nextStep:S,prevStep:w,now:l,future:d,round:m});return[k,E]}return k}},{key:"formatDateForStep",value:function(n,r,o,i){var s=this,a=i.labels,u=i.labelsType,l=i.nowLabel,c=i.now,d=i.future,f=i.round;if(r){if(r.format)return r.format(n,this.locale,{formatAs:function(y,w){return s.formatValue(w,y,{labels:a,future:d})},now:c,future:d});var p=r.unit||r.formatAs;if(!p)throw new Error("[javascript-time-ago] Each step must define either `formatAs` or `format()`. Step: ".concat(JSON.stringify(r)));if(p==="now")return l;var h=Math.abs(o)/FS(r);r.granularity&&(h=Wa(f)(h/r.granularity)*r.granularity);var m=-1*Math.sign(o)*Wa(f)(h);switch(m===0&&(d?m=0:m=-0),u){case"long":case"short":case"narrow":return this.getFormatter(u).format(m,p);default:return this.formatValue(m,p,{labels:a,future:d})}}}},{key:"formatValue",value:function(n,r,o){var i=o.labels,s=o.future;return this.getFormattingRule(i,r,n,{future:s}).replace("{0}",this.formatNumber(Math.abs(n)))}},{key:"getFormattingRule",value:function(n,r,o,i){var s=i.future;if(this.locale,n=n[r],typeof n=="string")return n;var a=o===0?s?"future":"past":o<0?"past":"future",u=n[a]||n;if(typeof u=="string")return u;var l=this.getPluralRules().select(Math.abs(o));return u[l]||u.other}},{key:"formatNumber",value:function(n){return this.numberFormat?this.numberFormat.format(n):String(n)}},{key:"getFormatter",value:function(n){return this.relativeTimeFormatCache.get(this.locale,n)||this.relativeTimeFormatCache.put(this.locale,n,new this.IntlRelativeTimeFormat(this.locale,{style:n}))}},{key:"getPluralRules",value:function(){return this.pluralRulesCache.get(this.locale)||this.pluralRulesCache.put(this.locale,new this.IntlPluralRules(this.locale))}},{key:"getLabels",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];typeof n=="string"&&(n=[n]),n=n.map(function(a){switch(a){case"tiny":case"mini-time":return"mini";default:return a}}),n=n.concat("long");for(var r=zi(this.locale),o=D3(n),i;!(i=o()).done;){var s=i.value;if(r[s])return{labelsType:s,labels:r[s]}}}}]),t}(),GS="en";Sn.getDefaultLocale=function(){return GS};Sn.setDefaultLocale=function(t){return GS=t};Sn.addDefaultLocale=function(t){if(jv)return console.error("[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.");jv=!0,Sn.setDefaultLocale(t.locale),Sn.addLocale(t)};var jv;Sn.addLocale=function(t){qS(t),Tr.addLocale(t)};Sn.locale=Sn.addLocale;Sn.addLabels=function(t,e,n){var r=zi(t);r||(qS({locale:t}),r=zi(t)),r[e]=n};function H3(t){if(t.constructor===Date||W3(t))return t.getTime();if(typeof t=="number")return t;throw new Error("Unsupported relative time formatter input: ".concat(oi(t),", ").concat(t))}function W3(t){return oi(t)==="object"&&typeof t.getTime=="function"}function K3(t,e,n){var r=Object.keys(e);return n&&r.push("now"),t&&(r=t.filter(function(o){return o==="now"||r.indexOf(o)>=0})),r}function G3(t,e,n,r){var o=t.now||e&&e.now;if(o)return typeof o=="string"?o:r?o.future:o.past;if(n&&n.second&&n.second.current)return n.second.current}function J3(t){return typeof t=="string"||BL(t)}function Hh(t){"@babel/helpers - typeof";return Hh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hh(t)}function Y3(t){if(JS())return Intl.DateTimeFormat.supportedLocalesOf(t)[0]}function JS(){var t=(typeof Intl>"u"?"undefined":Hh(Intl))==="object";return t&&typeof Intl.DateTimeFormat=="function"}function Sc(t){"@babel/helpers - typeof";return Sc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sc(t)}function Q3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function X3(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Z3(t,e,n){return e&&X3(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var YS=function(){function t(){Q3(this,t),this.cache={}}return Z3(t,[{key:"get",value:function(){for(var n=this.cache,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];for(var s=0,a=o;s<a.length;s++){var u=a[s];if(Sc(n)!=="object")return;n=n[u]}return n}},{key:"put",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];for(var i=r.pop(),s=r.pop(),a=this.cache,u=0,l=r;u<l.length;u++){var c=l[u];Sc(a[c])!=="object"&&(a[c]={}),a=a[c]}return a[s]=i}}]),t}(),Lv=new YS,e5=JS(),t5=function(e){return e.toString()};function n5(t,e){if(!e5)return t5;var n=o5(t),r=JSON.stringify(e),o=Lv.get(String(n),r)||Lv.put(String(n),r,new Intl.DateTimeFormat(n,e));return function(i){return o.format(i)}}const r5=C2(n5);var Ff={};function o5(t){var e=t.toString();return Ff[e]?Ff[e]:Ff[e]=Y3(t)}function Wh(t){"@babel/helpers - typeof";return Wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wh(t)}function i5(t){return s5(t)?t:new Date(t)}function s5(t){return t instanceof Date||a5(t)}function a5(t){return Wh(t)==="object"&&typeof t.getTime=="function"}var Bv=new YS;function l5(t,e){var n=e.polyfill,r=String(t)+":"+String(n);return Bv.get(r)||Bv.put(r,new Sn(t,{polyfill:n}))}var Bd={exports:{}},ea={exports:{}};(function(){var t,e,n,r,o,i;typeof performance<"u"&&performance!==null&&performance.now?ea.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(ea.exports=function(){return(t()-o)/1e6},e=process.hrtime,t=function(){var s;return s=e(),s[0]*1e9+s[1]},r=t(),i=process.uptime()*1e9,o=r-i):Date.now?(ea.exports=function(){return Date.now()-n},n=Date.now()):(ea.exports=function(){return new Date().getTime()-n},n=new Date().getTime())}).call(it);var u5=ea.exports,c5=u5,vr=typeof window>"u"?it:window,Xl=["moz","webkit"],ss="AnimationFrame",vs=vr["request"+ss],rl=vr["cancel"+ss]||vr["cancelRequest"+ss];for(var Us=0;!vs&&Us<Xl.length;Us++)vs=vr[Xl[Us]+"Request"+ss],rl=vr[Xl[Us]+"Cancel"+ss]||vr[Xl[Us]+"CancelRequest"+ss];if(!vs||!rl){var $f=0,Fv=0,xo=[],d5=1e3/60;vs=function(t){if(xo.length===0){var e=c5(),n=Math.max(0,d5-(e-$f));$f=n+e,setTimeout(function(){var r=xo.slice(0);xo.length=0;for(var o=0;o<r.length;o++)if(!r[o].cancelled)try{r[o].callback($f)}catch(i){setTimeout(function(){throw i},0)}},Math.round(n))}return xo.push({handle:++Fv,callback:t,cancelled:!1}),Fv},rl=function(t){for(var e=0;e<xo.length;e++)xo[e].handle===t&&(xo[e].cancelled=!0)}}Bd.exports=function(t){return vs.call(vr,t)};Bd.exports.cancel=function(){rl.apply(vr,arguments)};Bd.exports.polyfill=function(t){t||(t=vr),t.requestAnimationFrame=vs,t.cancelAnimationFrame=rl};var f5=Bd.exports;const $v=di(f5);function p5(t,e){if(t.length===0)return 0;for(var n=0,r=t.length-1,o;n<=r;){o=Math.floor((r+n)/2);var i=e(t[o]);if(i===0)return o;if(i<0){if(n=o+1,n>r)return n}else if(r=o-1,r<n)return n}}function h5(t,e){return v5(t)||g5(t,e)||y5(t,e)||m5()}function m5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
55
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y5(t,e){if(t){if(typeof t=="string")return zv(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 zv(t,e)}}function zv(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 g5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){i=!0,a=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function v5(t){if(Array.isArray(t))return t}const w5={instances:[],add:function(e){var n=this,r=this.instances.length===0;return QS(this.instances,e),r&&this.start(),{stop:function(){XS(n.instances,e),n.instances.length===0&&n.stop()},forceUpdate:function(){Uv(e,n.instances)}}},tick:function(){for(var e=Date.now();;){var n=this.instances[0];if(e>=n.nextUpdateTime)Uv(n,this.instances);else break}},scheduleNextTick:function(){var e=this;this.scheduledTick=$v(function(){e.tick(),e.scheduleNextTick()})},start:function(){this.scheduleNextTick()},stop:function(){$v.cancel(this.scheduledTick)}};function b5(t){var e=t.getNextValue(),n=h5(e,2),r=n[0],o=n[1];t.setValue(r),t.nextUpdateTime=o}function Uv(t,e){b5(t),XS(e,t),QS(e,t)}function QS(t,e){var n=_5(t,e);t.splice(n,0,e)}function XS(t,e){var n=t.indexOf(e);t.splice(n,1)}function _5(t,e){var n=e.nextUpdateTime;return p5(t,function(r){return r.nextUpdateTime===n?0:r.nextUpdateTime>n?1:-1})}function Zl(t,e){return E5(t)||x5(t,e)||k5(t,e)||S5()}function S5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
56
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k5(t,e){if(t){if(typeof t=="string")return Vv(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 Vv(t,e)}}function Vv(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 x5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){i=!0,a=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function E5(t){if(Array.isArray(t))return t}function T5(t){var e=t.date,n=t.future,r=t.locale,o=t.locales,i=t.timeStyle,s=t.round,a=t.minTimeLeft,u=t.formatVerboseDate,l=t.verboseDateFormat,c=l===void 0?O5:l,d=t.updateInterval,f=t.tick,p=f===void 0?!0:f,h=t.now,m=t.timeOffset,v=m===void 0?0:m,y=t.polyfill,w=_.useMemo(function(){return r&&(o=[r]),o.concat(Sn.getDefaultLocale())},[r,o]),b=_.useMemo(function(){return l5(w,{polyfill:y})},[w,y]);e=_.useMemo(function(){return i5(e)},[e]);var S=_.useCallback(function(){var K=(h||Date.now())-v,I;if(n&&K>=e.getTime()&&(K=e.getTime(),I=!0),a!==void 0){var L=e.getTime()-a*1e3;K>L&&(K=L,I=!0)}var F=b.format(e,i,{getTimeToNextUpdate:!0,now:K,future:n,round:s}),Z=Zl(F,2),ie=Z[0],ke=Z[1];return I?ke=M5:ke=d||ke||60*1e3,[ie,K+ke]},[e,n,i,d,s,a,b,h]),k=_.useRef();k.current=S;var E=_.useMemo(S,[]),x=Zl(E,2),T=x[0],O=x[1],N=_.useState(T),$=Zl(N,2),P=$[0],D=$[1],q=_.useRef();_.useEffect(function(){if(p)return q.current=w5.add({getNextValue:function(){return k.current()},setValue:D,nextUpdateTime:O}),function(){return q.current.stop()}},[p]),_.useEffect(function(){if(q.current)q.current.forceUpdate();else{var K=S(),I=Zl(K,1),L=I[0];D(L)}},[S]);var B=_.useMemo(function(){return r5(w,c)},[w,c]),z=_.useMemo(function(){return u?u(e):B(e)},[e,u,B]);return{date:e,formattedDate:P,verboseDate:z}}var C5=365*24*60*60*1e3,M5=1e3*C5,O5={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"},Kh=Se.oneOfType,qv=Se.arrayOf,Ui=Se.string,Hv=Se.number,ta=Se.shape,eu=Se.func,N5=Kh([ta({minTime:Hv,formatAs:Ui.isRequired}),ta({test:eu,formatAs:Ui.isRequired}),ta({minTime:Hv,format:eu.isRequired}),ta({test:eu,format:eu.isRequired})]),A5=Kh([Ui,ta({steps:qv(N5).isRequired,labels:Kh([Ui,qv(Ui)]).isRequired,round:Ui})]),I5=["date","future","timeStyle","round","minTimeLeft","locale","locales","formatVerboseDate","verboseDateFormat","updateInterval","tick","now","timeOffset","polyfill","tooltip","component","container","wrapperComponent","wrapperProps"];function kc(){return kc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},kc.apply(this,arguments)}function P5(t,e){if(t==null)return{};var n=R5(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function R5(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function ol(t){var e=t.date,n=t.future,r=t.timeStyle,o=t.round,i=t.minTimeLeft,s=t.locale,a=t.locales,u=a===void 0?[]:a,l=t.formatVerboseDate,c=t.verboseDateFormat,d=t.updateInterval,f=t.tick,p=t.now,h=t.timeOffset,m=t.polyfill,v=t.tooltip,y=v===void 0?!0:v,w=t.component,b=w===void 0?bc:w,S=t.container,k=t.wrapperComponent,E=t.wrapperProps,x=P5(t,I5),T=T5({date:e,future:n,timeStyle:r,round:o,minTimeLeft:i,locale:s,locales:u,formatVerboseDate:l,verboseDateFormat:c,updateInterval:d,tick:f,now:p,timeOffset:h,polyfill:m}),O=T.date,N=T.verboseDate,$=T.formattedDate,P=ue.createElement(b,kc({date:O,verboseDate:N,tooltip:y},x),$),D=k||S;return D?ue.createElement(D,kc({},E,{verboseDate:N}),P):P}ol.propTypes={date:Se.oneOfType([Se.instanceOf(Date),Se.number]).isRequired,locale:Se.string,locales:Se.arrayOf(Se.string),future:Se.bool,timeStyle:A5,round:Se.string,minTimeLeft:Se.number,component:Se.elementType,tooltip:Se.bool,formatVerboseDate:Se.func,verboseDateFormat:Se.object,updateInterval:Se.oneOfType([Se.number,Se.arrayOf(Se.shape({threshold:Se.number,interval:Se.number.isRequired}))]),tick:Se.bool,now:Se.number,timeOffset:Se.number,polyfill:Se.bool,wrapperComponent:Se.elementType,wrapperProps:Se.object};ol=ue.memo(ol);function Wv(t){return t.type==="user"}function Kv(t){return t.type==="field"}function Gv(t){return t.type==="asset"}function Jv(t){return t.type==="record"}function Yv(t){return t.type==="model"}function ZS(t,e){return t.type!==e.type?!1:Wv(t)&&Wv(e)?t.id===e.id&&t.name===e.name&&t.email===e.email&&t.avatarUrl===e.avatarUrl:Kv(t)&&Kv(e)?t.fieldPath===e.fieldPath&&t.locale===e.locale&&t.apiKey===e.apiKey&&t.label===e.label&&t.localized===e.localized&&t.fieldType===e.fieldType:Gv(t)&&Gv(e)?t.id===e.id&&t.filename===e.filename&&t.url===e.url&&t.thumbnailUrl===e.thumbnailUrl&&t.mimeType===e.mimeType:Jv(t)&&Jv(e)?t.id===e.id&&t.title===e.title&&t.modelId===e.modelId&&t.modelApiKey===e.modelApiKey&&t.modelName===e.modelName&&t.modelEmoji===e.modelEmoji&&t.thumbnailUrl===e.thumbnailUrl&&t.isSingleton===e.isSingleton:Yv(t)&&Yv(e)?t.id===e.id&&t.apiKey===e.apiKey&&t.name===e.name&&t.isBlockModel===e.isBlockModel:!1}function D5(t,e){return t.type!==e.type?!1:t.type==="text"&&e.type==="text"?t.content===e.content:t.type==="mention"&&e.type==="mention"?ZS(t.mention,e.mention):!1}function il(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!D5(t[n],e[n]))return!1;return!0}function ek(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].email!==e[n].email)return!1;return!0}const j5=20;function tk(t,e,n=0){if(n>j5)return!1;if(t===e||!t&&!e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const o=t[r],i=e[r];if(o.id!==i.id||!il(o.content,i.content)||!ek(o.usersWhoUpvoted,i.usersWhoUpvoted)||!tk(o.replies,i.replies,n+1))return!1}return!0}function nk(t){const e=t.site.attributes.internal_domain;return e?`https://${e}`:""}function L5(t,e){return e?`/schema/blocks_library/${t}`:`/schema/item_types/${t}`}function Gh(t,e){return`/editor/item_types/${t}/items/${e}/edit`}function B5(t,e){const n=nk(t);e==="sso"?window.open(`${n}/project_settings/sso-users`,"_blank"):e==="user"&&window.open(`${n}/project_settings/users`,"_blank")}function F5(t,e,n){const r=nk(t),o=L5(e,n);window.open(`${r}${o}`,"_blank")}function rk(t){const e=_.useCallback((o="user")=>{B5(t,o)},[t]),n=_.useCallback((o,i)=>{F5(t,o,i)},[t]),r=_.useCallback(async o=>{await t.editUpload(o)},[t]);return{handleNavigateToUsers:e,handleNavigateToModel:n,handleOpenAsset:r}}function $5(t){const e=rk(t),n=_.useCallback(async(o,i,s)=>{var a;try{const u=t.itemType.id,l=(a=t.item)==null?void 0:a.id;if(!l)return;if(i){const c=s??t.locale;await t.scrollToField(o,c);const f=c&&o.includes(`.${c}.`)?o:`${o}.${c}`,p=`${Gh(u,l)}#fieldPath=${f}`;await t.navigateTo(p)}else{const c=`${Gh(u,l)}#fieldPath=${o}`;await t.navigateTo(c)}}catch{}},[t]),r=_.useCallback(async(o,i)=>{if(window.location.hash.includes("fieldPath=")){const s=window.location.pathname+window.location.search;window.history.replaceState(null,"",s)}await t.editItem(o)},[t]);return{...e,handleScrollToField:n,handleOpenRecord:r}}function z5(t){const e=rk(t),n=_.useCallback(async(o,i)=>{if(window.location.hash.includes("fieldPath=")){const s=window.location.pathname+window.location.search;window.history.replaceState(null,"",s)}await t.editItem(o)},[t]),r=_.useCallback(async(o,i)=>{const s=Gh(o,i);await t.navigateTo(s)},[t]);return{...e,handleOpenRecord:n,handleNavigateToRecordComments:r}}const Ry=_.createContext(null);function ok(){const t=_.useContext(Ry);if(!t)throw new Error("useNavigationContext must be used within a NavigationCallbacksProvider");return t}function U5({ctx:t,children:e}){const n=$5(t);return g.jsx(Ry.Provider,{value:n,children:e})}function V5({ctx:t,children:e}){const n=z5(t),r={handleNavigateToUsers:n.handleNavigateToUsers,handleNavigateToModel:n.handleNavigateToModel,handleOpenAsset:n.handleOpenAsset,handleOpenRecord:n.handleOpenRecord,handleNavigateToRecordComments:n.handleNavigateToRecordComments};return g.jsx(Ry.Provider,{value:r,children:e})}const ik=_.createContext(null);function sk({children:t,projectUsers:e,projectModels:n,modelFields:r,currentUserEmail:o,typedUsers:i}){const s=_.useMemo(()=>({projectUsers:e,projectModels:n,modelFields:r,currentUserEmail:o,typedUsers:i}),[e,n,r,o,i]);return g.jsx(ik.Provider,{value:s,children:t})}function Dy(){const t=_.useContext(ik);if(!t)throw new Error("useProjectDataContext must be used within a ProjectDataProvider");return t}const io="project_comment",jy="__global__",ak="__project__",Iu={SYNC_COOLDOWN_MS:8e3,VERSION_CONFLICT_BACKOFF_BASE:100,VERSION_CONFLICT_BACKOFF_MAX:5e3,POLLING_INTERVAL_MS:3e4},Pu=30,q5={MENTION_CHIP_MAX_NAME_LENGTH:8},zf={MODEL_ID:"model_id",RECORD_ID:"record_id",CONTENT:"content"},Vs={SIDEBAR:"comments",PAGE:"comments-dashboard",ICON:"comment-dots"},Lt={SAVE_FAILED:"Failed to save comment. Please refresh and try again.",SAVE_RECORD_FIRST:"Please save the record first before adding comments.",ASSET_PICKER_FAILED:"Failed to open asset picker. Please try again.",RECORD_PICKER_FAILED:"Failed to open record picker. Please try again.",VERSION_CONFLICT_RETRYING:"Another user edited comments. Retrying...",MAX_RETRIES_EXCEEDED:"Unable to save after multiple attempts. Please check your connection and try again.",OPERATION_TIMEOUT:"Operation timed out after 2 minutes. Please try again.",MISSING_USER_INFO:"Unable to add comment: user information is missing."},Qv={MAX_ATTEMPTS:15,MAX_DURATION_MS:12e4},H5=new RegExp("^(\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F?)\\s*","u");function Jh(t){const e=t.match(H5);if(!e)return{emoji:null,textWithoutEmoji:t};const n=e[0].trim(),r=t.slice(e[0].length);return{emoji:n,textWithoutEmoji:r}}function W5(t){const e=q5.MENTION_CHIP_MAX_NAME_LENGTH,n=t.lastIndexOf(".");if(!(n!==-1))return t.length>e?`${t.slice(0,e)}…`:t;const o=t.slice(0,n),i=t.slice(n);return o.length<=e?t:`${o.slice(0,e)}…${i}`}function K5(t){if(!t)return null;const e=t.replace(/_/g," ");return e.charAt(0).toUpperCase()+e.slice(1)}const G5=({mention:t,onClick:e,isClickable:n=!0,isProjectOwner:r=!1,tabIndex:o=0,tooltipId:i,projectUsers:s})=>{const a=_.useId(),u=i??`mention-tooltip-${a}`,l=d=>{d.preventDefault(),d.stopPropagation(),e==null||e(d)},c=_.useMemo(()=>{if(t.type!=="user"||!s)return t.type==="user"?t.name:"";let d=s.find(f=>f.id===t.id);return!d&&t.email&&(d=s.find(f=>f.email&&f.email===t.email)),d?d.name:t.name},[t,s]);switch(t.type){case"user":{const d=r?"Project Owner":t.email||"Organization";return g.jsxs("span",{className:A.userMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.userMention}${n?"":` ${A.userMentionDisabled}`}`,"aria-describedby":u,onClick:n?l:void 0,disabled:!n,children:["@",c]}),g.jsxs("span",{id:u,role:"tooltip",className:A.userMentionTooltip,children:[d,g.jsx("span",{className:A.userMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"field":{const d=t.localized&&t.locale,f=K5(t.fieldType);return g.jsxs("span",{className:A.fieldMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.fieldMention}${n?"":` ${A.fieldMentionDisabled}`}`,"aria-describedby":f?u:void 0,onClick:n?l:void 0,disabled:!n,children:["#",t.apiKey,d&&g.jsx("span",{className:A.fieldMentionLocaleBadge,children:t.locale})]}),f&&g.jsxs("span",{id:u,role:"tooltip",className:A.fieldMentionTooltip,children:[f,g.jsx("span",{className:A.fieldMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"asset":{const d=t.mimeType.startsWith("image/")||t.mimeType.startsWith("video/"),f=t.thumbnailUrl&&d,p=W5(t.filename);return f?g.jsx("span",{className:A.assetMentionBlockWrapper,children:g.jsxs("button",{type:"button",tabIndex:o,className:A.assetMentionBlock,onClick:l,children:[g.jsx("img",{src:t.thumbnailUrl,alt:t.filename,className:A.assetMentionBlockThumb,onError:h=>{const m=h.currentTarget;m.onerror=null,m.style.display="none";const v=m.closest("button");v&&v.setAttribute("data-img-error","true")}}),g.jsx("span",{className:A.assetMentionBlockFallback,"aria-hidden":"true",children:"^"}),g.jsx("span",{className:A.assetMentionBlockName,children:t.filename})]})}):g.jsxs("span",{className:A.assetMentionWrapper,children:[g.jsx("button",{type:"button",tabIndex:o,className:`${A.assetMention} ${A.assetMentionNoThumb}`,"aria-describedby":u,onClick:l,children:g.jsx("span",{className:A.assetMentionName,children:p})}),g.jsxs("span",{id:u,role:"tooltip",className:A.assetMentionTooltip,children:[t.filename,g.jsx("span",{className:A.assetMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"record":{const{emoji:d,textWithoutEmoji:f}=Jh(t.title),p=t.thumbnailUrl?null:d||t.modelEmoji||(t.isSingleton?"📄":null),h=d?f:t.title,m=t.isSingleton?"Singleton":t.modelName;return g.jsxs("span",{className:A.recordMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.recordMention} ${t.thumbnailUrl?"":A.recordMentionNoThumb}`,"aria-describedby":u,onClick:l,children:[t.thumbnailUrl?g.jsxs(g.Fragment,{children:[g.jsx("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${h}`,className:A.recordMentionThumb,onError:v=>{const y=v.currentTarget;y.onerror=null,y.style.display="none";const w=y.closest("button");w&&w.setAttribute("data-img-error","true")}}),g.jsx("span",{className:A.recordMentionFallback,"aria-hidden":"true",children:g.jsx(iv,{className:A.recordMentionIcon})})]}):p?g.jsx("span",{className:A.recordMentionEmoji,children:p}):g.jsx(iv,{className:A.recordMentionIcon}),g.jsx("span",{className:A.recordMentionTitle,children:h})]}),g.jsxs("span",{id:u,role:"tooltip",className:A.recordMentionTooltip,children:[m,g.jsx("span",{className:A.recordMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"model":{const{emoji:d,textWithoutEmoji:f}=Jh(t.name);return g.jsxs("span",{className:A.modelMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:A.modelMention,"aria-describedby":u,onClick:l,children:[d?g.jsx("span",{className:A.modelMentionEmoji,children:d}):g.jsx(MS,{className:A.modelMentionIcon}),f]}),g.jsxs("span",{id:u,role:"tooltip",className:A.modelMentionTooltip,children:[t.isBlockModel?"Block":"Model",": ",t.apiKey,g.jsx("span",{className:A.modelMentionTooltipArrow,"aria-hidden":"true"})]})]})}default:return null}},lk=_.memo(G5,(t,e)=>t.isClickable!==e.isClickable||t.isProjectOwner!==e.isProjectOwner||t.tabIndex!==e.tabIndex||t.tooltipId!==e.tooltipId||t.onClick!==e.onClick||t.projectUsers!==e.projectUsers?!1:ZS(t.mention,e.mention));function J5(t,e){return il(t.segments,e.segments)}const Y5=_.memo(function({segments:e}){const n=ok(),{projectUsers:r,typedUsers:o}=Dy(),i=_.useCallback(u=>{let l=o.find(c=>c.user.id===u.id);if(!l&&u.email&&(l=o.find(c=>c.user.email===u.email)),!l)return"owner";switch(l.userType){case"user":return"user";case"sso":return"sso";case"org":case"account":default:return"owner"}},[o]),s=_.useMemo(()=>{const u=new Map;for(const l of e)l.type==="mention"&&l.mention.type==="user"&&u.set(l.mention.id,i(l.mention));return u},[e,i]),a=_.useCallback(u=>{switch(u.type){case"user":{const l=s.get(u.id)??"owner";return l==="owner"?void 0:()=>n.handleNavigateToUsers(l)}case"field":{if(!n.handleScrollToField)return;const l=u.fieldPath??u.apiKey;return()=>{var c;return(c=n.handleScrollToField)==null?void 0:c.call(n,l,u.localized,u.locale)}}case"asset":return()=>n.handleOpenAsset(u.id);case"record":return()=>n.handleOpenRecord(u.id,u.modelId);case"model":return()=>n.handleNavigateToModel(u.id,u.isBlockModel);default:return}},[n,s]);return g.jsx(g.Fragment,{children:e.map((u,l)=>{if(u.type==="text"){const v=`text-${l}`;return g.jsx("span",{children:u.content},v)}const{mention:c}=u,d=Q5(c,l),f=X5(c,l),p=a(c);let h=!0,m=!1;return c.type==="field"?h=!!n.handleScrollToField:c.type==="user"&&(m=(s.get(c.id)??"owner")==="owner",h=!m),g.jsx(lk,{mention:c,onClick:p,isClickable:h,isProjectOwner:m,tooltipId:f,projectUsers:r},d)})})},J5);function Q5(t,e){switch(t.type){case"user":return`user-${t.id}-${e}`;case"field":return`field-${t.fieldPath??t.apiKey}-${t.locale??""}-${e}`;case"asset":return`asset-${t.id}-${e}`;case"record":return`record-${t.id}-${e}`;case"model":return`model-${t.id}-${e}`;default:return`unknown-${e}`}}function X5(t,e){switch(t.type){case"user":return`user-tooltip-${t.id}-${e}`;case"field":return`field-tooltip-${t.fieldPath??t.apiKey}-${t.locale??""}-${e}`;case"asset":return`asset-tooltip-${t.id}-${e}`;case"record":return`record-tooltip-${t.id}-${e}`;case"model":return`model-tooltip-${t.id}-${e}`;default:return`tooltip-${e}`}}function Z5(t,e){return t.userUpvoted===e.userUpvoted&&t.userIsAuthor===e.userIsAuthor&&t.isTopLevel===e.isTopLevel&&t.hasUpvotes===e.hasUpvotes&&t.onUpvote===e.onUpvote&&t.onReply===e.onReply&&t.onEdit===e.onEdit&&t.onDelete===e.onDelete}const e4=_.memo(function({onUpvote:e,onReply:n,onEdit:r,onDelete:o,userUpvoted:i,userIsAuthor:s,isTopLevel:a,hasUpvotes:u}){return g.jsxs("div",{className:A.actionsWrapper,children:[g.jsx("button",{type:"button",className:A.actionsTrigger,"aria-label":"Comment actions menu","aria-haspopup":"menu","aria-expanded":"false",children:g.jsx(OR,{})}),g.jsxs("div",{className:A.actions,role:"menu","aria-label":"Comment actions",children:[!u&&g.jsx("button",{type:"button",role:"menuitem",className:ot(A.actionBtn,i&&A.actionBtnActive),onClick:e,"aria-label":i?"Remove upvote":"Upvote",children:g.jsx(CS,{"aria-hidden":"true"})}),a&&n&&g.jsx("button",{type:"button",role:"menuitem",className:A.actionBtn,onClick:n,"aria-label":"Reply to comment",children:g.jsx(NR,{"aria-hidden":"true"})}),s&&g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",role:"menuitem",className:A.actionBtn,onClick:r,"aria-label":"Edit comment",children:g.jsx(AR,{"aria-hidden":"true"})}),g.jsx("button",{type:"button",role:"menuitem",className:ot(A.actionBtn,A.actionBtnDanger),onClick:o,"aria-label":"Delete comment",children:g.jsx(IR,{"aria-hidden":"true"})})]})]})]})},Z5),uk=_.memo(function({compact:e=!1,accentColor:n,children:r}){const o=e?`${j.composerBox} ${j.compact}`:j.composerBox,i=n?{"--composer-accent":n}:void 0;return g.jsx("div",{className:o,style:i,children:r})});var ck={exports:{}},dk={};/**
|
|
57
|
+
* @license React
|
|
58
|
+
* use-sync-external-store-shim.production.js
|
|
59
|
+
*
|
|
60
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
61
|
+
*
|
|
62
|
+
* This source code is licensed under the MIT license found in the
|
|
63
|
+
* LICENSE file in the root directory of this source tree.
|
|
64
|
+
*/var ws=_;function t4(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var n4=typeof Object.is=="function"?Object.is:t4,r4=ws.useState,o4=ws.useEffect,i4=ws.useLayoutEffect,s4=ws.useDebugValue;function a4(t,e){var n=e(),r=r4({inst:{value:n,getSnapshot:e}}),o=r[0].inst,i=r[1];return i4(function(){o.value=n,o.getSnapshot=e,Uf(o)&&i({inst:o})},[t,n,e]),o4(function(){return Uf(o)&&i({inst:o}),t(function(){Uf(o)&&i({inst:o})})},[t]),s4(n),n}function Uf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!n4(t,n)}catch{return!0}}function l4(t,e){return e()}var u4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l4:a4;dk.useSyncExternalStore=ws.useSyncExternalStore!==void 0?ws.useSyncExternalStore:u4;ck.exports=dk;var Ly=ck.exports;function kt(t){this.content=t}kt.prototype={constructor:kt,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,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new kt(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 kt(n)},addToStart:function(t,e){return new kt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new kt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new kt(o)},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=kt.from(t),t.size?new kt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=kt.from(t),t.size?new kt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=kt.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}};kt.from=function(t){if(t instanceof kt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new kt(e)};function fk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=fk(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function pk(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),u=s.nodeSize;if(s==a){n-=u,r-=u;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let l=0,c=Math.min(s.text.length,a.text.length);for(;l<c&&s.text[s.text.length-l-1]==a.text[a.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let l=pk(s.content,a.content,n-1,r-1);if(l)return l}n-=u,r-=u}}class U{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,o=0,i){for(let s=0,a=0;a<n;s++){let u=this.content[s],l=a+u.nodeSize;if(l>e&&r(u,o+a,i||null,s)!==!1&&u.content.size){let c=a+1;u.nodesBetween(Math.max(0,e-c),Math.min(u.content.size,n-c),r,o+c)}a=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,u)=>{let l=a.isText?a.text.slice(Math.max(e,u)-u,n-u):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new U(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],u=s+a.nodeSize;u>e&&((s<e||u>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=u}return new U(r,o)}cutByIndex(e,n){return e==n?U.empty:e==0&&n==this.content.length?this:new U(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new U(o,i)}addToStart(e){return new U([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new U(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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return fk(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return pk(this,e,n,r)}findIndex(e){if(e==0)return tu(0,e);if(e==this.size)return tu(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 o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?tu(n+1,i):tu(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 U.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new U(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return U.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new U(n||e,r)}static from(e){if(!e)return U.empty;if(e instanceof U)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new U([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}U.empty=new U([],0);const Vf={index:0,offset:0};function tu(t,e){return Vf.index=t,Vf.offset=e,Vf}function xc(t,e){if(t===e)return!0;if(!(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(!xc(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!xc(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ie=class Yh{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),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&&xc(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 o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}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 Yh.none;if(e instanceof Yh)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ie.none=[];class Ec extends Error{}class J{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=mk(this.content,e+this.openStart,n);return r&&new J(r,this.openStart,this.openEnd)}removeBetween(e,n){return new J(hk(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 J.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new J(U.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=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)o++;return new J(e,r,o)}}J.empty=new J(U.empty,0,0);function hk(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(hk(i.content,e-o-1,n-o-1)))}function mk(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=mk(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function c4(t,e,n){if(n.openStart>t.depth)throw new Ec("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ec("Inconsistent open depths");return yk(t,e,n,0)}function yk(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=yk(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Ho(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=d4(n,t);return Ho(i,vk(t,s,a,e,r))}else return Ho(i,Tc(t,e,r))}function gk(t,e){if(!e.type.compatibleContent(t.type))throw new Ec("Cannot join "+e.type.name+" onto "+t.type.name)}function Qh(t,e,n){let r=t.node(n);return gk(r,e.node(n)),r}function qo(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 ya(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(qo(t.nodeAfter,r),i++));for(let a=i;a<s;a++)qo(o.child(a),r);e&&e.depth==n&&e.textOffset&&qo(e.nodeBefore,r)}function Ho(t,e){return t.type.checkContent(e),t.copy(e)}function vk(t,e,n,r,o){let i=t.depth>o&&Qh(t,e,o+1),s=r.depth>o&&Qh(n,r,o+1),a=[];return ya(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(gk(i,s),qo(Ho(i,vk(t,e,n,r,o+1)),a)):(i&&qo(Ho(i,Tc(t,e,o+1)),a),ya(e,n,o,a),s&&qo(Ho(s,Tc(n,r,o+1)),a)),ya(r,null,o,a),new U(a)}function Tc(t,e,n){let r=[];if(ya(null,t,n,r),t.depth>n){let o=Qh(t,e,n+1);qo(Ho(o,Tc(t,e,n+1)),r)}return ya(e,null,n,r),new U(r)}function d4(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(U.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class sl{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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}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),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.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 Cc(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=[],o=0,i=n;for(let s=e;;){let{index:a,offset:u}=s.content.findIndex(i),l=i-u;if(r.push(s,a,o+u),!l||(s=s.child(a),s.isText))break;i=l-1,o+=u+1}return new sl(n,r,i)}static resolveCached(e,n){let r=Xv.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Xv.set(e,r=new f4);let o=r.elts[r.i]=sl.resolve(e,n);return r.i=(r.i+1)%p4,o}}class f4{constructor(){this.elts=[],this.i=0}}const p4=12,Xv=new WeakMap;class Cc{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 h4=Object.create(null);class kn{constructor(e,n,r,o=Ie.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||U.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,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&xc(this.attrs,n||e.defaultAttrs||h4)&&Ie.sameSet(this.marks,r||Ie.none)}copy(e=null){return e==this.content?this:new kn(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new kn(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 J.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),l=o.node(s).content.cut(o.pos-a,i.pos-a);return new J(l,o.depth-s,i.depth-s)}replace(e,n,r){return c4(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return sl.resolveCached(this,e)}resolveNoCache(e){return sl.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),wk(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=U.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let u=o;u<i;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.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 o=U.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}}kn.prototype.text=void 0;class Mc extends kn{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wk(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 Mc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Mc(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 wk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ii{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new m4(e,n);if(r.next==null)return ii.empty;let o=bk(r);r.next&&r.err("Unexpected trailing text");let i=S4(_4(o));return k4(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 o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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 o=[this];function i(s,a){let u=s.matchFragment(e,r);if(u&&(!n||u.validEnd))return U.from(a.map(l=>l.createAndFill()));for(let l=0;l<s.next.length;l++){let{type:c,next:d}=s.next[l];if(!(c.isText||c.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(c));if(f)return f}}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 o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:u}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||u.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),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 o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
65
|
+
`)}}ii.empty=new ii(!0);class m4{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 bk(t){let e=[];do e.push(y4(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function y4(t){let e=[];do e.push(g4(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function g4(t){let e=b4(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=v4(t,e);else break;return e}function Zv(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function v4(t,e){let n=Zv(t),r=n;return t.eat(",")&&(t.next!="}"?r=Zv(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function w4(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function b4(t){if(t.eat("(")){let e=bk(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=w4(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 _4(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,u){let l={term:u,to:a};return e[s].push(l),l}function o(s,a){s.forEach(u=>u.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((u,l)=>u.concat(i(l,a)),[]);if(s.type=="seq")for(let u=0;;u++){let l=i(s.exprs[u],a);if(u==s.exprs.length-1)return l;o(l,a=n())}else if(s.type=="star"){let u=n();return r(a,u),o(i(s.expr,u),u),[r(u)]}else if(s.type=="plus"){let u=n();return o(i(s.expr,a),u),o(i(s.expr,u),u),[r(u)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let u=a;for(let l=0;l<s.min;l++){let c=n();o(i(s.expr,u),c),u=c}if(s.max==-1)o(i(s.expr,u),u);else for(let l=s.min;l<s.max;l++){let c=n();r(u,c),o(i(s.expr,u),c),u=c}return[r(u)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function _k(t,e){return e-t}function e1(t,e){let n=[];return r(e),n.sort(_k);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:u}=i[s];!a&&n.indexOf(u)==-1&&r(u)}}}function S4(t){let e=Object.create(null);return n(e1(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:u})=>{if(!a)return;let l;for(let c=0;c<o.length;c++)o[c][0]==a&&(l=o[c][1]);e1(t,u).forEach(c=>{l||o.push([a,l=[]]),l.indexOf(c)==-1&&l.push(c)})})});let i=e[r.join(",")]=new ii(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(_k);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function k4(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:u,next:l}=o.next[a];s.push(u.name),i&&!(u.isText||u.hasRequiredAttrs())&&(i=!1),r.indexOf(l)==-1&&r.push(l)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Sk(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 kk(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function xk(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function Ek(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new E4(t,r,e[r]);return n}let t1=class Tk{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=Ek(e,r.attrs),this.defaultAttrs=Sk(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==ii.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:kk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new kn(this,this.computeAttrs(e),U.from(n),Ie.setFrom(r))}createChecked(e=null,n,r){return n=U.from(n),this.checkContent(n),new kn(this,this.computeAttrs(e),n,Ie.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=U.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(U.empty,!0);return i?new kn(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){xk(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,s)=>r[i]=new Tk(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");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 x4(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class E4{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?x4(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Fd{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Ek(e,o.attrs),this.excluded=null;let i=Sk(this.attrs);this.instance=i?new Ie(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ie(this,kk(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Fd(i,o++,n,s)),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){xk(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ck{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=kt.from(e.nodes),n.marks=kt.from(e.marks||{}),this.nodes=t1.compile(this.spec.nodes,this),this.marks=Fd.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=ii.parse(s,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?n1(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:n1(this,s.split(" "))}this.nodeFromJSON=o=>kn.fromJSON(this,o),this.markFromJSON=o=>Ie.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof t1){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,o)}text(e,n){let r=this.nodes.text;return new Mc(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 n1(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let u=t.marks[a];(o=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=u)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function T4(t){return t.tag!=null}function C4(t){return t.style!=null}class so{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(T4(o))this.tags.push(o);else if(C4(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new o1(this,n,!1);return r.addAll(e,Ie.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new o1(this,n,!0);return r.addAll(e,Ie.none,n.from,n.to),J.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(N4(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let u=s.getAttrs(n);if(u===!1)continue;s.attrs=u||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i1(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i1(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new so(e,so.schemaRules(e)))}}const Mk={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},M4={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ok={ol:!0,ul:!0},al=1,Xh=2,ga=4;function r1(t,e,n){return e!=null?(e?al:0)|(e==="full"?Xh:0):t&&t.whitespace=="pre"?al|Xh:n&~ga}class nu{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ie.none,this.match=i||(s&ga?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(U.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&al)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=U.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(U.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&&!Mk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class o1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=r1(null,n.preserveWhitespace,0)|(r?ga:0);o?i=new nu(o.type,o.attrs,Ie.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new nu(null,null,Ie.none,!0,null,s):i=new nu(e.schema.topNodeType,null,Ie.none,!0,null,s),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,o=this.top,i=o.options&Xh?"full":this.localPreserveWS||(o.options&al)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
66
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let u=0;u<a.length;u++)u&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[u]&&this.insertNode(s.text(a[u]),n,!/\S/.test(a[u]));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=o.content[o.content.length-1],u=e.previousSibling;(!a||u&&u.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Ok.hasOwnProperty(s)&&this.parser.normalizeLists&&O4(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(u?u.ignore:M4.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let l,c=this.needsBlock;if(Mk.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),l=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=u&&u.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),l&&this.sync(i),this.needsBlock=c}else{let l=this.readStyles(e,n);l&&this.addElementByRule(e,u,l,u.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
67
|
+
`),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 o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let u=this.parser.matchStyle(i,s,this,a);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(l=>!u.clearMark(l)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)a=u;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(s,n.attrs||null,r,n.preserveWhitespace);u&&(i=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let u=this.nodes[s],l=u.findWrapping(e);if(l&&(!o||o.length>l.length+a)&&(o=l,i=u,!l.length))break;if(u.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],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 o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Ie.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):s1(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=r1(e,i,s.options);s.options&ga&&s.content.length==0&&(a|=ga);let u=Ie.none;return r=r.filter(l=>(s.type?s.type.allowsMarkType(l.type):s1(l.type,e))?(u=l.addToSet(u),!1):!0),this.nodes.push(new nu(e,n,u,o,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|=al)}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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,u)=>{for(;a>=0;a--){let l=n[a];if(l==""){if(a==n.length-1||a==0)continue;for(;u>=i;u--)if(s(a-1,u))return!0;return!1}else{let c=u>0||u==0&&o?this.nodes[u].type:r&&u>=i?r.node(u-i).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;u--}}return!0};return s(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];if(r.isTextblock&&r.defaultAttrs)return r}}}function O4(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ok.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function N4(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function i1(t){let e={};for(let n in t)e[n]=t[n];return e}function s1(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let u=0;u<a.edgeCount;u++){let{type:l,next:c}=a.edge(u);if(l==e||i.indexOf(c)<0&&s(c))return!0}};if(s(o.contentMatch))return!0}}class gi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=qf(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,u=0;for(;a<i.length&&u<s.marks.length;){let l=s.marks[u];if(!this.marks[l.type.name]){u++;continue}if(!l.eq(i[a][0])||l.type.spec.spanning===!1)break;a++,u++}for(;a<i.length;)o=i.pop()[1];for(;u<s.marks.length;){let l=s.marks[u++],c=this.serializeMark(l,s.isInline,n);c&&(i.push([l,o]),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Ru(qf(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Ru(qf(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Ru(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new gi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=a1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return a1(e.marks)}}function a1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function qf(t){return t.document||window.document}const l1=new WeakMap;function A4(t){let e=l1.get(t);return e===void 0&&l1.set(t,e=I4(t)),e}function I4(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 o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Ru(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=A4(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 s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,u=n?t.createElementNS(n,o):t.createElement(o),l=e[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let d in l)if(l[d]!=null){let f=d.indexOf(" ");f>0?u.setAttributeNS(d.slice(0,f),d.slice(f+1),l[d]):d=="style"&&u.style?u.style.cssText=l[d]:u.setAttribute(d,l[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:p,contentDOM:h}=Ru(t,f,n,r);if(u.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:u,contentDOM:a}}const Nk=65535,Ak=Math.pow(2,16);function P4(t,e){return t+e*Ak}function u1(t){return t&Nk}function R4(t){return(t-(t&Nk))/Ak}const Ik=1,Pk=2,Du=4,Rk=8;class Zh{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Rk)>0}get deletedBefore(){return(this.delInfo&(Ik|Du))>0}get deletedAfter(){return(this.delInfo&(Pk|Du))>0}get deletedAcross(){return(this.delInfo&Du)>0}}class rn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&rn.empty)return rn.empty}recover(e){let n=0,r=u1(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+R4(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 o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?o:0);if(u>e)break;let l=this.ranges[a+i],c=this.ranges[a+s],d=u+l;if(e<=d){let f=l?e==u?-1:e==d?1:n:n,p=u+o+(f<0?0:c);if(r)return p;let h=e==(n<0?u:d)?null:P4(a/3,e-u),m=e==u?Pk:e==d?Ik:Du;return(n<0?e!=u:e!=d)&&(m|=Rk),new Zh(p,m,h)}o+=c-l}return r?e+o:new Zh(e+o,0,null)}touches(e,n){let r=0,o=u1(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?r:0);if(u>e)break;let l=this.ranges[a+i],c=u+l;if(e<=c&&a==o*3)return!0;r+=this.ranges[a+s]-l}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),u=s+(this.inverted?0:i),l=this.ranges[o+n],c=this.ranges[o+r];e(a,a+l,u,u+c),i+=c-l}}invert(){return new rn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?rn.empty:new rn(e<0?[0,-e,0]:[0,0,e])}}rn.empty=new rn([]);class ll{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ll(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 o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new ll;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 o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let u=this.getMirror(i);if(u!=null&&u>i&&u<this.to){i=u,e=this._maps[u].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new Zh(e,o,null)}}const Hf=Object.create(null);class Dt{getMap(){return rn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Hf[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 Hf)throw new RangeError("Duplicate use of step JSON ID "+e);return Hf[e]=n,n.prototype.jsonID=e,n}}class st{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,n,r,o){try{return st.ok(e.replace(n,r,o))}catch(i){if(i instanceof Ec)return st.fail(i.message);throw i}}}function By(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(By(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return U.fromArray(r)}class Gr extends Dt{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),o=r.node(r.sharedDepth(this.to)),i=new J(By(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,i)}invert(){return new jn(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 Gr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gr(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 Gr(n.from,n.to,e.markFromJSON(n.mark))}}Dt.jsonID("addMark",Gr);class jn extends Dt{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 J(By(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,r)}invert(){return new Gr(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 jn(n.pos,r.pos,this.mark)}merge(e){return e instanceof jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new jn(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 jn(n.from,n.to,e.markFromJSON(n.mark))}}Dt.jsonID("removeMark",jn);class Jr extends Dt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new J(U.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Jr(this.pos,n.marks[o]);return new Jr(this.pos,this.mark)}}return new si(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Jr(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 Jr(n.pos,e.markFromJSON(n.mark))}}Dt.jsonID("addNodeMark",Jr);class si extends Dt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new J(U.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Jr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new si(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 si(n.pos,e.markFromJSON(n.mark))}}Dt.jsonID("removeNodeMark",si);class mt extends Dt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&em(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rn([this.from,this.to-this.from,this.slice.size])}invert(e){return new mt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new mt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof mt)||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?J.empty:new J(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new mt(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?J.empty:new J(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new mt(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 mt(n.from,n.to,J.fromJSON(e,n.slice),!!n.structure)}}Dt.jsonID("replace",mt);class vt extends Dt{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(em(e,this.from,this.gapFrom)||em(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return st.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?st.fromReplace(e,this.from,this.to,r):st.fail("Content does not fit in gap")}getMap(){return new rn([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 vt(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),o=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||o<n.pos||i>r.pos?null:new vt(n.pos,r.pos,o,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 vt(n.from,n.to,n.gapFrom,n.gapTo,J.fromJSON(e,n.slice),n.insert,!!n.structure)}}Dt.jsonID("replaceAround",vt);function em(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function D4(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,n,(u,l,c)=>{if(!u.isInline)return;let d=u.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(l,e),p=Math.min(l+u.nodeSize,n),h=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=p:o.push(s=new jn(f,p,d[m])));a&&a.to==f?a.to=p:i.push(a=new Gr(f,p,r))}}),o.forEach(u=>t.step(u)),i.forEach(u=>t.step(u))}function j4(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let u=null;if(r instanceof Fd){let l=s.marks,c;for(;c=r.isInSet(l);)(u||(u=[])).push(c),l=c.removeFromSet(l)}else r?r.isInSet(s.marks)&&(u=[r]):u=s.marks;if(u&&u.length){let l=Math.min(a+s.nodeSize,n);for(let c=0;c<u.length;c++){let d=u[c],f;for(let p=0;p<o.length;p++){let h=o[p];h.step==i-1&&d.eq(o[p].style)&&(f=h)}f?(f.to=l,f.step=i):o.push({style:d,from:Math.max(a,e),to:l,step:i})}}}),o.forEach(s=>t.step(new jn(s.from,s.to,s.style)))}function Fy(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let u=0;u<i.childCount;u++){let l=i.child(u),c=a+l.nodeSize,d=r.matchType(l.type);if(!d)s.push(new mt(a,c,J.empty));else{r=d;for(let f=0;f<l.marks.length;f++)n.allowsMarkType(l.marks[f].type)||t.step(new jn(a,c,l.marks[f]));if(o&&l.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(l.text);)h||(h=new J(U.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new mt(a+f.index,a+f.index+f[0].length,h))}}a=c}if(!r.validEnd){let u=r.fillBefore(U.empty,!0);t.replace(a,a,new J(u,0,0))}for(let u=s.length-1;u>=0;u--)t.step(s[u])}function L4(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ns(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+o,u=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(a,u,n))return r;if(r==0||s.type.spec.isolating||!L4(s,a,u))break;a&&(o=1),u<s.childCount&&(i=1)}return null}function B4(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),u=s,l=a,c=U.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,c=U.from(r.node(h).copy(c)),d++):u--;let f=U.empty,p=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=U.from(o.node(h).copy(f)),p++):l++;t.step(new vt(u,l,s,a,new J(c.append(f),d,p),c.size-d,!0))}function $y(t,e,n=null,r=t){let o=F4(t,e),i=o&&$4(r,e);return i?o.map(c1).concat({type:e,attrs:n}).concat(i.map(c1)):null}function c1(t){return{type:t,attrs:null}}function F4(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function $4(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let u=(s.length?s[s.length-1]:e).contentMatch;for(let l=r;u&&l<o;l++)u=u.matchType(n.child(l).type);return!u||!u.validEnd?null:s}function z4(t,e,n){let r=U.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].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=U.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new vt(o,i,o,i,new J(r,0,0),n.length,!0))}function U4(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let u=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,u)&&V4(t.doc,t.mapping.slice(i).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?l=!1:!p&&h&&(l=!0)}l===!1&&jk(t,s,a,i),Fy(t,t.mapping.slice(i).map(a,1),r,void 0,l===null);let c=t.mapping.slice(i),d=c.map(a,1),f=c.map(a+s.nodeSize,1);return t.step(new vt(d,f,d+1,f-1,new J(U.from(r.create(u,null,s.marks)),0,0),1,!0)),l===!0&&Dk(t,s,a,i),!1}})}function Dk(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let u=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function jk(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
68
|
+
`))}})}function V4(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function q4(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new vt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new J(U.from(s),0,0),1,!0))}function wr(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let l=o.depth-1,c=n-2;l>i;l--,c--){let d=o.node(l),f=o.index(l);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[c+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let a=o.indexAfter(i),u=r&&r[0];return o.node(i).canReplaceWith(a,a,u?u.type:o.node(i+1).type)}function H4(t,e,n=1,r){let o=t.doc.resolve(e),i=U.empty,s=U.empty;for(let a=o.depth,u=o.depth-n,l=n-1;a>u;a--,l--){i=U.from(o.node(a).copy(i));let c=r&&r[l];s=U.from(c?c.type.create(c.attrs,s):o.node(a).copy(s))}t.step(new mt(e,e,new J(i.append(s),n,n),!0))}function vo(t,e){let n=t.resolve(e),r=n.index();return Lk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function W4(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Lk(t,e){return!!(t&&e&&!t.isLeaf&&W4(t,e))}function $d(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&Lk(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function K4(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let c=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);jk(t,c.node(),c.before(),a)}s.inlineContent&&Fy(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(a),l=u.map(e-n);if(t.step(new mt(l,u.map(e+n,-1),J.empty,!0)),r===!0){let c=t.doc.resolve(l);Dk(t,c.node(),c.before(),t.steps.length)}return t}function G4(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 o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Bk(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,u=r.index(s)+(a>0?1:0),l=r.node(s),c=!1;if(i==1)c=l.canReplace(u,u,o);else{let d=l.contentMatchAt(u).findWrapping(o.firstChild.type);c=d&&l.canReplaceWith(u,u,d[0])}if(c)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function zd(t,e,n=e,r=J.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Fk(o,i,r)?new mt(e,n,r):new J4(o,i,r).fit()}function Fk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class J4{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=U.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=U.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let u=new J(i,s,a);return e>-1?new vt(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new mt(r.pos,o.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=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 o,i=null;r?(i=Wf(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:u,match:l}=this.frontier[a],c,d=null;if(n==1&&(s?l.matchType(s.type)||(d=l.fillBefore(U.from(s),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(c=l.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:c};if(i&&l.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Wf(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new J(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Wf(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new J(na(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new J(na(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,a=r?r.content:s.content,u=s.openStart-e,l=0,c=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)c.push(o.child(m));d=d.matchFragment(o)}let p=a.size+e-(s.content.size-s.openEnd);for(;l<a.childCount;){let m=a.child(l),v=d.matchType(m.type);if(!v)break;l++,(l>1||u==0||m.content.size)&&(d=v,c.push($k(m.mark(f.allowedMarks(m.marks)),l==1?u:0,l==a.childCount?p:-1)))}let h=l==a.childCount;h||(p=-1),this.placed=ra(this.placed,n,U.from(c)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,v=a;m<p;m++){let y=v.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),v=y.content}this.unplaced=h?e==0?J.empty:new J(na(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new J(na(s.content,e,l),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Kf(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,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Kf(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:u,type:l}=this.frontier[a],c=Kf(e,a,l,u,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,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=ra(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=ra(this.placed,this.depth,U.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(U.empty,!0);n.childCount&&(this.placed=ra(this.placed,this.frontier.length,n))}}function na(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(na(t.firstChild.content,e-1,n)))}function ra(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ra(t.lastChild.content,e-1,n)))}function Wf(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function $k(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,$k(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(U.empty,!0)))),t.copy(r)}function Kf(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!Y4(n,i.content,s)?a:null}function Y4(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Q4(t){return t.spec.defining||t.spec.definingForContent}function X4(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(Fk(o,i,r))return t.step(new mt(e,n,r));let s=Uk(o,i);s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==p&&s.splice(1,0,-f)}let u=s.indexOf(a),l=[],c=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(l.push(h),p==r.openStart)break;f=h.content}for(let f=c-1;f>=0;f--){let p=l[f],h=Q4(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(a)-1)))c=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+c+1)%(r.openStart+1),h=l[p];if(h)for(let m=0;m<s.length;m++){let v=s[(m+u)%s.length],y=!0;v<0&&(y=!1,v=-v);let w=o.node(v-1),b=o.index(v-1);if(w.canReplaceWith(b,b,h.type,h.marks))return t.replace(o.before(v),y?i.after(v):n,new J(zk(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=s[f];p<0||(e=o.before(p),n=i.after(p))}}function zk(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(zk(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(U.empty,!0))}return t}function Z4(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=G4(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new J(U.from(r),0,0))}function eB(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Uk(r,o);for(let s=0;s<i.length;s++){let a=i[s],u=s==i.length-1;if(u&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(u||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Uk(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class as extends Dt{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 st.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 o=n.type.create(r,null,n.marks);return st.fromReplace(e,this.pos,this.pos+1,new J(U.from(o),0,n.isLeaf?0:1))}getMap(){return rn.empty}invert(e){return new as(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 as(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 as(n.pos,n.attr,n.value)}}Dt.jsonID("attr",as);class ul extends Dt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return st.ok(r)}getMap(){return rn.empty}invert(e){return new ul(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 ul(n.attr,n.value)}}Dt.jsonID("docAttr",ul);let bs=class extends Error{};bs=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};bs.prototype=Object.create(Error.prototype);bs.prototype.constructor=bs;bs.prototype.name="TransformError";class Vk{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ll}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new bs(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}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=J.empty){let o=zd(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new J(U.from(r),0,0))}delete(e,n){return this.replace(e,n,J.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return X4(this,e,n,r),this}replaceRangeWith(e,n,r){return Z4(this,e,n,r),this}deleteRange(e,n){return eB(this,e,n),this}lift(e,n){return B4(this,e,n),this}join(e,n=1){return K4(this,e,n),this}wrap(e,n){return z4(this,e,n),this}setBlockType(e,n=e,r,o=null){return U4(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return q4(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new as(e,n,r)),this}setDocAttribute(e,n){return this.step(new ul(e,n)),this}addNodeMark(e,n){return this.step(new Jr(e,n)),this}removeNodeMark(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 si(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new si(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return H4(this,e,n,r),this}addMark(e,n,r){return D4(this,e,n,r),this}removeMark(e,n,r){return j4(this,e,n,r),this}clearIncompatible(e,n,r){return Fy(this,e,n,r),this}}const Gf=Object.create(null);class me{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new tB(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=J.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:u,$to:l}=s[a],c=e.mapping.slice(i);e.replaceRange(c.map(u.pos),c.map(l.pos),a?J.empty:n),a==0&&p1(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],u=e.mapping.slice(r),l=u.map(s.pos),c=u.map(a.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,n),p1(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new ce(e):Ei(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Ei(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Ei(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new an(e.node(0))}static atStart(e){return Ei(e,e,0,0,1)||new an(e)}static atEnd(e){return Ei(e,e,e.content.size,e.childCount,-1)||new an(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Gf[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 Gf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Gf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ce.between(this.$anchor,this.$head).getBookmark()}}me.prototype.visible=!0;class tB{constructor(e,n){this.$from=e,this.$to=n}}let d1=!1;function f1(t){!d1&&!t.parent.inlineContent&&(d1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ce extends me{constructor(e,n=e){f1(e),f1(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 me.near(r);let o=e.resolve(n.map(this.anchor));return new ce(o.parent.inlineContent?o:r,r)}replace(e,n=J.empty){if(super.replace(e,n),n==J.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ce&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ud(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 ce(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=me.findFrom(n,r,!0)||me.findFrom(n,-r,!0);if(i)n=i.$head;else return me.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(me.findFrom(e,-r,!0)||me.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new ce(e,n)}}me.jsonID("text",ce);class Ud{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ud(e.map(this.anchor),e.map(this.head))}resolve(e){return ce.between(e.resolve(this.anchor),e.resolve(this.head))}}class re extends me{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:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?me.near(i):new re(i)}content(){return new J(U.from(this.node),0,0)}eq(e){return e instanceof re&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new zy(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new re(e.resolve(n.anchor))}static create(e,n){return new re(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}re.prototype.visible=!1;me.jsonID("node",re);class zy{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ud(r,r):new zy(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&re.isSelectable(r)?new re(n):me.near(n)}}class an extends me{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=J.empty){if(n==J.empty){e.delete(0,e.doc.content.size);let r=me.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new an(e)}map(e){return new an(e)}eq(e){return e instanceof an}getBookmark(){return nB}}me.jsonID("all",an);const nB={map(){return this},resolve(t){return new an(t)}};function Ei(t,e,n,r,o,i=!1){if(e.inlineContent)return ce.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&re.isSelectable(a))return re.create(t,n-(o<0?a.nodeSize:0))}else{let u=Ei(t,a,n+o,o<0?a.childCount:0,o,i);if(u)return u}n+=a.nodeSize*o}return null}function p1(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof mt||o instanceof vt))return;let i=t.mapping.maps[r],s;i.forEach((a,u,l,c)=>{s==null&&(s=c)}),t.setSelection(me.near(t.doc.resolve(s),n))}const h1=1,ru=2,m1=4;class rB extends Vk{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|h1)&~ru,this.storedMarks=null,this}get selectionSet(){return(this.updated&h1)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ru,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&ru)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ru,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 o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(me.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|=m1,this}get scrolledIntoView(){return(this.updated&m1)>0}}function y1(t,e){return!e||!t?t:t.bind(e)}class oa{constructor(e,n,r){this.name=e,this.init=y1(n.init,r),this.apply=y1(n.apply,r)}}const oB=[new oa("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new oa("selection",{init(t,e){return t.selection||me.atStart(e.doc)},apply(t){return t.selection}}),new oa("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new oa("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Jf{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=oB.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 oa(r.key,r.spec.state,r))})}}class Vi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let u=o?o[s].n:0,l=o?o[s].state:this,c=u<n.length&&a.spec.appendTransaction.call(a,u?n.slice(u):n,l,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),i=!0}o&&(o[s]={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 Vi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new rB(this)}static create(e){let n=new Jf(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Vi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Jf(this.schema,e.plugins),r=n.fields,o=new Vi(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}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 o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.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 o=new Jf(e.schema,e.plugins),i=new Vi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=kn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=me.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let u=r[a],l=u.spec.state;if(u.key==s.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=l.fromJSON.call(u,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}}function qk(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=qk(o,e,{})),n[r]=o}return n}class ze{constructor(e){this.spec=e,this.props={},e.props&&qk(e.props,this,this.props),this.key=e.key?e.key.key:Hk("plugin")}getState(e){return e[this.key]}}const Yf=Object.create(null);function Hk(t){return t in Yf?t+"$"+ ++Yf[t]:(Yf[t]=0,t+"$")}class et{constructor(e="key"){this.key=Hk(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Uy=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Wk(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Kk=(t,e,n)=>{let r=Wk(t,n);if(!r)return!1;let o=Vy(r);if(!o){let s=r.blockRange(),a=s&&Ns(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(nx(t,o,e,-1))return!0;if(r.parent.content.size==0&&(_s(i,"end")||re.isSelectable(i)))for(let s=r.depth;;s--){let a=zd(t.doc,r.before(s),r.after(s),J.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=t.tr.step(a);u.setSelection(_s(i,"end")?me.findFrom(u.doc.resolve(u.mapping.map(o.pos,-1)),-1):re.create(u.doc,o.pos-i.nodeSize)),e(u.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},iB=(t,e,n)=>{let r=Wk(t,n);if(!r)return!1;let o=Vy(r);return o?Gk(t,o,e):!1},sB=(t,e,n)=>{let r=Yk(t,n);if(!r)return!1;let o=qy(r);return o?Gk(t,o,e):!1};function Gk(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let c=o.lastChild;if(!c)return!1;o=c}let s=e.nodeAfter,a=s,u=e.pos+1;for(;!a.isTextblock;u++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let l=zd(t.doc,i,u,J.empty);if(!l||l.from!=i||l instanceof mt&&l.slice.size>=u-i)return!1;if(n){let c=t.tr.step(l);c.setSelection(ce.create(c.doc,i)),n(c.scrollIntoView())}return!0}function _s(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 Jk=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Vy(r)}let s=i&&i.nodeBefore;return!s||!re.isSelectable(s)?!1:(e&&e(t.tr.setSelection(re.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Vy(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 Yk(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Qk=(t,e,n)=>{let r=Yk(t,n);if(!r)return!1;let o=qy(r);if(!o)return!1;let i=o.nodeAfter;if(nx(t,o,e,1))return!0;if(r.parent.content.size==0&&(_s(i,"start")||re.isSelectable(i))){let s=zd(t.doc,r.before(),r.after(),J.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(_s(i,"start")?me.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):re.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},Xk=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=qy(r)}let s=i&&i.nodeAfter;return!s||!re.isSelectable(s)?!1:(e&&e(t.tr.setSelection(re.create(t.doc,i.pos)).scrollIntoView()),!0)};function qy(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 aB=(t,e)=>{let n=t.selection,r=n instanceof re,o;if(r){if(n.node.isTextblock||!vo(t.doc,n.from))return!1;o=n.from}else if(o=$d(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(re.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},lB=(t,e)=>{let n=t.selection,r;if(n instanceof re){if(n.node.isTextblock||!vo(t.doc,n.to))return!1;r=n.to}else if(r=$d(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},uB=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&Ns(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},Zk=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
69
|
+
`).scrollIntoView()),!0)};function Hy(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 cB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Hy(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),u=t.tr.replaceWith(a,a,s.createAndFill());u.setSelection(me.near(u.doc.resolve(a),1)),e(u.scrollIntoView())}return!0},ex=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof an||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Hy(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(ce.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},tx=(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(wr(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ns(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function dB(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof re&&e.selection.node.isBlock)return!r.parentOffset||!wr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,u=!1,l=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){u=r.end(p)==r.pos+(r.depth-p),l=r.start(p)==r.pos-(r.depth-p),a=Hy(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(u&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof ce||e.selection instanceof an)&&c.deleteSelection();let d=c.mapping.map(r.pos),f=wr(c.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=wr(c.doc,d,i.length,i)),!f)return!1;if(c.split(d,i.length,i),!u&&l&&r.node(s).type!=a){let p=c.mapping.map(r.before(s)),h=c.doc.resolve(p);a&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,a)&&c.setNodeMarkup(c.mapping.map(r.before(s)),a)}return n&&n(c.scrollIntoView()),!0}}const fB=dB(),pB=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(re.create(t.doc,o))),!0)};function hB(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.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)||!(o.isTextblock||vo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function nx(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,u=o.type.spec.isolating||i.type.spec.isolating;if(!u&&hB(t,e,n))return!0;let l=!u&&e.parent.canReplace(e.index(),e.index()+1);if(l&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,h=U.empty;for(let y=s.length-1;y>=0;y--)h=U.from(s[y].create(null,h));h=U.from(o.copy(h));let m=t.tr.step(new vt(e.pos-1,p,e.pos,p,new J(h,1,0),s.length,!0)),v=m.doc.resolve(p+2*s.length);v.nodeAfter&&v.nodeAfter.type==o.type&&vo(m.doc,v.pos)&&m.join(v.pos),n(m.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&u?null:me.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&Ns(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(l&&_s(i,"start",!0)&&_s(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=i,v=1;for(;!m.isTextblock;m=m.firstChild)v++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let y=U.empty;for(let b=h.length-1;b>=0;b--)y=U.from(h[b].copy(y));let w=t.tr.step(new vt(e.pos-h.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new J(y,h.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function rx(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(ce.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const mB=rx(-1),yB=rx(1);function gB(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&$y(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function g1(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(u,l)=>{if(o)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)o=!0;else{let c=n.doc.resolve(l),d=c.index();o=c.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[s];i.setBlockType(a,u,t,e)}r(i.scrollIntoView())}return!0}}function Wy(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Wy(Uy,Kk,Jk);Wy(Uy,Qk,Xk);Wy(Zk,ex,tx,fB);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function vB(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return wB(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function wB(t,e,n,r=null){let o=!1,i=e,s=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 u=s.resolve(e.start-2);i=new Cc(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Cc(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=$y(i,n,r,e);return a?(t&&bB(t,e,a,o,n),!0):!1}function bB(t,e,n,r,o){let i=U.empty;for(let c=n.length-1;c>=0;c--)i=U.from(n[c].type.create(n[c].attrs,i));t.step(new vt(e.start-(r?2:0),e.end,e.start,e.end,new J(i,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==o&&(s=c+1);let a=n.length-s,u=e.start+n.length-(r?2:0),l=e.parent;for(let c=e.startIndex,d=e.endIndex,f=!0;c<d;c++,f=!1)!f&&wr(t.doc,u,a)&&(t.split(u,a),u+=2*a),u+=l.child(c).nodeSize;return t}function _B(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?SB(e,n,t,i):kB(e,n,i):!0:!1}}function SB(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new vt(i-1,s,i,s,new J(U.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Cc(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Ns(r);if(a==null)return!1;o.lift(r,a);let u=o.doc.resolve(o.mapping.map(i,-1)-1);return vo(o.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&o.join(u.pos),e(o.scrollIntoView()),!0}function kB(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,u=n.endIndex==o.childCount,l=i.node(-1),c=i.index(-1);if(!l.canReplace(c+(a?0:1),c+1,s.content.append(u?U.empty:U.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new vt(d-(a?1:0),f+(u?1:0),d+1,f-1,new J((a?U.empty:U.from(o.copy(U.empty))).append(u?U.empty:U.from(o.copy(U.empty))),a?0:1,u?0:1),a?0:1)),e(r.scrollIntoView()),!0}function xB(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,l=>l.childCount>0&&l.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,u=a.child(s-1);if(u.type!=t)return!1;if(n){let l=u.lastChild&&u.lastChild.type==a.type,c=U.from(l?t.create():null),d=new J(U.from(t.create(null,U.from(a.type.create(null,c)))),l?3:1,0),f=i.start,p=i.end;n(e.tr.step(new vt(f-(l?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const xt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ss=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let tm=null;const cr=function(t,e,n){let r=tm||(tm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},EB=function(){tm=null},ai=function(t,e,n,r){return n&&(v1(t,e,n,r,-1)||v1(t,e,n,r,1))},TB=/^(img|br|input|textarea|hr)$/i;function v1(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:wn(t))){let s=t.parentNode;if(!s||s.nodeType!=1||xl(t)||TB.test(t.nodeName)||t.contentEditable=="false")return!1;e=xt(t)+(o<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=s,e=o<0?wn(t):0}else return!1}}function wn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function CB(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=wn(t)}else if(t.parentNode&&!xl(t))e=xt(t),t=t.parentNode;else return null}}function MB(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&&!xl(t))e=xt(t)+1,t=t.parentNode;else return null}}function OB(t,e,n){for(let r=e==0,o=e==wn(t);r||o;){if(t==n)return!0;let i=xt(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==wn(t)}}function xl(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 Vd=function(t){return t.focusNode&&ai(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function No(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function NB(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function AB(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(wn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(wn(r.startContainer),r.startOffset)}}}const tr=typeof navigator<"u"?navigator:null,w1=typeof document<"u"?document:null,wo=tr&&tr.userAgent||"",nm=/Edge\/(\d+)/.exec(wo),ox=/MSIE \d/.exec(wo),rm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wo),Zt=!!(ox||rm||nm),ao=ox?document.documentMode:rm?+rm[1]:nm?+nm[1]:0,xn=!Zt&&/gecko\/(\d+)/i.test(wo);xn&&+(/Firefox\/(\d+)/.exec(wo)||[0,0])[1];const om=!Zt&&/Chrome\/(\d+)/.exec(wo),yt=!!om,ix=om?+om[1]:0,Rt=!Zt&&!!tr&&/Apple Computer/.test(tr.vendor),ks=Rt&&(/Mobile\/\w+/.test(wo)||!!tr&&tr.maxTouchPoints>2),yn=ks||(tr?/Mac/.test(tr.platform):!1),sx=tr?/Win/.test(tr.platform):!1,mr=/Android \d/.test(wo),El=!!w1&&"webkitFontSmoothing"in w1.documentElement.style,IB=El?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function PB(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 rr(t,e){return typeof t=="number"?t:t[e]}function RB(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 b1(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Ss(s);continue}let a=s,u=a==i.body,l=u?PB(i):RB(a),c=0,d=0;if(e.top<l.top+rr(r,"top")?d=-(l.top-e.top+rr(o,"top")):e.bottom>l.bottom-rr(r,"bottom")&&(d=e.bottom-e.top>l.bottom-l.top?e.top+rr(o,"top")-l.top:e.bottom-l.bottom+rr(o,"bottom")),e.left<l.left+rr(r,"left")?c=-(l.left-e.left+rr(o,"left")):e.right>l.right-rr(r,"right")&&(c=e.right-l.right+rr(o,"right")),c||d)if(u)i.defaultView.scrollBy(c,d);else{let p=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-p,v=a.scrollTop-h;e={left:e.left-m,top:e.top-v,right:e.right-m,bottom:e.bottom-v}}let f=u?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:Ss(s)}}function DB(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(i,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let u=a.getBoundingClientRect();if(u.top>=n-20){r=a,o=u.top;break}}return{refDOM:r,refTop:o,stack:ax(t.dom)}}function ax(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ss(r));return e}function jB({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;lx(n,r==0?0:r-e)}function lx(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Si=null;function LB(t){if(t.setActive)return t.setActive();if(Si)return t.focus(Si);let e=ax(t);t.focus(Si==null?{get preventScroll(){return Si={preventScroll:!0},!0}}:void 0),Si||(Si=!1,lx(e,0))}function ux(t,e){let n,r=2e8,o,i=0,s=e.top,a=e.top,u,l;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=cr(c).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){n=c,r=m,o=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,c.nodeType==1&&m&&(i=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!u&&h.left<=e.left&&h.right>=e.left&&(u=c,l={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=d+1)}}return!n&&u&&(n=u,o=l,r=0),n&&n.nodeType==3?BB(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:ux(n,o)}function BB(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=Rr(r,1);if(s.top!=s.bottom&&Ky(e,s)){o={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function Ky(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function FB(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function $B(t,e,n){let{node:r,offset:o}=ux(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function zB(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),u;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((u=a.dom.getBoundingClientRect()).width||u.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&u.left>r.left||u.top>r.top?o=a.posBefore:(!s&&u.right<r.left||u.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function cx(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let u=0;u<a.length;u++){let l=a[u];if(Ky(e,l))return cx(s,e,l)}}if((i=(i+1)%r)==o)break}return t}function UB(t,e){let n=t.dom.ownerDocument,r,o=0,i=AB(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let l=t.dom.getBoundingClientRect();if(!Ky(e,l)||(s=cx(t.dom,e,l),!s))return null}if(Rt)for(let l=s;r&&l;l=Ss(l))l.draggable&&(r=void 0);if(s=FB(s,e),r){if(xn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let c=r.childNodes[o],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let l;El&&o&&r.nodeType==1&&(l=r.childNodes[o-1]).nodeType==1&&l.contentEditable=="false"&&l.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=zB(t,r,o,e))}a==null&&(a=$B(t,s,e));let u=t.docView.nearestDesc(s,!0);return{pos:a,inside:u?u.posAtStart-u.border:-1}}function _1(t){return t.top<t.bottom||t.left<t.right}function Rr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(_1(r))return r}return Array.prototype.find.call(n,_1)||t.getBoundingClientRect()}const VB=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function dx(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=El||xn;if(r.nodeType==3)if(s&&(VB.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let u=Rr(cr(r,o,o),n);if(xn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let l=Rr(cr(r,o-1,o-1),-1);if(l.top==u.top){let c=Rr(cr(r,o,o+1),-1);if(c.top!=u.top)return qs(c,c.left<l.left)}}return u}else{let u=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==r.nodeValue.length?(u--,c=1):n<0?u--:l++,qs(Rr(cr(r,u,l),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==wn(r))){let u=r.childNodes[o-1];if(u.nodeType==1)return Qf(u.getBoundingClientRect(),!1)}if(i==null&&o<wn(r)){let u=r.childNodes[o];if(u.nodeType==1)return Qf(u.getBoundingClientRect(),!0)}return Qf(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==wn(r))){let u=r.childNodes[o-1],l=u.nodeType==3?cr(u,wn(u)-(s?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(l)return qs(Rr(l,1),!1)}if(i==null&&o<wn(r)){let u=r.childNodes[o];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let l=u?u.nodeType==3?cr(u,0,s?0:1):u.nodeType==1?u:null:null;if(l)return qs(Rr(l,-1),!0)}return qs(Rr(r.nodeType==3?cr(r):r,-n),n>=0)}function qs(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 Qf(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 fx(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function qB(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return fx(t,e,()=>{let{node:i}=t.docView.domFromPos(o.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 s=dx(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let u;if(a.nodeType==1)u=a.getClientRects();else if(a.nodeType==3)u=cr(a,0,a.nodeValue.length).getClientRects();else continue;for(let l=0;l<u.length;l++){let c=u[l];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const HB=/[\u0590-\u08ac]/;function WB(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return a?!HB.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:fx(t,e,()=>{let{focusNode:u,focusOffset:l,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),v=h&&!p.contains(h.nodeType==1?h:h.parentNode)||u==h&&l==m;try{a.collapse(c,d),u&&(u!=c||l!=d)&&a.extend&&a.extend(u,l)}catch{}return f!=null&&(a.caretBidiLevel=f),v}):r.pos==r.start()||r.pos==r.end()}let S1=null,k1=null,x1=!1;function KB(t,e,n){return S1==e&&k1==n?x1:(S1=e,k1=n,x1=n=="up"||n=="down"?qB(t,e,n):WB(t,e,n))}const En=0,E1=1,jo=2,nr=3;class Tl{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=En,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 o=this.children[n];if(o==e)return r;r+=o.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,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>xt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==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 o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let a=o.children[s];if(a.size){o=a;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>e||s instanceof hx){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof px&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?xt(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?xt(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 o=-1,i=-1;for(let s=r,a=0;;a++){let u=this.children[a],l=s+u.size;if(o==-1&&e<=l){let c=s+u.border;if(e>=c&&n<=l-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,c);e=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=xt(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(l>n||a==this.children.length-1)){n=l;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=xt(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=l}return{node:this.contentDOM,from:e,to:n,fromOffset:o,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,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let p=0,h=0;p<this.children.length;p++){let m=this.children[p],v=h+m.size;if(i>h&&s<v)return m.setSelection(e-h-m.border,n-h-m.border,r,o);h=v}let a=this.domFromPos(e,e?-1:1),u=n==e?a:this.domFromPos(n,n?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((xn||Rt)&&e==n){let{node:p,offset:h}=a;if(p.nodeType==3){if(d=!!(h&&p.nodeValue[h-1]==`
|
|
70
|
+
`),d&&h==p.nodeValue.length)for(let m=p,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(a=u={node:v.parentNode,offset:xt(v)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=p.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(xn&&c.focusNode&&c.focusNode!=u.node&&c.focusNode.nodeType==1){let p=c.focusNode.childNodes[c.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&Rt)&&ai(a.node,a.offset,c.anchorNode,c.anchorOffset)&&ai(u.node,u.offset,c.focusNode,c.focusOffset))return;let f=!1;if((l.extend||e==n)&&!(d&&xn)){l.collapse(a.node,a.offset);try{e!=n&&l.extend(u.node,u.offset),f=!0}catch{}}if(!f){if(e>n){let h=a;a=u,u=h}let p=document.createRange();p.setEnd(u.node,u.offset),p.setStart(a.node,a.offset),l.removeAllRanges(),l.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,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+i.border,u=s-i.border;if(e>=a&&n<=u){this.dirty=e==r||n==s?jo:E1,e==a&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=nr:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?jo:nr}r=s}this.dirty=jo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?jo:E1;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class px extends Tl{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==En&&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 GB extends Tl{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}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 li extends Tl{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=gi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new li(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&nr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=nr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=En){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=En}}slice(e,n,r){let o=li.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=sm(i,n,s,r)),e>0&&(i=sm(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lo extends Tl{constructor(e,n,r,o,i,s,a,u,l){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,i,s){let a=i.nodeViews[n.type.name],u,l=a&&a(n,i,()=>{if(!u)return s;if(u.parent)return u.parent.posBeforeChild(u)},r,o),c=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=gi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=gx(c,r,n),l?u=new JB(e,n,r,o,c,d||null,f,l,i,s+1):n.isText?new qd(e,n,r,o,c,f,i):new lo(e,n,r,o,c,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let 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=()=>U.empty)}return e}matchesNode(e,n,r){return this.dirty==En&&e.eq(this.node)&&Oc(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,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,u=new QB(this,s&&s.node,e);eF(this.node,this.innerDeco,(l,c,d)=>{l.spec.marks?u.syncToMarks(l.spec.marks,r,e):l.type.side>=0&&!d&&u.syncToMarks(c==this.node.childCount?Ie.none:this.node.child(c).marks,r,e),u.placeWidget(l,e,o)},(l,c,d,f)=>{u.syncToMarks(l.marks,r,e);let p;u.findNodeMatch(l,c,d,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+l.nodeSize&&(p=u.findIndexWithChild(i.node))>-1&&u.updateNodeAt(l,c,d,p,e)||u.updateNextNode(l,c,d,e,f,o)||u.addNode(l,c,d,e,o),o+=l.nodeSize}),u.syncToMarks([],r,e),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==jo)&&(s&&this.protectLocalComposition(e,s),mx(this.contentDOM,this.children,e),ks&&tF(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof ce)||r<n||o>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 s=i.nodeValue,a=nF(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){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 s=new GB(this,i,n,o);e.input.compositionNodes.push(s),this.children=sm(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==nr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=En}updateOuterDeco(e){if(Oc(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=yx(this.dom,this.nodeDOM,im(this.outerDeco,this.node,n),im(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 T1(t,e,n,r,o){gx(r,e,t);let i=new lo(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class qd extends lo{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,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,o){return this.dirty==nr||this.dirty!=En&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=En||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=En,!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 o=this.node.cut(e,n),i=document.createTextNode(o.text);return new qd(this.parent,o,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=nr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class hx extends Tl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==En&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class JB extends lo{constructor(e,n,r,o,i,s,a,u,l,c){super(e,n,r,o,i,s,a,l,c),this.spec=u}update(e,n,r,o){if(this.dirty==nr)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,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 mx(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=C1(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof li){let u=r?r.previousSibling:t.lastChild;mx(s.contentDOM,s.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=C1(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const va=function(t){t&&(this.nodeName=t)};va.prototype=Object.create(null);const Lo=[new va];function im(t,e,n){if(t.length==0)return Lo;let r=n?Lo[0]:new va,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new va(s.nodeName));for(let a in s){let u=s[a];u!=null&&(n&&o.length==1&&o.push(r=new va(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+u:a=="style"?r.style=(r.style?r.style+";":"")+u:a!="nodeName"&&(r[a]=u))}}}return o}function yx(t,e,n,r){if(n==Lo&&r==Lo)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let u;a&&a.nodeName==s.nodeName&&o!=t&&(u=o.parentNode)&&u.nodeName.toLowerCase()==s.nodeName||(u=document.createElement(s.nodeName),u.pmIsDeco=!0,u.appendChild(o),a=Lo[0]),o=u}YB(o,a||Lo[0],s)}return o}function YB(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function gx(t,e,n){return yx(t,t,Lo,im(e,n,t.nodeType!=1))}function Oc(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 C1(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class QB{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=XB(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){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=En,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let u=this.index;u<Math.min(this.index+3,this.top.children.length);u++){let l=this.top.children[u];if(l.matchesMark(e[i])&&!this.isLocked(l.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=li.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,u=Math.min(this.top.children.length,a+5);a<u;a++){let l=this.top.children[a];if(l.matchesNode(e,n,r)&&!this.preMatch.matched.has(l)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==nr&&s.dom==s.contentDOM&&(s.dirty=jo),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),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 o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let u=this.top.children[a];if(u instanceof lo){let l=this.preMatch.matched.get(u);if(l!=null&&l!=i)return!1;let c=u.dom,d,f=this.isLocked(c)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=nr&&Oc(n,u.outerDeco));if(!f&&u.update(e,n,r,o))return this.destroyBetween(this.index,a),u.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(u,e,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=jo,d.updateChildren(o,s+1),d.dirty=En),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Oc(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=lo.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let u of a.children)u.parent=a}return e.destroy(),a}addNode(e,n,r,o,i){let s=lo.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new px(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 li;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof qd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Rt||yt)&&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 o=new hx(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function XB(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let l=n.children[r-1];if(l instanceof li)n=l,r=l.children.length;else{a=l,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=a.node;if(u){if(u!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function ZB(t,e){return t.type.side-e.type.side}function eF(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let l=0;l<t.childCount;l++){let c=t.child(l);r(c,o,e.forChild(i,c),l),i+=c.nodeSize}return}let s=0,a=[],u=null;for(let l=0;;){let c,d;for(;s<o.length&&o[s].to==i;){let v=o[s++];v.widget&&(c?(d||(d=[c])).push(v):c=v)}if(c)if(d){d.sort(ZB);for(let v=0;v<d.length;v++)n(d[v],l,!!u)}else n(c,l,!!u);let f,p;if(u)p=-1,f=u,u=null;else if(l<t.childCount)p=l,f=t.child(l++);else break;for(let v=0;v<a.length;v++)a[v].to<=i&&a.splice(v--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let h=i+f.nodeSize;if(f.isText){let v=h;s<o.length&&o[s].from<v&&(v=o[s].from);for(let y=0;y<a.length;y++)a[y].to<v&&(v=a[y].to);v<h&&(u=f.cut(v-i),f=f.cut(0,v-i),h=v,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?a.filter(v=>!v.inline):a.slice();r(f,m,e.forChild(i,f),p),i=h}}function tF(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 nF(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let u=s.text;for(;o<t.childCount;){let l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;u+=l.text}if(i>=n){if(i>=r&&u.slice(r-e.length-a,r-a)==e)return r-e.length;let l=a<r?u.lastIndexOf(e,r-a-1):-1;if(l>=0&&l+e.length+a>=n)return a+l;if(n==r&&u.length>=r+e.length-a&&u.slice(r-a,r-a+e.length)==e)return r}}return-1}function sm(t,e,n,r,o){let i=[];for(let s=0,a=0;s<t.length;s++){let u=t[s],l=a,c=a+=u.size;l>=n||c<=e?i.push(u):(l<e&&i.push(u.slice(0,e-l,r)),o&&(i.push(o),o=void 0),c>n&&i.push(u.slice(n-l,u.size,r)))}return i}function Gy(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),u,l;if(Vd(n)){for(u=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&re.isSelectable(d)&&o.parent&&!(d.isInline&&OB(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;l=new re(s==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[u,s]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let c=r.resolve(u);if(!l){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;l=Jy(t,c,a,d)}return l}function vx(t){return t.editable?t.hasFocus():bx(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function br(t,e=!1){let n=t.state.selection;if(wx(t,n),!!vx(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&yt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&ai(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)oF(t);else{let{anchor:r,head:o}=n,i,s;M1&&!(n instanceof ce)&&(n.$from.parent.inlineContent||(i=O1(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=O1(t,n.to))),t.docView.setSelection(r,o,t,e),M1&&(i&&N1(i),s&&N1(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&rF(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const M1=Rt||yt&&ix<63;function O1(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Rt&&o&&o.contentEditable=="false")return Xf(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Xf(o);if(i)return Xf(i)}}function Xf(t){return t.contentEditable="true",Rt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function N1(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function rF(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!vx(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function oF(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,xt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Zt&&ao<=11&&(n.disabled=!0,n.disabled=!1)}function wx(t,e){if(e instanceof re){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(A1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else A1(t)}function A1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Jy(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||ce.between(e,n,r)}function I1(t){return t.editable&&!t.hasFocus()?!1:bx(t)}function bx(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 iF(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ai(e.node,e.offset,n.anchorNode,n.anchorOffset)}function am(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&me.findFrom(i,e)}function Br(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function P1(t,e,n){let r=t.state.selection;if(r instanceof ce)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Br(t,new ce(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=am(t.state,e);return o&&o instanceof re?Br(t,o):!1}else if(!(yn&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?re.isSelectable(i)?Br(t,new re(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):El?Br(t,new ce(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof re&&r.node.isInline)return Br(t,new ce(e>0?r.$to:r.$from));{let o=am(t.state,e);return o?Br(t,o):!1}}}function Nc(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wa(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ki(t,e){return e<0?sF(t):aF(t)}function sF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(xn&&n.nodeType==1&&r<Nc(n)&&wa(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(wa(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(_x(n))break;{let a=n.previousSibling;for(;a&&wa(a,-1);)o=n.parentNode,i=xt(a),a=a.previousSibling;if(a)n=a,r=Nc(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?lm(t,n,r):o&&lm(t,o,i)}function aF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Nc(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(wa(a,1))i=n,s=++r;else break}else{if(_x(n))break;{let a=n.nextSibling;for(;a&&wa(a,1);)i=a.parentNode,s=xt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=Nc(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&lm(t,i,s)}function _x(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function lF(t,e){for(;t&&e==t.childNodes.length&&!xl(t);)e=xt(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 uF(t,e){for(;t&&!e&&!xl(t);)e=xt(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 lm(t,e,n){if(e.nodeType!=3){let i,s;(s=lF(e,n))?(e=s,n=0):(i=uF(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Vd(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:o}=t;setTimeout(()=>{t.state==o&&br(t)},50)}function R1(t,e){let n=t.state.doc.resolve(e);if(!(yt||sx)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function D1(t,e,n){let r=t.state.selection;if(r instanceof ce&&!r.empty||n.indexOf("s")>-1||yn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=am(t.state,e);if(s&&s instanceof re)return Br(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof an?me.near(s,e):me.findFrom(s,e);return a?Br(t,a):!1}return!1}function j1(t,e){if(!(t.state.selection instanceof ce))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)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 s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function L1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function cF(t){if(!Rt||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;L1(t,r,"true"),setTimeout(()=>L1(t,r,"false"),20)}return!1}function dF(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function fF(t,e){let n=e.keyCode,r=dF(e);if(n==8||yn&&n==72&&r=="c")return j1(t,-1)||ki(t,-1);if(n==46&&!e.shiftKey||yn&&n==68&&r=="c")return j1(t,1)||ki(t,1);if(n==13||n==27)return!0;if(n==37||yn&&n==66&&r=="c"){let o=n==37?R1(t,t.state.selection.from)=="ltr"?-1:1:-1;return P1(t,o,r)||ki(t,o)}else if(n==39||yn&&n==70&&r=="c"){let o=n==39?R1(t,t.state.selection.from)=="ltr"?1:-1:1;return P1(t,o,r)||ki(t,o)}else{if(n==38||yn&&n==80&&r=="c")return D1(t,-1,r)||ki(t,-1);if(n==40||yn&&n==78&&r=="c")return cF(t)||D1(t,1,r)||ki(t,1);if(r==(yn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Yy(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||gi.fromSchema(t.state.schema),a=Cx(),u=a.createElement("div");u.appendChild(s.serializeFragment(r,{document:a}));let l=u.firstChild,c,d=0;for(;l&&l.nodeType==1&&(c=Tx[l.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let h=a.createElement(c[p]);for(;u.firstChild;)h.appendChild(u.firstChild);u.appendChild(h),d++}l=u.firstChild}l&&l.nodeType==1&&l.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
71
|
+
|
|
72
|
+
`);return{dom:u,text:f,slice:e}}function Sx(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return a=new J(U.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
73
|
+
`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)a=d;else{let f=o.marks(),{schema:p}=t.state,h=gi.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(h.serializeNode(p.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=yF(n),El&&gF(s);let l=s&&s.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||so.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(u||c),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!pF.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=vF(B1(a,+c[1],+c[2]),c[4]);else if(a=J.maxOpen(hF(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=B1(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,u)}),a}const pF=/^(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 hF(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let u=o.findWrapping(a.type),l;if(!u)return s=null;if(l=s.length&&i.length&&xx(u,i,a,s[s.length-1],0))s[s.length-1]=l;else{s.length&&(s[s.length-1]=Ex(s[s.length-1],i.length));let c=kx(a,u);s.push(c),o=o.matchType(c.type),i=u}}),s)return U.from(s)}return t}function kx(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,U.from(t));return t}function xx(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=xx(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(U.from(kx(n,t,o+1))))}}function Ex(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ex(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(U.empty,!0);return t.copy(n.append(r))}function um(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),o<r-1&&(a=um(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(U.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function B1(t,e,n){return e<t.openStart&&(t=new J(um(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new J(um(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Tx={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 F1=null;function Cx(){return F1||(F1=document.implementation.createHTMLDocument("title"))}let Zf=null;function mF(t){let e=window.trustedTypes;return e?(Zf||(Zf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Zf.createHTML(t)):t}function yF(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Cx().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Tx[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=mF(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function gF(t){let e=t.querySelectorAll(yt?"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 vF(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:o,openStart:i,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let u=n.nodes[r[a]];if(!u||u.hasRequiredAttrs())break;o=U.from(u.create(r[a+1],o)),i++,s++}return new J(o,i,s)}const $t={},zt={},wF={touchstart:!0,touchmove:!0};class bF{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function _F(t){for(let e in $t){let n=$t[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{kF(t,r)&&!Qy(t,r)&&(t.editable||!(r.type in zt))&&n(t,r)},wF[e]?{passive:!0}:void 0)}Rt&&t.dom.addEventListener("input",()=>null),cm(t)}function Yr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function SF(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 cm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Qy(t,r))})}function Qy(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function kF(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 xF(t,e){!Qy(t,e)&&$t[e.type]&&(t.editable||!(e.type in zt))&&$t[e.type](t,e)}zt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Ox(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(mr&&yt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ks&&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",o=>o(t,No(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||fF(t,n)?n.preventDefault():Yr(t,"key")};zt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};zt.keypress=(t,e)=>{let n=e;if(Ox(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||yn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ce)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Hd(t){return{left:t.clientX,top:t.clientY}}function EF(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Xy(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function ls(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 TF(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&re.isSelectable(r)?(ls(t,new re(n)),!0):!1}function CF(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof re&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(re.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(ls(t,re.create(t.state.doc,o)),!0):!1}function MF(t,e,n,r,o){return Xy(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?CF(t,n):TF(t,n))}function OF(t,e,n,r){return Xy(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function NF(t,e,n,r){return Xy(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||AF(t,n,r)}function AF(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ls(t,ce.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)ls(t,ce.create(r,a+1,a+1+s.content.size));else if(re.isSelectable(s))ls(t,re.create(r,a));else continue;return!0}}function Zy(t){return Ac(t)}const Mx=yn?"metaKey":"ctrlKey";$t.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Zy(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&EF(n,t.input.lastClick)&&!n[Mx]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Hd(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new IF(t,s,n,!!r)):(i=="doubleClick"?OF:NF)(t,s.pos,s.inside,n)?n.preventDefault():Yr(t,"pointer"))};class IF{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Mx],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}const a=o?null:r.target,u=a?e.docView.nearestDesc(a,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:l}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||l instanceof re&&l.from<=s&&l.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xn&&!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)),Yr(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(()=>br(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(Hd(e))),this.updateAllowDefault(e),this.allowDefault||!n?Yr(this.view,"pointer"):MF(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rt&&this.mightDrag&&!this.mightDrag.node.isAtom||yt&&!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)?(ls(this.view,me.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Yr(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)}}$t.touchstart=t=>{t.input.lastTouch=Date.now(),Zy(t),Yr(t,"pointer")};$t.touchmove=t=>{t.input.lastTouch=Date.now(),Yr(t,"pointer")};$t.contextmenu=t=>Zy(t);function Ox(t,e){return t.composing?!0:Rt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const PF=mr?5e3:-1;zt.compositionstart=zt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ce&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||yt&&sx&&RF(t)))t.markCursor=t.state.storedMarks||n.marks(),Ac(t,!0),t.markCursor=null;else if(Ac(t,!e.selection.empty),xn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Nx(t,PF)};function RF(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"}zt.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.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Nx(t,20))};function Nx(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ac(t),e))}function Ax(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=jF());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function DF(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=CB(e.focusNode,e.focusOffset),r=MB(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function jF(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ac(t,e=!1){if(!(mr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ax(t),e||t.docView&&t.docView.dirty){let n=Gy(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 LF(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(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const cl=Zt&&ao<15||ks&&IB<604;$t.copy=zt.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=cl?null:n.clipboardData,s=r.content(),{dom:a,text:u}=Yy(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",u)):LF(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function BF(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function FF(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 o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?dl(t,r.value,null,o,e):dl(t,r.textContent,r.innerHTML,o,e)},50)}function dl(t,e,n,r,o){let i=Sx(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,o,i||J.empty)))return!0;if(!i)return!1;let s=BF(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ix(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," "):""}zt.paste=(t,e)=>{let n=e;if(t.composing&&!mr)return;let r=cl?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&dl(t,Ix(r),r.getData("text/html"),o,n)?n.preventDefault():FF(t,n)};class Px{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const $F=yn?"altKey":"ctrlKey";function Rx(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[$F]}$t.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Hd(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof re?o.to-1:o.to))){if(r&&r.mightDrag)s=re.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=re.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:u,text:l,slice:c}=Yy(t,a);(!n.dataTransfer.files.length||!yt||ix>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(cl?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",cl||n.dataTransfer.setData("text/plain",l),t.dragging=new Px(c,Rx(t,n),s)};$t.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};zt.dragover=zt.dragenter=(t,e)=>e.preventDefault();zt.drop=(t,e)=>{try{zF(t,e,t.dragging)}finally{t.dragging=null}};function zF(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Hd(e));if(!r)return;let o=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=Sx(t,Ix(e.dataTransfer),cl?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&Rx(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||J.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Bk(t.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let u=t.state.tr;if(s){let{node:p}=n;p?p.replace(u):u.deleteSelection()}let l=u.mapping.map(a),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=u.doc;if(c?u.replaceRangeWith(l,l,i.content.firstChild):u.replaceRange(l,l,i),u.doc.eq(d))return;let f=u.doc.resolve(l);if(c&&re.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new re(f));else{let p=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((h,m,v,y)=>p=y),u.setSelection(Jy(t,f,u.doc.resolve(p)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}$t.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())&&br(t)},20))};$t.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)};$t.beforeinput=(t,e)=>{if(yt&&mr&&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,No(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in zt)$t[t]=zt[t];function fl(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 Ic{constructor(e,n){this.toDOM=e,this.spec=n||Wo,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new It(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ic&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&fl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class uo{constructor(e,n){this.attrs=e,this.spec=n||Wo}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new It(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof uo&&fl(this.attrs,e.attrs)&&fl(this.spec,e.spec)}static is(e){return e.type instanceof uo}destroy(){}}class eg{constructor(e,n){this.attrs=e,this.spec=n||Wo}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new It(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof eg&&fl(this.attrs,e.attrs)&&fl(this.spec,e.spec)}destroy(){}}class It{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new It(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 It(e,e,new Ic(n,r))}static inline(e,n,r,o){return new It(e,n,new uo(r,o))}static node(e,n,r,o){return new It(e,n,new eg(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof uo}get widget(){return this.type instanceof Ic}}const Ti=[],Wo={};class Le{constructor(e,n){this.local=e.length?e:Ti,this.children=n.length?n:Ti}static create(e,n){return n.length?Pc(n,e,0,Wo):Nt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Wo)}mapInner(e,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let u=this.local[a].map(e,r,o);u&&u.type.valid(n,u)?(s||(s=[])).push(u):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?UF(this.children,s||[],e,n,r,o,i):s?new Le(s.sort(Ko),Ti):Nt}add(e,n){return n.length?this==Nt?Le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,u)=>{let l=u+r,c;if(c=jx(n,a,l)){for(o||(o=this.children.slice());i<o.length&&o[i]<u;)i+=3;o[i]==u?o[i+2]=o[i+2].addInner(a,c,l+1):o.splice(i,0,u,u+a.nodeSize,Pc(c,a,l+1,Wo)),i+=3}});let s=Dx(i?Lx(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Le(s.length?this.local.concat(s).sort(Ko):this.local,o||this.children)}remove(e){return e.length==0||this==Nt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,u=r[i+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<u&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let l=r[i+2].removeInner(s,a+1);l!=Nt?r[i+2]=l:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Le(o,r):Nt}forChild(e,n){if(this==Nt)return this;if(n.isLeaf)return Le.empty;let r,o;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,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let u=this.local[a];if(u.from<s&&u.to>i&&u.type instanceof uo){let l=Math.max(i,u.from)-i,c=Math.min(s,u.to)-i;l<c&&(o||(o=[])).push(u.copy(l,c))}}if(o){let a=new Le(o.sort(Ko),Ti);return r?new Vr([a,r]):a}return r||Nt}eq(e){if(this==e)return!0;if(!(e instanceof Le)||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 tg(this.localsInner(e))}localsInner(e){if(this==Nt)return Ti;if(e.inlineContent||!this.local.some(uo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof uo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Le.empty=new Le([],[]);Le.removeOverlap=tg;const Nt=Le.empty;class Vr{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Wo));return Vr.from(r)}forChild(e,n){if(n.isLeaf)return Le.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Nt&&(i instanceof Vr?r=r.concat(i.members):r.push(i))}return Vr.from(r)}eq(e){if(!(e instanceof Vr)||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 o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?tg(r?n:n.sort(Ko)):Ti}static from(e){switch(e.length){case 0:return Nt;case 1:return e[0];default:return new Vr(e.every(n=>n instanceof Le)?e:e.reduce((n,r)=>n.concat(r instanceof Le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function UF(t,e,n,r,o,i,s){let a=t.slice();for(let l=0,c=i;l<n.maps.length;l++){let d=0;n.maps[l].forEach((f,p,h,m)=>{let v=m-h-(p-f);for(let y=0;y<a.length;y+=3){let w=a[y+1];if(w<0||f>w+c-d)continue;let b=a[y]+c-d;p>=b?a[y+1]=f<=b?-2:-1:f>=c&&v&&(a[y]+=v,a[y+1]+=v)}d+=v}),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(a[l+1]==-2){u=!0,a[l+1]=-1;continue}let c=n.map(t[l]+i),d=c-o;if(d<0||d>=r.content.size){u=!0;continue}let f=n.map(t[l+1]+i,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),v=r.maybeChild(h);if(v&&m==d&&m+v.nodeSize==p){let y=a[l+2].mapInner(n,v,c+1,t[l]+i+1,s);y!=Nt?(a[l]=d,a[l+1]=p,a[l+2]=y):(a[l+1]=-2,u=!0)}else u=!0}if(u){let l=VF(a,t,e,n,o,i,s),c=Pc(l,r,0,s);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let p=c.children[d];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Le(e.sort(Ko),a)}function Dx(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new It(o.from+e,o.to+e,o.type))}return n}function VF(t,e,n,r,o,i,s){function a(u,l){for(let c=0;c<u.local.length;c++){let d=u.local[c].map(r,o,l);d?n.push(d):s.onRemove&&s.onRemove(u.local[c].spec)}for(let c=0;c<u.children.length;c+=3)a(u.children[c+2],u.children[c]+l+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&a(t[u+2],e[u]+i+1);return n}function jx(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Lx(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Pc(t,e,n,r){let o=[],i=!1;e.forEach((a,u)=>{let l=jx(t,a,u+n);if(l){i=!0;let c=Pc(l,a,n+u+1,r);c!=Nt&&o.push(u,u+a.nodeSize,c)}});let s=Dx(i?Lx(t):t,-n).sort(Ko);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Le(s,o):Nt}function Ko(t,e){return t.from-e.from||t.to-e.to}function tg(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),$1(e,o+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),$1(e,o,r.copy(i.from,r.to)));break}}}return e}function $1(t,e,n){for(;e<t.length&&Ko(n,t[e])>0;)e++;t.splice(e,0,n)}function ep(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Nt&&e.push(r)}),t.cursorWrapper&&e.push(Le.create(t.state.doc,[t.cursorWrapper.deco])),Vr.from(e)}const qF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},HF=Zt&&ao<=11;class WF{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 KF{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new WF,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);Zt&&ao<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),HF&&(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,qF)),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(I1(this.view)){if(this.suppressingSelectionUpdates)return br(this.view);if(Zt&&ao<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ai(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=Ss(i))n.add(i);for(let i=e.anchorNode;i;i=Ss(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.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(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&I1(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,u=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],u);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(xn&&u.length){let c=u.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||YF(e,d)!=p)&&f.remove()}}}else if((yt||Rt)&&u.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of u)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let l=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vd(r)&&(l=Gy(e))&&l.eq(me.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,br(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),GF(e)),this.handleDOMChange(i,s,a,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||br(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 c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(Zt&&ao<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?xt(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),u=i&&i.parentNode==e.target?xt(i):e.target.childNodes.length,l=r.localPosFromDOM(e.target,u,1);return{from:a,to:l}}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 z1=new WeakMap,U1=!1;function GF(t){if(!z1.has(t)&&(z1.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=xn,U1)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."),U1=!0}}function V1(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ai(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function JF(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return V1(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?V1(t,n):null}function YF(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 QF(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=t.docView.parseRange(e,n),u=t.domSelectionRange(),l,c=u.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(l=[{node:c,offset:u.anchorOffset}],Vd(u)||l.push({node:u.focusNode,offset:u.focusOffset})),yt&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let y=r.childNodes[v-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=v;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||so.fromSchema(t.state.schema),p=d.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:XF,context:p});if(l&&l[0].pos!=null){let v=l[0].pos,y=l[1]&&l[1].pos;y==null&&(y=v),h={anchor:v+s,head:y+s}}return{doc:m,sel:h,from:s,to:a}}function XF(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Rt&&/^(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||Rt&&/^(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 ZF=/^(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 e$(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let x=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,T=Gy(t,x);if(T&&!t.state.selection.eq(T)){if(yt&&mr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,No(13,"Enter"))))return;let O=t.state.tr.setSelection(T);x=="pointer"?O.setMeta("pointer",!0):x=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),t.dispatch(O)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let u=t.state.selection,l=QF(t,e,n),c=t.state.doc,d=c.slice(l.from,l.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=r$(d.content,l.doc.content,l.from,f,p);if(h&&t.input.domChangeCount++,(ks&&t.input.lastIOSEnter>Date.now()-225||mr)&&o.some(x=>x.nodeType==1&&!ZF.test(x.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",x=>x(t,No(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&u instanceof ce&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))h={start:u.from,endA:u.to,endB:u.to};else{if(l.sel){let x=q1(t,t.state.doc,l.sel);if(x&&!x.eq(t.state.selection)){let T=t.state.tr.setSelection(x);i&&T.setMeta("composition",i),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof ce&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=l.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=l.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),Zt&&ao<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>l.from&&l.doc.textBetween(h.start-l.from-1,h.start-l.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=l.doc.resolveNoCache(h.start-l.from),v=l.doc.resolveNoCache(h.endB-l.from),y=c.resolve(h.start),w=m.sameParent(v)&&m.parent.inlineContent&&y.end()>=h.endA;if((ks&&t.input.lastIOSEnter>Date.now()-225&&(!w||o.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!w&&m.pos<l.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(l.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",x=>x(t,No(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&n$(c,h.start,h.endA,m,v)&&t.someProp("handleKeyDown",x=>x(t,No(8,"Backspace")))){mr&&yt&&t.domObserver.suppressSelectionUpdates();return}yt&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),mr&&!w&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==h.endA&&(h.endB-=2,v=l.doc.resolveNoCache(h.endB-l.from),setTimeout(()=>{t.someProp("handleKeyDown",function(x){return x(t,No(13,"Enter"))})},20));let b=h.start,S=h.endA,k=x=>{let T=x||t.state.tr.replace(b,S,l.doc.slice(h.start-l.from,h.endB-l.from));if(l.sel){let O=q1(t,T.doc,l.sel);O&&!(yt&&t.composing&&O.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==b||O.head==T.mapping.map(S)-1)||Zt&&O.empty&&O.head==b)&&T.setSelection(O)}return i&&T.setMeta("composition",i),T.scrollIntoView()},E;if(w)if(m.pos==v.pos){Zt&&ao<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>br(t),20));let x=k(t.state.tr.delete(b,S)),T=c.resolve(h.start).marksAcross(c.resolve(h.endA));T&&x.ensureMarks(T),t.dispatch(x)}else if(h.endA==h.endB&&(E=t$(m.parent.content.cut(m.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start())))){let x=k(t.state.tr);E.type=="add"?x.addMark(b,S,E.mark):x.removeMark(b,S,E.mark),t.dispatch(x)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let x=m.parent.textBetween(m.parentOffset,v.parentOffset),T=()=>k(t.state.tr.insertText(x,b,S));t.someProp("handleTextInput",O=>O(t,b,S,x,T))||t.dispatch(T())}else t.dispatch(k());else t.dispatch(k())}function q1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Jy(t,e.resolve(n.anchor),e.resolve(n.head))}function t$(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,u;for(let c=0;c<r.length;c++)o=r[c].removeFromSet(o);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",u=c=>c.mark(a.addToSet(c.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",u=c=>c.mark(a.removeFromSet(c.marks));else return null;let l=[];for(let c=0;c<e.childCount;c++)l.push(u(e.child(c)));if(U.from(l).eq(t))return{mark:a,type:s}}function n$(t,e,n,r,o){if(n-e<=o.pos-r.pos||tp(r,!0,!1)<o.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 s=t.resolve(tp(i,!0,!0));return!s.parent.isTextblock||s.pos>n||tp(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function tp(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function r$(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let u=Math.max(0,i-Math.min(s,a));r-=s+u-i}if(s<i&&t.size<e.size){let u=r<=i&&r>=s?i-r:0;i-=u,i&&i<e.size&&H1(e.textBetween(i-1,i+1))&&(i+=u?1:-1),a=i+(a-s),s=i}else if(a<i){let u=r<=i&&r>=a?i-r:0;i-=u,i&&i<t.size&&H1(t.textBetween(i-1,i+1))&&(i+=u?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function H1(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 Bx{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 bF,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Y1),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=G1(this),K1(this),this.nodeViews=J1(this),this.docView=T1(this.state.doc,W1(this),ep(this),this.dom,this),this.domObserver=new KF(this,(r,o,i,s)=>e$(this,r,o,i,s)),this.domObserver.start(),_F(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&&cm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Y1),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 o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Ax(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=J1(this);i$(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&cm(this),this.editable=G1(this),K1(this);let u=ep(this),l=W1(this),c=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,u);(d||!e.selection.eq(o.selection))&&(s=!0);let f=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&DB(this);if(s){this.domObserver.stop();let p=d&&(Zt||yt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&o$(o.selection,e.selection);if(d){let h=yt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=DF(this)),(i||!this.docView.update(e.doc,l,u,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=T1(e.doc,l,u,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&iF(this))?br(this,p):(wx(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&jB(f)}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 re){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&b1(this,n.getBoundingClientRect(),e)}else b1(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,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Px(e.slice,e.move,o<0?void 0:re.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(Zt){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&&LB(this.dom),br(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 UB(this,e)}coordsAtPos(e,n=1){return dx(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 o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return KB(this,n||this.state,e)}pasteHTML(e,n){return dl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return dl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Yy(this,e)}destroy(){this.docView&&(SF(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ep(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,EB())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xF(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rt&&this.root.nodeType===11&&NB(this.dom.ownerDocument)==this.dom&&JF(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Bx.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function W1(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"),[It.node(0,t.state.doc.content.size,e)]}function K1(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:It.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function G1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function o$(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 J1(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function i$(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Y1(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 po={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:"'"},Rc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s$=typeof navigator<"u"&&/Mac/.test(navigator.platform),a$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Et=0;Et<10;Et++)po[48+Et]=po[96+Et]=String(Et);for(var Et=1;Et<=24;Et++)po[Et+111]="F"+Et;for(var Et=65;Et<=90;Et++)po[Et]=String.fromCharCode(Et+32),Rc[Et]=String.fromCharCode(Et);for(var np in po)Rc.hasOwnProperty(np)||(Rc[np]=po[np]);function l$(t){var e=s$&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||a$&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Rc:po)[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 u$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),c$=typeof navigator<"u"&&/Win/.test(navigator.platform);function d$(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a++){let u=e[a];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))u$?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function f$(t){let e=Object.create(null);for(let n in t)e[d$(n)]=t[n];return e}function rp(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 p$(t){return new ze({props:{handleKeyDown:Fx(t)}})}function Fx(t){let e=f$(t);return function(n,r){let o=l$(r),i,s=e[rp(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[rp(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(c$&&r.ctrlKey&&r.altKey)&&(i=po[r.keyCode])&&i!=o){let a=e[rp(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var h$=Object.defineProperty,ng=(t,e)=>{for(var n in e)h$(t,n,{get:e[n],enumerable:!0})};function Wd(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=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 o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Kd=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:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...l)=>{const c=a(...l)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,u=t||o.tr,l=()=>(!a&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),s.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...h)=>{const m=this.buildProps(u,e),v=f(...h)(m);return s.push(v),c}])),run:l};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,u])=>[a,(...l)=>u(...l)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:Wd({state:o,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,u])=>[a,(...l)=>u(...l)(s)]))}};return s}},$x={};ng($x,{blur:()=>m$,clearContent:()=>y$,clearNodes:()=>g$,command:()=>v$,createParagraphNear:()=>w$,cut:()=>b$,deleteCurrentNode:()=>_$,deleteNode:()=>S$,deleteRange:()=>k$,deleteSelection:()=>x$,enter:()=>E$,exitCode:()=>T$,extendMarkRange:()=>C$,first:()=>M$,focus:()=>O$,forEach:()=>N$,insertContent:()=>A$,insertContentAt:()=>R$,joinBackward:()=>L$,joinDown:()=>j$,joinForward:()=>B$,joinItemBackward:()=>F$,joinItemForward:()=>$$,joinTextblockBackward:()=>z$,joinTextblockForward:()=>U$,joinUp:()=>D$,keyboardShortcut:()=>q$,lift:()=>H$,liftEmptyBlock:()=>W$,liftListItem:()=>K$,newlineInCode:()=>G$,resetAttributes:()=>J$,scrollIntoView:()=>Y$,selectAll:()=>Q$,selectNodeBackward:()=>X$,selectNodeForward:()=>Z$,selectParentNode:()=>e6,selectTextblockEnd:()=>t6,selectTextblockStart:()=>n6,setContent:()=>r6,setMark:()=>k6,setMeta:()=>x6,setNode:()=>E6,setNodeSelection:()=>T6,setTextDirection:()=>C6,setTextSelection:()=>M6,sinkListItem:()=>O6,splitBlock:()=>N6,splitListItem:()=>A6,toggleList:()=>I6,toggleMark:()=>P6,toggleNode:()=>R6,toggleWrap:()=>D6,undoInputRule:()=>j6,unsetAllMarks:()=>L6,unsetMark:()=>B6,unsetTextDirection:()=>F6,updateAttributes:()=>$6,wrapIn:()=>z6,wrapInList:()=>U6});var m$=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),y$=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),g$=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,u)=>{if(a.type.isText)return;const{doc:l,mapping:c}=e,d=l.resolve(c.map(u)),f=l.resolve(c.map(u+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Ns(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},v$=t=>e=>t(e),w$=()=>({state:t,dispatch:e})=>ex(t,e),b$=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new ce(r.doc.resolve(Math.max(s-1,0)))),!0},_$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const a=o.before(i),u=o.after(i);t.delete(a,u).scrollIntoView()}return!0}return!1};function at(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?`);return e.nodes[t]}return t}var S$=t=>({tr:e,state:n,dispatch:r})=>{const o=at(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const u=i.before(s),l=i.after(s);e.delete(u,l).scrollIntoView()}return!0}return!1},k$=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},x$=()=>({state:t,dispatch:e})=>Uy(t,e),E$=()=>({commands:t})=>t.keyboardShortcut("Enter"),T$=()=>({state:t,dispatch:e})=>cB(t,e);function rg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Dc(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:rg(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function zx(t,e,n={}){return t.find(r=>r.type===e&&Dc(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Q1(t,e,n={}){return!!zx(t,e,n)}function og(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(c=>c.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(c=>c.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!zx([...o.node.marks],e,n)))return;let s=o.index,a=t.start()+o.offset,u=s+1,l=a+o.node.nodeSize;for(;s>0&&Q1([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;u<t.parent.childCount&&Q1([...t.parent.child(u).marks],e,n);)l+=t.parent.child(u).nodeSize,u+=1;return{from:a,to:l}}function Or(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 C$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Or(t,r.schema),{doc:s,selection:a}=n,{$from:u,from:l,to:c}=a;if(o){const d=og(u,i,e);if(d&&d.from<=l&&d.to>=c){const f=ce.create(s,d.from,d.to);n.setSelection(f)}}return!0},M$=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 Ux(t){return t instanceof ce}function Bo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Vx(t,e=null){if(!e)return null;const n=me.atStart(t),r=me.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?ce.create(t,Bo(0,o,i),Bo(t.content.size,o,i)):ce.create(t,Bo(e,o,i),Bo(e,o,i))}function qx(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Gd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var O$=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Gd()||qx())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!Ux(n.state.selection))return s(),!0;const a=Vx(o.doc,t)||n.state.selection,u=n.state.selection.eq(a);return i&&(u||o.setSelection(a),u&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},N$=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),A$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Hx=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&&Hx(r)}return t};function ou(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 Hx(n)}function pl(t,e,n){if(t instanceof kn||t instanceof U)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return U.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}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),pl("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const u=new Ck({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:l=>(s=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?so.fromSchema(u).parseSlice(ou(t),n.parseOptions):so.fromSchema(u).parse(ou(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=so.fromSchema(e);return n.slice?i.parseSlice(ou(t),n.parseOptions).content:i.parse(ou(t),n.parseOptions)}return pl("",e,n)}function I$(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof mt||o instanceof vt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,u,l,c)=>{s===0&&(s=c)}),t.setSelection(me.near(t.doc.resolve(s),n))}var P$=t=>!("type"in t),R$=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{pl(e,i.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(v){u(v)}try{a=pl(e,i.schema,{parseOptions:l,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((P$(a)?a:[a]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,p=p?v.isBlock:!1}),c===d&&p){const{parent:v}=r.doc.resolve(c);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(c-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(v=>v.text||"").join("");else if(e instanceof U){let v="";e.forEach(y=>{y.text&&(v+=y.text)}),m=v}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else{m=a;const v=r.doc.resolve(c),y=v.node(),w=v.parentOffset===0,b=y.isText||y.isTextblock,S=y.content.size>0;w&&b&&S&&(c=Math.max(0,c-1)),r.replaceWith(c,d,m)}n.updateSelection&&I$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},D$=()=>({state:t,dispatch:e})=>aB(t,e),j$=()=>({state:t,dispatch:e})=>lB(t,e),L$=()=>({state:t,dispatch:e})=>Kk(t,e),B$=()=>({state:t,dispatch:e})=>Qk(t,e),F$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$d(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$d(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},z$=()=>({state:t,dispatch:e})=>iB(t,e),U$=()=>({state:t,dispatch:e})=>sB(t,e);function Wx(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function V$(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a+=1){const u=e[a];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))Gd()||Wx()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var q$=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=V$(t).split(/-(?!$)/),s=i.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return u==null||u.steps.forEach(l=>{const c=l.map(r.mapping);c&&o&&r.maybeStep(c)}),!0};function ho(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?at(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(o,f+d.nodeSize);a.push({node:d,from:p,to:h})});const u=o-r,l=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Dc(d.node.attrs,n,{strict:!1}));return i?!!l.length:l.reduce((d,f)=>d+f.to-f.from,0)>=u}var H$=(t,e={})=>({state:n,dispatch:r})=>{const o=at(t,n.schema);return ho(n,o,e)?uB(n,r):!1},W$=()=>({state:t,dispatch:e})=>tx(t,e),K$=t=>({state:e,dispatch:n})=>{const r=at(t,e.schema);return _B(r)(e,n)},G$=()=>({state:t,dispatch:e})=>Zk(t,e);function Jd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function X1(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var J$=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Jd(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=at(t,r.schema)),a==="mark"&&(s=Or(t,r.schema));let u=!1;return n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{i&&i===c.type&&(u=!0,o&&n.setNodeMarkup(d,void 0,X1(c.attrs,e))),s&&c.marks.length&&c.marks.forEach(f=>{s===f.type&&(u=!0,o&&n.addMark(d,d+c.nodeSize,s.create(X1(f.attrs,e))))})})}),u},Y$=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Q$=()=>({tr:t,dispatch:e})=>{if(e){const n=new an(t.doc);t.setSelection(n)}return!0},X$=()=>({state:t,dispatch:e})=>Jk(t,e),Z$=()=>({state:t,dispatch:e})=>Xk(t,e),e6=()=>({state:t,dispatch:e})=>pB(t,e),t6=()=>({state:t,dispatch:e})=>yB(t,e),n6=()=>({state:t,dispatch:e})=>mB(t,e);function dm(t,e,n={},r={}){return pl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var r6=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const l=dm(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,u.content.size,l).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function Kx(t,e){const n=Or(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,u=>{s.push(...u.marks)});const a=s.find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function Gx(t,e){const n=new Vk(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function o6(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 i6(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function s6(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 Yd(t){return e=>s6(e.$from,t)}function oe(t,e,n){return t.config[e]===void 0&&t.parent?oe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?oe(t.parent,e,n):null}):t.config[e]}function ig(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=oe(e,"addExtensions",n);return r?[e,...ig(r())]:e}).flat(10)}function sg(t,e){const n=gi.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Jx(t){return typeof t=="function"}function Me(t,e=void 0,...n){return Jx(t)?e?t.bind(e)(...n):t(...n):t}function a6(t={}){return Object.keys(t).length===0&&t.constructor===Object}function xs(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Yx(t){const e=[],{nodeExtensions:n,markExtensions:r}=xs(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:o},u=oe(s,"addGlobalAttributes",a);if(!u)return;u().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...i,...p}})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},u=oe(s,"addAttributes",a);if(!u)return;const l=u();Object.entries(l).forEach(([c,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:c,attribute:f})})}),e}function $e(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const a=i?String(i).split(" "):[],u=r[o]?r[o].split(" "):[],l=a.filter(c=>!u.includes(c));r[o]=[...u,...l].join(" ")}else if(o==="style"){const a=i?i.split(";").map(c=>c.trim()).filter(Boolean):[],u=r[o]?r[o].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;u.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());l.set(d,f)}),a.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());l.set(d,f)}),r[o]=Array.from(l.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[o]=i}),r},{})}function hl(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 l6(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Z1(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 o=e.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):l6(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function ew(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&a6(n)?!1:n!=null))}function tw(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 u6(t,e){var n;const r=Yx(t),{nodeExtensions:o,markExtensions:i}=xs(t),s=(n=o.find(l=>oe(l,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.map(l=>{const c=r.filter(y=>y.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},f=t.reduce((y,w)=>{const b=oe(w,"extendNodeSchema",d);return{...y,...b?b(l):{}}},{}),p=ew({...f,content:Me(oe(l,"content",d)),marks:Me(oe(l,"marks",d)),group:Me(oe(l,"group",d)),inline:Me(oe(l,"inline",d)),atom:Me(oe(l,"atom",d)),selectable:Me(oe(l,"selectable",d)),draggable:Me(oe(l,"draggable",d)),code:Me(oe(l,"code",d)),whitespace:Me(oe(l,"whitespace",d)),linebreakReplacement:Me(oe(l,"linebreakReplacement",d)),defining:Me(oe(l,"defining",d)),isolating:Me(oe(l,"isolating",d)),attrs:Object.fromEntries(c.map(tw))}),h=Me(oe(l,"parseHTML",d));h&&(p.parseDOM=h.map(y=>Z1(y,c)));const m=oe(l,"renderHTML",d);m&&(p.toDOM=y=>m({node:y,HTMLAttributes:hl(y,c)}));const v=oe(l,"renderText",d);return v&&(p.toText=v),[l.name,p]})),u=Object.fromEntries(i.map(l=>{const c=r.filter(v=>v.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},f=t.reduce((v,y)=>{const w=oe(y,"extendMarkSchema",d);return{...v,...w?w(l):{}}},{}),p=ew({...f,inclusive:Me(oe(l,"inclusive",d)),excludes:Me(oe(l,"excludes",d)),group:Me(oe(l,"group",d)),spanning:Me(oe(l,"spanning",d)),code:Me(oe(l,"code",d)),attrs:Object.fromEntries(c.map(tw))}),h=Me(oe(l,"parseHTML",d));h&&(p.parseDOM=h.map(v=>Z1(v,c)));const m=oe(l,"renderHTML",d);return m&&(p.toDOM=v=>m({mark:v,HTMLAttributes:hl(v,c)})),[l.name,p]}));return new Ck({topNode:s,nodes:a,marks:u})}function c6(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ag(t){return t.sort((n,r)=>{const o=oe(n,"priority")||100,i=oe(r,"priority")||100;return o>i?-1:o<i?1:0})}function Qx(t){const e=ag(ig(t)),n=c6(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 Xx(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
|
|
74
|
+
|
|
75
|
+
`,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,o,(u,l,c,d)=>{var f;u.isBlock&&l>r&&(a+=i);const p=s==null?void 0:s[u.type.name];if(p)return c&&(a+=p({node:u,pos:l,parent:c,index:d,range:e})),!1;u.isText&&(a+=(f=u==null?void 0:u.text)==null?void 0:f.slice(Math.max(r,l)-l,o-l))}),a}function d6(t,e){const n={from:0,to:t.content.size};return Xx(t,n,e)}function Zx(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function f6(t,e){const n=at(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function eE(t,e){const n=Jd(typeof e=="string"?e:e.name,t.schema);return n==="node"?f6(t,e):n==="mark"?Kx(t,e):{}}function p6(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function h6(t){const e=p6(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==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 tE(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((a,u)=>{s.push({from:a,to:u})});else{const{from:a,to:u}=n[i];if(a===void 0||u===void 0)return;s.push({from:a,to:u})}s.forEach(({from:a,to:u})=>{const l=e.slice(i).map(a,-1),c=e.slice(i).map(u),d=e.invert().map(l,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:l,to:c}})})}),h6(r)}function lg(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t),s=og(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var m6=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let i=r,s=null;for(;i>0&&s===null;){const a=o.node(i);(a==null?void 0:a.type.name)===e?s=a:i-=1}return[s,i]};function op(t,e){return e.nodes[t]||e.marks[t]||null}function ju(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var y6=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{var u,l;const c=((l=(u=o.type.spec).toText)==null?void 0:l.call(u,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?c:c.slice(0,Math.max(0,r-i))}),n};function fm(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?Or(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Dc(d.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;t.doc.nodesBetween(p,h,(m,v)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(p,v),w=Math.min(h,v+m.nodeSize),b=w-y;s+=b,a.push(...m.marks.map(S=>({mark:S,from:y,to:w})))})}),s===0)return!1;const u=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Dc(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),l=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(u>0?u+l:u)>=s}function g6(t,e,n={}){if(!e)return ho(t,null,n)||fm(t,null,n);const r=Jd(e,t.schema);return r==="node"?ho(t,e,n):r==="mark"?fm(t,e,n):!1}var v6=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const i=Yd(a=>a.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},w6=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function nw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function rw(t,e){const{nodeExtensions:n}=xs(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=Me(oe(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Qd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.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 o=!0;return t.content.forEach(i=>{o!==!1&&(Qd(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function nE(t){return t instanceof re}var rE=class oE{constructor(e){this.position=e}static fromJSON(e){return new oE(e.position)}toJSON(){return{position:this.position}}};function b6(t,e){const n=e.mapping.mapResult(t.position);return{position:new rE(n.pos),mapResult:n}}function _6(t){return new rE(t)}function S6(t,e,n){var r;const{selection:o}=e;let i=null;if(Ux(o)&&(i=o.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(l=>l.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:a,$to:u})=>{let l=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,u.pos,(c,d,f)=>{if(l)return!1;if(c.isInline){const p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));l=p&&h}return!l}),l})}var k6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,u=Or(t,r.schema);if(o)if(s){const l=Kx(r,u);n.addStoredMark(u.create({...l,...e}))}else a.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(c,d,(f,p)=>{const h=Math.max(p,c),m=Math.min(p+f.nodeSize,d);f.marks.find(y=>y.type===u)?f.marks.forEach(y=>{u===y.type&&n.addMark(h,m,u.create({...y.attrs,...e}))}):n.addMark(h,m,u.create(e))})});return S6(r,n,u)},x6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),E6=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=at(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:a})=>g1(i,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>g1(i,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},T6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=Bo(t,0,r.content.size),i=re.create(r,o);e.setSelection(i)}return!0},C6=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return typeof e=="number"?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(u,l)=>{u.isText||n.setNodeMarkup(l,void 0,{...u.attrs,dir:t})}),!0},M6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=ce.atStart(r).from,a=ce.atEnd(r).to,u=Bo(o,s,a),l=Bo(i,s,a),c=ce.create(r,u,l);e.setSelection(c)}return!0},O6=t=>({state:e,dispatch:n})=>{const r=at(t,e.schema);return xB(r)(e,n)};function ow(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}var N6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:a,$to:u}=i,l=o.extensionManager.attributes,c=ju(l,a.node().type.name,a.node().attrs);if(i instanceof re&&i.node.isBlock)return!a.parentOffset||!wr(s,a.pos)?!1:(r&&(t&&ow(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=u.parentOffset===u.parent.content.size,f=a.depth===0?void 0:o6(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&f?[{type:f,attrs:c}]:void 0,h=wr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&wr(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:c}]:void 0),r){if(h&&(i instanceof ce&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),v=e.doc.resolve(m);a.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&ow(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return h},A6=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=at(t,r.schema),{$from:u,$to:l}=r.selection,c=r.selection.node;if(c&&c.isBlock||u.depth<2||!u.sameParent(l))return!1;const d=u.node(-1);if(d.type!==a)return!1;const f=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(o){let y=U.empty;const w=u.index(-1)?1:u.index(-2)?2:3;for(let T=u.depth-w;T>=u.depth-3;T-=1)y=U.from(u.node(T).copy(y));const b=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,S={...ju(f,u.node().type.name,u.node().attrs),...e},k=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(S))||void 0;y=y.append(U.from(a.createAndFill(null,k)||void 0));const E=u.before(u.depth-(w-1));n.replace(E,u.after(-b),new J(y,4-w,0));let x=-1;n.doc.nodesBetween(E,n.doc.content.size,(T,O)=>{if(x>-1)return!1;T.isTextblock&&T.content.size===0&&(x=O+1)}),x>-1&&n.setSelection(ce.near(n.doc.resolve(x))),n.scrollIntoView()}return!0}const p=l.pos===u.end()?d.contentMatchAt(0).defaultType:null,h={...ju(f,d.type.name,d.attrs),...e},m={...ju(f,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,l.pos);const v=p?[{type:a,attrs:h},{type:p,attrs:m}]:[{type:a,attrs:h}];if(!wr(n.doc,u.pos,2))return!1;if(o){const{selection:y,storedMarks:w}=r,{splittableMarks:b}=i.extensionManager,S=w||y.$to.parentOffset&&y.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!S||!o)return!0;const k=S.filter(E=>b.includes(E.type.name));n.ensureMarks(k)}return!0},ip=(t,e)=>{const n=Yd(s=>s.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 o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&vo(t.doc,n.pos)&&t.join(n.pos),!0},sp=(t,e)=>{const n=Yd(s=>s.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 o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&vo(t.doc,r)&&t.join(r),!0},I6=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:u,commands:l,can:c})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,p=at(t,s.schema),h=at(e,s.schema),{selection:m,storedMarks:v}=s,{$from:y,$to:w}=m,b=y.blockRange(w),S=v||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const k=Yd(E=>rw(E.type.name,d))(m);if(b.depth>=1&&k&&b.depth-k.depth<=1){if(k.node.type===p)return l.liftListItem(h);if(rw(k.node.type.name,d)&&p.validContent(k.node.content)&&a)return u().command(()=>(i.setNodeMarkup(k.pos,p),!0)).command(()=>ip(i,p)).command(()=>sp(i,p)).run()}return!n||!S||!a?u().command(()=>c().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>ip(i,p)).command(()=>sp(i,p)).run():u().command(()=>{const E=c().wrapInList(p,r),x=S.filter(T=>f.includes(T.type.name));return i.ensureMarks(x),E?!0:l.clearNodes()}).wrapInList(p,r).command(()=>ip(i,p)).command(()=>sp(i,p)).run()},P6=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Or(t,r.schema);return fm(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},R6=(t,e,n={})=>({state:r,commands:o})=>{const i=at(t,r.schema),s=at(e,r.schema),a=ho(r,i,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),a?o.setNode(s,u):o.setNode(i,{...u,...n})},D6=(t,e={})=>({state:n,commands:r})=>{const o=at(t,n.schema);return ho(n,o,e)?r.lift(o):r.wrapIn(o,e)},j6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,a=i.transform;for(let u=a.steps.length-1;u>=0;u-=1)s.step(a.steps[u].invert(a.docs[u]));if(i.text){const u=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else s.delete(i.from,i.to)}return!0}}return!1},L6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},B6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,u=Or(t,r.schema),{$from:l,empty:c,ranges:d}=a;if(!o)return!0;if(c&&s){let{from:f,to:p}=a;const h=(i=l.marks().find(v=>v.type===u))==null?void 0:i.attrs,m=og(l,u,h);m&&(f=m.from,p=m.to),n.removeMark(f,p,u)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,u)});return n.removeStoredMark(u),!0},F6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=o.from,s=o.to),r&&e.doc.nodesBetween(i,s,(a,u)=>{if(a.isText)return;const l={...a.attrs};delete l.dir,e.setNodeMarkup(u,void 0,l)}),!0},$6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Jd(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=at(t,r.schema)),a==="mark"&&(s=Or(t,r.schema));let u=!1;return n.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let f,p,h,m;n.selection.empty?r.doc.nodesBetween(c,d,(v,y)=>{i&&i===v.type&&(u=!0,h=Math.max(y,c),m=Math.min(y+v.nodeSize,d),f=y,p=v)}):r.doc.nodesBetween(c,d,(v,y)=>{y<c&&i&&i===v.type&&(u=!0,h=Math.max(y,c),m=Math.min(y+v.nodeSize,d),f=y,p=v),y>=c&&y<=d&&(i&&i===v.type&&(u=!0,o&&n.setNodeMarkup(y,void 0,{...v.attrs,...e})),s&&v.marks.length&&v.marks.forEach(w=>{if(s===w.type&&(u=!0,o)){const b=Math.max(y,c),S=Math.min(y+v.nodeSize,d);n.addMark(b,S,s.create({...w.attrs,...e}))}}))}),p&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(v=>{s===v.type&&o&&n.addMark(h,m,s.create({...v.attrs,...e}))}))}),u},z6=(t,e={})=>({state:n,dispatch:r})=>{const o=at(t,n.schema);return gB(o,e)(n,r)},U6=(t,e={})=>({state:n,dispatch:r})=>{const o=at(t,n.schema);return vB(o,e)(n,r)},V6=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={}}},Xd=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},q6=(t,e)=>{if(rg(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 iu(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=t,{view:u}=n;if(u.composing)return!1;const l=u.state.doc.resolve(r);if(l.parent.type.spec.code||(e=l.nodeBefore||l.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=y6(l)+i;return s.forEach(f=>{if(c)return;const p=q6(d,f.find);if(!p)return;const h=u.state.tr,m=Wd({state:u.state,transaction:h}),v={from:r-(p[0].length-i.length),to:o},{commands:y,chain:w,can:b}=new Kd({editor:n,state:m});f.handler({state:m,range:v,match:p,commands:y,chain:w,can:b})===null||!h.steps.length||(f.undoable&&h.setMeta(a,{transform:h,from:r,to:o,text:i}),u.dispatch(h),c=!0)}),c}function H6(t){const{editor:e,rules:n}=t,r=new ze({state:{init(){return null},apply(o,i,s){const a=o.getMeta(r);if(a)return a;const u=o.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:c}=u;typeof c=="string"?c=c:c=sg(U.from(c),s.schema);const{from:d}=u,f=d+c.length;iu({editor:e,from:d,to:f,text:c,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,a){return iu({editor:e,from:i,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&iu({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?iu({editor:e,from:s.pos,to:s.pos,text:`
|
|
76
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function W6(t){return Object.prototype.toString.call(t).slice(8,-1)}function su(t){return W6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function iE(t,e){const n={...t};return su(t)&&su(e)&&Object.keys(e).forEach(r=>{su(e[r])&&su(t[r])?n[r]=iE(t[r],e[r]):n[r]=e[r]}),n}var ug=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{...Me(oe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Me(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>iE(this.options,t)});return e.name=this.name,e.parent=this.parent,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}},vi=class sE extends ug{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new sE(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(l=>(l==null?void 0:l.type.name)===n.name))return!1;const u=s.find(l=>(l==null?void 0:l.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",o.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 K6(t){return typeof t=="number"}var G6=class{constructor(t){this.find=t.find,this.handler=t.handler}},J6=(t,e,n)=>{if(rg(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function Y6(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:u,chain:l,can:c}=new Kd({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(p,h)=>{var m,v,y,w,b;if((v=(m=p.type)==null?void 0:m.spec)!=null&&v.code||!(p.isText||p.isTextblock||p.isInline))return;const S=(b=(w=(y=p.content)==null?void 0:y.size)!=null?w:p.nodeSize)!=null?b:0,k=Math.max(r,h),E=Math.min(o,h+S);if(k>=E)return;const x=p.isText?p.text||"":p.textBetween(k-h,E-h,void 0,"");J6(x,i.find,s).forEach(O=>{if(O.index===void 0)return;const N=k+O.index+1,$=N+O[0].length,P={from:n.tr.mapping.map(N),to:n.tr.mapping.map($)},D=i.handler({state:n,range:P,match:O,commands:u,chain:l,can:c,pasteEvent:s,dropEvent:a});d.push(D)})}),d.every(p=>p!==null)}var au=null,Q6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function X6(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const u=({state:c,from:d,to:f,rule:p,pasteEvt:h})=>{const m=c.tr,v=Wd({state:c,transaction:m});if(!(!Y6({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new ze({view(d){const f=h=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(h.target)?d.dom.parentElement:null,r&&(au=e)},p=()=>{au&&(au=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const p=au;p!=null&&p.isEditable&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,f)=>{var p;const h=(p=f.clipboardData)==null?void 0:p.getData("text/html");return s=f,o=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,p)=>{const h=d[0],m=h.getMeta("uiEvent")==="paste"&&!o,v=h.getMeta("uiEvent")==="drop"&&!i,y=h.getMeta("applyPasteRules"),w=!!y;if(!m&&!v&&!w)return;if(w){let{text:k}=y;typeof k=="string"?k=k:k=sg(U.from(k),p.schema);const{from:E}=y,x=E+k.length,T=Q6(k);return u({rule:c,state:p,from:E,to:{b:x},pasteEvt:T})}const b=f.doc.content.findDiffStart(p.doc.content),S=f.doc.content.findDiffEnd(p.doc.content);if(!(!K6(b)||!S||b===S.b))return u({rule:c,state:p,from:b,to:S,pasteEvt:s})}}))}var Zd=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Qx(t),this.schema=u6(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:op(e.name,this.schema)},r=oe(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ag([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:op(r.name,this.schema)},i=[],s=oe(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&oe(r,"exitable",o)&&(a.ArrowRight=()=>vi.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([p,h])=>[p,()=>h({editor:t})]));a={...a,...f}}const u=p$(a);i.push(u);const l=oe(r,"addInputRules",o);if(nw(r,t.options.enableInputRules)&&l){const f=l();if(f&&f.length){const p=H6({editor:t,rules:f}),h=Array.isArray(p)?p:[p];i.push(...h)}}const c=oe(r,"addPasteRules",o);if(nw(r,t.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const p=X6({editor:t,rules:f});i.push(...p)}}const d=oe(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return Yx(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=xs(this.extensions);return Object.fromEntries(e.filter(n=>!!oe(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:at(n.name,this.schema)},i=oe(n,"addNodeView",o);if(!i)return[];const s=i();if(!s)return[];const a=(u,l,c,d,f)=>{const p=hl(u,r);return s({node:u,view:l,getPos:c,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:p})};return[n.name,a]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=xs(this.extensions);return Object.fromEntries(e.filter(n=>!!oe(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Or(n.name,this.schema)},i=oe(n,"addMarkView",o);if(!i)return[];const s=(a,u,l)=>{const c=hl(a,r);return i()({mark:a,view:u,inline:l,editor:t,extension:n,HTMLAttributes:c,updateAttributes:d=>{fz(a,t,d)}})};return[n.name,s]}))}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:op(e.name,this.schema)};e.type==="mark"&&((n=Me(oe(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=oe(e,"onBeforeCreate",r),i=oe(e,"onCreate",r),s=oe(e,"onUpdate",r),a=oe(e,"onSelectionUpdate",r),u=oe(e,"onTransaction",r),l=oe(e,"onFocus",r),c=oe(e,"onBlur",r),d=oe(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),u&&this.editor.on("transaction",u),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};Zd.resolve=Qx;Zd.sort=ag;Zd.flatten=ig;var Z6={};ng(Z6,{ClipboardTextSerializer:()=>lE,Commands:()=>uE,Delete:()=>cE,Drop:()=>dE,Editable:()=>fE,FocusEvents:()=>hE,Keymap:()=>mE,Paste:()=>yE,Tabindex:()=>gE,TextDirection:()=>vE,focusEventsPluginKey:()=>pE});var tt=class aE extends ug{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new aE(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},lE=tt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ze({key:new et("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(c=>c.$from.pos)),a=Math.max(...i.map(c=>c.$to.pos)),u=Zx(n);return Xx(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),uE=tt.create({name:"commands",addCommands(){return{...$x}}}),cE=tt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,a,u,l;if((l=(u=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:u.call(a,t))!=null?l:t.getMeta("y-sync$"))return;const c=Gx(t.before,[t,...e]);tE(c).forEach(p=>{c.mapping.mapResult(p.oldRange.from).deletedAfter&&c.mapping.mapResult(p.oldRange.to).deletedBefore&&c.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{const v=m+h.nodeSize-2,y=p.oldRange.from<=m&&v<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:v,newFrom:c.mapping.map(m),newTo:c.mapping.map(v),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((p,h)=>{var m,v;if(p instanceof jn){const y=f.slice(h).map(p.from,-1),w=f.slice(h).map(p.to),b=f.invert().map(y,-1),S=f.invert().map(w),k=(m=c.doc.nodeAt(y-1))==null?void 0:m.marks.some(x=>x.eq(p.mark)),E=(v=c.doc.nodeAt(w))==null?void 0:v.marks.some(x=>x.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:b,to:S},newRange:{from:y,to:w},partial:!!(E||k),editor:this.editor,transaction:t,combinedTransform:c})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),dE=tt.create({name:"drop",addProseMirrorPlugins(){return[new ze({key:new et("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),fE=tt.create({name:"editable",addProseMirrorPlugins(){return[new ze({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),pE=new et("focusEvents"),hE=tt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ze({key:pE,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}}}})]}}),mE=tt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:u,doc:l}=a,{empty:c,$anchor:d}=u,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,v=d.pos-d.parentOffset,y=m&&h.parent.childCount===1?v===d.pos:me.atStart(l).from===f;return!c||!p.type.isTextblock||p.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.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()},o={...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 Gd()||Wx()?i:o},addProseMirrorPlugins(){return[new ze({key:new et("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=e.selection,u=me.atStart(e.doc).from,l=me.atEnd(e.doc).to;if(i||!(s===u&&a===l)||!Qd(n.doc))return;const f=n.tr,p=Wd({state:n,transaction:f}),{commands:h}=new Kd({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),yE=tt.create({name:"paste",addProseMirrorPlugins(){return[new ze({key:new et("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),gE=tt.create({name:"tabindex",addProseMirrorPlugins(){return[new ze({key:new et("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),vE=tt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=xs(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 ze({key:new et("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),ez=class Ci{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}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 Ci(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 Ci(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 Ci(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!o&&a.depth<=this.depth)return;const u=new Ci(a,this.editor,o,o?n:null);o&&(u.actualDepth=this.depth+1),e.push(new Ci(a,this.editor,o,o?n:null))}),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,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const u=s[a];if(i[u]!==n[u])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(u=>n[u]===s.node.attrs[u])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},tz=`.ProseMirror {
|
|
77
|
+
position: relative;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ProseMirror {
|
|
81
|
+
word-wrap: break-word;
|
|
82
|
+
white-space: pre-wrap;
|
|
83
|
+
white-space: break-spaces;
|
|
84
|
+
-webkit-font-variant-ligatures: none;
|
|
85
|
+
font-variant-ligatures: none;
|
|
86
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ProseMirror [contenteditable="false"] {
|
|
90
|
+
white-space: normal;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
94
|
+
white-space: pre-wrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ProseMirror pre {
|
|
98
|
+
white-space: pre-wrap;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
img.ProseMirror-separator {
|
|
102
|
+
display: inline !important;
|
|
103
|
+
border: none !important;
|
|
104
|
+
margin: 0 !important;
|
|
105
|
+
width: 0 !important;
|
|
106
|
+
height: 0 !important;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.ProseMirror-gapcursor {
|
|
110
|
+
display: none;
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
position: absolute;
|
|
113
|
+
margin: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ProseMirror-gapcursor:after {
|
|
117
|
+
content: "";
|
|
118
|
+
display: block;
|
|
119
|
+
position: absolute;
|
|
120
|
+
top: -2px;
|
|
121
|
+
width: 20px;
|
|
122
|
+
border-top: 1px solid black;
|
|
123
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@keyframes ProseMirror-cursor-blink {
|
|
127
|
+
to {
|
|
128
|
+
visibility: hidden;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ProseMirror-hideselection *::selection {
|
|
133
|
+
background: transparent;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
137
|
+
background: transparent;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ProseMirror-hideselection * {
|
|
141
|
+
caret-color: transparent;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
145
|
+
display: block;
|
|
146
|
+
}`;function nz(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var rz=class extends V6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:b6,createMappablePosition:_6},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:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Vx(e,this.options.autofocus);this.editorState=Vi.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=nz(tz,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=Jx(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(o=>{const i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.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;const r=[...this.options.enableCoreExtensions?[fE,lE.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),uE,hE,mE,gE,dE,yE,cE,vE.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 Zd(r,this)}createCommandManager(){this.commandManager=new Kd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=dm(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=dm(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new Bx(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.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(l=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(l)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)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 s=n.findLast(l=>l.getMeta("focus")||l.getMeta("blur")),a=s==null?void 0:s.getMeta("focus"),u=s==null?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),u&&this.emit("blur",{editor:this,event:u.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(l=>l.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return eE(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return g6(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return sg(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
147
|
+
|
|
148
|
+
`,textSerializers:n={}}=t||{};return d6(this.state.doc,{blockSeparator:e,textSerializers:{...Zx(this.schema),...n}})}get isEmpty(){return Qd(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}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);return new ez(e,this)}get $doc(){return this.$pos(0)}};function Es(t){return new Xd({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Me(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],a=r[0];if(s){const u=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(lg(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>l).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+u,l);const f=n.from+u+s.length;i.addMark(n.from+u,f,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function oz(t){return new Xd({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Me(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let a=n.to;const u=t.type.create(o);if(r[1]){const l=r[0].lastIndexOf(r[1]);let c=s+l;c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(c,a,u)}else if(r[0]){const l=t.type.isInline?s:s-1;i.insert(l,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:t.undoable})}function pm(t){return new Xd({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=Me(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.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 Ts(t){return new Xd({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const i=Me(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),u=s.doc.resolve(n.from).blockRange(),l=u&&$y(u,t.type,i);if(!l)return null;if(s.wrap(u,l),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const m=h.filter(v=>p.includes(v.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&vo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)},undoable:t.undoable})}function iz(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof re){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){const i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}function sz(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var az={};ng(az,{createAtomBlockMarkdownSpec:()=>lz,createBlockMarkdownSpec:()=>uz,createInlineMarkdownSpec:()=>wE,parseAttributes:()=>cg,parseIndentedBlocks:()=>hm,renderNestedMarkdownContent:()=>fg,serializeAttributes:()=>dg});function cg(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,l=>(n.push(l),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const l=o.map(c=>c.trim().slice(1));e.class=l.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,l,c])=>{var d;const f=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=n[f];p&&(e[l]=p.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(e[c]=!0)}),e}function dg(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 lz(t){const{nodeName:e,name:n,parseAttributes:r=cg,serializeAttributes:o=dg,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=t,u=n||e,l=c=>{if(!a)return c;const d={};return a.forEach(f=>{f in c&&(d[f]=c[f])}),d};return{parseMarkdown:(c,d)=>{const f={...i,...c.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(c){var d;const f=new RegExp(`^:::${u}(?:\\s|$)`,"m"),p=(d=c.match(f))==null?void 0:d.index;return p!==void 0?p:-1},tokenize(c,d,f){const p=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),h=c.match(p);if(!h)return;const m=h[1]||"",v=r(m);if(!s.find(w=>!(w in v)))return{type:e,raw:h[0],attributes:v}}},renderMarkdown:c=>{const d=l(c.attrs||{}),f=o(d),p=f?` {${f}}`:"";return`:::${u}${p} :::`}}}function uz(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=cg,serializeAttributes:i=dg,defaultAttributes:s={},content:a="block",allowedAttributes:u}=t,l=n||e,c=d=>{if(!u)return d;const f={};return u.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{let p;if(r){const m=r(d);p=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?p=f.parseChildren(d.tokens||[]):p=f.parseInline(d.tokens||[]);const h={...s,...d.attributes};return f.createNode(e,h,p)},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${l}`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){var h;const m=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(m);if(!v)return;const[y,w=""]=v,b=o(w);let S=1;const k=y.length;let E="";const x=/^:::([\w-]*)(\s.*)?/gm,T=d.slice(k);for(x.lastIndex=0;;){const O=x.exec(T);if(O===null)break;const N=O.index,$=O[1];if(!((h=O[2])!=null&&h.endsWith(":::"))){if($)S+=1;else if(S-=1,S===0){const P=T.slice(0,N);E=P.trim();const D=d.slice(0,k+N+O[0].length);let q=[];if(E)if(a==="block")for(q=p.blockTokens(P),q.forEach(B=>{B.text&&(!B.tokens||B.tokens.length===0)&&(B.tokens=p.inlineTokens(B.text))});q.length>0;){const B=q[q.length-1];if(B.type==="paragraph"&&(!B.text||B.text.trim()===""))q.pop();else break}else q=p.inlineTokens(E);return{type:e,raw:D,attributes:b,content:E,tokens:q}}}}}},renderMarkdown:(d,f)=>{const p=c(d.attrs||{}),h=i(p),m=h?` {${h}}`:"",v=f.renderChildren(d.content||[],`
|
|
149
|
+
|
|
150
|
+
`);return`:::${l}${m}
|
|
151
|
+
|
|
152
|
+
${v}
|
|
153
|
+
|
|
154
|
+
:::`}}}function cz(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,i,s]=r;e[o]=i||s,r=n.exec(t)}return e}function dz(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function wE(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=cz,serializeAttributes:i=dz,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:u}=t,l=n||e,c=f=>{if(!u)return f;const p={};return u.forEach(h=>{const m=typeof h=="string"?h:h.name,v=typeof h=="string"?void 0:h.skipIfDefault;if(m in f){const y=f[m];if(v!==void 0&&y===v)return;p[m]=y}}),p},d=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const h={...s,...f.attributes};if(a)return p.createNode(e,h);const m=r?r(f):f.content||"";return m?p.createNode(e,h,[p.createTextNode(m)]):p.createNode(e,h,[])},markdownTokenizer:{name:e,level:"inline",start(f){const p=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),h=f.match(p),m=h==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,p,h){const m=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),v=f.match(m);if(!v)return;let y="",w="";if(a){const[,S]=v;w=S}else{const[,S,k]=v;w=S,y=k||""}const b=o(w.trim());return{type:e,raw:v[0],content:y.trim(),attributes:b}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const h=c(f.attrs||{}),m=i(h),v=m?` ${m}`:"";return a?`[${l}${v}]`:`[${l}${v}]${p}[/${l}]`}}}function hm(t,e,n){var r,o,i,s;const a=t.split(`
|
|
155
|
+
`),u=[];let l="",c=0;const d=e.baseIndentSize||2;for(;c<a.length;){const f=a[c],p=f.match(e.itemPattern);if(!p){if(u.length>0)break;if(f.trim()===""){c+=1,l=`${l}${f}
|
|
156
|
+
`;continue}else return}const h=e.extractItemData(p),{indentLevel:m,mainContent:v}=h;l=`${l}${f}
|
|
157
|
+
`;const y=[v];for(c+=1;c<a.length;){const k=a[c];if(k.trim()===""){const x=a.slice(c+1).findIndex(N=>N.trim()!=="");if(x===-1)break;if((((o=(r=a[c+1+x].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){y.push(k),l=`${l}${k}
|
|
158
|
+
`,c+=1;continue}else break}if((((s=(i=k.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>m)y.push(k),l=`${l}${k}
|
|
159
|
+
`,c+=1;else break}let w;const b=y.slice(1);if(b.length>0){const k=b.map(E=>E.slice(m+d)).join(`
|
|
160
|
+
`);k.trim()&&(e.customNestedParser?w=e.customNestedParser(k):w=n.blockTokens(k))}const S=e.createToken(h,w);u.push(S)}if(u.length!==0)return{items:u,raw:l}}function fg(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[i,...s]=t.content,a=e.renderChildren([i]),u=[`${o}${a}`];return s&&s.length>0&&s.forEach(l=>{const c=e.renderChildren([l]);if(c){const d=c.split(`
|
|
161
|
+
`).map(f=>f?e.indent(f):"").join(`
|
|
162
|
+
`);u.push(d)}}),u.join(`
|
|
163
|
+
`)}function fz(t,e,n={}){const{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((a,u)=>{const l=i.mapping.map(u),c=i.mapping.map(u)+a.nodeSize;let d=null;if(a.marks.forEach(p=>{if(p!==s)return!1;d=p}),!d)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==d.attrs[p]&&(f=!0)}),f){const p=t.type.create({...t.attrs,...n});i.removeMark(l,c,t.type),i.addMark(l,c,p)}}),i.docChanged&&e.view.dispatch(i)}var en=class bE extends ug{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new bE(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},pz=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,o,i,s,a;const{view:u}=this.editor,l=t.target,c=l.nodeType===3?(e=l.parentElement)==null?void 0:e.closest("[data-drag-handle]"):l.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(l)||!c)return;let d=0,f=0;if(this.dom!==c){const w=this.dom.getBoundingClientRect(),b=c.getBoundingClientRect(),S=(o=t.offsetX)!=null?o:(r=t.nativeEvent)==null?void 0:r.offsetX,k=(s=t.offsetY)!=null?s:(i=t.nativeEvent)==null?void 0:i.offsetY;d=b.x-w.x+S,f=b.y-w.y+k}const p=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();p.style.width=`${Math.round(w.width)}px`,p.style.height=`${Math.round(w.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let h=null;try{h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(p),document.body.appendChild(h),(a=t.dataTransfer)==null||a.setDragImage(p,d,f)}finally{h&&setTimeout(()=>{try{h==null||h.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const v=re.create(u.state.doc,m),y=u.state.tr.setSelection(v);u.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const o=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:u}=this,l=!!this.node.type.spec.draggable,c=re.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",p=t.type==="cut",h=t.type==="mousedown";if(!l&&c&&o&&t.target===this.dom&&t.preventDefault(),l&&o&&!u&&t.target===this.dom)return t.preventDefault(),!1;if(l&&a&&!u&&h){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(u||i||d||f||p||h&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Gd()||qx())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function ui(t){return new G6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=Me(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=e,a=r[r.length-1],u=r[0];let l=n.to;if(a){const c=u.search(/\S/),d=n.from+u.indexOf(a),f=d+a.length;if(lg(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(v=>v===t.type&&v!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+c,d),l=n.from+c+a.length,s.addMark(n.from+c,l,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:hz,getOwnPropertySymbols:mz}=Object,{hasOwnProperty:yz}=Object.prototype;function ap(t,e){return function(r,o,i){return t(r,o,i)&&e(r,o,i)}}function lu(t){return function(n,r,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,o);const{cache:i}=o,s=i.get(n),a=i.get(r);if(s&&a)return s===r&&a===n;i.set(n,r),i.set(r,n);const u=t(n,r,o);return i.delete(n),i.delete(r),u}}function gz(t){return t!=null?t[Symbol.toStringTag]:void 0}function iw(t){return hz(t).concat(mz(t))}const vz=Object.hasOwn||((t,e)=>yz.call(t,e));function wi(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const wz="__v",bz="__o",_z="_owner",{getOwnPropertyDescriptor:sw,keys:aw}=Object;function Sz(t,e){return t.byteLength===e.byteLength&&jc(new Uint8Array(t),new Uint8Array(e))}function kz(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 xz(t,e){return t.byteLength===e.byteLength&&jc(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Ez(t,e){return wi(t.getTime(),e.getTime())}function Tz(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Cz(t,e){return t===e}function lw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),i=t.entries();let s,a,u=0;for(;(s=i.next())&&!s.done;){const l=e.entries();let c=!1,d=0;for(;(a=l.next())&&!a.done;){if(o[d]){d++;continue}const f=s.value,p=a.value;if(n.equals(f[0],p[0],u,d,t,e,n)&&n.equals(f[1],p[1],f[0],p[0],t,e,n)){c=o[d]=!0;break}d++}if(!c)return!1;u++}return!0}const Mz=wi;function Oz(t,e,n){const r=aw(t);let o=r.length;if(aw(e).length!==o)return!1;for(;o-- >0;)if(!_E(t,e,n,r[o]))return!1;return!0}function Hs(t,e,n){const r=iw(t);let o=r.length;if(iw(e).length!==o)return!1;let i,s,a;for(;o-- >0;)if(i=r[o],!_E(t,e,n,i)||(s=sw(t,i),a=sw(e,i),(s||a)&&(!s||!a||s.configurable!==a.configurable||s.enumerable!==a.enumerable||s.writable!==a.writable)))return!1;return!0}function Nz(t,e){return wi(t.valueOf(),e.valueOf())}function Az(t,e){return t.source===e.source&&t.flags===e.flags}function uw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),i=t.values();let s,a;for(;(s=i.next())&&!s.done;){const u=e.values();let l=!1,c=0;for(;(a=u.next())&&!a.done;){if(!o[c]&&n.equals(s.value,a.value,s.value,a.value,t,e,n)){l=o[c]=!0;break}c++}if(!l)return!1}return!0}function jc(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 Iz(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 _E(t,e,n,r){return(r===_z||r===bz||r===wz)&&(t.$$typeof||e.$$typeof)?!0:vz(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const Pz="[object ArrayBuffer]",Rz="[object Arguments]",Dz="[object Boolean]",jz="[object DataView]",Lz="[object Date]",Bz="[object Error]",Fz="[object Map]",$z="[object Number]",zz="[object Object]",Uz="[object RegExp]",Vz="[object Set]",qz="[object String]",Hz={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Wz="[object URL]",Kz=Object.prototype.toString;function Gz({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:u,arePrimitiveWrappersEqual:l,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:h}){return function(v,y,w){if(v===y)return!0;if(v==null||y==null)return!1;const b=typeof v;if(b!==typeof y)return!1;if(b!=="object")return b==="number"?a(v,y,w):b==="function"?i(v,y,w):!1;const S=v.constructor;if(S!==y.constructor)return!1;if(S===Object)return u(v,y,w);if(Array.isArray(v))return e(v,y,w);if(S===Date)return r(v,y,w);if(S===RegExp)return c(v,y,w);if(S===Map)return s(v,y,w);if(S===Set)return d(v,y,w);const k=Kz.call(v);if(k===Lz)return r(v,y,w);if(k===Uz)return c(v,y,w);if(k===Fz)return s(v,y,w);if(k===Vz)return d(v,y,w);if(k===zz)return typeof v.then!="function"&&typeof y.then!="function"&&u(v,y,w);if(k===Wz)return p(v,y,w);if(k===Bz)return o(v,y,w);if(k===Rz)return u(v,y,w);if(Hz[k])return f(v,y,w);if(k===Pz)return t(v,y,w);if(k===jz)return n(v,y,w);if(k===Dz||k===$z||k===qz)return l(v,y,w);if(h){let E=h[k];if(!E){const x=gz(v);x&&(E=h[x])}if(E)return E(v,y,w)}return!1}}function Jz({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Sz,areArraysEqual:n?Hs:kz,areDataViewsEqual:xz,areDatesEqual:Ez,areErrorsEqual:Tz,areFunctionsEqual:Cz,areMapsEqual:n?ap(lw,Hs):lw,areNumbersEqual:Mz,areObjectsEqual:n?Hs:Oz,arePrimitiveWrappersEqual:Nz,areRegExpsEqual:Az,areSetsEqual:n?ap(uw,Hs):uw,areTypedArraysEqual:n?ap(jc,Hs):jc,areUrlsEqual:Iz,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const o=lu(r.areArraysEqual),i=lu(r.areMapsEqual),s=lu(r.areObjectsEqual),a=lu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:o,areMapsEqual:i,areObjectsEqual:s,areSetsEqual:a})}return r}function Yz(t){return function(e,n,r,o,i,s,a){return t(e,n,a)}}function Qz({circular:t,comparator:e,createState:n,equals:r,strict:o}){if(n)return function(a,u){const{cache:l=t?new WeakMap:void 0,meta:c}=n();return e(a,u,{cache:l,equals:r,meta:c,strict:o})};if(t)return function(a,u){return e(a,u,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(a,u){return e(a,u,i)}}const Xz=bo();bo({strict:!0});bo({circular:!0});bo({circular:!0,strict:!0});bo({createInternalComparator:()=>wi});bo({strict:!0,createInternalComparator:()=>wi});bo({circular:!0,createInternalComparator:()=>wi});bo({circular:!0,createInternalComparator:()=>wi,strict:!0});function bo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:o=!1}=t,i=Jz(t),s=Gz(i),a=n?n(s):Yz(s);return Qz({circular:e,comparator:s,createState:r,equals:a,strict:o})}var SE={exports:{}},kE={};/**
|
|
164
|
+
* @license React
|
|
165
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
166
|
+
*
|
|
167
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the MIT license found in the
|
|
170
|
+
* LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/var ef=_,Zz=Ly;function e8(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var t8=typeof Object.is=="function"?Object.is:e8,n8=Zz.useSyncExternalStore,r8=ef.useRef,o8=ef.useEffect,i8=ef.useMemo,s8=ef.useDebugValue;kE.useSyncExternalStoreWithSelector=function(t,e,n,r,o){var i=r8(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=i8(function(){function u(p){if(!l){if(l=!0,c=p,p=r(p),o!==void 0&&s.hasValue){var h=s.value;if(o(h,p))return d=h}return d=p}if(h=d,t8(c,p))return h;var m=r(p);return o!==void 0&&o(h,m)?(c=p,h):(c=p,d=m)}var l=!1,c,d,f=n===void 0?null:n;return[function(){return u(e())},f===null?void 0:function(){return u(f())}]},[e,n,r,o]);var a=n8(t,i[0],i[1]);return o8(function(){s.hasValue=!0,s.value=a},[a]),s8(a),a};SE.exports=kE;var a8=SE.exports,l8=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},u8=({contentComponent:t})=>{const e=Ly.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(e)})};function c8(){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]:n2.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var d8=class extends ue.Component{constructor(t){var e;super(t),this.editorContentRef=ue.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}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=c8(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),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 g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:l8(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&g.jsx(u8,{contentComponent:t.contentComponent})]})}},f8=_.forwardRef((t,e)=>{const n=ue.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ue.createElement(d8,{key:n,innerRef:e,...t})}),p8=ue.memo(f8),h8=typeof window<"u"?_.useLayoutEffect:_.useEffect,m8=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(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 y8(t){var e;const[n]=_.useState(()=>new m8(t.editor)),r=a8.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:Xz);return h8(()=>n.watch(t.editor),[t.editor,n]),_.useDebugValue(r),r}var g8=!1,mm=typeof window>"u",v8=mm||!!(typeof window<"u"&&window.next),w8=class xE{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(){return this.options.current.immediatelyRender===void 0?mm||v8?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onBeforeCreate)==null?void 0:i.call(o,...r)},onBlur:(...r)=>{var o,i;return(i=(o=this.options.current).onBlur)==null?void 0:i.call(o,...r)},onCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onCreate)==null?void 0:i.call(o,...r)},onDestroy:(...r)=>{var o,i;return(i=(o=this.options.current).onDestroy)==null?void 0:i.call(o,...r)},onFocus:(...r)=>{var o,i;return(i=(o=this.options.current).onFocus)==null?void 0:i.call(o,...r)},onSelectionUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onSelectionUpdate)==null?void 0:i.call(o,...r)},onTransaction:(...r)=>{var o,i;return(i=(o=this.options.current).onTransaction)==null?void 0:i.call(o,...r)},onUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onUpdate)==null?void 0:i.call(o,...r)},onContentError:(...r)=>{var o,i;return(i=(o=this.options.current).onContentError)==null?void 0:i.call(o,...r)},onDrop:(...r)=>{var o,i;return(i=(o=this.options.current).onDrop)==null?void 0:i.call(o,...r)},onPaste:(...r)=>{var o,i;return(i=(o=this.options.current).onPaste)==null?void 0:i.call(o,...r)},onDelete:(...r)=>{var o,i;return(i=(o=this.options.current).onDelete)==null?void 0:i.call(o,...r)}};return new rz(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((o,i)=>{var s;return o===((s=n.extensions)==null?void 0:s[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?xE.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):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,o)=>r===e[o]))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 b8(t={},e=[]){const n=_.useRef(t);n.current=t;const[r]=_.useState(()=>new w8(n)),o=Ly.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return _.useDebugValue(o),_.useEffect(r.onRender(e)),y8({editor:o,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),o}var _8=_.createContext({editor:null});_8.Consumer;var EE=_.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),S8=()=>_.useContext(EE),k8=ue.forwardRef((t,e)=>{const{onDragStart:n}=S8(),r=t.as||"div";return g.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function cw(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function dw(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function x8(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function E8(t){if(cw(t)||dw(t))return!0;if(x8(t)){const e=t.type;if(e)return cw(e)||dw(e)}return!1}function T8(){try{if(_.version)return parseInt(_.version.split(".")[0],10)>=19}catch{}return!1}var C8=class{constructor(t,{editor:e,props:n={},as:r="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Oy.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,o=T8(),i=E8(e),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=a=>{this.ref=a}),this.reactElement=g.jsx(e,{...s}),(t=r==null?void 0:r.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e==null?void 0:e.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};ue.createContext({markViewContentRef:()=>{}});var M8=class extends pz{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(u={})=>this.updateAttributes(u),deleteNode:()=>this.deleteNode(),ref:_.createRef()};if(!this.component.displayName){const u=l=>l.charAt(0).toUpperCase()+l.substring(1);this.component.displayName=u(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:u=>{u&&this.contentDOMElement&&u.firstChild!==this.contentDOMElement&&(u.hasAttribute("data-node-view-wrapper")&&u.removeAttribute("data-node-view-wrapper"),u.appendChild(this.contentDOMElement))}},o=this.component,i=_.memo(u=>g.jsx(EE.Provider,{value:r,children:_.createElement(o,u)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new C8(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=hl(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function O8(t,e){return n=>n.editor.contentComponent?new M8(t,n,e):{}}var Lc=(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]},N8=/^\s*>\s$/,A8=en.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Lc("blockquote",{...$e(this.options.HTMLAttributes,t),children:Lc("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(o=>{const a=e.renderChildren([o]).split(`
|
|
172
|
+
`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(a.join(`
|
|
173
|
+
`))}),r.join(`
|
|
174
|
+
${n}
|
|
175
|
+
`)},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()}},addInputRules(){return[Ts({find:N8,type:this.type})]}}),I8=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,P8=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,R8=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,D8=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,j8=vi.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 Lc("strong",{...$e(this.options.HTMLAttributes,t),children:Lc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),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()}},addInputRules(){return[Es({find:I8,type:this.type}),Es({find:R8,type:this.type})]},addPasteRules(){return[ui({find:P8,type:this.type}),ui({find:D8,type:this.type})]}}),L8=/(^|[^`])`([^`]+)`(?!`)$/,B8=/(^|[^`])`([^`]+)`(?!`)/g,F8=vi.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[Es({find:L8,type:this.type})]},addPasteRules(){return[ui({find:B8,type:this.type})]}}),lp=4,$8=/^```([a-z]+)?[\s\n]$/,z8=/^~~~([a-z]+)?[\s\n]$/,U8=en.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:lp,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(s=>s.startsWith(n)).map(s=>s.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;return((n=t.raw)==null?void 0:n.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 o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
|
|
176
|
+
`):r=`\`\`\`${o}
|
|
177
|
+
|
|
178
|
+
\`\`\``,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:lp,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?t.commands.insertContent(a):t.commands.command(({tr:u})=>{const{from:l,to:c}=o,p=r.doc.textBetween(l,c,`
|
|
179
|
+
`,`
|
|
180
|
+
`).split(`
|
|
181
|
+
`).map(h=>a+h).join(`
|
|
182
|
+
`);return u.replaceWith(l,c,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:lp,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type!==this.type?!1:s?t.commands.command(({tr:a})=>{var u;const{pos:l}=i,c=i.start(),d=i.end(),p=r.doc.textBetween(c,d,`
|
|
183
|
+
`,`
|
|
184
|
+
`).split(`
|
|
185
|
+
`);let h=0,m=0;const v=l-c;for(let E=0;E<p.length;E+=1){if(m+p[E].length>=v){h=E;break}m+=p[E].length+1}const w=((u=p[h].match(/^ */))==null?void 0:u[0])||"",b=Math.min(w.length,n);if(b===0)return!0;let S=c;for(let E=0;E<h;E+=1)S+=p[E].length+1;return a.delete(S,S+b),l-S<=b&&a.setSelection(ce.create(a.doc,S)),!0}):t.commands.command(({tr:a})=>{const{from:u,to:l}=o,f=r.doc.textBetween(u,l,`
|
|
186
|
+
`,`
|
|
187
|
+
`).split(`
|
|
188
|
+
`).map(p=>{var h;const m=((h=p.match(/^ */))==null?void 0:h[0])||"",v=Math.min(m.length,n);return p.slice(v)}).join(`
|
|
189
|
+
`);return a.replaceWith(u,l,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
|
|
190
|
+
|
|
191
|
+
`);return!i||!s?!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:o,empty:i}=n;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:l})=>(l.setSelection(me.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[pm({find:$8,type:this.type,getAttributes:t=>({language:t[1]})}),pm({find:z8,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ze({key:new et("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"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=t.state,u=a.text(n.replace(/\r\n?/g,`
|
|
192
|
+
`));return s.replaceSelectionWith(this.type.create({language:i},u)),s.selection.$from.parent.type!==this.type&&s.setSelection(ce.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),V8=en.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
193
|
+
|
|
194
|
+
`):""}),q8=en.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`
|
|
195
|
+
`},renderMarkdown:()=>`
|
|
196
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,u=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:c})=>{if(c&&u&&s){const d=u.filter(f=>a.includes(f.type.name));l.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),H8=en.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,o="#".repeat(r);return t.content?`${o} ${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=>pm({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),W8=en.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(!iz(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return nE(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:a})=>{if(a){const{$to:u}=s.selection,l=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(ce.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(re.create(s.doc,u.pos)):s.setSelection(ce.create(s.doc,u.pos));else{const c=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,d=c==null?void 0:c.create();d&&(s.insert(l,d),s.setSelection(ce.create(s.doc,l+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[oz({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),K8=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,G8=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,J8=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Y8=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Q8=vi.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||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Es({find:K8,type:this.type}),Es({find:J8,type:this.type})]},addPasteRules(){return[ui({find:G8,type:this.type}),ui({find:Y8,type:this.type})]}});const X8="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Z8="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ym="numeric",gm="ascii",vm="alpha",ba="asciinumeric",ia="alphanumeric",wm="domain",TE="emoji",eU="scheme",tU="slashscheme",up="whitespace";function nU(t,e){return t in e||(e[t]=[]),e[t]}function Fo(t,e,n){e[ym]&&(e[ba]=!0,e[ia]=!0),e[gm]&&(e[ba]=!0,e[vm]=!0),e[ba]&&(e[ia]=!0),e[vm]&&(e[ia]=!0),e[ia]&&(e[wm]=!0),e[TE]&&(e[wm]=!0);for(const r in e){const o=nU(r,n);o.indexOf(t)<0&&o.push(t)}}function rU(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Kt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Kt.groups={};Kt.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 o=e.jr[r][0],i=e.jr[r][1];if(i&&o.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 o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||Kt.groups;let o;return e&&e.j?o=e:(o=new Kt(e),n&&r&&Fo(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Kt.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,a=o.go(t);if(a?(s=new Kt,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Kt,i){if(r)if(s.t&&typeof s.t=="string"){const u=Object.assign(rU(s.t,r),n);Fo(i,u,r)}else n&&Fo(i,n,r);s.t=i}return o.j[t]=s,s}};const he=(t,e,n,r,o)=>t.ta(e,n,r,o),Je=(t,e,n,r,o)=>t.tr(e,n,r,o),fw=(t,e,n,r,o)=>t.ts(e,n,r,o),H=(t,e,n,r,o)=>t.tt(e,n,r,o),ar="WORD",bm="UWORD",CE="ASCIINUMERICAL",ME="ALPHANUMERICAL",ml="LOCALHOST",_m="TLD",Sm="UTLD",Lu="SCHEME",Mi="SLASH_SCHEME",pg="NUM",km="WS",hg="NL",_a="OPENBRACE",Sa="CLOSEBRACE",Bc="OPENBRACKET",Fc="CLOSEBRACKET",$c="OPENPAREN",zc="CLOSEPAREN",Uc="OPENANGLEBRACKET",Vc="CLOSEANGLEBRACKET",qc="FULLWIDTHLEFTPAREN",Hc="FULLWIDTHRIGHTPAREN",Wc="LEFTCORNERBRACKET",Kc="RIGHTCORNERBRACKET",Gc="LEFTWHITECORNERBRACKET",Jc="RIGHTWHITECORNERBRACKET",Yc="FULLWIDTHLESSTHAN",Qc="FULLWIDTHGREATERTHAN",Xc="AMPERSAND",Zc="APOSTROPHE",ed="ASTERISK",Fr="AT",td="BACKSLASH",nd="BACKTICK",rd="CARET",qr="COLON",mg="COMMA",od="DOLLAR",Wn="DOT",id="EQUALS",yg="EXCLAMATION",mn="HYPHEN",ka="PERCENT",sd="PIPE",ad="PLUS",ld="POUND",xa="QUERY",gg="QUOTE",OE="FULLWIDTHMIDDLEDOT",vg="SEMI",Kn="SLASH",Ea="TILDE",ud="UNDERSCORE",NE="EMOJI",cd="SYM";var AE=Object.freeze({__proto__:null,ALPHANUMERICAL:ME,AMPERSAND:Xc,APOSTROPHE:Zc,ASCIINUMERICAL:CE,ASTERISK:ed,AT:Fr,BACKSLASH:td,BACKTICK:nd,CARET:rd,CLOSEANGLEBRACKET:Vc,CLOSEBRACE:Sa,CLOSEBRACKET:Fc,CLOSEPAREN:zc,COLON:qr,COMMA:mg,DOLLAR:od,DOT:Wn,EMOJI:NE,EQUALS:id,EXCLAMATION:yg,FULLWIDTHGREATERTHAN:Qc,FULLWIDTHLEFTPAREN:qc,FULLWIDTHLESSTHAN:Yc,FULLWIDTHMIDDLEDOT:OE,FULLWIDTHRIGHTPAREN:Hc,HYPHEN:mn,LEFTCORNERBRACKET:Wc,LEFTWHITECORNERBRACKET:Gc,LOCALHOST:ml,NL:hg,NUM:pg,OPENANGLEBRACKET:Uc,OPENBRACE:_a,OPENBRACKET:Bc,OPENPAREN:$c,PERCENT:ka,PIPE:sd,PLUS:ad,POUND:ld,QUERY:xa,QUOTE:gg,RIGHTCORNERBRACKET:Kc,RIGHTWHITECORNERBRACKET:Jc,SCHEME:Lu,SEMI:vg,SLASH:Kn,SLASH_SCHEME:Mi,SYM:cd,TILDE:Ea,TLD:_m,UNDERSCORE:ud,UTLD:Sm,UWORD:bm,WORD:ar,WS:km});const or=/[a-z]/,Ws=new RegExp("\\p{L}","u"),cp=new RegExp("\\p{Emoji}","u"),ir=/\d/,dp=/\s/,pw="\r",fp=`
|
|
197
|
+
`,oU="️",iU="",pp="";let uu=null,cu=null;function sU(t=[]){const e={};Kt.groups=e;const n=new Kt;uu==null&&(uu=hw(X8)),cu==null&&(cu=hw(Z8)),H(n,"'",Zc),H(n,"{",_a),H(n,"}",Sa),H(n,"[",Bc),H(n,"]",Fc),H(n,"(",$c),H(n,")",zc),H(n,"<",Uc),H(n,">",Vc),H(n,"(",qc),H(n,")",Hc),H(n,"「",Wc),H(n,"」",Kc),H(n,"『",Gc),H(n,"』",Jc),H(n,"<",Yc),H(n,">",Qc),H(n,"&",Xc),H(n,"*",ed),H(n,"@",Fr),H(n,"`",nd),H(n,"^",rd),H(n,":",qr),H(n,",",mg),H(n,"$",od),H(n,".",Wn),H(n,"=",id),H(n,"!",yg),H(n,"-",mn),H(n,"%",ka),H(n,"|",sd),H(n,"+",ad),H(n,"#",ld),H(n,"?",xa),H(n,'"',gg),H(n,"/",Kn),H(n,";",vg),H(n,"~",Ea),H(n,"_",ud),H(n,"\\",td),H(n,"・",OE);const r=Je(n,ir,pg,{[ym]:!0});Je(r,ir,r);const o=Je(r,or,CE,{[ba]:!0}),i=Je(r,Ws,ME,{[ia]:!0}),s=Je(n,or,ar,{[gm]:!0});Je(s,ir,o),Je(s,or,s),Je(o,ir,o),Je(o,or,o);const a=Je(n,Ws,bm,{[vm]:!0});Je(a,or),Je(a,ir,i),Je(a,Ws,a),Je(i,ir,i),Je(i,or),Je(i,Ws,i);const u=H(n,fp,hg,{[up]:!0}),l=H(n,pw,km,{[up]:!0}),c=Je(n,dp,km,{[up]:!0});H(n,pp,c),H(l,fp,u),H(l,pp,c),Je(l,dp,c),H(c,pw),H(c,fp),Je(c,dp,c),H(c,pp,c);const d=Je(n,cp,NE,{[TE]:!0});H(d,"#"),Je(d,cp,d),H(d,oU,d);const f=H(d,iU);H(f,"#"),Je(f,cp,d);const p=[[or,s],[ir,o]],h=[[or,null],[Ws,a],[ir,i]];for(let m=0;m<uu.length;m++)Pr(n,uu[m],_m,ar,p);for(let m=0;m<cu.length;m++)Pr(n,cu[m],Sm,bm,h);Fo(_m,{tld:!0,ascii:!0},e),Fo(Sm,{utld:!0,alpha:!0},e),Pr(n,"file",Lu,ar,p),Pr(n,"mailto",Lu,ar,p),Pr(n,"http",Mi,ar,p),Pr(n,"https",Mi,ar,p),Pr(n,"ftp",Mi,ar,p),Pr(n,"ftps",Mi,ar,p),Fo(Lu,{scheme:!0,ascii:!0},e),Fo(Mi,{slashscheme:!0,ascii:!0},e),t=t.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<t.length;m++){const v=t[m][0],w=t[m][1]?{[eU]:!0}:{[tU]:!0};v.indexOf("-")>=0?w[wm]=!0:or.test(v)?ir.test(v)?w[ba]=!0:w[gm]=!0:w[ym]=!0,fw(n,v,v,w)}return fw(n,"localhost",ml,{ascii:!0}),n.jd=new Kt(cd),{start:n,tokens:Object.assign({groups:e},AE)}}function IE(t,e){const n=aU(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,u=null,l=0,c=null,d=-1,f=-1;for(;s<r&&(u=a.go(n[s]));)a=u,a.accepts()?(d=0,f=0,c=a):d>=0&&(d+=n[s].length,f++),l+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,l-=d,o.push({t:c.t,v:e.slice(i-l,i),s:i-l,e:i})}return o}function aU(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Pr(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const u=e[a];t.j[u]?i=t.j[u]:(i=new Kt(r),i.jr=o.slice(),t.j[u]=i),t=i}return i=new Kt(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function hw(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const yl={defaultProtocol:"http",events:null,format:mw,formatHref:mw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function wg(t,e=null){let n=Object.assign({},yl);t&&(n=Object.assign(n,t instanceof wg?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}wg.prototype={o:yl,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:yl[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},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 mw(t){return t}function PE(t,e){this.t="token",this.v=t,this.tk=e}PE.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=yl.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),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),u=t.get("target",n,e),l=t.get("rel",n,e),c=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),u&&(s.target=u),l&&(s.rel=l),c&&Object.assign(s,c),{tagName:o,attributes:s,content:i,eventListeners:d}}};function tf(t,e){class n extends PE{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const yw=tf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gw=tf("text"),lU=tf("nl"),du=tf("url",{isLink:!0,toHref(t=yl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ml&&t[1].t===qr}}),dn=t=>new Kt(t);function uU({groups:t}){const e=t.domain.concat([Xc,ed,Fr,td,nd,rd,od,id,mn,pg,ka,sd,ad,ld,Kn,cd,Ea,ud]),n=[Zc,qr,mg,Wn,yg,ka,xa,gg,vg,Uc,Vc,_a,Sa,Fc,Bc,$c,zc,qc,Hc,Wc,Kc,Gc,Jc,Yc,Qc],r=[Xc,Zc,ed,td,nd,rd,od,id,mn,_a,Sa,ka,sd,ad,ld,xa,Kn,cd,Ea,ud],o=dn(),i=H(o,Ea);he(i,r,i),he(i,t.domain,i);const s=dn(),a=dn(),u=dn();he(o,t.domain,s),he(o,t.scheme,a),he(o,t.slashscheme,u),he(s,r,i),he(s,t.domain,s);const l=H(s,Fr);H(i,Fr,l),H(a,Fr,l),H(u,Fr,l);const c=H(i,Wn);he(c,r,i),he(c,t.domain,i);const d=dn();he(l,t.domain,d),he(d,t.domain,d);const f=H(d,Wn);he(f,t.domain,d);const p=dn(yw);he(f,t.tld,p),he(f,t.utld,p),H(l,ml,p);const h=H(d,mn);H(h,mn,h),he(h,t.domain,d),he(p,t.domain,d),H(p,Wn,f),H(p,mn,h);const m=H(p,qr);he(m,t.numeric,yw);const v=H(s,mn),y=H(s,Wn);H(v,mn,v),he(v,t.domain,s),he(y,r,i),he(y,t.domain,s);const w=dn(du);he(y,t.tld,w),he(y,t.utld,w),he(w,t.domain,s),he(w,r,i),H(w,Wn,y),H(w,mn,v),H(w,Fr,l);const b=H(w,qr),S=dn(du);he(b,t.numeric,S);const k=dn(du),E=dn();he(k,e,k),he(k,n,E),he(E,e,k),he(E,n,E),H(w,Kn,k),H(S,Kn,k);const x=H(a,qr),T=H(u,qr),O=H(T,Kn),N=H(O,Kn);he(a,t.domain,s),H(a,Wn,y),H(a,mn,v),he(u,t.domain,s),H(u,Wn,y),H(u,mn,v),he(x,t.domain,k),H(x,Kn,k),H(x,xa,k),he(N,t.domain,k),he(N,e,k),H(N,Kn,k);const $=[[_a,Sa],[Bc,Fc],[$c,zc],[Uc,Vc],[qc,Hc],[Wc,Kc],[Gc,Jc],[Yc,Qc]];for(let P=0;P<$.length;P++){const[D,q]=$[P],B=H(k,D);H(E,D,B),H(B,q,k);const z=dn(du);he(B,e,z);const K=dn();he(B,n),he(z,e,z),he(z,n,K),he(K,e,z),he(K,n,K),H(z,q,k),H(K,q,k)}return H(o,ml,w),H(o,hg,lU),{start:o,tokens:AE}}function cU(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,u=null,l=null,c=0,d=null,f=-1;for(;o<r&&!(u=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(l=u||a.go(n[o].t));)u=null,a=l,a.accepts()?(f=0,d=a):f>=0&&f++,o++,c++;if(f<0)o-=c,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(hp(gw,e,s)),s=[]),o-=f,c-=f;const p=d.t,h=n.slice(o-c,o);i.push(hp(p,e,h))}}return s.length>0&&i.push(hp(gw,e,s)),i}function hp(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const dU=typeof console<"u"&&console&&console.warn||(()=>{}),fU="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",De={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function pU(){return Kt.groups={},De.scanner=null,De.parser=null,De.tokenQueue=[],De.pluginQueue=[],De.customSchemes=[],De.initialized=!1,De}function vw(t,e=!1){if(De.initialized&&dU(`linkifyjs: already initialized - will not register custom scheme "${t}" ${fU}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
198
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
199
|
+
2. Cannot start or end with "-"
|
|
200
|
+
3. "-" cannot repeat`);De.customSchemes.push([t,e])}function hU(){De.scanner=sU(De.customSchemes);for(let t=0;t<De.tokenQueue.length;t++)De.tokenQueue[t][1]({scanner:De.scanner});De.parser=uU(De.scanner.tokens);for(let t=0;t<De.pluginQueue.length;t++)De.pluginQueue[t][1]({scanner:De.scanner,parser:De.parser});return De.initialized=!0,De}function bg(t){return De.initialized||hU(),cU(De.parser.start,t,IE(De.scanner.start,t))}bg.scan=IE;function RE(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 wg(n),o=bg(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var _g="[\0- -\u2029 ]",mU=new RegExp(_g),yU=new RegExp(`${_g}$`),gU=new RegExp(_g,"g");function vU(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function wU(t){return new ze({key:new et("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),i=e.some(l=>l.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=Gx(n.doc,[...e]);if(tE(a).forEach(({newRange:l})=>{const c=i6(r.doc,l,p=>p.isTextblock);let d,f;if(c.length>1)d=c[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const p=r.doc.textBetween(l.from,l.to," "," ");if(!yU.test(p))return;d=c[0],f=r.doc.textBetween(d.pos,l.to,void 0," ")}if(d&&f){const p=f.split(mU).filter(Boolean);if(p.length<=0)return!1;const h=p[p.length-1],m=d.pos+f.lastIndexOf(h);if(!h)return!1;const v=bg(h).map(y=>y.toObject(t.defaultProtocol));if(!vU(v))return!1;v.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{lg(y.from,y.to,r.doc).some(w=>w.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function bU(t){return new ze({key:new et("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let a=null;if(r.target instanceof HTMLAnchorElement)a=r.target;else{let d=r.target;const f=[];for(;d.nodeName!=="DIV";)f.push(d),d=d.parentNode;a=f.find(p=>p.nodeName==="A")}if(!a)return s;const u=eE(e.state,t.type.name),l=(o=a==null?void 0:a.href)!=null?o:u.href,c=(i=a==null?void 0:a.target)!=null?i:u.target;a&&l&&(window.open(l,c),s=!0)}return s}}})}function _U(t){return new ze({key:new et("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let u="";r.content.forEach(c=>{u+=c.textContent});const l=RE(u,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===u);return!u||!l||o!==void 0&&!o(l.href)?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function Eo(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(gU,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var SU=vi.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"){vw(t);return}vw(t.scheme,t.optionalSlashes)})},onDestroy(){pU()},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)=>!!Eo(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},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}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Eo(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=>!!Eo(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;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Eo(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=>!!Eo(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[ui({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=RE(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Eo(s,n),protocols:n,defaultProtocol:r}));o.length&&o.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(wU({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Eo(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(bU({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(_U({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),kU=Object.defineProperty,xU=(t,e)=>{for(var n in e)kU(t,n,{get:e[n],enumerable:!0})},EU="listItem",ww="textStyle",bw=/^\s*([-+*])\s$/,DE=en.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,`
|
|
201
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(EU,this.editor.getAttributes(ww)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ts({find:bw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ts({find:bw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ww),editor:this.editor})),[t]}}),jE=en.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)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))n=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const s=t.tokens.slice(1),a=e.parseChildren(s);n.push(...a)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>fg(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",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)}}}),TU={};xU(TU,{findListItemPos:()=>Cl,getNextListDepth:()=>Sg,handleBackspace:()=>xm,handleDelete:()=>Em,hasListBefore:()=>LE,hasListItemAfter:()=>CU,hasListItemBefore:()=>BE,listItemHasSubList:()=>FE,nextListIsDeeper:()=>$E,nextListIsHigher:()=>zE});var Cl=(t,e)=>{const{$from:n}=e.selection,r=at(t,e.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&a===null;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return a===null?null:{$pos:e.doc.resolve(s),depth:a}},Sg=(t,e)=>{const n=Cl(t,e);if(!n)return!1;const[,r]=m6(e,t,n.$pos.pos+4);return r},LE=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),i=t.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},BE=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},FE=(t,e,n)=>{if(!n)return!1;const r=at(t,e.schema);let o=!1;return n.descendants(i=>{i.type===r&&(o=!0)}),o},xm=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ho(t.state,e)&&LE(t.state,e,n)){const{$anchor:a}=t.state.selection,u=t.state.doc.resolve(a.before()-1),l=[];u.node().descendants((f,p)=>{f.type.name===e&&l.push({node:f,pos:p})});const c=l.at(-1);if(!c)return!1;const d=t.state.doc.resolve(u.start()+c.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!ho(t.state,e)||!w6(t.state))return!1;const r=Cl(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=FE(e,t.state,i);return BE(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},$E=(t,e)=>{const n=Sg(t,e),r=Cl(t,e);return!r||!n?!1:n>r.depth},zE=(t,e)=>{const n=Sg(t,e),r=Cl(t,e);return!r||!n?!1:n<r.depth},Em=(t,e)=>{if(!ho(t.state,e)||!v6(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:$E(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():zE(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},CU=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},UE=tt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Em(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&&Em(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&&xm(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&&xm(t,n,r)&&(e=!0)}),e}}}}),_w=/^(\s*)(\d+)\.\s+(.*)$/,MU=/^\s/;function OU(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],i=o.match(_w);if(!i)break;const[,s,a,u]=i,l=s.length;let c=u,d=n+1;const f=[o];for(;d<t.length;){const p=t[d];if(p.match(_w))break;if(p.trim()==="")f.push(p),c+=`
|
|
202
|
+
`,d+=1;else if(p.match(MU))f.push(p),c+=`
|
|
203
|
+
${p.slice(l+2)}`,d+=1;else break}e.push({indent:l,number:parseInt(a,10),content:c.trim(),raw:f.join(`
|
|
204
|
+
`)}),r=d,n=d}return[e,r]}function VE(t,e,n){var r;const o=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const a=s.content.split(`
|
|
205
|
+
`),u=((r=a[0])==null?void 0:r.trim())||"",l=[];u&&l.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const c=a.slice(1).join(`
|
|
206
|
+
`).trim();if(c){const p=n.blockTokens(c);l.push(...p)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const p=Math.min(...f.map(m=>m.indent)),h=VE(f,p,n);l.push({type:"list",ordered:!0,start:f[0].number,items:h,raw:f.map(m=>m.raw).join(`
|
|
207
|
+
`)})}o.push({type:"list_item",raw:s.raw,tokens:l}),i=d}else i+=1}return o}function NU(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(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){const i=e.parseChildren([o]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([o]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var AU="listItem",Sw="textStyle",kw=/^(\d+)\.\s$/,qE=en.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?NU(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,`
|
|
208
|
+
`):"",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 o=t.split(`
|
|
209
|
+
`),[i,s]=OU(o);if(i.length===0)return;const a=VE(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:o.slice(0,s).join(`
|
|
210
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AU,this.editor.getAttributes(Sw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ts({find:kw,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=Ts({find:kw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),IU=/^\s*(\[([( |x])?\])\s$/,PU=en.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 o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return fg(t,e,o)},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 o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),u=document.createElement("div"),l=c=>{var d,f;a.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,c,a.checked))||`Task item checkbox for ${c.textContent||"empty task item"}`};return l(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",c=>c.preventDefault()),a.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=c.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=n();if(typeof p!="number")return!1;const h=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...h==null?void 0:h.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,d])=>{o.setAttribute(c,d)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,u),Object.entries(e).forEach(([c,d])=>{o.setAttribute(c,d)}),{dom:o,contentDOM:u,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,a.checked=c.attrs.checked,l(c),!0)}}},addInputRules(){return[Ts({find:IU,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),RU=en.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,`
|
|
211
|
+
`):"",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 s=hm(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,u)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:u}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},o=hm(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.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()}}});tt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(DE.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(jE.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(UE.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(qE.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(PU.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(RU.configure(this.options.taskList)),t}});var DU=en.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||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),jU=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,LU=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,BU=vi.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[Es({find:jU,type:this.type})]},addPasteRules(){return[ui({find:LU,type:this.type})]}}),FU=en.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),$U=vi.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 o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[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()}}});function zU(t={}){return new ze({view(e){return new UU(e,t)}})}class UU{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(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){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,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,a=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),m=d?h.bottom:h.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*a;r={left:h.left,right:h.right,top:m-v,bottom:m+v}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.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 l,c;if(!u||u==document.body&&getComputedStyle(u).position=="static")l=-pageXOffset,c=-pageYOffset;else{let d=u.getBoundingClientRect(),f=d.width/u.offsetWidth,p=d.height/u.offsetHeight;l=d.left-u.scrollLeft*f,c=d.top-u.scrollTop*p}this.element.style.left=(r.left-l)/s+"px",this.element.style.top=(r.top-c)/a+"px",this.element.style.width=(r.right-r.left)/s+"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),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Bk(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Xe extends me{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Xe.valid(r)?new Xe(r):me.near(r)}content(){return J.empty}eq(e){return e instanceof Xe&&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 Xe(e.resolve(n.pos))}getBookmark(){return new kg(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!VU(e)||!qU(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Xe.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let u=e.doc.resolve(o);if(Xe.valid(u))return u}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!re.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if(Xe.valid(a))return a}return null}}}Xe.prototype.visible=!1;Xe.findFrom=Xe.findGapCursorFrom;me.jsonID("gapcursor",Xe);class kg{constructor(e){this.pos=e}map(e){return new kg(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Xe.valid(n)?new Xe(n):me.near(n)}}function HE(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function VU(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 o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||HE(o.type))return!0;if(o.inlineContent)return!1}}return!0}function qU(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 o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||HE(o.type))return!0;if(o.inlineContent)return!1}}return!0}function HU(){return new ze({props:{decorations:JU,createSelectionBetween(t,e,n){return e.pos==n.pos&&Xe.valid(n)?new Xe(n):null},handleClick:KU,handleKeyDown:WU,handleDOMEvents:{beforeinput:GU}}})}const WU=Fx({ArrowLeft:fu("horiz",-1),ArrowRight:fu("horiz",1),ArrowUp:fu("vert",-1),ArrowDown:fu("vert",1)});function fu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,u=s.empty;if(s instanceof ce){if(!i.endOfTextblock(n)||a.depth==0)return!1;u=!1,a=r.doc.resolve(e>0?a.after():a.before())}let l=Xe.findGapCursorFrom(a,e,u);return l?(o&&o(r.tr.setSelection(new Xe(l))),!0):!1}}function KU(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Xe.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&re.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Xe(r))),!0)}function GU(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Xe))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 o=U.empty;for(let s=r.length-1;s>=0;s--)o=U.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new J(o,0,0));return i.setSelection(ce.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function JU(t){if(!(t.selection instanceof Xe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Le.create(t.doc,[It.widget(t.selection.head,e,{key:"gapcursor"})])}var dd=200,wt=function(){};wt.prototype.append=function(e){return e.length?(e=wt.from(e),!this.length&&e||e.length<dd&&this.leafAppend(e)||this.length<dd&&e.leafPrepend(this)||this.appendInner(e)):this};wt.prototype.prepend=function(e){return e.length?wt.from(e).append(this):this};wt.prototype.appendInner=function(e){return new YU(this,e)};wt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?wt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};wt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};wt.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)};wt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};wt.from=function(e){return e instanceof wt?e:e&&e.length?new WE(e):wt.empty};var WE=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(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var u=i;u<s;u++)if(o(this.values[u],a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,a){for(var u=i-1;u>=s;u--)if(o(this.values[u],a+u)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=dd)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=dd)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(wt);wt.empty=new WE([]);var YU=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,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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}(wt);const QU=500;class Rn{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 o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,u,l=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,c.push(d);return}if(o){c.push(new Gn(d.map));let p=d.step.map(o.slice(i)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],l.push(new Gn(h,void 0,void 0,l.length+c.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,u=new Rn(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:s,selection:a}}addTransform(e,n,r,o){let i=[],s=this.eventCount,a=this.items,u=!o&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new Gn(e.mapping.maps[c],d,n),p;(p=u&&u.merge(f))&&(f=p,c?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(u=f)}let l=s-r.depth;return l>ZU&&(a=XU(a,l),s-=l),new Rn(a.append(i),s)}remapping(e,n){let r=new ll;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Rn(this.items.append(e.map(n=>new Gn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let u=n;this.items.forEach(f=>{let p=i.getMirror(--u);if(p==null)return;s=Math.min(s,p);let h=i.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),v=f.selection&&f.selection.map(i.slice(u+1,p));v&&a++,r.push(new Gn(h,m,v))}else r.push(new Gn(h))},o);let l=[];for(let f=n;f<s;f++)l.push(new Gn(i.maps[f]));let c=this.items.slice(0,o).append(l).append(r),d=new Rn(c,a);return d.emptyItemCount()>QU&&(d=d.compress(this.items.length-r.length)),d}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,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let u=s.step.map(n.slice(r)),l=u&&u.getMap();if(r--,l&&n.appendMap(l,r),u){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let d=new Gn(l.invert(),u,c),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new Rn(wt.from(o.reverse()),i)}}Rn.empty=new Rn(wt.empty,0);function XU(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Gn{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Gn(n.getMap().invert(),n,this.selection)}}}class $r{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const ZU=20;function e7(t,e,n,r){let o=n.getMeta(Go),i;if(o)return o.historyState;n.getMeta(r7)&&(t=new $r(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Go))return s.getMeta(Go).redo?new $r(t.done.addTransform(n,void 0,r,Bu(e)),t.undone,xw(n.mapping.maps),t.prevTime,t.prevComposition):new $r(t.done,t.undone.addTransform(n,void 0,r,Bu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),u=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!t7(n,t.prevRanges)),l=s?mp(t.prevRanges,n.mapping):xw(n.mapping.maps);return new $r(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Bu(e)),Rn.empty,l,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new $r(t.done.rebased(n,i),t.undone.rebased(n,i),mp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new $r(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),mp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function t7(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function xw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function mp(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function n7(t,e,n){let r=Bu(e),o=Go.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),u=new $r(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Go,{redo:n,historyState:u})}let yp=!1,Ew=null;function Bu(t){let e=t.plugins;if(Ew!=e){yp=!1,Ew=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){yp=!0;break}}return yp}const Go=new et("history"),r7=new et("closeHistory");function o7(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ze({key:Go,state:{init(){return new $r(Rn.empty,Rn.empty,null,0,-1)},apply(e,n,r){return e7(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?GE:r=="historyRedo"?JE:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function KE(t,e){return(n,r)=>{let o=Go.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=n7(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const GE=KE(!1,!0),JE=KE(!0,!0);tt.create({name:"characterCount",addOptions(){return{limit:null,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 ze({key:new et("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,a=0,u=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const l=r.tr.deleteRange(a,u);return t=!0,l}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,u=i-r,l=a-u,c=a;return e.deleteRange(l,c),!(this.storage.characters({node:e.doc})>r)}})]}});var i7=tt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[zU(this.options)]}});tt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ze({key:new et("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return Le.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((u,l)=>{if(u.isText)return;if(!(o>=l&&o<=l+u.nodeSize-1))return!1;s+=1});let a=0;return t.descendants((u,l)=>{if(u.isText||!(o>=l&&o<=l+u.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(It.node(l,l+u.nodeSize,{class:this.options.className}))}),Le.create(t,i)}}})]}});var s7=tt.create({name:"gapCursor",addProseMirrorPlugins(){return[HU()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Me(oe(t,"allowGapCursor",n)))!=null?e:null}}}),a7=tt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ze({key:new et("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const u=r>=a&&r<=a+s.nodeSize,l=!s.isLeaf&&Qd(s);if((u||!this.options.showOnlyCurrent)&&l){const c=[this.options.emptyNodeClass];i&&c.push(this.options.emptyEditorClass);const d=It.node(a,a+s.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:u}):this.options.placeholder});o.push(d)}return this.options.includeChildren}),Le.create(t,o)}}})]}});tt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ze({key:new et("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||nE(n.selection)||t.view.dragging?null:Le.create(n.doc,[It.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Tw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var l7=tt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new et(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(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new ze({key:e,appendTransaction:(o,i,s)=>{const{doc:a,tr:u,schema:l}=s,c=e.getState(s),d=a.content.size,f=l.nodes[n];if(c)return u.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!Tw({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return i;const s=o.doc.lastChild;return!Tw({node:s,types:r})}}})]}}),u7=tt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>GE(t,e),redo:()=>({state:t,dispatch:e})=>JE(t,e)}},addProseMirrorPlugins(){return[o7(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()}}}),c7=tt.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(j8.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(A8.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(DE.configure(this.options.bulletList)),this.options.code!==!1&&o.push(F8.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(U8.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(V8.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(i7.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(s7.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(q8.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(H8.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(u7.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(W8.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Q8.configure(this.options.italic)),this.options.listItem!==!1&&o.push(jE.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(UE.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(SU.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(qE.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(DU.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(BU.configure(this.options.strike)),this.options.text!==!1&&o.push(FU.configure(this.options.text)),this.options.underline!==!1&&o.push($U.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(l7.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),d7=c7,f7=a7;function p7(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,u=r&&!o,l=sz(n),c=new RegExp(`\\s${l}$`),d=s?"^":"",f=o?"":l,p=u?new RegExp(`${d}${l}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${l}[^\\s${f}]*`,"gm"),h=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!h)return null;const m=a.pos-h.length,v=Array.from(h.matchAll(p)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const y=v.input.slice(Math.max(0,v.index-1),v.index),w=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!w)return null;const b=m+v.index;let S=b+v[0].length;return u&&c.test(h.slice(S-1,S+1))&&(v[0]+=" ",S+=1),b<a.pos&&S>=a.pos?{range:{from:b,to:S},query:v[0].slice(n.length),text:v[0]}:null}var h7=new et("suggestion");function m7({pluginKey:t=h7,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:u="suggestion",decorationContent:l="",decorationEmptyClass:c="is-empty",command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:h=()=>!0,findSuggestionMatch:m=p7}){let v;const y=p==null?void 0:p(),w=()=>{const E=e.state.selection.$anchor.pos,x=e.view.coordsAtPos(E),{top:T,right:O,bottom:N,left:$}=x;try{return new DOMRect($,T,O-$,N-T)}catch{return null}},b=(E,x)=>x?()=>{const T=t.getState(e.state),O=T==null?void 0:T.decorationId,N=E.dom.querySelector(`[data-decoration-id="${O}"]`);return(N==null?void 0:N.getBoundingClientRect())||null}:w;function S(E,x){var T;try{const N=t.getState(E.state),$=N!=null&&N.decorationId?E.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,P={editor:e,range:(N==null?void 0:N.range)||{from:0,to:0},query:(N==null?void 0:N.query)||null,text:(N==null?void 0:N.text)||null,items:[],command:D=>d({editor:e,range:(N==null?void 0:N.range)||{from:0,to:0},props:D}),decorationNode:$,clientRect:b(E,$)};(T=y==null?void 0:y.onExit)==null||T.call(y,P)}catch{}const O=E.state.tr.setMeta(x,{exit:!0});E.dispatch(O)}const k=new ze({key:t,view(){return{update:async(E,x)=>{var T,O,N,$,P,D,q;const B=(T=this.key)==null?void 0:T.getState(x),z=(O=this.key)==null?void 0:O.getState(E.state),K=B.active&&z.active&&B.range.from!==z.range.from,I=!B.active&&z.active,L=B.active&&!z.active,F=!I&&!L&&B.query!==z.query,Z=I||K&&F,ie=F||K,ke=L||K&&F;if(!Z&&!ie&&!ke)return;const fe=ke&&!Z?B:z,Ne=E.dom.querySelector(`[data-decoration-id="${fe.decorationId}"]`);v={editor:e,range:fe.range,query:fe.query,text:fe.text,items:[],command:pe=>d({editor:e,range:fe.range,props:pe}),decorationNode:Ne,clientRect:b(E,Ne)},Z&&((N=y==null?void 0:y.onBeforeStart)==null||N.call(y,v)),ie&&(($=y==null?void 0:y.onBeforeUpdate)==null||$.call(y,v)),(ie||Z)&&(v.items=await f({editor:e,query:fe.query})),ke&&((P=y==null?void 0:y.onExit)==null||P.call(y,v)),ie&&((D=y==null?void 0:y.onUpdate)==null||D.call(y,v)),Z&&((q=y==null?void 0:y.onStart)==null||q.call(y,v))},destroy:()=>{var E;v&&((E=y==null?void 0:y.onExit)==null||E.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(E,x,T,O){const{isEditable:N}=e,{composing:$}=e.view,{selection:P}=E,{empty:D,from:q}=P,B={...x},z=E.getMeta(t);if(z&&z.exit)return B.active=!1,B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null,B;if(B.composing=$,N&&(D||e.view.composing)){(q<x.range.from||q>x.range.to)&&!$&&!x.composing&&(B.active=!1);const K=m({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:P.$from}),I=`id_${Math.floor(Math.random()*4294967295)}`;K&&h({editor:e,state:O,range:K.range,isActive:x.active})?(B.active=!0,B.decorationId=x.decorationId?x.decorationId:I,B.range=K.range,B.query=K.query,B.text=K.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(E,x){var T,O,N,$;const{active:P,range:D}=k.getState(E.state);if(!P)return!1;if(x.key==="Escape"||x.key==="Esc"){const B=k.getState(E.state),z=(T=v==null?void 0:v.decorationNode)!=null?T:null,K=z??(B!=null&&B.decorationId?E.dom.querySelector(`[data-decoration-id="${B.decorationId}"]`):null);if(((O=y==null?void 0:y.onKeyDown)==null?void 0:O.call(y,{view:E,event:x,range:B.range}))||!1)return!0;const L={editor:e,range:B.range,query:B.query,text:B.text,items:[],command:F=>d({editor:e,range:B.range,props:F}),decorationNode:K,clientRect:K?()=>K.getBoundingClientRect()||null:null};return(N=y==null?void 0:y.onExit)==null||N.call(y,L),S(E,t),!0}return(($=y==null?void 0:y.onKeyDown)==null?void 0:$.call(y,{view:E,event:x,range:D}))||!1},decorations(E){const{active:x,range:T,decorationId:O,query:N}=k.getState(E);if(!x)return null;const $=!(N!=null&&N.length),P=[u];return $&&P.push(c),Le.create(E.doc,[It.inline(T.from,T.to,{nodeName:a,class:P.join(" "),"data-decoration-id":O,"data-decoration-content":l})])}}});return k}function y7({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new et;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var u,l,c;const d=i.view.state.selection.$to.nodeAfter;((u=d==null?void 0:d.text)==null?void 0:u.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(c=(l=i.view.dom.ownerDocument.defaultView)==null?void 0:l.getSelection())==null||c.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),u=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(u)},...e}}function YE(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>y7({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Cw(t,e){const n=YE(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}var g7=en.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",$e(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(o=e.attrs.label)!=null?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Cw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",$e({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=$e({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",$e({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},...wE({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,i,s]=r,a=i??s;e[o==="char"?"mentionSuggestionChar":o]=a,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:Cw(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;let s=new kn,a=0;return e.doc.nodesBetween(i-1,i,(u,l)=>{if(u.type.name===this.name)return n=!0,s=u,a=l,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return YE(this).map(m7)}}),v7=g7;const w7={type:{default:null}},b7={user:{id:{default:null},name:{default:null},email:{default:null},avatarUrl:{default:null}},field:{apiKey:{default:null},label:{default:null},localized:{default:!1},fieldPath:{default:null},locale:{default:null},fieldType:{default:null}},asset:{id:{default:null},filename:{default:null},url:{default:null},thumbnailUrl:{default:null},mimeType:{default:null}},record:{id:{default:null},title:{default:null},modelId:{default:null},modelApiKey:{default:null},modelName:{default:null},modelEmoji:{default:null},thumbnailUrl:{default:null},isSingleton:{default:!1}},model:{id:{default:null},apiKey:{default:null},name:{default:null},isBlockModel:{default:!1}}};function Ks(t){const{name:e,mentionType:n,nodeViewComponent:r}=t,o=b7[n];return v7.extend({name:e,addAttributes(){return{...w7,...o,...t.extraAttrs??{}}},parseHTML(){return[{tag:`span[data-mention-type="${n}"]`}]},renderHTML({HTMLAttributes:i}){return["span",{"data-mention-type":n,...i}]},addNodeView(){return O8(r)}})}const _7=({mention:t,onClick:e,isInComposer:n=!1,projectUsers:r})=>{const o=i=>{e==null||e(t,i)};return g.jsx(lk,{mention:t,onClick:o,tabIndex:n?-1:0,projectUsers:r})},S7=_.memo(_7),QE=_.createContext({});function k7(){return _.useContext(QE)}function Fe(t){return typeof t=="string"}function fd(t){return t===null||typeof t=="string"}function Mw(t){return t==null||typeof t=="string"}function x7(t){return t===void 0||typeof t=="boolean"}function XE(t){return Fe(t.id)&&Fe(t.name)&&Fe(t.email)&&fd(t.avatarUrl)}function ZE(t){return t===void 0||typeof t=="boolean"}function eT(t){return Fe(t.apiKey)&&Fe(t.label)&&ZE(t.localized)&&Fe(t.fieldPath)&&Mw(t.locale)&&Mw(t.fieldType)}function tT(t){return Fe(t.id)&&Fe(t.filename)&&Fe(t.url)&&fd(t.thumbnailUrl)&&Fe(t.mimeType)}function nT(t){return Fe(t.id)&&Fe(t.title)&&Fe(t.modelId)&&Fe(t.modelApiKey)&&Fe(t.modelName)&&fd(t.modelEmoji)&&fd(t.thumbnailUrl)&&x7(t.isSingleton)}function rT(t){return Fe(t.id)&&Fe(t.apiKey)&&Fe(t.name)&&ZE(t.isBlockModel)}function E7(t){if(!t||typeof t!="string")return!1;const e=Date.parse(t);if(Number.isNaN(e))return!1;try{return new Date(e).toISOString().length>0}catch{return!1}}function xg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function oT(t){return xg(t)?Fe(t.name)&&Fe(t.email):!1}function T7(t){return oT(t)}function C7(t){return xg(t)?t.type==="text"?Fe(t.content):t.type==="mention"?t.mention!==null&&typeof t.mention=="object":!1:!1}function iT(t,e=new WeakSet){if(!xg(t)||e.has(t)||(e.add(t),!Fe(t.id))||!Fe(t.dateISO)||!E7(t.dateISO)||!oT(t.author)||!Array.isArray(t.content))return!1;for(const n of t.content)if(!C7(n))return!1;if(!Array.isArray(t.usersWhoUpvoted))return!1;for(const n of t.usersWhoUpvoted)if(!T7(n))return!1;if(t.parentCommentId!==void 0&&!Fe(t.parentCommentId))return!1;if(t.replies!==void 0){if(!Array.isArray(t.replies))return!1;for(const n of t.replies)if(!iT(n,e))return!1}return!0}function Ow(t){if(!Array.isArray(t))return!1;for(const e of t)if(!iT(e))return!1;return!0}const sT={field:{localized:!1},model:{isBlockModel:!1}},aT={localized:t=>t??sT.field.localized},lT={isBlockModel:t=>t??sT.model.isBlockModel};function M7(){return g.jsx("span",{style:{color:"#888",fontStyle:"italic",fontSize:"inherit"},children:"[invalid mention]"})}function O7(t){const e=t.type;if(typeof e!="string")return console.warn("[MentionNodeView] Invalid mention: type is not a string",{type:e,attrs:t}),null;switch(e){case"user":return XE(t)?{type:"user",id:t.id,name:t.name,email:t.email,avatarUrl:t.avatarUrl}:(console.warn("[MentionNodeView] Invalid user mention attrs",t),null);case"field":return eT(t)?{type:"field",apiKey:t.apiKey,label:t.label,localized:aT.localized(t.localized),fieldPath:t.fieldPath,locale:t.locale??void 0,fieldType:t.fieldType??void 0}:(console.warn("[MentionNodeView] Invalid field mention attrs",t),null);case"asset":return tT(t)?{type:"asset",id:t.id,filename:t.filename,url:t.url,thumbnailUrl:t.thumbnailUrl,mimeType:t.mimeType}:null;case"record":return nT(t)?{type:"record",id:t.id,title:t.title,modelId:t.modelId,modelApiKey:t.modelApiKey,modelName:t.modelName,modelEmoji:t.modelEmoji,thumbnailUrl:t.thumbnailUrl,isSingleton:t.isSingleton}:null;case"model":return rT(t)?{type:"model",id:t.id,apiKey:t.apiKey,name:t.name,isBlockModel:lT.isBlockModel(t.isBlockModel)}:null;default:return null}}function Ml(t,e=!1){return function({node:r}){const{onMentionClick:o}=k7(),{projectUsers:i}=Dy(),s=O7({...r.attrs,type:t});return g.jsx(k8,{as:"span",contentEditable:!1,children:s?g.jsx(S7,{mention:s,onClick:o,isInComposer:!0,...e&&{projectUsers:i}}):g.jsx(M7,{})})}}const N7=Ml("user",!0),A7=Ml("field"),I7=Ml("asset"),P7=Ml("record"),R7=Ml("model"),ct={user:"userMention",field:"fieldMention",asset:"assetMention",record:"recordMention",model:"modelMention"};function D7(t){return{...t}}function j7(t,e){switch(t){case ct.user:return XE(e)?{type:"user",id:e.id,name:e.name,email:e.email,avatarUrl:e.avatarUrl}:null;case ct.field:return eT(e)?{type:"field",apiKey:e.apiKey,label:e.label,localized:aT.localized(e.localized),fieldPath:e.fieldPath,locale:e.locale??void 0,fieldType:e.fieldType??void 0}:null;case ct.asset:return tT(e)?{type:"asset",id:e.id,filename:e.filename,url:e.url,thumbnailUrl:e.thumbnailUrl,mimeType:e.mimeType}:null;case ct.record:return nT(e)?{type:"record",id:e.id,title:e.title,modelId:e.modelId,modelApiKey:e.modelApiKey,modelName:e.modelName,modelEmoji:e.modelEmoji,thumbnailUrl:e.thumbnailUrl,isSingleton:e.isSingleton}:null;case ct.model:return rT(e)?{type:"model",id:e.id,apiKey:e.apiKey,name:e.name,isBlockModel:lT.isBlockModel(e.isBlockModel)}:null;default:return null}}function Nw(t){if(t.length===0)return{type:"doc",content:[{type:"paragraph"}]};const e=[];for(const n of t)if(n.type==="text"){const r=n.content.split(`
|
|
212
|
+
`);for(let o=0;o<r.length;o++){const i=r[o];i&&e.push({type:"text",text:i}),o<r.length-1&&e.push({type:"hardBreak"})}}else{const{mention:r}=n,o=ct[r.type];e.push({type:o,attrs:D7(r)})}return{type:"doc",content:[{type:"paragraph",content:e.length>0?e:void 0}]}}function pu(t){const e=[];let n="";const r=()=>{n&&(e.push({type:"text",content:n}),n="")},o=i=>{if(!i)return;if(i.type==="text"&&i.text){n+=i.text;return}if(i.type==="hardBreak"){n+=`
|
|
213
|
+
`;return}const s=i.type?Object.values(ct).find(a=>a===i.type):void 0;if(s){r();const a=j7(s,i.attrs??{});a&&e.push({type:"mention",mention:a});return}if(i.type==="paragraph"){if((e.length>0||n)&&(n+=`
|
|
214
|
+
`),i.content)for(const a of i.content)o(a);return}if(i.content)for(const a of i.content)o(a)};if(t.content)for(let i=0;i<t.content.length;i++)o(t.content[i]);for(r();e.length>0;){const i=e[0];if(i.type==="text"&&(i.content=i.content.replace(/^[\s\n\r]+/,""),!i.content)){e.shift();continue}break}return e}function Eg(t,e,n){const r=e.toLowerCase();return t.filter(o=>n(o).some(i=>i&&i.toLowerCase().includes(r)))}function Aw(t,e){return Eg(t,e,n=>[n.name,n.email])}function Iw(t,e){return Eg(t,e,n=>[n.apiKey,n.label,n.displayLabel])}function Pw(t,e){return Eg(t,e,n=>[n.apiKey,n.name])}const L7=({users:t,query:e,selectedIndex:n,onSelect:r,onClose:o,position:i="below"})=>{const s=e?`No users matching "${e}"`:"No users available";return g.jsx(Ny,{items:t,emptyMessage:s,headerText:"People",selectedIndex:n,onClose:o,position:i,keyExtractor:a=>a.id,renderItem:(a,u,l,c)=>g.jsxs("button",{ref:l?c:null,type:"button",className:ot(A.mentionOption,l&&A.mentionOptionSelected),onMouseDown:d=>{d.preventDefault(),r(a)},onClick:()=>r(a),children:[a.avatarUrl&&g.jsx("img",{src:a.avatarUrl,alt:`Avatar for ${a.name}`,className:A.mentionUserAvatar}),g.jsx("span",{className:A.mentionUserName,children:a.name})]})})};function Tg(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t,n=typeof e.id=="string"||typeof e.type=="string"||typeof e.itemTypeId=="string",r=e.attributes===void 0||typeof e.attributes=="object"&&e.attributes!==null;return n&&r}function us(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function pd(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Cg(t){return t==="modular_content"||t==="structured_text"||t==="single_block"||t==="rich_text"}function B7(t){return t.attributes!==void 0&&typeof t.attributes=="object"&&t.attributes!==null}function Rw(t){return t.__isStructuredTextBlock===!0&&typeof t.__dastIndex=="number"}function F7(t){if(!t||typeof t!="object")return!1;const e=t;if(e.item_item_type!==void 0){if(!us(e.item_item_type))return!1;const n=e.item_item_type;if(!Array.isArray(n.item_types)||!n.item_types.every(r=>typeof r=="string"))return!1}if(e.rich_text_blocks!==void 0){if(!us(e.rich_text_blocks))return!1;const n=e.rich_text_blocks;if(!Array.isArray(n.item_types)||!n.item_types.every(r=>typeof r=="string"))return!1}if(e.structured_text_blocks!==void 0){if(!us(e.structured_text_blocks))return!1;const n=e.structured_text_blocks;if(!Array.isArray(n.item_types)||!n.item_types.every(r=>typeof r=="string"))return!1}return!0}function $7(t){if(!t||typeof t!="object")return!1;const e=t;return!(e.editor!==void 0&&typeof e.editor!="string")}function Mg(t){if($7(t))return t.editor}function uT(t){if(F7(t))return t}function Tm(t){const e=t.itemTypeId??t.type;return typeof e=="string"?e:void 0}const z7=new Set(["id","type","itemTypeId","attributes","item","__dastIndex","__isStructuredTextBlock","blockModelId"]);function Dw(t){if(t.attributes&&typeof t.attributes=="object")return t.attributes;const e={};for(const n of Object.keys(t))z7.has(n)||(e[n]=t[n]);return e}function Og(t,e){return t?e==="structured_text"||e==="rich_text"?U7(t):Array.isArray(t)?t:[]:[]}function U7(t){return us(t)&&"document"in t?t.blocks??[]:us(t)&&"value"in t?t.blocks??[]:Array.isArray(t)?V7(t):[]}function V7(t){const e=t[0];if(e&&typeof e.itemTypeId=="string"&&!e.blockModelId)return t;const r=[];return t.forEach((o,i)=>{const s=o;typeof s.blockModelId=="string"&&r.push({node:s,originalIndex:i})}),r.map(({node:o,originalIndex:i})=>({...o,itemTypeId:o.blockModelId,type:o.blockModelId,__dastIndex:i,__isStructuredTextBlock:!0}))}function q7(t,e){return t.__isStructuredTextBlock&&t.__dastIndex!==void 0?t.__dastIndex:e}function Te(t,e,n){console.error(`[RecordComments] ${t}`,e,n)}function nf(t,e){if(!e||!t||typeof t!="object"||Array.isArray(t))return t;const n=t;return e in n?n[e]:t}function cT(t,e,n={}){if(!e)return t;const r=e.split(".");let o=t;for(const i of r){if(o==null)return;const s=parseInt(i,10);if(!Number.isNaN(s)&&Array.isArray(o))o=o[s];else if(pd(o))n.checkBlockAttributes&&o.attributes&&pd(o.attributes)?o=o.attributes[i]:o=o[i];else return}return o}function H7(t,e){return{getFieldValue:n=>J7(t,n,e)}}function W7(t){return{getFieldValue:e=>t[e]}}function dT(t,e){var n,r,o;return e?t==="modular_content"||t==="single_block"?((n=e.item_item_type)==null?void 0:n.item_types)??[]:t==="structured_text"?((r=e.structured_text_blocks)==null?void 0:r.item_types)??((o=e.rich_text_blocks)==null?void 0:o.item_types)??[]:[]:[]}function Ng(t,e){if(!us(t))return e.length>0?[...e]:void 0;const n=e.filter(r=>{const o=t[r];return!(o==null||typeof o=="string"&&o.trim()===""||Array.isArray(o)&&o.length===0)});return n.length>0?n:[...e]}async function jw(t){const{ctx:e,blockFields:n,blockAttrs:r,blockModelName:o,parentFieldLabel:i,basePath:s,depth:a,allLocales:u,blockIndex:l}=t,c=[],d=l!==void 0?` #${l+1}`:"";for(const f of n){const p=f.attributes.api_key,h=f.attributes.label,m=f.attributes.localized,v=f.attributes.field_type,y=Mg(f.attributes.appearance),w=`${s}.${p}`,b=`${i} > ${o}${d} > ${h}`,S=r[p],k=m?Ng(S,u):void 0,E=Cg(v),x=E?v:void 0;if(c.push({apiKey:p,label:h,localized:m,fieldPath:w,displayLabel:b,depth:a,availableLocales:k,fieldType:y,isBlockContainer:E,blockFieldType:x}),E){const T=uT(f.attributes.validators),O=dT(v,T),N=await fT(e,W7(r),{parentFieldApiKey:p,parentFieldLabel:h,parentFieldType:v,allowedBlockModelIds:O,allLocales:u,depth:a+1,basePath:s});c.push(...N)}}return c}async function fT(t,e,n){const{parentFieldApiKey:r,parentFieldLabel:o,parentFieldType:i,allowedBlockModelIds:s,allLocales:a,depth:u,basePath:l}=n,c=[],d=e.getFieldValue(r);if(i==="single_block"){if(Tg(d)){const f=Tm(d);if(f&&s.includes(f)){const p=t.itemTypes[f];if(p){const h=p.attributes.name,m=l?`${l}.${r}`:r,v=Dw(d),y=await t.loadItemTypeFields(f),w=await jw({ctx:t,blockFields:y,blockAttrs:v,blockModelName:h,parentFieldLabel:o,basePath:m,depth:u,allLocales:a});c.push(...w)}}}}else if(i==="modular_content"||i==="structured_text"){const f=Og(d,i);for(let p=0;p<f.length;p++){const h=f[p],m=Tm(h);if(!m){Te("loadNestedFieldsUnified: Block without model ID found",void 0,{parentFieldApiKey:r,blockIndex:p,basePath:l,blockKeys:Object.keys(h)});continue}const v=t.itemTypes[m];if(!v){Te("loadNestedFieldsUnified: Block references unknown model",void 0,{parentFieldApiKey:r,blockIndex:p,blockModelId:m,basePath:l});continue}const y=v.attributes.name,w=l?`${l}.${r}.${p}`:`${r}.${p}`,b=Dw(h),S=await t.loadItemTypeFields(m),k=await jw({ctx:t,blockFields:S,blockAttrs:b,blockModelName:y,parentFieldLabel:o,basePath:w,depth:u,allLocales:a,blockIndex:p});c.push(...k)}}return c}async function K7(t){const e=[],n=t.formValues,r=t.site.attributes.locales,o=await t.loadItemTypeFields(t.itemType.id);for(const i of o){const s=i.attributes.field_type,a=i.attributes.api_key,u=i.attributes.label,l=i.attributes.localized,c=uT(i.attributes.validators),d=Mg(i.attributes.appearance),f=n[a],p=l?Ng(f,r):void 0,h=Cg(s)?s:void 0;if(e.push({apiKey:a,label:u,localized:l,fieldPath:a,displayLabel:u,depth:0,availableLocales:p,fieldType:d,isBlockContainer:h!==void 0,blockFieldType:h}),h){const m=dT(s,c),v=await G7(t,n,a,u,s,m,r,1);e.push(...v)}}return e}async function G7(t,e,n,r,o,i,s,a,u=""){const l=H7(e,u);return fT(t,l,{parentFieldApiKey:n,parentFieldLabel:r,parentFieldType:o,allowedBlockModelIds:i,allLocales:s,depth:a,basePath:u||""})}function J7(t,e,n){if(!n)return t[e];const r=cT(t,n,{checkBlockAttributes:!0});if(pd(r))return pd(r.attributes)?r.attributes[e]:r[e]}function Y7(t,e,n,r){const o=t.formValues,i=pT(o,e),s=nf(i,r);if(n==="single_block"){if(Tg(s)){const u=Tm(s);if(u){const l=t.itemTypes[u];if(l)return[{index:0,modelId:u,modelName:l.attributes.name}]}}return[]}return Og(s,n).map((u,l)=>{const c=u.itemTypeId??u.type;if(!c)return null;const d=t.itemTypes[c];return d?{index:q7(u,l),modelId:c,modelName:d.attributes.name}:null}).filter(u=>u!==null)}async function Q7(t,e,n,r){const o=t.site.attributes.locales,i=await t.loadItemTypeFields(e),s=n??{};return i.map(a=>{const u=a.attributes.api_key,l=a.attributes.label,c=a.attributes.localized,d=a.attributes.field_type,f=Mg(a.attributes.appearance),p=r?`${r}.${u}`:u,h=Cg(d)?d:void 0,m=s[u],v=c?Ng(m,o):void 0;return{apiKey:u,label:l,localized:c,fieldPath:p,displayLabel:l,depth:0,availableLocales:v,fieldType:f,isBlockContainer:h!==void 0,blockFieldType:h}})}function pT(t,e){return cT(t,e,{checkBlockAttributes:!0})}function gp(t){return B7(t)?t.attributes:t}function X7(t,e,n,r,o){const i=t.formValues,s=pT(i,e),a=nf(s,o);if(r==="single_block")return Tg(a)?gp(a):null;const u=Og(a,r),l=u[0];if(l&&Rw(l)){const d=u.find(f=>Rw(f)&&f.__dastIndex===n);if(d)return gp(d)}else if(n>=0&&n<u.length){const d=u[n];return gp(d)}return null}function hT(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.type==="field")return n.field}return null}function Z7(t){for(const e of t)if(e.type==="locale")return e.locale}function eV(t){let e="",n=null;for(const r of t)r.type==="field"?(e=r.field.fieldPath,n=r.field):r.type==="locale"?e=`${e}.${r.locale}`:r.type==="block"&&(n==null?void 0:n.blockFieldType)!=="single_block"&&(e=`${e}.${r.blockIndex}`);return e}function tV(t){if(t.length===0)return"fields";const e=t[t.length-1];if(e.type==="block")return"nestedFields";if(e.type==="locale"){const n=hT(t);return n!=null&&n.isBlockContainer?"blocks":"fields"}if(e.type==="field"){const n=e.field;return n.localized&&n.availableLocales&&n.availableLocales.length>1?"locales":n.isBlockContainer?"blocks":"fields"}return"fields"}function nV(t){const e=[];for(const n of t)n.type==="field"?e.push(n.field.label):n.type==="locale"?e.push(`(${n.locale.toUpperCase()})`):n.type==="block"&&e.push(`${n.blockModelName} #${n.blockIndex+1}`);return e.join(" > ")}function vp(t,e,n,r,o){switch(t){case"ArrowDown":return n>0&&e(i=>(i+1)%n),!0;case"ArrowUp":return n>0&&e(i=>(i-1+n)%n),!0;case"Enter":case"Tab":return r(),!0;case"Escape":case"Backspace":return o(),!0;default:return!0}}function rV({ctx:t,onSelect:e,pendingFieldForLocale:n,onClearPendingField:r,selectedIndex:o}){const[i,s]=_.useState([]),[a,u]=_.useState(0),[l,c]=_.useState([]),[d,f]=_.useState([]),[p,h]=_.useState(!1),m=_.useRef(0),v=_.useMemo(()=>tV(i),[i]),y=_.useMemo(()=>hT(i),[i]),w=_.useMemo(()=>Z7(i),[i]),b=_.useMemo(()=>nV(i),[i]);_.useEffect(()=>{if(v==="blocks"&&(y==null?void 0:y.blockFieldType)==="single_block"&&l.length===1){const P=l[0];s(D=>[...D,{type:"block",blockIndex:P.index,blockModelId:P.modelId,blockModelName:P.modelName}]),u(0)}},[l,y,v]),_.useEffect(()=>{if(v!=="blocks"||!t){c([]);return}if(!(y!=null&&y.isBlockContainer)||!y.blockFieldType){c([]);return}h(!0);const P=Y7(t,y.fieldPath,y.blockFieldType,w);c(P),u(0),h(!1)},[i,t,y,v,w]),_.useEffect(()=>{if(v!=="nestedFields"||!t){f([]);return}let P=!0;return(async()=>{const q=++m.current;h(!0);let B=null;for(let L=i.length-1;L>=0;L--)if(i[L].type==="block"){B=i[L];break}if(!B||B.type!=="block"){if(!P||m.current!==q)return;f([]),h(!1);return}if(!(y!=null&&y.blockFieldType)){if(!P||m.current!==q)return;f([]),h(!1);return}const z=X7(t,y.fieldPath,B.blockIndex,y.blockFieldType,w);let K=y.fieldPath;y.blockFieldType!=="single_block"&&(K=`${K}.${B.blockIndex}`);const I=await Q7(t,B.blockModelId,z,K);!P||m.current!==q||(f(I),u(0),h(!1))})(),()=>{P=!1}},[i,t,y,v,w]),_.useEffect(()=>{n!=null&&n.isBlockContainer&&!n.localized&&i.length===0&&(s([{type:"field",field:n}]),u(0),r==null||r())},[n,i.length,r]);const S=_.useCallback(()=>{i.length>0&&(s(P=>P.slice(0,-1)),u(0)),r==null||r()},[i.length,r]),k=_.useCallback(P=>{if(P.isBlockContainer){s(z=>[...z,{type:"field",field:P}]),u(0);return}if(P.localized&&P.availableLocales&&P.availableLocales.length>1){s(z=>[...z,{type:"field",field:P}]),u(0);return}const D=eV(i),q=D?`${D}.${P.apiKey}`:P.fieldPath,B={...P,fieldPath:q,localized:P.localized||!!w};e(B,w),s([])},[i,w,e]),E=_.useCallback(P=>{y!=null&&y.isBlockContainer?(s(D=>[...D,{type:"locale",locale:P}]),u(0)):y&&(e(y,P),s([]))},[y,e]),x=_.useCallback(()=>{y&&(e(y,w),s([]))},[y,w,e]),T=_.useCallback(P=>{s(D=>[...D,{type:"block",blockIndex:P.index,blockModelId:P.modelId,blockModelName:P.modelName}]),u(0)},[]),O=_.useCallback(P=>{n&&(n.isBlockContainer?(s([{type:"field",field:n},{type:"locale",locale:P}]),u(0),r==null||r()):(e(n,P),r==null||r()))},[n,e,r]),N=_.useCallback(()=>{m.current++,s([]),u(0)},[]);_.useEffect(()=>{n!=null&&n.availableLocales&&i.length===0&&u(0)},[n,i.length]);const $=_.useCallback(P=>{if(n!=null&&n.availableLocales&&i.length===0){const D=n.availableLocales.length;if(P==="ArrowDown")return D>0&&u(q=>(q+1)%D),!0;if(P==="ArrowUp")return D>0&&u(q=>(q-1+D)%D),!0;if(P==="Enter"||P==="Tab"){const q=n.availableLocales[a];return q&&O(q),!0}return P==="Escape"?(r==null||r(),!0):!1}if(v==="blocks"){const D=l.length+1;return vp(P,u,D,()=>{if(a===0)x();else{const q=a-1;q<l.length&&T(l[q])}},S)}return v==="nestedFields"?vp(P,u,d.length,()=>{a<d.length&&k(d[a])},S):v==="locales"&&(y!=null&&y.availableLocales)?vp(P,u,y.availableLocales.length,()=>{a<y.availableLocales.length&&E(y.availableLocales[a])},S):!1},[v,a,l,d,y,x,T,k,E,S,n,i,o,r,O]);return{navigationStack:i,localSelectedIndex:a,setLocalSelectedIndex:u,currentBlocks:l,currentNestedFields:d,isLoadingBlocks:p,viewMode:v,currentField:y,selectedLocale:w,breadcrumb:b,handleBack:S,handleFieldClick:k,handleLocaleClick:E,handleBlockClick:T,handleSelectEntireField:x,handleKeyboardNavigation:$,handlePendingLocaleSelection:O,resetNavigation:N}}const oV=()=>g.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Go back"}),g.jsx("path",{fillRule:"evenodd",d:"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"})]});function hu({title:t,onBack:e,justClickedInsideRef:n}){return g.jsxs("div",{className:A.mentionHeader,children:[g.jsx("button",{type:"button",className:A.mentionBackButton,onMouseDown:r=>{r.preventDefault(),n.current=!0,e()},children:g.jsx(oV,{})}),t]})}function Lw({locales:t,selectedIndex:e,onSelect:n,onHover:r,selectedRef:o,justClickedInsideRef:i}){return g.jsx("div",{className:A.mentionList,role:"listbox","aria-label":"Select locale",children:t.map((s,a)=>g.jsxs("button",{ref:a===e?o:null,type:"button",role:"option","aria-selected":a===e,className:`${A.mentionOption} ${a===e?A.mentionOptionSelected:""}`,onMouseDown:u=>{u.preventDefault(),i.current=!0,n(s)},onClick:()=>n(s),onMouseEnter:()=>r(a),children:[g.jsx("span",{className:A.mentionLocaleBadge,children:s.toUpperCase()}),g.jsx("span",{className:A.mentionFieldLabel,children:s})]},s))})}function iV({blocks:t,selectedIndex:e,isLoading:n,onSelectEntireField:r,onSelectBlock:o,onHover:i,selectedRef:s,justClickedInsideRef:a}){return n?g.jsx("div",{className:A.mentionList,children:g.jsx("div",{className:A.mentionEmpty,children:"Loading blocks..."})}):g.jsxs("div",{className:A.mentionList,role:"listbox","aria-label":"Select block",children:[g.jsxs("button",{ref:e===0?s:null,type:"button",role:"option","aria-selected":e===0,className:`${A.mentionOption} ${A.mentionOptionEntireField} ${e===0?A.mentionOptionSelected:""}`,onMouseDown:u=>{u.preventDefault(),a.current=!0,r()},onClick:r,onMouseEnter:()=>i(0),children:[g.jsx("span",{className:A.mentionFieldLabel,children:"Select entire field"}),g.jsx("span",{className:A.mentionFieldMeta,children:g.jsxs("span",{className:A.mentionBlockCount,children:[t.length," block",t.length!==1?"s":""]})})]}),t.length===0?g.jsx("div",{className:A.mentionEmpty,children:"No blocks in this field"}):t.map((u,l)=>{const c=l+1;return g.jsxs("button",{ref:c===e?s:null,type:"button",role:"option","aria-selected":c===e,className:`${A.mentionOption} ${c===e?A.mentionOptionSelected:""}`,onMouseDown:d=>{d.preventDefault(),a.current=!0,o(u)},onClick:()=>o(u),onMouseEnter:()=>i(c),children:[g.jsxs("span",{className:A.mentionFieldLabel,children:[u.modelName," #",u.index+1]}),g.jsx("span",{className:A.mentionFieldMeta,children:g.jsx("span",{className:A.mentionBlockBadge,children:u.modelName})})]},`${u.modelId}-${u.index}`)})]})}function sV({fields:t,selectedIndex:e,isLoading:n,onSelect:r,onHover:o,selectedRef:i,justClickedInsideRef:s}){return n?g.jsx("div",{className:A.mentionList,children:g.jsx("div",{className:A.mentionEmpty,children:"Loading fields..."})}):t.length===0?g.jsx("div",{className:A.mentionList,children:g.jsx("div",{className:A.mentionEmpty,children:"No fields in this block"})}):g.jsx("div",{className:A.mentionList,children:t.map((a,u)=>{const l=a.availableLocales&&a.availableLocales.length>1,c=a.isBlockContainer;return g.jsxs("button",{ref:u===e?i:null,type:"button",className:`${A.mentionOption} ${u===e?A.mentionOptionSelected:""}`,onMouseDown:d=>{d.preventDefault(),s.current=!0,r(a)},onClick:()=>r(a),onMouseEnter:()=>o(u),children:[g.jsx("span",{className:A.mentionFieldLabel,children:a.label}),g.jsxs("span",{className:A.mentionFieldMeta,children:[c&&!l&&g.jsx("span",{className:A.mentionBlockIndicator,title:"Contains blocks",children:"▶"}),l&&g.jsx("span",{className:A.mentionLocaleIndicator,title:"Localized field",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M12.87 15.07l-2.54-2.51.03-.03A17.52 17.52 0 0014.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"})})}),g.jsxs("span",{className:A.mentionFieldApiKey,children:["#",a.apiKey]})]})]},a.fieldPath)})})}function aV({fields:t,selectedIndex:e,onSelect:n,selectedRef:r,justClickedInsideRef:o}){return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:A.mentionHeader,children:"Fields"}),g.jsx("div",{className:A.mentionList,role:"listbox",children:t.map((i,s)=>{const a=i.depth>0,u=i.availableLocales&&i.availableLocales.length>1,l=i.isBlockContainer;return g.jsxs("button",{ref:s===e?r:null,type:"button",role:"option","aria-selected":s===e,className:`${A.mentionOption} ${s===e?A.mentionOptionSelected:""}`,style:{paddingLeft:`${8+i.depth*12}px`},onMouseDown:c=>{c.preventDefault(),o.current=!0,n(i)},onClick:()=>n(i),children:[g.jsx("span",{className:A.mentionFieldLabel,children:a?i.displayLabel:i.label}),g.jsxs("span",{className:A.mentionFieldMeta,children:[l&&!u&&g.jsx("span",{className:A.mentionBlockIndicator,title:"Contains blocks",children:"▶"}),u&&g.jsx("span",{className:A.mentionLocaleIndicator,title:"Localized field",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M12.87 15.07l-2.54-2.51.03-.03A17.52 17.52 0 0014.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"})})}),g.jsxs("span",{className:A.mentionFieldApiKey,children:["#",i.apiKey]})]})]},i.fieldPath)})})]})}const lV=({fields:t,query:e,selectedIndex:n,onSelect:r,onClose:o,pendingFieldForLocale:i,onClearPendingField:s,ctx:a,registerKeyHandler:u,position:l="below"})=>{const c=ot(A.mentionDropdown,l==="above"&&A.mentionDropdownAbove),d=_.useRef(null),f=_.useRef(null),p=_.useRef(!1);TS(d,()=>{if(p.current){p.current=!1;return}o()});const{navigationStack:h,localSelectedIndex:m,setLocalSelectedIndex:v,currentBlocks:y,currentNestedFields:w,isLoadingBlocks:b,viewMode:S,currentField:k,breadcrumb:E,handleBack:x,handleFieldClick:T,handleLocaleClick:O,handleBlockClick:N,handleSelectEntireField:$,handleKeyboardNavigation:P,handlePendingLocaleSelection:D}=rV({ctx:a,onSelect:r,pendingFieldForLocale:i,onClearPendingField:s,selectedIndex:n});return _.useEffect(()=>{var q;(q=f.current)==null||q.scrollIntoView({block:"nearest",behavior:"smooth"})},[m,n]),_.useEffect(()=>{u&&u(P)},[u,P]),i!=null&&i.availableLocales&&h.length===0?g.jsxs("div",{ref:d,className:c,children:[g.jsx(hu,{title:`Select locale for ${i.label}`,onBack:()=>s==null?void 0:s(),justClickedInsideRef:p}),g.jsx(Lw,{locales:i.availableLocales,selectedIndex:m,onSelect:D,onHover:v,selectedRef:f,justClickedInsideRef:p})]}):S==="fields"&&t.length===0?g.jsx("div",{ref:d,className:c,children:g.jsx("div",{className:A.mentionEmpty,children:e?`No fields matching "${e}"`:"No fields available"})}):S==="locales"&&(k!=null&&k.availableLocales)?g.jsxs("div",{ref:d,className:c,children:[g.jsx(hu,{title:`Select locale for ${k.label}`,onBack:x,justClickedInsideRef:p}),g.jsx(Lw,{locales:k.availableLocales,selectedIndex:m,onSelect:O,onHover:v,selectedRef:f,justClickedInsideRef:p})]}):S==="blocks"?g.jsxs("div",{ref:d,className:c,children:[g.jsx(hu,{title:E,onBack:x,justClickedInsideRef:p}),g.jsx(iV,{blocks:y,selectedIndex:m,isLoading:b,onSelectEntireField:$,onSelectBlock:N,onHover:v,selectedRef:f,justClickedInsideRef:p})]}):S==="nestedFields"?g.jsxs("div",{ref:d,className:c,children:[g.jsx(hu,{title:E,onBack:x,justClickedInsideRef:p}),g.jsx(sV,{fields:w,selectedIndex:m,isLoading:b,onSelect:T,onHover:v,selectedRef:f,justClickedInsideRef:p})]}):g.jsx("div",{ref:d,className:c,children:g.jsx(aV,{fields:t,selectedIndex:n,onSelect:T,selectedRef:f,justClickedInsideRef:p})})},uV=({models:t,query:e,selectedIndex:n,onSelect:r,onClose:o,position:i="below"})=>{const s=e?`No models matching "${e}"`:"No models available";return g.jsx(Ny,{items:t,emptyMessage:s,headerText:"Models",selectedIndex:n,onClose:o,position:i,keyExtractor:a=>a.id,renderItem:(a,u,l,c)=>g.jsxs("button",{ref:l?c:null,type:"button",className:ot(A.mentionOption,l&&A.mentionOptionSelected),onMouseDown:d=>{d.preventDefault(),r(a)},onClick:()=>r(a),children:[g.jsxs("span",{className:A.mentionModelInfo,children:[g.jsx("span",{className:A.mentionModelName,children:a.name}),a.isBlockModel&&g.jsx("span",{className:A.mentionModelBadge,children:"Block"})]}),g.jsxs("span",{className:A.mentionFieldApiKey,children:["$",a.apiKey]})]})})},cV="_editor_161n9_3",dV="_editorLarge_161n9_20",Bw={editor:cV,editorLarge:dV},rf=_.forwardRef(({segments:t,onSegmentsChange:e,onSubmit:n,onCancel:r,onBlur:o,placeholder:i="Write a comment...",projectUsers:s,modelFields:a=[],projectModels:u,canMentionAssets:l=!0,canMentionModels:c=!0,canMentionFields:d=!0,onAssetTrigger:f,onRecordTrigger:p,autoFocus:h=!1,large:m=!1,dropdownPosition:v="below",ctx:y},w)=>{const b=ok(),[S,k]=_.useState(null),[E,x]=_.useState(0),T=_.useRef(null),O=_.useRef(null),[N,$]=_.useState(null);_.useEffect(()=>{T.current=S},[S]);const P=_.useRef(n),D=_.useRef(r),q=_.useRef(o),B=_.useRef(f),z=_.useRef(p),K=_.useRef(e),I=_.useRef(!0);_.useEffect(()=>()=>{I.current=!1,T.current=null,pe.current=null,O.current=null},[]),_.useEffect(()=>{P.current=n,D.current=r,q.current=o,B.current=f,z.current=p,K.current=e},[n,r,o,f,p,e]);const L=_.useRef(s),F=_.useRef(a),Z=_.useRef(u);_.useEffect(()=>{L.current=s,F.current=a,Z.current=u},[s,a,u]);const ie=_.useMemo(()=>(S==null?void 0:S.type)!=="user"?[]:Aw(s,S.query),[s,S]),ke=_.useMemo(()=>(S==null?void 0:S.type)!=="field"?[]:Iw(a,S.query),[a,S]),fe=_.useMemo(()=>(S==null?void 0:S.type)!=="model"?[]:Pw(u,S.query),[u,S]),Ne=_.useRef(0);_.useEffect(()=>{Ne.current=E},[E]);const pe=_.useRef(null),Ae=_.useCallback(G=>{O.current=G},[]),Ue=_.useCallback(()=>{$(null)},[]),pt=_.useCallback(G=>{var le;switch(G.type){case"user":b.handleNavigateToUsers();break;case"field":{const Y=G;(le=b.handleScrollToField)==null||le.call(b,Y.fieldPath,Y.localized,Y.locale);break}case"asset":{const Y=G;b.handleOpenAsset(Y.id);break}case"record":{const Y=G;b.handleOpenRecord(Y.id,Y.modelId);break}case"model":{const Y=G;b.handleNavigateToModel(Y.id,Y.isBlockModel);break}}},[b]),Ve=_.useMemo(()=>({onMentionClick:pt}),[pt]),Mn=_.useCallback((G,le)=>({char:le,allowSpaces:!1,items:()=>[],render:()=>({onStart:Y=>{k({type:G,query:Y.query,range:Y.range,clientRect:Y.clientRect??null}),x(0)},onUpdate:Y=>{k({type:G,query:Y.query,range:Y.range,clientRect:Y.clientRect??null}),x(0)},onExit:()=>{k(null),x(0),G==="field"&&($(null),O.current=null)},onKeyDown:Y=>{var Ce,qe;const{event:te,range:ye}=Y,ae=((Ce=T.current)==null?void 0:Ce.query)??"";if(G==="field"&&O.current&&O.current(te.key))return te.preventDefault(),!0;let we=[];if(G==="user"?we=Aw(L.current,ae):G==="field"?we=Iw(F.current,ae):G==="model"&&(we=Pw(Z.current,ae)),te.key==="ArrowDown")return we.length>0&&x(ut=>(ut+1)%we.length),!0;if(te.key==="ArrowUp")return we.length>0&&x(ut=>(ut-1+we.length)%we.length),!0;if(te.key==="Enter"||te.key==="Tab"){te.preventDefault();const ut=Ne.current,bt=we[ut],zn=pe.current;if(bt&&zn){if(G==="user"){const Ee=bt;zn.chain().focus().deleteRange(ye).insertContent([{type:ct.user,attrs:{type:"user",id:Ee.id,name:Ee.name,email:Ee.email,avatarUrl:Ee.avatarUrl}},{type:"text",text:" "}]).run(),k(null)}else if(G==="model"){const Ee=bt;zn.chain().focus().deleteRange(ye).insertContent([{type:ct.model,attrs:{type:"model",id:Ee.id,apiKey:Ee.apiKey,name:Ee.name,isBlockModel:Ee.isBlockModel}},{type:"text",text:" "}]).run(),k(null)}else if(G==="field"){const Ee=bt;Ee.isBlockContainer||Ee.localized&&Ee.availableLocales&&Ee.availableLocales.length>1?(Ee.localized&&Ee.availableLocales&&Ee.availableLocales.length>1||Ee.isBlockContainer)&&($(Ee),x(0)):(zn.chain().focus().deleteRange(ye).insertContent([{type:ct.field,attrs:{type:"field",apiKey:Ee.apiKey,label:Ee.label,localized:Ee.localized,fieldPath:Ee.fieldPath,locale:(qe=Ee.availableLocales)==null?void 0:qe[0],fieldType:Ee.fieldType}},{type:"text",text:" "}]).run(),k(null))}}return!0}return te.key==="Escape"?(k(null),!0):!1}})}),[]),_o=_.useMemo(()=>{const G=[],le=Ks({name:ct.user,mentionType:"user",nodeViewComponent:N7});if(G.push(le.configure({suggestion:Mn("user","@")})),d&&a.length>0){const ye=Ks({name:ct.field,mentionType:"field",nodeViewComponent:A7});G.push(ye.configure({suggestion:Mn("field","#")}))}if(c){const ye=Ks({name:ct.model,mentionType:"model",nodeViewComponent:R7});G.push(ye.configure({suggestion:Mn("model","$")}))}const Y=Ks({name:ct.asset,mentionType:"asset",nodeViewComponent:I7});G.push(Y);const te=Ks({name:ct.record,mentionType:"record",nodeViewComponent:P7});return G.push(te),G},[d,c,a,Mn]),se=b8({extensions:[d7.configure({blockquote:!1,bulletList:!1,codeBlock:!1,heading:!1,horizontalRule:!1,listItem:!1,orderedList:!1,paragraph:{},hardBreak:{},bold:!1,code:!1,italic:!1,strike:!1}),f7.configure({placeholder:i}),..._o],content:Nw(t),autofocus:h?"end":!1,editorProps:{handleKeyDown:(G,le)=>{var Y,te;if(le.key==="^"&&l&&B.current){const ye=B.current,ae=G;return setTimeout(()=>{try{const{state:we}=ae,{from:Ce}=we.selection;if(Ce>0){const qe=we.tr.delete(Ce-1,Ce);ae.dispatch(qe)}}catch{}ye()},0),!1}if(le.key==="&"&&z.current){const ye=z.current,ae=G;return setTimeout(()=>{try{const{state:we}=ae,{from:Ce}=we.selection;if(Ce>0){const qe=we.tr.delete(Ce-1,Ce);ae.dispatch(qe)}}catch{}ye()},0),!1}return le.key==="Enter"&&!le.shiftKey&&!S?(le.preventDefault(),(Y=P.current)==null||Y.call(P),!0):le.key==="Escape"&&!S?(le.preventDefault(),(te=D.current)==null||te.call(D),!0):!1}},onUpdate:({editor:G})=>{var te;const le=G.getJSON(),Y=pu(le);(te=K.current)==null||te.call(K,Y)},onBlur:()=>{var G;(G=q.current)==null||G.call(q)}});_.useEffect(()=>{pe.current=se},[se]);const Nr=_.useCallback(G=>{const le=T.current;if(!se||!le||le.type!=="user")return;const Y={type:"user",id:G.id,name:G.name,email:G.email,avatarUrl:G.avatarUrl};se.chain().focus().deleteRange(le.range).insertContent([{type:ct.user,attrs:Y},{type:"text",text:" "}]).run(),k(null)},[se]),So=_.useCallback((G,le)=>{const Y=T.current;if(!se||!Y||Y.type!=="field")return;const te={type:"field",apiKey:G.apiKey,label:G.label,localized:G.localized,fieldPath:G.fieldPath,locale:le,fieldType:G.fieldType};se.chain().focus().deleteRange(Y.range).insertContent([{type:ct.field,attrs:te},{type:"text",text:" "}]).run(),k(null)},[se]),Ar=_.useCallback(G=>{const le=T.current;if(!se||!le||le.type!=="model")return;const Y={type:"model",id:G.id,apiKey:G.apiKey,name:G.name,isBlockModel:G.isBlockModel};se.chain().focus().deleteRange(le.range).insertContent([{type:ct.model,attrs:Y},{type:"text",text:" "}]).run(),k(null)},[se]),$n=_.useCallback(()=>{k(null)},[]);_.useImperativeHandle(w,()=>({focus:()=>{se==null||se.chain().focus().run()},clear:()=>{se==null||se.chain().clearContent().run()},insertMention:G=>{if(!se)return;const le=ct[G.type],Y=pu(se.getJSON());Y.length===0||Y.length===1&&Y[0].type==="text"&&!Y[0].content.trim()?se.chain().focus().setContent({type:"doc",content:[{type:"paragraph",content:[{type:le,attrs:G},{type:"text",text:" "}]}]}).run():se.chain().focus().insertContent([{type:le,attrs:G},{type:"text",text:" "}]).run()},insertText:G=>{se==null||se.chain().focus().insertContent(G).run()},getSegments:()=>se?pu(se.getJSON()):[],isEmpty:()=>se?se.isEmpty:!0,getEditor:()=>se}),[se]);const ge=_.useRef(t);_.useEffect(()=>{if(!se)return;const G=pu(se.getJSON()),le=!il(ge.current,t),Y=il(G,t);if(le&&!Y){const{from:te,to:ye}=se.state.selection,ae=Nw(t);se.commands.setContent(ae,{emitUpdate:!1});const we=se.state.doc.content.size,Ce=Math.min(te,we-1),qe=Math.min(ye,we-1);Ce>0&&se.commands.setTextSelection({from:Ce,to:qe})}ge.current=t},[se,t]);const lt=`${Bw.editor}${m?` ${Bw.editorLarge}`:""}`;return g.jsx(QE.Provider,{value:Ve,children:g.jsxs("div",{style:{position:"relative"},children:[g.jsx("div",{className:lt,children:g.jsx(p8,{editor:se})}),(S==null?void 0:S.type)==="user"&&g.jsx(L7,{users:ie,query:S.query,selectedIndex:E,onSelect:Nr,onClose:$n,position:v}),(S==null?void 0:S.type)==="field"&&g.jsx(lV,{fields:ke,query:S.query,selectedIndex:E,onSelect:So,onClose:$n,pendingFieldForLocale:N,onClearPendingField:Ue,registerKeyHandler:Ae,ctx:y,position:v}),(S==null?void 0:S.type)==="model"&&g.jsx(uV,{models:fe,query:S.query,selectedIndex:E,onSelect:Ar,onClose:$n,position:v})]})})});rf.displayName="TipTapComposer";function fV({commentContent:t,isNewComment:e}){const n=_.useRef(null),[r,o]=_.useState(e),[i,s]=_.useState(t);return _.useEffect(()=>{r||s(t)},[t,r]),_.useEffect(()=>{r&&n.current&&n.current.focus()},[r]),{isEditing:r,setIsEditing:o,segments:i,setSegments:s,composerRef:n,handleStartEditing:()=>{s(t),o(!0)},resetToOriginal:()=>{s(t),o(!1)}}}const pV=`
|
|
215
|
+
query CommentsQuery($modelId: String!, $recordId: String!) {
|
|
216
|
+
allProjectComments(filter: { modelId: { eq: $modelId }, recordId: { eq: $recordId } }, first: 1) {
|
|
217
|
+
id
|
|
218
|
+
content
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
`;function gl(t){if(!t)return[];if(Array.isArray(t))return Ow(t)?t:(Te("parseComments: Array content failed validation",void 0,{arrayLength:t.length,firstItemType:t.length>0?typeof t[0]:"empty",hasNestedArrays:t.some(e=>Array.isArray(e))}),[]);if(typeof t=="string")try{const e=JSON.parse(t);return Ow(e)?e:(Te("parseComments: Parsed JSON failed validation",void 0,{contentLength:t.length,parsedType:typeof e,isArray:Array.isArray(e),parsedLength:Array.isArray(e)?e.length:void 0}),[])}catch(e){return Te("parseComments: JSON parsing failed",e,{contentLength:t.length,startsWithBracket:t.startsWith("[")||t.startsWith("{"),containsNullBytes:t.includes("\0")}),[]}return Te("parseComments: Unexpected content type",void 0,{contentType:typeof t}),[]}function Fw(t){return t.length===0?!0:t.every(e=>e.type==="text"&&e.content.trim()==="")}var mT={exports:{}},yT={exports:{}};(function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(n,r){return n<<r|n>>>32-r},rotr:function(n,r){return n<<32-r|n>>>r},endian:function(n){if(n.constructor==Number)return e.rotl(n,8)&16711935|e.rotl(n,24)&4278255360;for(var r=0;r<n.length;r++)n[r]=e.endian(n[r]);return n},randomBytes:function(n){for(var r=[];n>0;n--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(n){for(var r=[],o=0,i=0;o<n.length;o++,i+=8)r[i>>>5]|=n[o]<<24-i%32;return r},wordsToBytes:function(n){for(var r=[],o=0;o<n.length*32;o+=8)r.push(n[o>>>5]>>>24-o%32&255);return r},bytesToHex:function(n){for(var r=[],o=0;o<n.length;o++)r.push((n[o]>>>4).toString(16)),r.push((n[o]&15).toString(16));return r.join("")},hexToBytes:function(n){for(var r=[],o=0;o<n.length;o+=2)r.push(parseInt(n.substr(o,2),16));return r},bytesToBase64:function(n){for(var r=[],o=0;o<n.length;o+=3)for(var i=n[o]<<16|n[o+1]<<8|n[o+2],s=0;s<4;s++)o*8+s*6<=n.length*8?r.push(t.charAt(i>>>6*(3-s)&63)):r.push("=");return r.join("")},base64ToBytes:function(n){n=n.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],o=0,i=0;o<n.length;i=++o%4)i!=0&&r.push((t.indexOf(n.charAt(o-1))&Math.pow(2,-2*i+8)-1)<<i*2|t.indexOf(n.charAt(o))>>>6-i*2);return r}};yT.exports=e})();var hV=yT.exports,Cm={utf8:{stringToBytes:function(t){return Cm.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(Cm.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],n=0;n<t.length;n++)e.push(t.charCodeAt(n)&255);return e},bytesToString:function(t){for(var e=[],n=0;n<t.length;n++)e.push(String.fromCharCode(t[n]));return e.join("")}}},$w=Cm;/*!
|
|
222
|
+
* Determine if an object is a Buffer
|
|
223
|
+
*
|
|
224
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
225
|
+
* @license MIT
|
|
226
|
+
*/var mV=function(t){return t!=null&&(gT(t)||yV(t)||!!t._isBuffer)};function gT(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function yV(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&gT(t.slice(0,0))}(function(){var t=hV,e=$w.utf8,n=mV,r=$w.bin,o=function(i,s){i.constructor==String?s&&s.encoding==="binary"?i=r.stringToBytes(i):i=e.stringToBytes(i):n(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var a=t.bytesToWords(i),u=i.length*8,l=1732584193,c=-271733879,d=-1732584194,f=271733878,p=0;p<a.length;p++)a[p]=(a[p]<<8|a[p]>>>24)&16711935|(a[p]<<24|a[p]>>>8)&4278255360;a[u>>>5]|=128<<u%32,a[(u+64>>>9<<4)+14]=u;for(var h=o._ff,m=o._gg,v=o._hh,y=o._ii,p=0;p<a.length;p+=16){var w=l,b=c,S=d,k=f;l=h(l,c,d,f,a[p+0],7,-680876936),f=h(f,l,c,d,a[p+1],12,-389564586),d=h(d,f,l,c,a[p+2],17,606105819),c=h(c,d,f,l,a[p+3],22,-1044525330),l=h(l,c,d,f,a[p+4],7,-176418897),f=h(f,l,c,d,a[p+5],12,1200080426),d=h(d,f,l,c,a[p+6],17,-1473231341),c=h(c,d,f,l,a[p+7],22,-45705983),l=h(l,c,d,f,a[p+8],7,1770035416),f=h(f,l,c,d,a[p+9],12,-1958414417),d=h(d,f,l,c,a[p+10],17,-42063),c=h(c,d,f,l,a[p+11],22,-1990404162),l=h(l,c,d,f,a[p+12],7,1804603682),f=h(f,l,c,d,a[p+13],12,-40341101),d=h(d,f,l,c,a[p+14],17,-1502002290),c=h(c,d,f,l,a[p+15],22,1236535329),l=m(l,c,d,f,a[p+1],5,-165796510),f=m(f,l,c,d,a[p+6],9,-1069501632),d=m(d,f,l,c,a[p+11],14,643717713),c=m(c,d,f,l,a[p+0],20,-373897302),l=m(l,c,d,f,a[p+5],5,-701558691),f=m(f,l,c,d,a[p+10],9,38016083),d=m(d,f,l,c,a[p+15],14,-660478335),c=m(c,d,f,l,a[p+4],20,-405537848),l=m(l,c,d,f,a[p+9],5,568446438),f=m(f,l,c,d,a[p+14],9,-1019803690),d=m(d,f,l,c,a[p+3],14,-187363961),c=m(c,d,f,l,a[p+8],20,1163531501),l=m(l,c,d,f,a[p+13],5,-1444681467),f=m(f,l,c,d,a[p+2],9,-51403784),d=m(d,f,l,c,a[p+7],14,1735328473),c=m(c,d,f,l,a[p+12],20,-1926607734),l=v(l,c,d,f,a[p+5],4,-378558),f=v(f,l,c,d,a[p+8],11,-2022574463),d=v(d,f,l,c,a[p+11],16,1839030562),c=v(c,d,f,l,a[p+14],23,-35309556),l=v(l,c,d,f,a[p+1],4,-1530992060),f=v(f,l,c,d,a[p+4],11,1272893353),d=v(d,f,l,c,a[p+7],16,-155497632),c=v(c,d,f,l,a[p+10],23,-1094730640),l=v(l,c,d,f,a[p+13],4,681279174),f=v(f,l,c,d,a[p+0],11,-358537222),d=v(d,f,l,c,a[p+3],16,-722521979),c=v(c,d,f,l,a[p+6],23,76029189),l=v(l,c,d,f,a[p+9],4,-640364487),f=v(f,l,c,d,a[p+12],11,-421815835),d=v(d,f,l,c,a[p+15],16,530742520),c=v(c,d,f,l,a[p+2],23,-995338651),l=y(l,c,d,f,a[p+0],6,-198630844),f=y(f,l,c,d,a[p+7],10,1126891415),d=y(d,f,l,c,a[p+14],15,-1416354905),c=y(c,d,f,l,a[p+5],21,-57434055),l=y(l,c,d,f,a[p+12],6,1700485571),f=y(f,l,c,d,a[p+3],10,-1894986606),d=y(d,f,l,c,a[p+10],15,-1051523),c=y(c,d,f,l,a[p+1],21,-2054922799),l=y(l,c,d,f,a[p+8],6,1873313359),f=y(f,l,c,d,a[p+15],10,-30611744),d=y(d,f,l,c,a[p+6],15,-1560198380),c=y(c,d,f,l,a[p+13],21,1309151649),l=y(l,c,d,f,a[p+4],6,-145523070),f=y(f,l,c,d,a[p+11],10,-1120210379),d=y(d,f,l,c,a[p+2],15,718787259),c=y(c,d,f,l,a[p+9],21,-343485551),l=l+w>>>0,c=c+b>>>0,d=d+S>>>0,f=f+k>>>0}return t.endian([l,c,d,f])};o._ff=function(i,s,a,u,l,c,d){var f=i+(s&a|~s&u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._gg=function(i,s,a,u,l,c,d){var f=i+(s&u|a&~u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._hh=function(i,s,a,u,l,c,d){var f=i+(s^a^u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._ii=function(i,s,a,u,l,c,d){var f=i+(a^(s|~u))+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._blocksize=16,o._digestsize=16,mT.exports=function(i,s){if(i==null)throw new Error("Illegal argument "+i);var a=t.wordsToBytes(o(i,s));return s&&s.asBytes?a:s&&s.asString?r.bytesToString(a):t.bytesToHex(a)}})();var gV=mT.exports;const vV=di(gV);function yr(t,e=64){return`https://www.gravatar.com/avatar/${vV(t)}?d=mp&s=${e}`}function Ag(t,e,n,r=300){const o=t.startsWith("image/"),i=t.startsWith("video/");return o&&e?`${e}?w=${r}&fit=max&auto=format`:i&&n?`https://image.mux.com/${n}/thumbnail.jpg?width=${r}&fit_mode=preserve`:null}function Ig(t){return t.length===0?!0:t.length===1&&t[0].type==="text"?!t[0].content.trim():!1}function Mm(t){const e=t.attributes.mime_type??"application/octet-stream",n=t.attributes.url??"",r=Ag(e,n,t.attributes.mux_playback_id);return{type:"asset",id:t.id,filename:t.attributes.filename,url:n,thumbnailUrl:r,mimeType:e}}function wV(t,e){const n=t.email.toLowerCase().trim(),r=t.name.toLowerCase().trim();if(n){const o=e.find(i=>i.user.email&&i.user.email.toLowerCase().trim()===n);if(o)return o}if(r){const o=e.find(i=>i.user.name.toLowerCase().trim()===r);if(o)return o}return null}function bV(t,e){const n=wV(t,e);return n?n.user.name:t.name||t.email.split("@")[0]}function _V(t,e){const n=t.commentObject,r=e.commentObject;return n===r?zw(t,e):n.id!==r.id||!il(n.content,r.content)||!ek(n.usersWhoUpvoted,r.usersWhoUpvoted)||!tk(n.replies,r.replies)?!1:zw(t,e)}function zw(t,e){return t.currentUserEmail===e.currentUserEmail&&t.isReply===e.isReply&&t.canMentionFields===e.canMentionFields&&t.canMentionAssets===e.canMentionAssets&&t.canMentionModels===e.canMentionModels&&t.isPickerActive===e.isPickerActive&&t.modelFields===e.modelFields&&t.projectUsers===e.projectUsers&&t.projectModels===e.projectModels&&t.deleteComment===e.deleteComment&&t.editComment===e.editComment&&t.upvoteComment===e.upvoteComment&&t.replyComment===e.replyComment&&t.onPickerRequest===e.onPickerRequest}const vT=_.memo(function t({deleteComment:e,editComment:n,upvoteComment:r,replyComment:o,commentObject:i,currentUserEmail:s,isReply:a=!1,modelFields:u=[],projectUsers:l,projectModels:c,ctx:d,canMentionFields:f=!0,onPickerRequest:p,canMentionAssets:h=!1,canMentionModels:m=!0,isPickerActive:v=!1,typedUsers:y=[]}){const w=i.usersWhoUpvoted.some(ge=>ge.email===s),b=Fw(i.content),S="replies"in i,k=i.author.email===s,E=S?i.replies??[]:[],x=E.length,T=E.some(ge=>Fw(ge.content)),O=a?24:32,N=_.useMemo(()=>{var G,le;const ge=new Map,lt=new Map;for(let Y=0;Y<y.length;Y++){const te=y[Y].user,ye=(G=te.email)==null?void 0:G.toLowerCase().trim(),ae=(le=te.name)==null?void 0:le.toLowerCase().trim();ye&&!ge.has(ye)&&ge.set(ye,Y),ae&&!lt.has(ae)&<.set(ae,Y)}return{byEmail:ge,byName:lt}},[y]),$=_.useMemo(()=>{var Y,te;const ge=yr(i.author.email||"",O*2),lt=(Y=i.author.email)==null?void 0:Y.toLowerCase().trim(),G=(te=i.author.name)==null?void 0:te.toLowerCase().trim();let le=-1;if(lt&&(le=N.byEmail.get(lt)??-1),le===-1&&G&&(le=N.byName.get(G)??-1),le!==-1&&le<l.length){const ye=l[le];return{name:ye.name,avatarUrl:ye.avatarUrl??ge}}return{name:i.author.name,avatarUrl:ge}},[i.author,l,N,O]),P=$.avatarUrl,D=$.name,[q,B]=_.useState(!1),z=_.useRef(v);z.current=v;const{isEditing:K,setIsEditing:I,segments:L,setSegments:F,composerRef:Z,handleStartEditing:ie,resetToOriginal:ke}=fV({commentContent:i.content,isNewComment:b});_.useEffect(()=>{T&&!q&&B(!0)},[T,q]);const fe=_.useMemo(()=>i.usersWhoUpvoted.map(ge=>bV(ge,y)).join(", "),[i.usersWhoUpvoted,y]),Ne=_.useMemo(()=>Ig(L),[L]),pe=()=>{if(Ne){S?e(i.id):e(i.id,i.parentCommentId);return}I(!1),S?n(i.id,L):n(i.id,L,i.parentCommentId)},Ae=()=>{S?e(i.id):e(i.id,i.parentCommentId)},Ue=()=>{S?r(i.id,w):r(i.id,w,i.parentCommentId)},pt=()=>{B(!0),o(i.id)},Ve=()=>{b?Ae():ke()},Mn=()=>{setTimeout(()=>{Ne&&b&&!z.current&&Ae()},150)},_o=()=>{B(!q)},se=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("@")},[Z]),Nr=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("#")},[Z]),So=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("$")},[Z]),Ar=_.useCallback(()=>{p&&p("asset",Z)},[p,Z]),$n=_.useCallback(()=>{p&&p("record",Z)},[p,Z]);return g.jsxs("div",{className:ot(A.comment,a&&A.reply,k&&A.ownComment),children:[!K&&g.jsx(e4,{onUpvote:Ue,onReply:S?pt:void 0,onEdit:ie,onDelete:Ae,userUpvoted:w,userIsAuthor:k,isTopLevel:S,hasUpvotes:i.usersWhoUpvoted.length>0}),g.jsxs("div",{className:A.commentBody,style:{gridTemplateColumns:`${O}px 1fr`},children:[g.jsx("div",{className:A.avatarContainer,children:g.jsx("img",{className:A.avatar,src:P,alt:D,style:{width:O,height:O},onError:ge=>{const lt=ge.currentTarget;lt.onerror=null,lt.src=yr(i.author.email||"",O*2)}})}),g.jsxs("div",{className:A.content,children:[g.jsxs("div",{className:A.header,children:[g.jsx("span",{className:A.authorName,children:D}),g.jsx("span",{className:A.timestamp,children:g.jsx(ol,{date:new Date(i.dateISO)})})]}),K?g.jsx("div",{className:A.editContainer,children:g.jsxs(uk,{compact:!0,children:[g.jsx(rf,{ref:Z,segments:L,onSegmentsChange:F,onSubmit:pe,onCancel:Ve,onBlur:Mn,placeholder:"Write a comment...",projectUsers:l,modelFields:u,projectModels:c,canMentionAssets:h,canMentionModels:m,canMentionFields:f,onAssetTrigger:Ar,onRecordTrigger:$n,autoFocus:!0,ctx:d}),g.jsx(Ay,{onUserClick:se,onFieldClick:Nr,onRecordClick:$n,onAssetClick:Ar,onModelClick:So,onSendClick:pe,isSendDisabled:Ne,canMentionAssets:h&&!!p,canMentionModels:m,canMentionFields:f})]})}):g.jsx("div",{className:A.text,children:g.jsx(Y5,{segments:i.content})}),g.jsxs("div",{className:A.footer,children:[i.usersWhoUpvoted.length>0&&!K&&g.jsxs("div",{className:A.reactionWrapper,children:[g.jsxs("button",{type:"button",className:ot(A.reaction,w&&A.reactionActive),onClick:Ue,children:[g.jsx(CS,{role:"img","aria-labelledby":"upvoteIconTitle"}),g.jsx("title",{id:"upvoteIconTitle",children:"Upvote"}),g.jsx("span",{children:i.usersWhoUpvoted.length})]}),g.jsxs("div",{className:A.tooltip,children:[fe,g.jsx("div",{className:A.tooltipArrow})]})]}),S&&x>0&&!K&&g.jsxs("button",{type:"button",className:A.replyToggle,onClick:_o,"aria-expanded":q,"aria-label":`${q?"Collapse":"Expand"} ${x} ${x===1?"reply":"replies"}`,children:[g.jsx("div",{className:A.replyAvatars,children:(()=>{var G,le;const ge=new Set,lt=[];for(const Y of E){const te=((G=Y.author.email)==null?void 0:G.toLowerCase().trim())||((le=Y.author.name)==null?void 0:le.toLowerCase().trim())||Y.id;if(!ge.has(te)&&(ge.add(te),lt.push(Y),lt.length>=3))break}return lt.map((Y,te)=>{var Ee,As;const ye=yr(Y.author.email||"",40),ae=(Ee=Y.author.email)==null?void 0:Ee.toLowerCase().trim(),we=(As=Y.author.name)==null?void 0:As.toLowerCase().trim();let Ce=-1;ae&&(Ce=N.byEmail.get(ae)??-1),Ce===-1&&we&&(Ce=N.byName.get(we)??-1);const qe=Ce!==-1?l[Ce]:null,ut=(qe==null?void 0:qe.avatarUrl)??ye,bt=(qe==null?void 0:qe.name)??Y.author.name,zn=yr(Y.author.email||"",40);return g.jsx("img",{src:ut,alt:bt,className:A.replyAvatar,style:{zIndex:3-te},onError:af=>{const Bg=af.currentTarget;Bg.onerror=null,Bg.src=zn}},Y.id)})})()}),g.jsx("div",{className:A.replyMeta,children:g.jsxs("span",{className:A.replyText,children:[x," ",x===1?"reply":"replies"]})}),g.jsx(BR,{className:ot(A.chevron,q&&A.chevronExpanded),role:"img","aria-labelledby":"chevronTitle"}),g.jsx("title",{id:"chevronTitle",children:q?"Collapse":"Expand"})]})]})]})]}),S&&x>0&&q&&g.jsx("div",{className:A.replies,children:E.map(ge=>g.jsx(t,{deleteComment:e,editComment:n,upvoteComment:r,replyComment:o,commentObject:ge,currentUserEmail:s,isReply:!0,modelFields:u,projectUsers:l,projectModels:c,ctx:d,canMentionFields:f,onPickerRequest:p,canMentionAssets:h,canMentionModels:m,isPickerActive:v,typedUsers:y},ge.id))})]})},_V);class hd extends ue.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){Te("Comment rendering failed",e,{componentStack:n.componentStack})}render(){return this.state.hasError?g.jsx("div",{className:A.errorFallback,children:this.props.fallbackMessage??"Unable to display comment"}):this.props.children}}const SV=({comments:t,hasMoreComments:e,onLoadMore:n,currentUserEmail:r,modelFields:o,projectUsers:i,projectModels:s,deleteComment:a,editComment:u,upvoteComment:l,replyComment:c,onPickerRequest:d,canMentionAssets:f,canMentionModels:p,ctx:h,isPickerActive:m,typedUsers:v})=>t.length===0?g.jsxs("div",{className:He.empty,children:[g.jsx("p",{children:"No comments yet"}),g.jsx("span",{children:"Be the first to leave a comment on this record."})]}):g.jsxs("div",{className:He.commentsList,children:[t.map(y=>g.jsx(hd,{children:g.jsx(vT,{deleteComment:a,editComment:u,upvoteComment:l,replyComment:c,commentObject:y,currentUserEmail:r,modelFields:o,projectUsers:i,projectModels:s,onPickerRequest:d,canMentionAssets:f,canMentionModels:p,ctx:h,isPickerActive:m,typedUsers:v})},y.id)),e&&g.jsx("button",{type:"button",className:He.loadMoreButton,onClick:n,children:"Load more comments"})]}),kV=_.memo(SV);var wT={},Qn={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});class bT extends Error{constructor(e,n,r,o,i,s,a){super(e),this.name="GraphQLError",this.message=e,i&&(this.path=i),n&&(this.nodes=Array.isArray(n)?n:[n]),r&&(this.source=r),o&&(this.positions=o),s&&(this.originalError=s);var u=a;if(!u&&s){var l=s.extensions;l&&typeof l=="object"&&(u=l)}this.extensions=u||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}var ee,V;function Bt(t){return new bT(`Syntax Error: Unexpected token at ${V} in ${t}`)}function Uw(t){if(t.lastIndex=V,t.test(ee))return ee.slice(V,V=t.lastIndex)}var mu=/ +(?=[^\s])/y;function xV(t){for(var e=t.split(`
|
|
227
|
+
`),n="",r=0,o=0,i=e.length-1,s=0;s<e.length;s++)mu.lastIndex=0,mu.test(e[s])&&(s&&(!r||mu.lastIndex<r)&&(r=mu.lastIndex),o=o||s,i=s);for(var a=o;a<=i;a++)a!==o&&(n+=`
|
|
228
|
+
`),n+=e[a].slice(r).replace(/\\"""/g,'"""');return n}function be(){for(var t=0|ee.charCodeAt(V++);t===9||t===10||t===13||t===32||t===35||t===44||t===65279;t=0|ee.charCodeAt(V++))if(t===35)for(;(t=0|ee.charCodeAt(V++))&&t!==10&&t!==13;);V--}function Pg(){for(var t=V,e=0|ee.charCodeAt(V++);e>=48&&e<=57||e>=65&&e<=90||e===95||e>=97&&e<=122;e=0|ee.charCodeAt(V++));if(t===V-1)throw Bt("Name");var n=ee.slice(t,--V);return be(),n}function Gt(){return{kind:"Name",value:Pg()}}var EV=/(?:"""|(?:[\s\S]*?[^\\])""")/y,TV=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function ci(t){var e;switch(ee.charCodeAt(V)){case 91:V++,be();for(var n=[];ee.charCodeAt(V)!==93;)n.push(ci(t));return V++,be(),{kind:"ListValue",values:n};case 123:V++,be();for(var r=[];ee.charCodeAt(V)!==125;){var o=Gt();if(ee.charCodeAt(V++)!==58)throw Bt("ObjectField");be(),r.push({kind:"ObjectField",name:o,value:ci(t)})}return V++,be(),{kind:"ObjectValue",fields:r};case 36:if(t)throw Bt("Variable");return V++,{kind:"Variable",name:Gt()};case 34:if(ee.charCodeAt(V+1)===34&&ee.charCodeAt(V+2)===34){if(V+=3,(e=Uw(EV))==null)throw Bt("StringValue");return be(),{kind:"StringValue",value:xV(e.slice(0,-3)),block:!0}}else{var i=V,s;V++;var a=!1;for(s=0|ee.charCodeAt(V++);s===92&&(V++,a=!0)||s!==10&&s!==13&&s!==34&&s;s=0|ee.charCodeAt(V++));if(s!==34)throw Bt("StringValue");return e=ee.slice(i,V),be(),{kind:"StringValue",value:a?JSON.parse(e):e.slice(1,-1),block:!1}}case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var u=V++,l;(l=0|ee.charCodeAt(V++))>=48&&l<=57;);var c=ee.slice(u,--V);if((l=ee.charCodeAt(V))===46||l===69||l===101){if((e=Uw(TV))==null)throw Bt("FloatValue");return be(),{kind:"FloatValue",value:c+e}}else return be(),{kind:"IntValue",value:c};case 110:if(ee.charCodeAt(V+1)===117&&ee.charCodeAt(V+2)===108&&ee.charCodeAt(V+3)===108)return V+=4,be(),{kind:"NullValue"};break;case 116:if(ee.charCodeAt(V+1)===114&&ee.charCodeAt(V+2)===117&&ee.charCodeAt(V+3)===101)return V+=4,be(),{kind:"BooleanValue",value:!0};break;case 102:if(ee.charCodeAt(V+1)===97&&ee.charCodeAt(V+2)===108&&ee.charCodeAt(V+3)===115&&ee.charCodeAt(V+4)===101)return V+=5,be(),{kind:"BooleanValue",value:!1};break}return{kind:"EnumValue",value:Pg()}}function _T(t){if(ee.charCodeAt(V)===40){var e=[];V++,be();do{var n=Gt();if(ee.charCodeAt(V++)!==58)throw Bt("Argument");be(),e.push({kind:"Argument",name:n,value:ci(t)})}while(ee.charCodeAt(V)!==41);return V++,be(),e}}function Hr(t){if(ee.charCodeAt(V)===64){var e=[];do V++,e.push({kind:"Directive",name:Gt(),arguments:_T(t)});while(ee.charCodeAt(V)===64);return e}}function ST(){for(var t=0;ee.charCodeAt(V)===91;)t++,V++,be();var e={kind:"NamedType",name:Gt()};do if(ee.charCodeAt(V)===33&&(V++,be(),e={kind:"NonNullType",type:e}),t){if(ee.charCodeAt(V++)!==93)throw Bt("NamedType");be(),e={kind:"ListType",type:e}}while(t--);return e}function md(){if(ee.charCodeAt(V++)!==123)throw Bt("SelectionSet");return be(),yd()}function yd(){var t=[];do if(ee.charCodeAt(V)===46){if(ee.charCodeAt(++V)!==46||ee.charCodeAt(++V)!==46)throw Bt("SelectionSet");switch(V++,be(),ee.charCodeAt(V)){case 64:t.push({kind:"InlineFragment",typeCondition:void 0,directives:Hr(!1),selectionSet:md()});break;case 111:ee.charCodeAt(V+1)===110?(V+=2,be(),t.push({kind:"InlineFragment",typeCondition:{kind:"NamedType",name:Gt()},directives:Hr(!1),selectionSet:md()})):t.push({kind:"FragmentSpread",name:Gt(),directives:Hr(!1)});break;case 123:V++,be(),t.push({kind:"InlineFragment",typeCondition:void 0,directives:void 0,selectionSet:yd()});break;default:t.push({kind:"FragmentSpread",name:Gt(),directives:Hr(!1)})}}else{var e=Gt(),n=void 0;ee.charCodeAt(V)===58&&(V++,be(),n=e,e=Gt());var r=_T(!1),o=Hr(!1),i=void 0;ee.charCodeAt(V)===123&&(V++,be(),i=yd()),t.push({kind:"Field",alias:n,name:e,arguments:r,directives:o,selectionSet:i})}while(ee.charCodeAt(V)!==125);return V++,be(),{kind:"SelectionSet",selections:t}}function CV(){if(be(),ee.charCodeAt(V)===40){var t=[];V++,be();do{var e=void 0;if(ee.charCodeAt(V)===34&&(e=ci(!0)),ee.charCodeAt(V++)!==36)throw Bt("Variable");var n=Gt();if(ee.charCodeAt(V++)!==58)throw Bt("VariableDefinition");be();var r=ST(),o=void 0;ee.charCodeAt(V)===61&&(V++,be(),o=ci(!0)),be();var i={kind:"VariableDefinition",variable:{kind:"Variable",name:n},type:r,defaultValue:o,directives:Hr(!0)};e&&(i.description=e),t.push(i)}while(ee.charCodeAt(V)!==41);return V++,be(),t}}function MV(t){var e=Gt();if(ee.charCodeAt(V++)!==111||ee.charCodeAt(V++)!==110)throw Bt("FragmentDefinition");be();var n={kind:"FragmentDefinition",name:e,typeCondition:{kind:"NamedType",name:Gt()},directives:Hr(!1),selectionSet:md()};return t&&(n.description=t),n}function Vw(){var t=[];do{var e=void 0;if(ee.charCodeAt(V)===34&&(e=ci(!0)),ee.charCodeAt(V)===123){if(e)throw Bt("Document");V++,be(),t.push({kind:"OperationDefinition",operation:"query",name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:yd()})}else{var n=Pg();switch(n){case"fragment":t.push(MV(e));break;case"query":case"mutation":case"subscription":var r,o=void 0;(r=ee.charCodeAt(V))!==40&&r!==64&&r!==123&&(o=Gt());var i={kind:"OperationDefinition",operation:n,name:o,variableDefinitions:CV(),directives:Hr(!1),selectionSet:md()};e&&(i.description=e),t.push(i);break;default:throw Bt("Document")}}}while(V<ee.length);return t}var xi={};function qt(t,e,n){for(var r="",o=0;o<t.length;o++)o&&(r+=e),r+=n(t[o]);return r}function kT(t){return JSON.stringify(t)}function xT(t){return`"""
|
|
229
|
+
`+t.replace(/"""/g,'\\"""')+`
|
|
230
|
+
"""`}var qn=`
|
|
231
|
+
`,Ye={OperationDefinition(t){var e="";t.description&&(e+=Ye.StringValue(t.description)+`
|
|
232
|
+
`),e+=t.operation,t.name&&(e+=" "+t.name.value),t.variableDefinitions&&t.variableDefinitions.length&&(t.name||(e+=" "),e+="("+qt(t.variableDefinitions,", ",Ye.VariableDefinition)+")"),t.directives&&t.directives.length&&(e+=" "+qt(t.directives," ",Ye.Directive));var n=Ye.SelectionSet(t.selectionSet);return e!=="query"?e+" "+n:n},VariableDefinition(t){var e="";return t.description&&(e+=Ye.StringValue(t.description)+" "),e+=Ye.Variable(t.variable)+": "+sr(t.type),t.defaultValue&&(e+=" = "+sr(t.defaultValue)),t.directives&&t.directives.length&&(e+=" "+qt(t.directives," ",Ye.Directive)),e},Field(t){var e=t.alias?t.alias.value+": "+t.name.value:t.name.value;if(t.arguments&&t.arguments.length){var n=qt(t.arguments,", ",Ye.Argument);e.length+n.length+2>80?e+="("+(qn+=" ")+qt(t.arguments,qn,Ye.Argument)+(qn=qn.slice(0,-2))+")":e+="("+n+")"}return t.directives&&t.directives.length&&(e+=" "+qt(t.directives," ",Ye.Directive)),t.selectionSet&&t.selectionSet.selections.length&&(e+=" "+Ye.SelectionSet(t.selectionSet)),e},StringValue(t){return t.block?xT(t.value).replace(/\n/g,qn):kT(t.value)},BooleanValue:t=>""+t.value,NullValue:t=>"null",IntValue:t=>t.value,FloatValue:t=>t.value,EnumValue:t=>t.value,Name:t=>t.value,Variable:t=>"$"+t.name.value,ListValue:t=>"["+qt(t.values,", ",sr)+"]",ObjectValue:t=>"{"+qt(t.fields,", ",Ye.ObjectField)+"}",ObjectField:t=>t.name.value+": "+sr(t.value),Document(t){return!t.definitions||!t.definitions.length?"":qt(t.definitions,`
|
|
233
|
+
|
|
234
|
+
`,sr)},SelectionSet:t=>"{"+(qn+=" ")+qt(t.selections,qn,sr)+(qn=qn.slice(0,-2))+"}",Argument:t=>t.name.value+": "+sr(t.value),FragmentSpread(t){var e="..."+t.name.value;return t.directives&&t.directives.length&&(e+=" "+qt(t.directives," ",Ye.Directive)),e},InlineFragment(t){var e="...";return t.typeCondition&&(e+=" on "+t.typeCondition.name.value),t.directives&&t.directives.length&&(e+=" "+qt(t.directives," ",Ye.Directive)),e+=" "+Ye.SelectionSet(t.selectionSet)},FragmentDefinition(t){var e="";return t.description&&(e+=Ye.StringValue(t.description)+`
|
|
235
|
+
`),e+="fragment "+t.name.value,e+=" on "+t.typeCondition.name.value,t.directives&&t.directives.length&&(e+=" "+qt(t.directives," ",Ye.Directive)),e+" "+Ye.SelectionSet(t.selectionSet)},Directive(t){var e="@"+t.name.value;return t.arguments&&t.arguments.length&&(e+="("+qt(t.arguments,", ",Ye.Argument)+")"),e},NamedType:t=>t.name.value,ListType:t=>"["+sr(t.type)+"]",NonNullType:t=>sr(t.type)+"!"},sr=t=>Ye[t.kind](t);function Ta(t,e){switch(t.kind){case"NullValue":return null;case"IntValue":return parseInt(t.value,10);case"FloatValue":return parseFloat(t.value);case"StringValue":case"EnumValue":case"BooleanValue":return t.value;case"ListValue":for(var n=[],r=0,o=t.values.length;r<o;r++)n.push(Ta(t.values[r],e));return n;case"ObjectValue":for(var i=Object.create(null),s=0,a=t.fields.length;s<a;s++){var u=t.fields[s];i[u.name.value]=Ta(u.value,e)}return i;case"Variable":return e&&e[t.name.value]}}_t.BREAK=xi,_t.GraphQLError=bT,_t.Kind={NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType"},_t.OperationTypeNode={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"},_t.Source=function(e,n,r){return{body:e,name:n,locationOffset:r||{line:1,column:1}}},_t.isSelectionNode=function(e){return e.kind==="Field"||e.kind==="FragmentSpread"||e.kind==="InlineFragment"},_t.parse=function(e,n){return ee=e.body?e.body:e,V=0,be(),n&&n.noLocation?{kind:"Document",definitions:Vw()}:{kind:"Document",definitions:Vw(),loc:{start:0,end:ee.length,startToken:void 0,endToken:void 0,source:{body:ee,name:"graphql.web",locationOffset:{line:1,column:1}}}}},_t.parseType=function(e,n){return ee=e.body?e.body:e,V=0,ST()},_t.parseValue=function(e,n){return ee=e.body?e.body:e,V=0,be(),ci(!1)},_t.print=function(e){return qn=`
|
|
236
|
+
`,Ye[e.kind]?Ye[e.kind](e):""},_t.printBlockString=xT,_t.printString=kT,_t.valueFromASTUntyped=Ta,_t.valueFromTypeNode=function t(e,n,r){if(e.kind==="Variable")return r?t(r[e.name.value],n,r):void 0;if(n.kind==="NonNullType")return e.kind!=="NullValue"?t(e,n,r):void 0;if(e.kind==="NullValue")return null;if(n.kind==="ListType"){if(e.kind==="ListValue"){for(var o=[],i=0,s=e.values.length;i<s;i++){var a=t(e.values[i],n.type,r);if(a===void 0)return;o.push(a)}return o}}else if(n.kind==="NamedType")switch(n.name.value){case"Int":case"Float":case"String":case"Bool":return n.name.value+"Value"===e.kind?Ta(e,r):void 0;default:return Ta(e,r)}},_t.visit=function(e,n){var r=[],o=[];try{var i=function s(a,u,l){var c=!1,d=n[a.kind]&&n[a.kind].enter||n[a.kind]||n.enter,f=d&&d.call(n,a,u,l,o,r);if(f===!1)return a;if(f===null)return null;if(f===xi)throw xi;f&&typeof f.kind=="string"&&(c=f!==a,a=f),l&&r.push(l);var p,h={...a};for(var m in a){o.push(m);var v=a[m];if(Array.isArray(v)){for(var y=[],w=0;w<v.length;w++)v[w]!=null&&typeof v[w].kind=="string"&&(r.push(a),o.push(w),p=s(v[w],w,v),o.pop(),r.pop(),p==null?c=!0:(c=c||p!==v[w],y.push(p)));v=y}else v!=null&&typeof v.kind=="string"&&(p=s(v,m,a))!==void 0&&(c=c||v!==p,v=p);o.pop(),c&&(h[m]=v)}l&&r.pop();var b=n[a.kind]&&n[a.kind].leave||n.leave,S=b&&b.call(n,a,u,l,o,r);if(S===xi)throw xi;return S!==void 0?S:f!==void 0?c?h:f:c?h:a}(e);return i!==void 0&&i!==!1?i:e}catch(s){if(s!==xi)throw s;return e}};var Rg=it&&it.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ao=it&&it.__assign||function(){return Ao=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Ao.apply(this,arguments)},qw=it&&it.__awaiter||function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},Hw=it&&it.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Qn.__esModule=!0;Qn.subscribeToQuery=Qn.InvalidResponseError=Qn.Response400Error=Qn.Response500Error=void 0;var OV=_t,NV=function(){function t(e,n){this.type=e,this.data=n==null?void 0:n.data}return t}(),AV=typeof MessageEvent<"u"?MessageEvent:NV,ET=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.Response500Error=ET;var Om=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.Response400Error=Om;var TT=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.InvalidResponseError=TT;function CT(t){return qw(this,void 0,void 0,function(){var e,n,r,o,i,s,a,u,l,c,d,f,p,h,m,v,y,w,b,S,k,E,x,T,O,N,$,P=this;return Hw(this,function(D){switch(D.label){case 0:e=t.query,n=t.token,r=t.variables,o=t.preview,i=t.includeDrafts,s=t.excludeInvalid,a=t.environment,u=t.fetcher,l=t.eventSourceClass,c=t.onStatusChange,d=t.onUpdate,f=t.onChannelError,p=t.onError,h=t.onEvent,m=t.reconnectionPeriod,v=t.baseUrl,y=u||window.fetch,w=l||window.EventSource,b=Math.min(m||1e3,2e4),S=v||"https://graphql-listen.datocms.com",k=function(){return qw(P,void 0,void 0,function(){return Hw(this,function(q){switch(q.label){case 0:return[4,new Promise(function(B){return setTimeout(B,b)})];case 1:return q.sent(),[2,CT(Ao(Ao({},t),{reconnectionPeriod:b*2*(1+(Math.random()*.2-.1))}))]}})})},c&&c("connecting"),D.label=1;case 1:return D.trys.push([1,4,,5]),x=typeof e=="string"?e:(0,OV.print)(e),[4,y(S,{headers:Ao(Ao(Ao({Authorization:"Bearer ".concat(n),Accept:"application/json"},a?{"X-Environment":a}:{}),i||o?{"X-Include-Drafts":"true"}:{}),s?{"X-Exclude-Invalid":"true"}:{}),method:"POST",body:JSON.stringify({query:x,variables:r})})];case 2:if(T=D.sent(),T.status>=300&&T.status<500)throw new Om("Invalid status code: ".concat(T.status," ").concat(T.statusText),T);if(T.status>=500)throw new ET("Invalid status code: ".concat(T.status," ").concat(T.statusText),T);if(T.headers.get("Content-Type")!=="application/json")throw new TT("Invalid content type: ".concat(T.headers.get("Content-Type")),T);return[4,T.json()];case 3:return O=D.sent(),E=O.url,h&&h({status:"connecting",channelUrl:E,message:"Received channel URL",response:T}),[3,5];case 4:if(N=D.sent(),p&&($=new AV("FetchError",{data:N}),p($)),N instanceof Om)throw N;return c&&c("closed"),[2,k()];case 5:return[2,new Promise(function(q){var B=new w(E),z=!1,K=function(){B.readyState!==2&&(z=!0,B.close())};B.addEventListener("open",function(){c&&c("connected"),q(K)});var I=setInterval(function(){B.readyState===2&&(clearInterval(I),c&&c("closed"),z||k())},300);B.addEventListener("update",function(L){var F=JSON.parse(L.data);d(F)}),B.addEventListener("channelError",function(L){var F=JSON.parse(L.data);F.fatal&&(z=!0),f&&f(F),B.close()}),B.addEventListener("onerror",function(L){var F=L;p&&p(F),B.close()})})]}})})}Qn.subscribeToQuery=CT;(function(t){var e=it&&it.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(o,i);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,s,a)}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=it&&it.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&e(o,r,i)};t.__esModule=!0,n(Qn,t)})(wT);var Ww=Object.prototype.hasOwnProperty;function Kw(t,e,n){for(n of t.keys())if(Ca(n,e))return n}function Ca(t,e){var n,r,o;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Ca(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(o=r,o&&typeof o=="object"&&(o=Kw(e,o),!o)||!e.has(o))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(o=r[0],o&&typeof o=="object"&&(o=Kw(e,o),!o)||!Ca(r[1],e.get(o)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(Ww.call(t,n)&&++r&&!Ww.call(e,n)||!(n in e)||!Ca(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}function IV(t){var e=_.useRef(t),n=_.useRef(0);return Ca(t,e.current)||(e.current=t,n.current+=1),_.useMemo(function(){return e.current},[n.current])}function PV(t,e){return _.useEffect(t,IV(e))}var RV=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},DV=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 o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function jV(t){const{enabled:e,initialData:n}=t,r=DV(t,["enabled","initialData"]),[o,i]=_.useState(null),[s,a]=_.useState(null),[u,l]=_.useState(e?"connecting":"closed"),c=r;return PV(()=>{if(e===!1)return l("closed"),()=>{};let d;function f(){return RV(this,void 0,void 0,function*(){d=yield wT.subscribeToQuery(Object.assign(Object.assign({},c),{onStatusChange:p=>{l(p)},onUpdate:p=>{i(null),a(p.response.data)},onChannelError:p=>{a(null),i(p)}}))})}return f(),()=>{d&&d()}},[c]),{error:o,status:u,data:s||n}}function MT(t){return Object.values(t).find(e=>(e==null?void 0:e.attributes.api_key)===io)}function Gw(t){return Object.values(t).filter(e=>e!==void 0)}function OT(t){if(!t)return null;const n=t.attributes.icon;return typeof n=="string"?n:null}const LV=["token","unauthorized","401","403","authentication","forbidden"],BV=["network","fetch","connection","timeout","socket","econnrefused"],FV=["graphql","query","syntax","validation"];function wp(t,e){return e.some(n=>t.includes(n))}function $V(t){const e=t.message.toLowerCase();return wp(e,LV)?{type:"token_expired",message:"CDA token is invalid or expired. Please reconfigure in plugin settings."}:wp(e,BV)?{type:"network_error",message:"Connection lost. Attempting to reconnect..."}:wp(e,FV)?{type:"graphql_error",message:"Query error. Please refresh the page."}:{type:"unknown",message:"Sync error occurred. Please try again."}}function Dg(t){const e=t.message.toLowerCase();return e.includes("forbidden")||e.includes("401")||e.includes("403")?{type:"permission_denied",message:"Permission denied."}:e.includes("network")||e.includes("fetch")||e.includes("timeout")?{type:"network_error",message:"Network error. Check your connection."}:{type:"unknown",message:"Failed to load data."}}function NT(t){if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){const e=t;if(typeof e.message=="string")return new Error(e.message)}return new Error(String(t))}const gd={CONNECTING:"connecting",CLOSED:"closed"};function zV({ctx:t,realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o,query:i,variables:s,filterParams:a,subscriptionEnabled:u,onCommentRecordIdChange:l}){const[c,d]=_.useState([]),[f,p]=_.useState(null),[h,m]=_.useState(null),[v,y]=_.useState(!0),w=_.useCallback(I=>{m(I),l==null||l(I)},[l]),[b,S]=_.useState(0),k=_.useRef(0),E=_.useRef(null),{data:x,status:T,error:O}=jV({query:i,variables:s,token:n??"",enabled:u&&!!n&&e,includeDrafts:!0,reconnectionPeriod:b>0?100:void 0});_.useEffect(()=>{T==="connected"&&(k.current=0)},[T]),_.useEffect(()=>{if(O){const I=O instanceof Error?O.message:String(O),L=E.current,F=L instanceof Error?L.message:String(L??"");(!L||I!==F)&&(k.current+=1,E.current=O)}else E.current=null},[O]);const N=_.useCallback(async()=>{if(e){const I=k.current,L=Math.min(1e3*Math.pow(2,I),3e4);I>0&&await new Promise(F=>setTimeout(F,L)),S(F=>F+1)}else B.current=0,P(null),q(I=>I+1)},[e]);_.useEffect(()=>{const I=MT(t.itemTypes);I&&p(I.id)},[t.itemTypes]),_.useEffect(()=>{if(!e)return;const I=x==null?void 0:x.allProjectComments[0];x&&y(!1),!(!I||!o)&&(w(I.id),d(gl(I.content)))},[x,o,e,w,d]);const[$,P]=_.useState(null),[D,q]=_.useState(0),B=_.useRef(0);_.useEffect(()=>{if(e)return;if(!r||!f||!a.recordId){y(!1);return}let I=!0,L=null,F=null;const Z=3e4,ie=3,ke=async(fe=0)=>{if(!I)return;y(!0),fe===0&&P(null);const Ne=new Promise((pe,Ae)=>{L=setTimeout(()=>{I&&Ae(new Error(`CMA fetch timed out after ${Z/1e3} seconds`))},Z)});try{const pe=r.items.list({filter:{type:io,fields:{model_id:{eq:a.modelId},record_id:{eq:a.recordId}}}}),Ae=await Promise.race([pe,Ne]);if(L!==null&&(clearTimeout(L),L=null),!I)return;if(B.current=0,Ae.length>0){const Ue=Ae[0];typeof Ue.id=="string"&&w(Ue.id),d(gl(Ue.content))}y(!1)}catch(pe){if(L!==null&&(clearTimeout(L),L=null),!I)return;const Ae=pe instanceof Error?pe:new Error(String(pe));if(fe<ie){B.current=fe+1;const Ue=Math.min(1e3*Math.pow(2,fe),8e3);Te(`CMA fetch failed (attempt ${fe+1}/${ie+1}), retrying in ${Ue}ms`,Ae,{modelId:a.modelId,recordId:a.recordId}),F=setTimeout(()=>{I&&ke(fe+1)},Ue);return}Te("Failed to fetch comments (CMA fallback) after max retries",Ae,{modelId:a.modelId,recordId:a.recordId,attempts:fe+1}),P(Ae),y(!1)}};return ke(),()=>{I=!1,L!==null&&(clearTimeout(L),L=null),F!==null&&(clearTimeout(F),F=null)}},[e,r,a.modelId,a.recordId,f,D,w,d]);const z=O?NT(O):$,K=z?{error:z,...$V(z),consecutiveCount:k.current}:null;return{comments:c,setComments:d,commentsModelId:f,commentRecordId:h,setCommentRecordId:w,isLoading:v,error:z,errorInfo:K,status:T,retry:N}}const UV="_indicator_1rjaa_1",VV="_spinner_1rjaa_29",qV="_icon_1rjaa_52",HV="_text_1rjaa_62",WV="_count_1rjaa_66",KV="_retryButton_1rjaa_70",Ht={indicator:UV,spinner:VV,icon:qV,text:HV,count:WV,retryButton:KV};function GV({subscriptionStatus:t,subscriptionError:e,retryState:n,onRetry:r}){return n.isRetrying?g.jsxs("div",{className:Ht.indicator,"data-status":"retrying",role:"status","aria-live":"polite","aria-atomic":"true",children:[g.jsx("span",{className:Ht.spinner,"aria-hidden":"true"}),g.jsxs("span",{className:Ht.text,children:[n.message,n.retryCount>1&&g.jsxs("span",{className:Ht.count,children:[" (attempt ",n.retryCount,")"]})]})]}):e?g.jsxs("div",{className:Ht.indicator,"data-status":"error",role:"alert","aria-live":"assertive",children:[g.jsx("span",{className:Ht.icon,"aria-hidden":"true",children:"!"}),g.jsx("span",{className:Ht.text,children:"Sync error"}),r&&g.jsx("button",{type:"button",className:Ht.retryButton,onClick:r,children:"Retry"})]}):t===gd.CONNECTING?g.jsxs("div",{className:Ht.indicator,"data-status":"connecting",role:"status","aria-live":"polite",children:[g.jsx("span",{className:Ht.spinner,"aria-hidden":"true"}),g.jsx("span",{className:Ht.text,children:"Connecting..."})]}):t===gd.CLOSED?g.jsxs("div",{className:Ht.indicator,"data-status":"disconnected",role:"status","aria-live":"polite",children:[g.jsx("span",{className:Ht.icon,"aria-hidden":"true",children:"●"}),g.jsx("span",{className:Ht.text,children:"Offline"})]}):null}const JV=_.memo(GV);function Nm(t,e){return t.find(n=>n.id===e)}function YV(t,e){var n;return(n=t.replies)==null?void 0:n.find(r=>r.id===e)}function jg(t,e,n,r){if(n){const i=Nm(t,n);if(!i)return`${r.operationName}${n}`,{success:!1,result:{comments:t,status:"failed_parent_missing",failureReason:r.parentMissingReason}};const s=YV(i,e);return s?{success:!0,isReply:!0,parent:i,target:s}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(`${r.operationName}${e}${n}`,{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}const o=Nm(t,e);return o?{success:!0,isReply:!1,target:o}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(`${r.operationName}${e}`,{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}function AT(t,e,n,r){return n?t.map(o=>{var i;return o.id===n?{...o,replies:(i=o.replies)==null?void 0:i.map(s=>s.id===e?r(s):s)}:o}):t.map(o=>o.id===e?r(o):o)}function bp(t,e){switch(e.type){case"ADD_COMMENT":return QV(t,e);case"DELETE_COMMENT":return XV(t,e);case"EDIT_COMMENT":return ZV(t,e);case"UPVOTE_COMMENT":return e9(t,e);case"ADD_REPLY":return t9(t,e)}}function QV(t,e){return t.some(n=>n.id===e.comment.id)?{comments:t,status:"no_op_idempotent"}:{comments:[e.comment,...t],status:"applied"}}function XV(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"DELETE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:"The comment was deleted by another user.",targetNotFoundIsIdempotent:!0});return n.success?n.isReply?{comments:t.map(o=>{var i;return o.id===e.parentCommentId?{...o,replies:(i=o.replies)==null?void 0:i.filter(s=>s.id!==e.id)}:o}),status:"applied"}:{comments:t.filter(r=>r.id!==e.id),status:"applied"}:n.result}function ZV(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"EDIT_COMMENT",parentMissingReason:"Your edit could not be saved because the comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply you were editing was deleted by another user.":"The comment you were editing was deleted by another user."});return n.success?{comments:AT(t,e.id,e.parentCommentId,o=>({...o,content:e.newContent})),status:"applied"}:n.result}function e9(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"UPVOTE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply was deleted by another user.":"The comment was deleted by another user."});if(!n.success)return n.result;const r=i=>{const s=i.some(a=>a.email===e.user.email);return e.action==="add"?s?i:[...i,e.user]:i.filter(a=>a.email!==e.user.email)};return{comments:AT(t,e.id,e.parentCommentId,i=>({...i,usersWhoUpvoted:r(i.usersWhoUpvoted)})),status:"applied"}}function t9(t,e){var o;const n=Nm(t,e.parentCommentId);return n?(o=n.replies)!=null&&o.some(i=>i.id===e.reply.id)?{comments:t,status:"no_op_idempotent"}:{comments:t.map(i=>i.id!==e.parentCommentId?i:{...i,replies:[e.reply,...i.replies??[]]}),status:"applied"}:(`${e.parentCommentId}`,{comments:t,status:"failed_parent_missing",failureReason:"Your reply could not be saved because the comment was deleted by another user."})}const IT=t=>new Promise(e=>setTimeout(e,t));function PT(t,e,n,r=!1){const o=e*Math.pow(2,t),i=r?Math.random()*100:0;return Math.min(o+i,n)}function _p(t){const e={type:t.type};switch(t.type){case"ADD_COMMENT":return{...e,commentId:t.comment.id};case"DELETE_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"EDIT_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"UPVOTE_COMMENT":return{...e,id:t.id,action:t.action,parentCommentId:t.parentCommentId};case"ADD_REPLY":return{...e,parentCommentId:t.parentCommentId,replyId:t.reply.id};default:return e}}function RT({client:t,commentRecordId:e,commentsModelId:n,modelId:r,recordId:o,ctx:i,onRecordCreated:s}){const a=_.useRef([]),[u,l]=_.useState(!1),[c,d]=_.useState(0),[f,p]=_.useState({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null}),h=_.useCallback(()=>{p({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null})},[]),m=_.useCallback((N,$)=>{p({isRetrying:!0,operationType:N,retryCount:$,message:Lt.VERSION_CONFLICT_RETRYING,wasTerminated:!1,terminationReason:null})},[]),[v,y]=_.useState(!1),w=_.useRef(null),b=_.useRef(e);b.current=e,_.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]);const S=_.useCallback(()=>{w.current&&clearTimeout(w.current),y(!0),w.current=setTimeout(()=>{y(!1),w.current=null},Iu.SYNC_COOLDOWN_MS)},[]),k=_.useCallback(async N=>{if(!t||!o)return;let $=0;const P=Date.now();for(;;)try{const D=b.current;if(!D){if(!n)return;const K=await t.items.list({filter:{type:n,fields:{model_id:{eq:r},record_id:{eq:o}}},page:{limit:1}});if(K.length>0){const F=K[0],Z=gl(F.content),ie=bp(Z,N);if(ie.status==="failed_parent_missing"||ie.status==="failed_target_missing"){ie.failureReason&&i.alert(ie.failureReason),h();return}await t.items.update(F.id,{content:JSON.stringify(ie.comments),meta:{current_version:F.meta.current_version}}),s(F.id),S(),h();return}const I=bp([],N),L=await t.items.create({item_type:{type:"item_type",id:n},model_id:r,record_id:o,content:JSON.stringify(I.comments)});s(L.id),S(),h();return}const q=await t.items.find(D),B=gl(q.content),z=bp(B,N);if(z.status==="failed_parent_missing"||z.status==="failed_target_missing"){z.failureReason&&i.alert(z.failureReason),h();return}await t.items.update(D,{content:JSON.stringify(z.comments),meta:{current_version:q.meta.current_version}}),S(),h();return}catch(D){if(D instanceof qi&&D.findError("STALE_ITEM_VERSION")){if($++,$>=Qv.MAX_ATTEMPTS){Te("Retry terminated: max attempts reached for version conflict:",_p(N),{attempt:$}),i.alert(Lt.MAX_RETRIES_EXCEEDED),p({isRetrying:!1,operationType:N.type,retryCount:$,message:Lt.MAX_RETRIES_EXCEEDED,wasTerminated:!0,terminationReason:"max_attempts"});return}if(Date.now()-P>=Qv.MAX_DURATION_MS){Te("Retry terminated: timeout reached for version conflict:",_p(N),{attempt:$,durationMs:Date.now()-P}),i.alert(Lt.OPERATION_TIMEOUT),p({isRetrying:!1,operationType:N.type,retryCount:$,message:Lt.OPERATION_TIMEOUT,wasTerminated:!0,terminationReason:"timeout"});return}m(N.type,$);const q=PT($,Iu.VERSION_CONFLICT_BACKOFF_BASE,Iu.VERSION_CONFLICT_BACKOFF_MAX);await IT(q);continue}Te("Failed to save comment operation:",D,{op:_p(N)}),i.alert(Lt.SAVE_FAILED),h();return}},[t,n,r,o,i,s,S,h,m]),E=_.useRef(!1),x=_.useCallback(async()=>{if(!(E.current||a.current.length===0||!t)){E.current=!0,l(!0);try{for(;a.current.length>0;){const N=a.current[0];await k(N),a.current.shift(),d(a.current.length)}}catch(N){Te("Unexpected error in processQueue - operation removed from queue:",N),a.current.shift(),d(a.current.length)}finally{E.current=!1,l(!1)}}},[t,k]);return{enqueue:_.useCallback(N=>{a.current.push(N),d(a.current.length),x()},[x]),pendingCount:c,isProcessing:u,isSyncAllowed:c===0&&!v,retryState:f}}function An(t){return typeof t=="string"?t:null}function of(t){const e=t.indexOf("@");return e>0?t.slice(0,e):t}function n9(t,e=48){return{id:t.id,email:t.attributes.email,name:t.attributes.full_name??of(t.attributes.email),avatarUrl:yr(t.attributes.email,e)}}function r9(t,e=48){const n=t.attributes.username,r=t.attributes.first_name??"",o=t.attributes.last_name??"",i=[r,o].filter(Boolean).join(" ")||of(n),a=n.includes("@")?yr(n,e):null;return{id:t.id,email:n,name:i,avatarUrl:a}}function o9(t,e=48){const n=t.attributes??{};if(t.type==="account"){const o=An(t.email)??An(n.email)??"",i=An(t.first_name)??An(n.first_name)??"",s=An(t.last_name)??An(n.last_name)??"",a=[i,s].filter(Boolean).join(" ")||of(o)||"Account Owner";return{id:String(t.id),email:o,name:a,avatarUrl:o?yr(o,e):null}}const r=An(t.name)??An(n.name)??"Organization";return{id:String(t.id),email:"",name:r,avatarUrl:null}}function DT(t){const e=t.attributes,n=An(e.email)??"unknown@email.com",r=An(e.full_name)??An(e.name)??of(n);return{email:n,name:r}}function Jw(t,e,n){const{enabled:r=!0,operationName:o,errorContext:i,onError:s,onSuccess:a}=n,[u,l]=_.useState(null),[c,d]=_.useState(!1),[f,p]=_.useState(null),[h,m]=_.useState(0),v=_.useRef(0),y=_.useCallback(()=>{p(null),m(w=>w+1)},[]);return _.useEffect(()=>{if(!r)return;const w=++v.current;let b=!0;return d(!0),t().then(S=>{if(b&&w===v.current&&(l(S),p(null),d(!1),a))try{a(S)}catch(k){Te(`onSuccess callback for "${o}" threw an error`,k,i)}}).catch(S=>{if(!b||w!==v.current)return;const k=NT(S),E=Dg(k);if(Te(`Failed to ${o}`,S,i),p({source:o,message:E.message}),d(!1),s)try{s(k)}catch(x){Te(`onError callback for "${o}" threw an error`,x,i)}}),()=>{b=!1}},[r,h,...e]),{data:u,isLoading:c,error:f,retry:y}}function Sp(t){return"itemType"in t}function jT(t,e={}){const{loadFields:n=!1}=e,r=_.useMemo(()=>Gw(t.itemTypes).map(k=>k.id).sort().join(","),[t.itemTypes]),o=_.useMemo(()=>Gw(t.itemTypes).map(k=>({id:k.id,apiKey:k.attributes.api_key,name:k.attributes.name,isBlockModel:k.attributes.modular_block})),[r]),i=Sp(t)?t.itemType.id:null,s=t.site.id,a=_.useCallback(async()=>Sp(t)?K7(t):[],[i]),{data:u,error:l,retry:c}=Jw(a,[i],{enabled:n&&Sp(t)&&i!==null,operationName:"load fields",errorContext:{itemTypeId:i}}),d=_.useCallback(async()=>{const S=await Promise.allSettled([t.loadUsers(),t.loadSsoUsers()]),k=S[0].status==="fulfilled"?S[0].value:[],E=S[1].status==="fulfilled"?S[1].value:[];if(S[0].status==="rejected"&&Te("Failed to load regular users",S[0].reason,{siteId:s}),S[1].status==="rejected"&&Te("Failed to load SSO users",S[1].reason,{siteId:s}),S[0].status==="rejected"&&S[1].status==="rejected")throw new Error("Failed to load users. Please check your connection and try again.");const x=[];for(const P of k){const D=n9(P,48);x.push({user:D,userType:"user"})}for(const P of E){const D=r9(P,48);x.push({user:D,userType:"sso"})}const T=o9(t.owner,48),O=t.owner.type==="organization"?"org":"account";return x.some(P=>P.user.id===T.id)||x.unshift({user:T,userType:O}),{allUsers:x.map(P=>P.user),typedUsers:x}},[s]),{data:f,error:p,retry:h}=Jw(d,[s],{enabled:!0,operationName:"load users",errorContext:{siteId:s}}),m=_.useCallback(()=>{c(),h()},[c,h]),v=l||p,y=_.useMemo(()=>(f==null?void 0:f.allUsers)??[],[f]),w=_.useMemo(()=>(f==null?void 0:f.typedUsers)??[],[f]),b=_.useMemo(()=>u??[],[u]);return{projectUsers:y,projectModels:o,modelFields:b,loadError:v,retry:m,typedUsers:w}}function LT({composerRef:t,canMentionModels:e=!0,handleAssetTrigger:n,handleRecordTrigger:r}){const o=_.useCallback(()=>{t.current&&(t.current.insertText("@"),t.current.focus())},[t]),i=_.useCallback(()=>{t.current&&(t.current.insertText("#"),t.current.focus())},[t]),s=_.useCallback(()=>{e&&t.current&&(t.current.insertText("$"),t.current.focus())},[t,e]),a=_.useCallback(()=>{n==null||n()},[n]),u=_.useCallback(()=>{r==null||r()},[r]);return{handleUserToolbarClick:o,handleFieldToolbarClick:i,handleModelToolbarClick:s,handleAssetToolbarClick:a,handleRecordToolbarClick:u}}const i9=`
|
|
237
|
+
query GlobalCommentsQuery($modelId: String!, $recordId: String!) {
|
|
238
|
+
allProjectComments(
|
|
239
|
+
filter: {
|
|
240
|
+
modelId: { eq: $modelId },
|
|
241
|
+
recordId: { eq: $recordId }
|
|
242
|
+
}
|
|
243
|
+
first: 1
|
|
244
|
+
) {
|
|
245
|
+
id
|
|
246
|
+
content
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
`;function s9(t){return t.context==="record"}function BT(t){var f,p;const{realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o}=t,i=s9(t);let s,a,u,l,c;i?(s=t.ctx.itemType.id,a=((f=t.ctx.item)==null?void 0:f.id)??"",u=pV,l=!!((p=t.ctx.item)!=null&&p.id),c=t.onCommentRecordIdChange):(s=jy,a=ak,u=i9,l=!0,c=void 0);const d=zV({ctx:t.ctx,realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o,query:u,variables:{modelId:s,recordId:a},filterParams:{modelId:s,recordId:a},subscriptionEnabled:l,onCommentRecordIdChange:c});return{comments:d.comments,setComments:d.setComments,isLoading:d.isLoading,error:d.error,errorInfo:d.errorInfo,status:d.status,retry:d.retry,fullResult:d}}function a9(t){return t.length===0?!0:!t.some(e=>e.type==="text"?e.content.trim().length>0:e.type==="mention")}function FT(t,e){return t.trim().length>0&&e.trim().length>0}function Yw(t,e,n){return n?t.filter(r=>r.email!==e.email):[...t,e]}function l9(t,e,n){return n?t.map(r=>{var o;return r.id===n?{...r,replies:(o=r.replies)==null?void 0:o.filter(i=>i.id!==e)}:r}):t.filter(r=>r.id!==e)}function u9(t,e,n,r){return r?t.map(o=>{var i;return o.id===r?{...o,replies:(i=o.replies)==null?void 0:i.map(s=>s.id===e?{...s,content:n}:s)}:o}):t.map(o=>o.id===e?{...o,content:n}:o)}function c9(t,e,n,r,o){return o?t.map(i=>{var s;return i.id===o?{...i,replies:(s=i.replies)==null?void 0:s.map(a=>a.id===e?{...a,usersWhoUpvoted:Yw(a.usersWhoUpvoted,n,r)}:a)}:i}):t.map(i=>i.id===e?{...i,usersWhoUpvoted:Yw(i.usersWhoUpvoted,n,r)}:i)}function Qw(t,e,n,r){if(!FT(e,n))throw new Error("Cannot create comment: author name and email are required");const o=crypto.randomUUID(),i=new Date().toISOString();return r?{id:o,dateISO:i,content:t,author:{name:e,email:n},usersWhoUpvoted:[],parentCommentId:r}:{id:o,dateISO:i,content:t,author:{name:e,email:n},usersWhoUpvoted:[],replies:[]}}function d9(t,e,n,r){var i,s;((i=t.current)==null?void 0:i.has(e))??!1?(s=t.current)==null||s.delete(e):r({type:"DELETE_COMMENT",id:e,parentCommentId:n})}function $T({userEmail:t,userName:e,setComments:n,enqueue:r,composerSegments:o,setComposerSegments:i,pendingNewReplies:s,insertPosition:a="prepend",ctx:u}){const l=_.useCallback(()=>{var m;if(a9(o))return;if(!FT(e,t)){u==null||u.alert(Lt.MISSING_USER_INFO);return}if(u&&!((m=u.item)!=null&&m.id)){u.alert(Lt.SAVE_RECORD_FIRST);return}const h=Qw(o,e,t);n(a==="prepend"?v=>[h,...v]:v=>[...v,h]),r({type:"ADD_COMMENT",comment:h}),i([])},[o,u,t,e,n,r,i,a]),c=_.useCallback((h,m)=>{n(v=>l9(v,h,m)),d9(s,h,m,r)},[n,r,s]),d=_.useCallback((h,m,v)=>{var w,b;const y=((w=s.current)==null?void 0:w.has(h))??!1;n(S=>u9(S,h,m,v)),y&&v?((b=s.current)==null||b.delete(h),n(S=>{var T;const k=S.find(O=>O.id===v),E=(T=k==null?void 0:k.replies)==null?void 0:T.find(O=>O.id===h),x=(E==null?void 0:E.dateISO)??new Date().toISOString();return r({type:"ADD_REPLY",parentCommentId:v,reply:{id:h,dateISO:x,content:m,author:{name:e,email:t},usersWhoUpvoted:[],parentCommentId:v}}),S})):r({type:"EDIT_COMMENT",id:h,newContent:m,parentCommentId:v})},[e,t,n,r,s]),f=_.useCallback((h,m,v)=>{const y={name:e,email:t};n(w=>c9(w,h,y,m,v)),r({type:"UPVOTE_COMMENT",id:h,action:m?"remove":"add",user:y,parentCommentId:v})},[t,e,n,r]),p=_.useCallback(h=>{var v;const m=Qw([],e,t,h);(v=s.current)==null||v.add(m.id),n(y=>y.map(w=>w.id!==h?w:a==="prepend"?{...w,replies:[m,...w.replies??[]]}:{...w,replies:[...w.replies??[],m]}))},[t,e,n,s,a]);return{submitNewComment:l,deleteComment:c,editComment:d,upvoteComment:f,replyComment:p}}function f9(t){const e=t.currentRole,n=t.environment,r=e.attributes.positive_upload_permissions||[],o=e.attributes.negative_upload_permissions||[];return r.some(a=>a.environment===n&&(a.action==="all"||a.action==="read"))?!o.some(a=>a.environment===n&&(a.action==="all"||a.action==="read")):!1}function p9(t){return t.currentRole.meta.final_permissions.can_edit_schema}function h9(t,e){const n=t.currentRole,r=t.environment,o=n.attributes.positive_item_type_permissions||[],i=n.attributes.negative_item_type_permissions||[];return o.some(u=>u.environment===r&&(u.action==="all"||u.action==="read")&&(u.item_type===null||u.item_type===e))?!i.some(u=>u.environment===r&&(u.action==="all"||u.action==="read")&&(u.item_type===null||u.item_type===e)):!1}function m9(t,e){return e.filter(n=>h9(t,n.id))}function zT(t,e){const n=_.useMemo(()=>f9(t),[t.currentRole,t.environment]),r=_.useMemo(()=>p9(t),[t.currentRole]),o=_.useMemo(()=>m9(t,e),[t.currentRole,t.environment,e]);return{canMentionAssets:n,canMentionModels:r,readableModels:o}}const UT=_.createContext(null);function VT({children:t,canMentionFields:e=!0,canMentionAssets:n=!1,canMentionModels:r=!0}){const o=_.useMemo(()=>({canMentionFields:e,canMentionAssets:n,canMentionModels:r}),[e,n,r]);return g.jsx(UT.Provider,{value:o,children:t})}function y9(){const t=_.useContext(UT);if(!t)throw new Error("useMentionPermissionsContext must be used within a MentionPermissionsProvider");return t}function g9(t){return t?Sd({apiToken:t}):null}function v9(t){return typeof t=="object"&&!!t&&"data"in t}function Xw({__itemTypeId:t,id:e,type:n,attributes:r,relationships:o,meta:i}){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t?{__itemTypeId:t}:{}),e?{id:e}:{}),n?{type:n}:{}),r||{}),o?Object.fromEntries(Object.entries(o).map(([s,a])=>[s,a==null?void 0:a.data])):{}),i?{meta:i}:{})}function tn(t){if(!v9(t))throw new Error("Invalid body!");return Array.isArray(t.data)?t.data.map(Xw):Xw(t.data)}function w9(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"link":return e.validators.item_item_type.item_types;case"links":return e.validators.items_item_type.item_types;case"structured_text":return e.validators.structured_text_links.item_types;default:return[]}}function kp(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"single_block":return e.validators.single_block_blocks.item_types;case"rich_text":return e.validators.rich_text_blocks.item_types;case"structured_text":return[...e.validators.structured_text_blocks.item_types,...e.validators.structured_text_inline_blocks?e.validators.structured_text_inline_blocks.item_types:[]];default:return[]}}var _e=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};class b9{constructor(e){this.itemTypesPromise=null,this.itemTypesByApiKey=new Map,this.itemTypesById=new Map,this.fieldsByItemType=new Map,this.fieldsetsByItemType=new Map,this.pluginsPromise=null,this.pluginsById=new Map,this.pluginsByPackageName=new Map,this.prefetchPromise=null,this.client=e}loadItemTypes(){return _e(this,void 0,void 0,function*(){return this.itemTypesPromise||(this.itemTypesPromise=_e(this,void 0,void 0,function*(){const{data:e}=yield this.client.itemTypes.rawList();for(const n of e)this.itemTypesByApiKey.set(n.attributes.api_key,n),this.itemTypesById.set(n.id,n);return e})),this.itemTypesPromise})}getAllItemTypes(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawItemTypes();return tn({data:e})})}getAllRawItemTypes(){return _e(this,void 0,void 0,function*(){return yield this.loadItemTypes()})}getAllModels(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawModels();return tn({data:e})})}getAllRawModels(){return _e(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>!n.attributes.modular_block)})}getAllBlockModels(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawBlockModels();return tn({data:e})})}getAllRawBlockModels(){return _e(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>n.attributes.modular_block)})}getItemTypeByApiKey(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeByApiKey(e);return tn({data:n})})}getRawItemTypeByApiKey(e){return _e(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesByApiKey.get(e);if(!n)throw new Error(`Item type with API key '${e}' not found`);return n})}getItemTypeById(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeById(e);return tn({data:n})})}getRawItemTypeById(e){return _e(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesById.get(e);if(!n)throw new Error(`Item type with ID '${e}' not found`);return n})}getItemTypeFields(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFields(e);return tn({data:n})})}getRawItemTypeFields(e){return _e(this,void 0,void 0,function*(){const n=this.fieldsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fields.rawList(e.id);return this.fieldsByItemType.set(e.id,r),r})}getItemTypeFieldsets(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFieldsets(e);return tn({data:n})})}getRawItemTypeFieldsets(e){return _e(this,void 0,void 0,function*(){const n=this.fieldsetsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fieldsets.rawList(e.id);return this.fieldsetsByItemType.set(e.id,r),r})}loadPlugins(){return _e(this,void 0,void 0,function*(){return this.pluginsPromise||(this.pluginsPromise=_e(this,void 0,void 0,function*(){const{data:e}=yield this.client.plugins.rawList();for(const n of e)this.pluginsById.set(n.id,n),n.attributes.package_name&&this.pluginsByPackageName.set(n.attributes.package_name,n);return e})),this.pluginsPromise})}getAllPlugins(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawPlugins();return tn({data:e})})}getAllRawPlugins(){return _e(this,void 0,void 0,function*(){return yield this.loadPlugins()})}getPluginById(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawPluginById(e);return tn({data:n})})}getRawPluginById(e){return _e(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsById.get(e);if(!n)throw new Error(`Plugin with ID '${e}' not found`);return n})}getPluginByPackageName(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawPluginByPackageName(e);return tn({data:n})})}getRawPluginByPackageName(e){return _e(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsByPackageName.get(e);if(!n)throw new Error(`Plugin with package name '${e}' not found`);return n})}prefetchAllModelsAndFields(){return _e(this,void 0,void 0,function*(){if(this.prefetchPromise)return this.prefetchPromise;const e=()=>_e(this,void 0,void 0,function*(){const{included:n}=yield this.client.site.rawFind({include:"item_types,item_types.fields"});if(!n)return;const r=n.filter(s=>s.type==="item_type"),o=n.filter(s=>s.type==="field");this.itemTypesPromise=Promise.resolve(r);for(const s of r)this.itemTypesByApiKey.set(s.attributes.api_key,s),this.itemTypesById.set(s.id,s);const i=new Map;for(const s of o){const a=s.relationships.item_type.data.id;i.has(a)||i.set(a,[]),i.get(a).push(s)}for(const[s,a]of i)this.fieldsByItemType.set(s,a)});return this.prefetchPromise=e(),this.prefetchPromise})}getRawModelsEmbeddingBlocks(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set(e.map(s=>s.id)),o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return!1;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=kp(l);if(c.some(f=>r.has(f)))return!0;const d=c.map(f=>n.find(p=>p.id===f));for(const f of d)if(yield i(f,new Set(a)))return!0}return!1});for(const s of n)(yield i(s))&&o.push(s);return o})}getModelsEmbeddingBlocks(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawModelsEmbeddingBlocks(e);return tn({data:n})})}getRawNestedBlocks(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=kp(l);for(const d of c)if(!r.has(d)){r.add(d);const f=n.find(p=>p.id===d);f&&(o.push(f),yield i(f,new Set(a)))}}});for(const s of e)yield i(s);return o})}getNestedBlocks(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawNestedBlocks(e);return tn({data:n})})}getRawNestedModels(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=w9(l);for(const f of c)if(!r.has(f)){r.add(f);const p=n.find(h=>h.id===f);p&&o.push(p)}const d=kp(l);for(const f of d){const p=n.find(h=>h.id===f);p&&(yield i(p,new Set(a)))}}});for(const s of e)yield i(s);return o})}getNestedModels(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawNestedModels(e);return tn({data:n})})}}function qT(t,e,n,r,o,i,s){const a=`Record #${t}`;if(s)return o;const u=n.presentationTitleFieldId??n.titleFieldId;if(!u)return a;const l=r.find(f=>f.id===u);if(!l)return a;const c=e[l.apiKey];if(c==null)return a;const d=nf(c,i);return d!==c&&d?String(d):typeof c=="object"&&!Array.isArray(c)?a:String(c)}let Zw=new WeakMap;function _9(t){let e=Zw.get(t);return e||(e=new b9(t),Zw.set(t,e)),e}async function S9(t,e,n){const r=new Map,o=new Map;for(const u of e)o.set(u.recordId,u);const i=new Map;for(const{recordId:u,modelId:l}of o.values()){const c=i.get(l)??[];c.push(u),i.set(l,c)}const s=_9(t),a=Array.from(i.entries()).map(async([u,l])=>{var c,d;try{const f=await s.getItemTypeById(u),p=f.name,h=f.singleton??!1;if(h){for(const b of l)r.set(b,{title:p,modelName:p,isSingleton:h});return}const v=(await s.getItemTypeFields(f)).map(b=>({id:b.id,apiKey:b.api_key})),y={presentationTitleFieldId:((c=f.presentation_title_field)==null?void 0:c.id)??null,titleFieldId:((d=f.title_field)==null?void 0:d.id)??null},w=100;for(let b=0;b<l.length;b+=w){const S=l.slice(b,b+w);try{const k=await t.items.list({filter:{type:u,ids:S.join(",")},page:{limit:w}}),E=new Map(k.map(x=>[x.id,x]));for(const x of S){const T=E.get(x);if(!T){r.set(x,{title:`Record #${x}`,modelName:p,isSingleton:!1});continue}const O=qT(x,T,y,v,p,n,h);r.set(x,{title:O,modelName:p,isSingleton:h})}}catch(k){Te("Failed to batch fetch records:",k,{modelId:u,batchIds:S});for(const E of S)r.set(E,{title:`Record #${E}`,modelName:p,isSingleton:!1})}}}catch(f){Te("Failed to process model for titles:",f,{modelId:u});for(const p of l)r.set(p,{title:`Record #${p}`,modelName:"Unknown",isSingleton:!1})}});return await Promise.all(a),r}function xp(t){return typeof t=="object"&&t!==null&&"upload_id"in t&&typeof t.upload_id=="string"}function k9(t,e,n,r,o){var u,l;if(!e)return`Record #${t.id}`;const i={presentationTitleFieldId:((u=e.relationships.presentation_title_field.data)==null?void 0:u.id)??null,titleFieldId:((l=e.relationships.title_field.data)==null?void 0:l.id)??null},s=n.map(c=>({id:c.id,apiKey:c.attributes.api_key})),a=e.attributes.singleton??!1;return qT(t.id,t.attributes,i,s,r,o,a)}function eb(t,e){if(t==null)return null;const r=!Array.isArray(t)&&xp(t)?t:nf(t,e);if(!r)return null;if(Array.isArray(r)){const o=r[0];return xp(o)?o.upload_id:null}return xp(r)?r.upload_id:null}async function tb(t,e){try{const n=await t.uploads.find(e),r=n.mime_type??"",o=n.url??"";return Ag(r,o,n.mux_playback_id)}catch(n){return Te("Failed to fetch thumbnail for upload:",n,{uploadId:e}),null}}async function x9(t,e,n,r,o){var d,f;if(!e||!o||e.attributes.collection_appearance==="compact")return null;const s=(d=e.relationships.presentation_image_field.data)==null?void 0:d.id,a=(f=e.relationships.image_preview_field.data)==null?void 0:f.id,u=s??a;if(u){const p=n.find(h=>h.id===u);if(p){const h=p.attributes.api_key,m=eb(t.attributes[h],r);if(m){const v=await tb(o,m);if(v)return v}}}const c=[...n].sort((p,h)=>(p.attributes.position??0)-(h.attributes.position??0)).find(p=>{const h=p.attributes.field_type;return h==="file"||h==="gallery"});if(c){const p=c.attributes.api_key,h=eb(t.attributes[p],r);if(h)return await tb(o,h)}return null}async function Lg(t,e,n,r,o,i,s){const a=(n==null?void 0:n.attributes.singleton)??!1,u=k9(t,n,r,e.name,o),l=await x9(t,n,r,o,i),c=s!==void 0?s:Jh(e.name).emoji;return{type:"record",id:t.id,title:u,modelId:e.id,modelApiKey:e.apiKey,modelName:e.name,modelEmoji:c,thumbnailUrl:l,isSingleton:a}}function E9(t){return"current"in t?t.current:t}async function nb(t,e,n){const{maxRetries:r=5,delayMs:o=100}={};for(let i=0;i<r;i++){await new Promise(s=>setTimeout(s,o));try{const s=E9(t);if(s)return s.focus(),s.insertMention(e),!0;i<r-1&&(i+1,`${r}`,e.type,void 0)}catch(s){if(i===r-1)throw Te("insertMentionWithRetry: all retry attempts failed",s,{mentionType:e.type,maxRetries:r}),s;i+1,`${r}`,e.type,s instanceof Error?s.message:String(s)}}return e.type,!1}const Gs={cdaToken:"",migrationCompleted:!1,realTimeUpdatesEnabled:!0,dashboardEnabled:!0};function sf(t){if(!t||typeof t!="object")return{...Gs};const e=t;return{cdaToken:typeof e.cdaToken=="string"?e.cdaToken:Gs.cdaToken,migrationCompleted:typeof e.migrationCompleted=="boolean"?e.migrationCompleted:Gs.migrationCompleted,realTimeUpdatesEnabled:typeof e.realTimeUpdatesEnabled=="boolean"?e.realTimeUpdatesEnabled:Gs.realTimeUpdatesEnabled,dashboardEnabled:typeof e.dashboardEnabled=="boolean"?e.dashboardEnabled:Gs.dashboardEnabled}}function T9(t){return typeof t.cdaToken=="string"&&t.cdaToken.length>0}const C9=({ctx:t})=>{var Y;const{email:e,name:n}=DT(t.currentUser),[r,o]=_.useState([]),i=_.useRef(null),s=_.useRef(new Set),[a,u]=_.useState(!1),[l,c]=_.useState(!1),[d,f]=_.useState(null),p=t.currentUserAccessToken,h=sf(t.plugin.attributes.parameters),m=h.realTimeUpdatesEnabled??!0,v=h.cdaToken,y=_.useMemo(()=>g9(p),[p]),{projectUsers:w,projectModels:b,modelFields:S,typedUsers:k}=jT(t,{loadFields:!0}),{canMentionAssets:E,canMentionModels:x,readableModels:T}=zT(t,b),O=_.useMemo(()=>{const te=MT(t.itemTypes);return(te==null?void 0:te.id)??null},[t.itemTypes]),[N,$]=_.useState(null),{enqueue:P,pendingCount:D,isSyncAllowed:q,retryState:B}=RT({client:y,commentRecordId:N,commentsModelId:O,modelId:t.itemType.id,recordId:(Y=t.item)==null?void 0:Y.id,ctx:t,onRecordCreated:$}),{comments:z,setComments:K,isLoading:I,error:L,errorInfo:F,status:Z,retry:ie}=BT({context:"record",ctx:t,realTimeEnabled:m,cdaToken:v,client:y,isSyncAllowed:q,onCommentRecordIdChange:$});_.useEffect(()=>{d===null&&z.length>0&&f(Math.max(0,z.length-Pu))},[z.length,d]);const ke=_.useMemo(()=>{const te=d??Math.max(0,z.length-Pu),ye=z.length-te;return z.slice(0,ye)},[z,d]),fe=(d??0)>0,{submitNewComment:Ne,deleteComment:pe,editComment:Ae,upvoteComment:Ue,replyComment:pt}=$T({ctx:t,userEmail:e,userName:n,setComments:K,enqueue:P,composerSegments:r,setComposerSegments:o,pendingNewReplies:s}),Ve=_.useCallback(async()=>{var te;if(E)try{const ye=await t.selectUpload({multiple:!1});if(!ye)return;const ae=Mm(ye);(te=i.current)==null||te.insertMention(ae)}catch(ye){Te("Asset picker error:",ye),t.alert(Lt.ASSET_PICKER_FAILED)}},[t,E]),Mn=_.useCallback(()=>{u(!0)},[]),_o=_.useCallback(()=>{var te;u(!1),c(!1),(te=se.current||i.current)==null||te.focus(),se.current=null},[]),se=_.useRef(null),Nr=_.useCallback(async(te,ye)=>{var ae;if(se.current=ye.current,c(!0),te==="asset"){if(!E){c(!1);return}try{const we=await t.selectUpload({multiple:!1});if(!we){(ae=se.current)==null||ae.focus(),c(!1);return}const Ce=Mm(we);await nb(se,Ce)}catch(we){Te("Asset picker error:",we),t.alert(Lt.ASSET_PICKER_FAILED)}finally{c(!1),se.current=null}}else te==="record"&&u(!0)},[t,E]),So=_.useCallback(async te=>{u(!1);const ye=se.current||i.current;if(!ye){c(!1),se.current=null;return}try{const ae=await t.selectItem(te.id,{multiple:!1});if(!ae){ye==null||ye.focus();return}const we=t.itemTypes[te.id];let Ce=[];if(we)try{Ce=await t.loadItemTypeFields(te.id)}catch(bt){Te("Failed to load item type fields for record mention",bt,{modelId:te.id})}const qe=t.site.attributes.locales[0],ut=await Lg({id:ae.id,attributes:ae.attributes},{id:te.id,apiKey:te.apiKey,name:te.name,isBlockModel:te.isBlockModel},we,Ce,qe,y);await nb(ye,ut)}catch(ae){Te("Record picker error:",ae),t.alert(Lt.RECORD_PICKER_FAILED)}finally{c(!1),se.current=null}},[t,y]),{handleUserToolbarClick:Ar,handleFieldToolbarClick:$n,handleModelToolbarClick:ge,handleAssetToolbarClick:lt,handleRecordToolbarClick:G}=LT({composerRef:i,canMentionModels:x,handleAssetTrigger:Ve,handleRecordTrigger:Mn}),le=_.useMemo(()=>Ig(r),[r]);if(m&&Z===gd.CONNECTING||!m&&I)return g.jsx(ma,{ctx:t,children:g.jsx("div",{className:He.loading,children:g.jsx(Ch,{})})});if(L){const te=Dg(L);return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:He.error,role:"alert",children:[g.jsx("p",{children:"Error loading comments"}),g.jsx("span",{children:te.message})]})})}return g.jsx(ma,{ctx:t,children:g.jsx(sk,{projectUsers:w,projectModels:b,modelFields:S,currentUserEmail:e,typedUsers:k,children:g.jsx(VT,{canMentionFields:!0,canMentionAssets:E,canMentionModels:x,children:g.jsxs("div",{className:He.container,children:[g.jsx("div",{className:He.header,children:g.jsx(JV,{subscriptionStatus:Z,subscriptionError:(F==null?void 0:F.message)??null,retryState:B,onRetry:ie})}),m&&!v&&g.jsxs("div",{className:He.warning,children:[g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-labelledby":"warningIconTitle",children:[g.jsx("title",{id:"warningIconTitle",children:"Warning"}),g.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})]}),g.jsx("span",{children:"Realtime updates disabled. Configure a CDA token in plugin settings."})]}),g.jsx("div",{className:He.composer,children:g.jsx(hd,{fallbackMessage:"Unable to load editor. Please refresh.",children:g.jsxs("div",{className:He.composerInputWrapper,children:[g.jsx(rf,{ref:i,segments:r,onSegmentsChange:o,onSubmit:Ne,placeholder:`Add a comment...
|
|
250
|
+
@ user, # field, & record, ^ asset, $ model`,projectUsers:w,modelFields:S,projectModels:b,canMentionAssets:E,canMentionModels:x,canMentionFields:!0,onAssetTrigger:Ve,onRecordTrigger:Mn,autoFocus:!1,ctx:t}),a&&g.jsx(Ah,{models:T,onSelect:So,onClose:_o}),g.jsx(Ay,{onUserClick:Ar,onFieldClick:$n,onRecordClick:G,onAssetClick:lt,onModelClick:ge,onSendClick:Ne,isSendDisabled:le||D>0,canMentionAssets:E,canMentionModels:x})]})})}),g.jsx(kV,{comments:ke,hasMoreComments:fe,onLoadMore:()=>f(te=>Math.max(0,(te??0)-Pu)),currentUserEmail:e,modelFields:S,projectUsers:w,projectModels:b,deleteComment:pe,editComment:Ae,upvoteComment:Ue,replyComment:pt,onPickerRequest:Nr,canMentionAssets:E,canMentionModels:x,ctx:t,isPickerActive:l,typedUsers:k})]})})})})},M9="_container_a1s2s_23",O9="_intro_a1s2s_29",N9="_successBox_a1s2s_36",A9="_successIcon_a1s2s_49",I9="_warningBox_a1s2s_63",P9="_warningIcon_a1s2s_76",R9="_formField_a1s2s_90",D9="_buttonRow_a1s2s_94",j9="_section_a1s2s_99",L9="_sectionTitle_a1s2s_103",B9="_description_a1s2s_112",F9="_code_a1s2s_118",$9="_migrationActions_a1s2s_131",z9="_migrationModels_a1s2s_137",U9="_migrationSubtitle_a1s2s_144",V9="_modelList_a1s2s_151",q9="_modelItem_a1s2s_157",H9="_modelName_a1s2s_169",W9="_modelApiKey_a1s2s_174",K9="_progressContainer_a1s2s_182",G9="_progressHeader_a1s2s_189",J9="_progressBar_a1s2s_197",Y9="_progressFill_a1s2s_204",Q9="_resultsContainer_a1s2s_213",X9="_resultsGrid_a1s2s_220",Z9="_resultItem_a1s2s_227",eq="_resultNumber_a1s2s_235",tq="_resultLabel_a1s2s_242",nq="_errorList_a1s2s_249",rq="_errorBox_a1s2s_276",oq="_errorIcon_a1s2s_289",iq="_dangerBox_a1s2s_305",sq="_dangerIcon_a1s2s_318",aq="_cleanupSection_a1s2s_325",lq="_confirmDialog_a1s2s_331",uq="_confirmActions_a1s2s_345",cq="_scanProgressContainer_a1s2s_352",dq="_scanProgressHeader_a1s2s_360",fq="_scanPhaseLabel_a1s2s_367",pq="_scanProgressCount_a1s2s_373",hq="_scanDetails_a1s2s_379",mq="_scanCurrentModel_a1s2s_388",yq="_scanFoundCounter_a1s2s_399",ne={container:M9,intro:O9,successBox:N9,successIcon:A9,warningBox:I9,warningIcon:P9,formField:R9,buttonRow:D9,section:j9,sectionTitle:L9,description:B9,code:F9,migrationActions:$9,migrationModels:z9,migrationSubtitle:U9,modelList:V9,modelItem:q9,modelName:H9,modelApiKey:W9,progressContainer:K9,progressHeader:G9,progressBar:J9,progressFill:Y9,resultsContainer:Q9,resultsGrid:X9,resultItem:Z9,resultNumber:eq,resultLabel:tq,errorList:nq,errorBox:rq,errorIcon:oq,dangerBox:iq,dangerIcon:sq,cleanupSection:aq,confirmDialog:lq,confirmActions:uq,scanProgressContainer:cq,scanProgressHeader:dq,scanPhaseLabel:fq,scanProgressCount:pq,scanDetails:hq,scanCurrentModel:mq,scanFoundCounter:yq};function gq(t){return!t||!Array.isArray(t)?[]:t.map(e=>{if(typeof e!="string")return e;const n=e;return{name:n.includes("@")?n.split("@")[0]:n,email:n}})}function HT(t){var r;const{parentCommentISO:e,...n}=t;return{...n,usersWhoUpvoted:gq(t.usersWhoUpvoted),replies:(r=t.replies)==null?void 0:r.map(HT),...e!==void 0&&{parentCommentId:e}}}function Am(t){return!t.id||t.id===t.dateISO?!0:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t.id)}function WT(t,e=new Map){var a;const n=t.id??t.dateISO,r=Am(t),o=r?crypto.randomUUID():n;r&&n&&e.set(n,o);let i=t.parentCommentId;t.parentCommentId&&e.has(t.parentCommentId)&&(i=e.get(t.parentCommentId));const s=(a=t.replies)==null?void 0:a.map(u=>{const l={...u,parentCommentId:u.parentCommentId===n?o:u.parentCommentId};return WT(l,e)});return{...t,id:o,...i!==void 0&&{parentCommentId:i},...s&&{replies:s}}}function vq(t){if(!t.some(o=>{var i;return Am(o)||((i=o.replies)==null?void 0:i.some(Am))}))return{comments:t,wasMigrated:!1};const n=new Map;return{comments:t.map(o=>WT(o,n)),wasMigrated:!0}}const wq=({ctx:t})=>{const e=sf(t.plugin.attributes.parameters),[n,r]=_.useState(e.cdaToken??""),[o,i]=_.useState(e.realTimeUpdatesEnabled??!0),[s,a]=_.useState(e.dashboardEnabled??!0),[u,l]=_.useState(!1),[c,d]=_.useState(e.migrationCompleted?"completed":"idle"),[f,p]=_.useState([]),[h,m]=_.useState(null),[v,y]=_.useState(null),[w,b]=_.useState(null),[S,k]=_.useState(!1),[E,x]=_.useState(!1),[T,O]=_.useState(null),N=async()=>{l(!0),await t.updatePluginParameters({...e,cdaToken:n,realTimeUpdatesEnabled:o,dashboardEnabled:s}),await t.notice("Settings saved successfully!"),l(!1)},$=_.useCallback(()=>t.currentUserAccessToken?Sd({apiToken:t.currentUserAccessToken}):null,[t.currentUserAccessToken]),P=_.useCallback(async()=>{d("scanning"),b(null),p([]),O({phase:"fetching-models",scannedModels:0,totalModels:0,foundCount:0});try{const z=Object.values(t.itemTypes).filter(F=>F!==void 0),K=[],I=z.filter(F=>F.attributes.api_key!==io);O({phase:"scanning-fields",scannedModels:0,totalModels:I.length,foundCount:0});let L=0;for(const F of I){O({phase:"scanning-fields",currentModel:F.attributes.name,scannedModels:L,totalModels:I.length,foundCount:K.length});try{const ie=(await t.loadItemTypeFields(F.id)).find(ke=>ke.attributes.api_key==="comment_log");ie&&K.push({modelId:F.id,modelName:F.attributes.name,modelApiKey:F.attributes.api_key,fieldId:ie.id})}catch(Z){`${F.attributes.name}`,F.id}L++,O({phase:"scanning-fields",currentModel:F.attributes.name,scannedModels:L,totalModels:I.length,foundCount:K.length})}p(K),O(null),K.length===0?(d("idle"),await t.notice("No legacy comment_log fields found. Nothing to migrate!")):(d("idle"),await t.notice(`Found ${K.length} model(s) with comment_log fields.`))}catch(z){d("error"),O(null),b(z instanceof Error?z.message:"Unknown error during scan")}},[t]),D=_.useCallback(async()=>{const z=$();if(!z){t.alert("Unable to access API. Please ensure you have proper permissions.");return}if(f.length===0){t.alert("No models to migrate. Please scan first.");return}d("migrating"),b(null),y(null);const K={success:0,skipped:0,failed:0,errors:[]};try{const I=Object.values(t.itemTypes).find(F=>(F==null?void 0:F.attributes.api_key)===io);if(!I)throw new Error("project_comment model not found. Please reload the plugin to create it.");let L=0;for(const F of f){m({currentModel:F.modelName,currentRecord:0,totalRecords:0,processedModels:L,totalModels:f.length});const Z=[];for await(const fe of z.items.listPagedIterator({filter:{type:F.modelApiKey}}))Z.push({id:fe.id,comment_log:fe.comment_log});let ie=0;const ke=Z.length;for(const fe of Z){ie++,m({currentModel:F.modelName,currentRecord:ie,totalRecords:ke,processedModels:L,totalModels:f.length});const Ne=fe.comment_log;if(!Ne)continue;let pe;if(typeof Ne=="string")try{const Ve=JSON.parse(Ne);if(!Array.isArray(Ve))continue;pe=Ve}catch(Ve){fe.id;continue}else if(Array.isArray(Ne))pe=Ne;else continue;if(pe.length===0)continue;const Ae=pe.map(HT),{comments:Ue}=vq(Ae);if((await z.items.list({filter:{type:io,fields:{model_id:{eq:F.modelId},record_id:{eq:fe.id}}}})).length>0){K.skipped++;continue}try{await z.items.create({item_type:{type:"item_type",id:I.id},model_id:F.modelId,record_id:fe.id,content:JSON.stringify(Ue)}),K.success++}catch(Ve){K.failed++,K.errors.push(`Record ${fe.id} in ${F.modelName}: ${Ve instanceof Error?Ve.message:"Unknown error"}`)}ie%10===0&&await new Promise(Ve=>setTimeout(Ve,100))}L++}y(K),m(null),K.failed===0?(d("completed"),await t.updatePluginParameters({...e,migrationCompleted:!0}),await t.notice("Migration completed successfully!")):(d("completed"),await t.notice(`Migration completed with ${K.failed} error(s). Check details below.`))}catch(I){d("error"),b(I instanceof Error?I.message:"Unknown error during migration"),m(null)}},[t,$,f,e]),q=_.useCallback(async()=>{const z=$();if(!z){t.alert("Unable to access API. Please ensure you have proper permissions.");return}k(!0),x(!1);try{for(const K of f)await z.fields.destroy(K.fieldId);p([]),await t.notice("Old comment_log fields have been deleted successfully!")}catch(K){t.alert(`Error deleting fields: ${K instanceof Error?K.message:"Unknown error"}`)}finally{k(!1)}},[t,$,f]),B=()=>g.jsxs("div",{className:ne.section,children:[g.jsx("h2",{className:ne.sectionTitle,children:"Migration from Legacy System"}),g.jsxs("p",{className:ne.description,children:["If you were using an older version of this plugin that stored comments in a"," ",g.jsx("code",{className:ne.code,children:"comment_log"})," field on each model, you can migrate those comments to the new centralized system."]}),c==="idle"&&f.length>0&&g.jsxs("div",{className:ne.warningBox,children:[g.jsx("div",{className:ne.warningIcon,children:"!"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Important:"})," Please ensure no one is editing comments during the migration process to avoid data loss."]})]}),c!=="completed"&&g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"muted",onClick:P,disabled:c==="scanning"||c==="migrating",children:c==="scanning"?g.jsxs(g.Fragment,{children:[g.jsx(Ch,{size:16})," Scanning..."]}):"Scan for Legacy Comments"})}),c==="scanning"&&T&&g.jsxs("div",{className:ne.scanProgressContainer,children:[g.jsxs("div",{className:ne.scanProgressHeader,children:[g.jsx("span",{className:ne.scanPhaseLabel,children:T.phase==="fetching-models"?"Loading models list...":"Checking model fields..."}),T.phase==="scanning-fields"&&g.jsxs("span",{className:ne.scanProgressCount,children:[T.scannedModels," / ",T.totalModels]})]}),T.phase==="scanning-fields"&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:ne.progressBar,children:g.jsx("div",{className:ne.progressFill,style:{width:`${T.totalModels>0?T.scannedModels/T.totalModels*100:0}%`}})}),g.jsxs("div",{className:ne.scanDetails,children:[T.currentModel&&g.jsxs("span",{className:ne.scanCurrentModel,children:["Checking: ",g.jsx("strong",{children:T.currentModel})]}),g.jsxs("span",{className:ne.scanFoundCounter,children:[T.foundCount," legacy field",T.foundCount!==1?"s":""," found"]})]})]})]}),f.length>0&&c!=="migrating"&&g.jsxs("div",{className:ne.migrationModels,children:[g.jsxs("h3",{className:ne.migrationSubtitle,children:["Found ",f.length," model(s) with comment_log field:"]}),g.jsx("ul",{className:ne.modelList,children:f.map(z=>g.jsxs("li",{className:ne.modelItem,children:[g.jsx("span",{className:ne.modelName,children:z.modelName}),g.jsxs("span",{className:ne.modelApiKey,children:["(",z.modelApiKey,")"]})]},z.modelId))}),c!=="completed"&&g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"primary",onClick:D,children:"Start Migration"})})]}),c==="migrating"&&h&&g.jsxs("div",{className:ne.progressContainer,children:[g.jsxs("div",{className:ne.progressHeader,children:[g.jsxs("span",{children:["Migrating: ",h.currentModel," (",h.processedModels+1,"/",h.totalModels," models)"]}),g.jsxs("span",{children:["Record ",h.currentRecord,"/",h.totalRecords]})]}),g.jsx("div",{className:ne.progressBar,children:g.jsx("div",{className:ne.progressFill,style:{width:`${h.totalRecords>0?h.currentRecord/h.totalRecords*100:0}%`}})})]}),c==="error"&&w&&g.jsxs("div",{className:ne.errorBox,children:[g.jsx("div",{className:ne.errorIcon,children:"✕"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Error:"})," ",w]})]}),v&&g.jsxs("div",{className:ne.resultsContainer,children:[g.jsx("h3",{className:ne.migrationSubtitle,children:"Migration Results"}),g.jsxs("div",{className:ne.resultsGrid,children:[g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.success}),g.jsx("span",{className:ne.resultLabel,children:"Migrated"})]}),g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.skipped}),g.jsx("span",{className:ne.resultLabel,children:"Skipped (already migrated)"})]}),g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.failed}),g.jsx("span",{className:ne.resultLabel,children:"Failed"})]})]}),v.errors.length>0&&g.jsxs("div",{className:ne.errorList,children:[g.jsx("h4",{children:"Errors:"}),g.jsxs("ul",{children:[v.errors.slice(0,10).map(z=>g.jsx("li",{children:z},z)),v.errors.length>10&&g.jsxs("li",{children:["...and ",v.errors.length-10," more errors"]})]})]})]}),c==="completed"&&f.length>0&&g.jsxs("div",{className:ne.cleanupSection,children:[g.jsx("h3",{className:ne.migrationSubtitle,children:"Cleanup Old Fields"}),g.jsxs("p",{className:ne.description,children:["After verifying the migration was successful, you can optionally delete the old"," ",g.jsx("code",{className:ne.code,children:"comment_log"})," fields from your models."]}),g.jsxs("div",{className:ne.dangerBox,children:[g.jsx("div",{className:ne.dangerIcon,children:"⚠️"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Warning:"})," This action is irreversible. Only proceed if you have verified that all comments were migrated successfully."]})]}),E?g.jsxs("div",{className:ne.confirmDialog,children:[g.jsxs("p",{children:["Are you sure you want to delete ",f.length," comment_log field(s)?"]}),g.jsxs("div",{className:ne.confirmActions,children:[g.jsx(_i,{buttonType:"negative",onClick:q,disabled:S,children:S?g.jsxs(g.Fragment,{children:[g.jsx(Ch,{size:16})," Deleting..."]}):"Yes, Delete Fields"}),g.jsx(_i,{buttonType:"muted",onClick:()=>x(!1),disabled:S,children:"Cancel"})]})]}):g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"negative",onClick:()=>x(!0),disabled:S,children:"Delete Old comment_log Fields"})})]}),c==="completed"&&f.length===0&&g.jsxs("div",{className:ne.successBox,children:[g.jsx("div",{className:ne.successIcon,children:"✓"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Migration complete!"})," All comments have been migrated to the new system and old fields have been cleaned up."]})]})]});return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:ne.container,children:[g.jsxs("p",{className:ne.intro,children:["This plugin enables team collaboration through comments in two ways: a"," ",g.jsx("strong",{children:"sidebar panel"})," on every record for record-specific discussions, and a"," ",g.jsx("strong",{children:"project-wide Comments Dashboard"})," for general team conversations. Use rich mentions to reference users (@), fields (#), records (&), assets (^), and models ($) directly in your comments. The dashboard also shows your mentions and recent activity across the project."]}),g.jsxs("div",{className:ne.section,children:[g.jsx("h2",{className:ne.sectionTitle,children:"Configuration"}),g.jsx("p",{className:ne.description,children:"Configure how comments are synchronized across users. Real-time updates are recommended for the best collaborative experience."}),g.jsx("div",{className:ne.formField,children:g.jsx(ov,{id:"realtime-toggle",name:"realtime-toggle",label:"Enable Real-Time Updates (Recommended)",hint:"When enabled, comments update instantly across all users. Requires a Content Delivery API token.",value:o,onChange:z=>i(z)})}),o&&g.jsx("div",{className:ne.formField,children:g.jsx(F2,{id:"cda-token",name:"cda-token",label:"Content Delivery API Token",hint:"You can find this in Project Settings → API Tokens. Use a token with read access.",value:n,onChange:z=>r(z),textInputProps:{monospaced:!0}})}),g.jsx("div",{className:ne.formField,children:g.jsx(ov,{id:"dashboard-toggle",name:"dashboard-toggle",label:"Enable Comments Dashboard",hint:"When enabled, users can access the project-wide Comments Dashboard from the sidebar navigation. Disabling this hides the dashboard for all users.",value:s,onChange:z=>a(z)})}),g.jsx("div",{className:ne.buttonRow,children:g.jsx(_i,{buttonType:"primary",onClick:N,disabled:u||o&&!n,children:u?"Saving...":"Save Settings"})})]}),B()]})})};function bq({count:t,onClick:e,accentColor:n}){if(t===0)return null;const r=t===1?"comment":"comments";return g.jsxs("button",{type:"button",className:j.newCommentsIndicator,onClick:e,style:{"--accent-color":n},children:[g.jsx(zR,{"aria-label":"Scroll to new comments"}),t," new ",r]})}function _q({ctx:t,composerRef:e,canMentionAssets:n=!0}){const r=_.useCallback(async()=>{var o,i,s;if(n)try{const a=await t.selectUpload({multiple:!1});if(!a){(o=e.current)==null||o.focus();return}const u=a.attributes.mime_type??"application/octet-stream",l=a.attributes.url??"",c=Ag(u,l,a.attributes.mux_playback_id),d={type:"asset",id:a.id,filename:a.attributes.filename,url:l,thumbnailUrl:c,mimeType:u};(i=e.current)==null||i.insertMention(d)}catch(a){Te("Asset picker error",a),t.alert(Lt.ASSET_PICKER_FAILED),(s=e.current)==null||s.focus()}},[t,e,n]);return{handleAssetTrigger:r,handleAssetClick:r}}function Sq({ctx:t,client:e,composerRef:n}){const[r,o]=_.useState(!1),i=_.useRef(0),s=_.useCallback(()=>{o(!0)},[]),a=_.useCallback(async l=>{var d,f,p;o(!1),i.current+=1;const c=i.current;try{const h=await t.selectItem(l.id,{multiple:!1});if(c!==i.current)return;if(!h){(d=n.current)==null||d.focus();return}const m=t.itemTypes[l.id],v=m?await t.loadItemTypeFields(l.id):[],y=t.site.attributes.locales[0],w=OT(m),b=await Lg({id:h.id,attributes:h.attributes},{id:l.id,apiKey:l.apiKey,name:l.name,isBlockModel:l.isBlockModel},m,v,y,e,w);if(c!==i.current)return;(f=n.current)==null||f.insertMention(b)}catch(h){c===i.current&&(Te("Record picker error",h),t.alert(Lt.RECORD_PICKER_FAILED),(p=n.current)==null||p.focus())}},[t,e,n]),u=_.useCallback(()=>{var l;o(!1),(l=n.current)==null||l.focus()},[n]);return{isRecordModelSelectorOpen:r,setIsRecordModelSelectorOpen:o,handleRecordTrigger:s,handleRecordModelSelect:a,handleRecordModelSelectorClose:u}}function kq({containerRef:t,itemsCount:e,bottomThreshold:n=50}){const[r,o]=_.useState(!0),[i,s]=_.useState(0),a=_.useRef(!1),u=_.useRef(e),l=_.useRef(n);l.current=n;const c=_.useCallback(()=>{const f=t.current;if(!f)return;const{scrollTop:p,scrollHeight:h,clientHeight:m}=f,v=h-p-m<n;o(v),v&&s(0)},[t,n]),d=_.useCallback(()=>{const f=t.current;f&&f.scrollTo({top:f.scrollHeight,behavior:"smooth"}),s(0)},[t]);return _.useEffect(()=>{const f=e-u.current,p=t.current;f>0&&(r&&p?(a.current=!0,p.scrollTop=p.scrollHeight):r||s(h=>h+f)),u.current=e},[e,r,t]),_.useEffect(()=>{const f=t.current;if(!f)return;let p=!0;const h=new ResizeObserver(()=>{const v=t.current;if(!(!p||!v||!v.isConnected)&&a.current){const{scrollTop:y,scrollHeight:w,clientHeight:b}=v;w-y-b<l.current?v.scrollTop=w:a.current=!1}}),m=f.firstElementChild;return m&&h.observe(m),h.observe(f),()=>{p=!1,h.disconnect()}},[t]),{isAtBottom:r,newItemsCount:i,handleScroll:c,handleNewItemsClick:d}}function xq({items:t,pageSize:e=Pu,containerRef:n}){const[r,o]=_.useState(null),i=_.useRef(null);_.useEffect(()=>{r===null&&t.length>0&&o(Math.max(0,t.length-e))},[t.length,r,e]);const s=_.useMemo(()=>{const l=r??Math.max(0,t.length-e);return t.slice(l)},[t,r,e]),a=(r??0)>0,u=_.useCallback(()=>{const l=n.current;l&&(i.current=l.scrollHeight),o(c=>Math.max(0,(c??0)-e))},[n,e]);return _.useLayoutEffect(()=>{if(i.current===null)return;const l=n.current;if(!l)return;const d=l.scrollHeight-i.current;l.scrollTop+=d,i.current=null},[s,n]),{paginatedItems:s,hasMore:a,handleLoadEarlier:u}}const Eq=({ctx:t,client:e,userName:n,readableModels:r,accentColor:o,comments:i,filteredComments:s,setComments:a,commentsModelId:u,commentRecordId:l,setCommentRecordId:c,isLoading:d,error:f,status:p,isFiltering:h,onSyncAllowedChange:m})=>{const{projectUsers:v,projectModels:y,currentUserEmail:w,typedUsers:b}=Dy(),{canMentionAssets:S,canMentionModels:k}=y9(),[E,x]=_.useState([]),T=_.useRef(null),O=_.useRef(new Set),N=_.useRef(null),$=RT({client:e,commentRecordId:l,commentsModelId:u,modelId:jy,recordId:ak,ctx:t,onRecordCreated:c});_.useEffect(()=>{m($.isSyncAllowed)},[$.isSyncAllowed,m]);const{submitNewComment:P,deleteComment:D,editComment:q,upvoteComment:B,replyComment:z}=$T({userEmail:w,userName:n,setComments:a,enqueue:$.enqueue,composerSegments:E,setComposerSegments:x,pendingNewReplies:O,insertPosition:"append"}),{handleUserToolbarClick:K,handleFieldToolbarClick:I,handleModelToolbarClick:L}=LT({composerRef:T,canMentionModels:k}),{handleAssetTrigger:F,handleAssetClick:Z}=_q({ctx:t,composerRef:T,canMentionAssets:S}),{isRecordModelSelectorOpen:ie,handleRecordTrigger:ke,handleRecordModelSelect:fe,handleRecordModelSelectorClose:Ne}=Sq({ctx:t,client:e,composerRef:T}),pe=_.useRef(null),[Ae,Ue]=_.useState(!1),[pt,Ve]=_.useState(!1),Mn=_.useCallback(async(ae,we)=>{var Ce,qe,ut;if(!pt)if(pe.current=we.current,ae==="asset"){if(!S)return;Ve(!0);try{const bt=await t.selectUpload({multiple:!1});if(!bt){(Ce=pe.current)==null||Ce.focus();return}const zn=Mm(bt);(qe=pe.current)==null||qe.insertMention(zn)}catch(bt){Te("Reply asset picker error:",bt),t.alert(Lt.ASSET_PICKER_FAILED),(ut=pe.current)==null||ut.focus()}finally{Ve(!1)}}else ae==="record"&&Ue(!0)},[t,S,pt]),_o=_.useCallback(async ae=>{var we,Ce,qe;if(Ue(!1),!!pe.current){Ve(!0);try{const ut=await t.selectItem(ae.id,{multiple:!1});if(!ut){(we=pe.current)==null||we.focus();return}const bt=t.itemTypes[ae.id],zn=bt?await t.loadItemTypeFields(ae.id):[],Ee=t.site.attributes.locales[0],As=OT(bt),af=await Lg({id:ut.id,attributes:ut.attributes},{id:ae.id,apiKey:ae.apiKey,name:ae.name,isBlockModel:ae.isBlockModel},bt,zn,Ee,e,As);(Ce=pe.current)==null||Ce.insertMention(af)}catch(ut){Te("Reply record picker error:",ut),t.alert(Lt.RECORD_PICKER_FAILED),(qe=pe.current)==null||qe.focus()}finally{Ve(!1)}}},[t,e]),se=_.useCallback(()=>{var ae;Ue(!1),(ae=pe.current)==null||ae.focus()},[]),Nr=_.useMemo(()=>[...s].sort((ae,we)=>ae.dateISO.localeCompare(we.dateISO)),[s]),{newItemsCount:So,handleScroll:Ar,handleNewItemsClick:$n}=kq({containerRef:N,itemsCount:i.length}),{paginatedItems:ge,hasMore:lt,handleLoadEarlier:G}=xq({items:Nr,containerRef:N}),le=_.useMemo(()=>Ig(E),[E]);if(p===gd.CONNECTING||d)return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),g.jsx("div",{className:j.commentsListEmpty,role:"status","aria-live":"polite","aria-label":"Loading comments",children:g.jsx("div",{className:j.loadingSpinner})})]});if(f){const ae=Dg(f);return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),g.jsxs("div",{className:j.error,role:"alert",children:[g.jsx("p",{children:"Error loading comments"}),g.jsx("span",{children:ae.message})]})]})}const Y=i.length>0,te=ge.length>0,ye=Y&&Nr.length===0&&h;return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),te?g.jsxs("div",{ref:N,className:j.commentsList,onScroll:Ar,children:[lt&&g.jsx("div",{style:{padding:"12px 24px",textAlign:"center"},children:g.jsx("button",{type:"button",className:j.loadEarlierButton,onClick:G,children:"Load earlier messages"})}),ge.map(ae=>g.jsx("div",{style:{padding:"0 24px"},children:g.jsx(hd,{children:g.jsx(vT,{deleteComment:D,editComment:q,upvoteComment:B,replyComment:z,commentObject:ae,currentUserEmail:w,modelFields:[],projectUsers:v,projectModels:y,canMentionFields:!1,onPickerRequest:Mn,canMentionAssets:S,canMentionModels:k,isPickerActive:pt,typedUsers:b})})},ae.id))]}):ye?g.jsxs("div",{className:j.noResults,children:[g.jsx(FR,{className:j.noResultsIcon}),g.jsx("h3",{className:j.noResultsTitle,children:"No comments match your filters"}),g.jsx("p",{className:j.noResultsDescription,children:"Try adjusting your search or filter criteria."})]}):g.jsxs("div",{className:j.commentsListEmpty,children:[g.jsx($R,{className:j.emptyIcon}),g.jsx("h3",{className:j.emptyTitle,children:"Start the conversation"}),g.jsx("p",{className:j.emptyDescription,children:"Be the first to share an update or ask a question about this project."})]}),g.jsx(bq,{count:So,onClick:$n,accentColor:o}),g.jsx("div",{className:j.composer,children:g.jsx(hd,{fallbackMessage:"Unable to load editor. Please refresh the page.",children:g.jsxs(uk,{accentColor:o,children:[g.jsx(rf,{ref:T,segments:E,onSegmentsChange:x,onSubmit:P,placeholder:`Add a message...
|
|
251
|
+
@ user, & record, ^ asset, $ model`,projectUsers:v,modelFields:[],projectModels:y,canMentionAssets:S,canMentionModels:k,canMentionFields:!1,onAssetTrigger:F,onRecordTrigger:ke,autoFocus:!1,large:!0,dropdownPosition:"above"}),ie&&g.jsx(Ah,{models:r,onSelect:fe,onClose:Ne,position:"above"}),Ae&&g.jsx(Ah,{models:r,onSelect:_o,onClose:se,position:"above"}),g.jsx(Ay,{onUserClick:K,onFieldClick:I,onRecordClick:ke,onAssetClick:Z,onModelClick:L,onSendClick:P,isSendDisabled:le||$.pendingCount>0,canMentionAssets:S,canMentionModels:k,canMentionFields:!1,large:!0,accentColor:o})]})})})]})};function Tq(t,e=80){const n=[];for(const o of t.content)if(o.type==="text")n.push(o.content);else if(o.type==="mention")switch(o.mention.type){case"user":n.push(`@${o.mention.name}`);break;case"field":n.push(`#${o.mention.apiKey}`);break;case"record":n.push(o.mention.title);break;case"asset":n.push(o.mention.filename);break;case"model":n.push(`$${o.mention.name}`);break}const r=n.join("").trim();return r.length<=e?r:`${r.slice(0,e)}…`}const Cq=({commentWithContext:t,onClick:e,showMentionBadge:n=!1})=>{const{comment:r,isGlobal:o,isReply:i}=t,s=yr(r.author.email,64),a=Tq(r);return g.jsxs("button",{type:"button",className:j.commentPreview,onClick:e,children:[g.jsx("img",{src:s,alt:r.author.name,className:j.previewAvatar,onError:u=>{const l=u.currentTarget;l.onerror=null,l.src=yr(r.author.email,64)}}),g.jsxs("div",{className:j.previewContent,children:[g.jsxs("div",{className:j.previewHeader,children:[g.jsx("span",{className:j.previewAuthor,children:r.author.name}),g.jsx("span",{className:j.previewTime,children:g.jsx(ol,{date:new Date(r.dateISO)})}),n&&g.jsx("span",{className:j.previewMentionBadge,children:g.jsx(UR,{"aria-label":"Mentioned you"})})]}),g.jsx("div",{className:j.previewText,children:a}),!o&&g.jsx("div",{className:j.previewContext,children:g.jsxs("span",{className:j.previewContextText,children:[i?"Reply in ":"In ",t.isSingleton?t.recordTitle??`Record #${t.recordId}`:`${t.modelName??"Record"} "${t.recordTitle??t.recordId}"`]})}),o&&g.jsxs("div",{className:j.previewContext,children:[g.jsx(VR,{className:j.previewContextIcon,"aria-label":"Project discussion"}),g.jsx("span",{className:j.previewContextText,children:i?"Reply in project discussion":"Project discussion"})]})]})]})},Mq=_.memo(Cq,(t,e)=>!(t.commentWithContext.comment.id!==e.commentWithContext.comment.id||t.showMentionBadge!==e.showMentionBadge||t.onClick!==e.onClick)),KT=({title:t,emptyMessage:e,items:n,isLoading:r,onNavigateToRecord:o,onScrollToGlobalComment:i})=>{const s=a=>{a.isGlobal&&i?i(a.comment.id):o(a.modelId,a.recordId)};return g.jsxs("div",{className:j.sidebarSection,children:[g.jsx("div",{className:j.sectionHeader,children:g.jsx("h3",{className:j.sectionTitle,children:t})}),g.jsx("div",{className:j.sectionContent,children:r?g.jsx("div",{className:j.loading,children:g.jsx("div",{className:j.loadingSpinner})}):n.length===0?g.jsx("div",{className:j.emptySmall,children:e}):n.map(a=>g.jsx(Mq,{commentWithContext:a,onClick:()=>s(a)},`${a.recordId}-${a.comment.id}`))})]})},Oq=({mentions:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r})=>g.jsx(KT,{title:"My Mentions",emptyMessage:"No mentions yet. When someone mentions you with @, it will appear here.",items:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r}),Nq=({comments:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r})=>g.jsx(KT,{title:"Recent Comments",emptyMessage:"No comments yet. Start a discussion to see recent activity.",items:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r});function Aq(t){return _.useMemo(()=>({authorOptions:t.authors.map(e=>({value:e.email,label:e.name})),recordOptions:t.mentionedRecords.map(e=>({value:e.id,label:e.title,sublabel:e.modelName})),assetOptions:t.mentionedAssets.map(e=>({value:e.id,label:e.filename})),modelOptions:t.mentionedModels.map(e=>({value:e.id,label:e.name})),userOptions:t.mentionedUsers.map(e=>({value:e.email,label:e.name}))}),[t])}const Js=({label:t,options:e,selectedValue:n,onSelect:r,placeholder:o="All",searchable:i=!0,disabled:s=!1,emptyMessage:a="No options available"})=>{const[u,l]=_.useState(!1),[c,d]=_.useState(""),[f,p]=_.useState(-1),h=_.useRef(null),m=_.useRef(null),v=_.useRef([]),y=_.useId();_.useEffect(()=>{const O=N=>{h.current&&!h.current.contains(N.target)&&(l(!1),d(""))};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]),_.useEffect(()=>{u&&(p(-1),i&&m.current&&m.current.focus())},[u,i]),_.useEffect(()=>{p(-1)},[c]),_.useEffect(()=>{var O;f>=0&&v.current[f]&&((O=v.current[f])==null||O.scrollIntoView({block:"nearest",behavior:"smooth"}))},[f]);const w=_.useMemo(()=>c?e.filter(O=>{var N;return O.label.toLowerCase().includes(c.toLowerCase())||((N=O.sublabel)==null?void 0:N.toLowerCase().includes(c.toLowerCase()))}):e,[c,e]),b=e.find(O=>O.value===n),S=()=>{s||(l(!u),u||d(""))},k=O=>{r(O),l(!1),d("")},E=e.length>0,x=E?1+w.length:0,T=O=>{if(u)switch(O.key){case"Escape":O.preventDefault(),l(!1),d("");break;case"ArrowDown":O.preventDefault(),x>0&&p(N=>N<x-1?N+1:N);break;case"ArrowUp":O.preventDefault(),p(N=>N>0?N-1:N);break;case"Enter":if(O.preventDefault(),f>=0&&E)if(f===0)k(null);else{const N=w[f-1];N&&k(N.value)}break;case"Tab":l(!1),d("");break}};return g.jsxs("div",{className:ot(j.filterDropdown,s&&j.filterDropdownDisabled),ref:h,onKeyDown:T,children:[g.jsxs("button",{type:"button",className:ot(j.filterDropdownTrigger,n&&j.filterDropdownActive),onClick:S,disabled:s,"aria-expanded":u,"aria-haspopup":"listbox","aria-controls":u?y:void 0,children:[g.jsx("span",{className:j.filterDropdownLabel,children:t}),b&&g.jsx("span",{className:j.filterDropdownValue,children:b.label}),g.jsxs("svg",{className:j.filterDropdownChevron,viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Toggle dropdown"}),g.jsx("path",{fillRule:"evenodd",d:"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"})]})]}),u&&g.jsxs("div",{id:y,className:j.filterDropdownMenu,role:"listbox","aria-label":`${t} options`,children:[i&&e.length>5&&g.jsx("div",{className:j.filterDropdownSearch,children:g.jsx("input",{ref:m,type:"text",placeholder:"Search...",value:c,onChange:O=>d(O.target.value),className:j.filterDropdownSearchInput,"aria-label":`Search ${t} options`})}),g.jsx("div",{className:j.filterDropdownOptions,children:E?g.jsxs(g.Fragment,{children:[g.jsx("button",{ref:O=>{v.current[0]=O},type:"button",className:ot(j.filterDropdownOption,n===null&&j.filterDropdownOptionSelected,f===0&&j.filterDropdownOptionHighlighted),onClick:()=>k(null),onMouseEnter:()=>p(0),role:"option","aria-selected":n===null,children:g.jsx("span",{className:j.filterDropdownOptionLabel,children:o})}),w.map((O,N)=>{const $=N+1;return g.jsxs("button",{ref:P=>{v.current[$]=P},type:"button",className:ot(j.filterDropdownOption,n===O.value&&j.filterDropdownOptionSelected,f===$&&j.filterDropdownOptionHighlighted),onClick:()=>k(O.value),onMouseEnter:()=>p($),role:"option","aria-selected":n===O.value,children:[g.jsx("span",{className:j.filterDropdownOptionLabel,children:O.label}),O.sublabel&&g.jsx("span",{className:j.filterDropdownOptionSublabel,children:O.sublabel})]},O.value)}),w.length===0&&c&&g.jsx("div",{className:j.filterDropdownEmpty,children:"No matches found"})]}):g.jsx("div",{className:j.filterDropdownEmpty,children:a})})]})]})},Iq=({filters:t,filterOptions:e,onFiltersChange:n,onClearAll:r,onApply:o,isFiltering:i,hasUnappliedChanges:s,accentColor:a})=>{var h,m,v,y;const{authorOptions:u,recordOptions:l,assetOptions:c,modelOptions:d,userOptions:f}=Aq(e),p=(w,b)=>{n({...t,[w]:b})};return g.jsxs("div",{className:j.filterSidebar,children:[g.jsx("div",{className:j.filterSidebarHeader,children:g.jsx("h3",{className:j.filterSidebarTitle,children:"Filters"})}),g.jsxs("div",{className:j.filterSidebarContent,children:[g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Search"}),g.jsxs("div",{className:j.searchInputWrapperVertical,children:[g.jsxs("svg",{className:j.searchIcon,viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Search"}),g.jsx("path",{d:"M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"})]}),g.jsx("input",{type:"text",className:j.searchInputVertical,placeholder:"Search...",value:t.searchQuery,onChange:w=>p("searchQuery",w.target.value)}),t.searchQuery&&g.jsx("button",{type:"button",className:j.searchClear,onClick:()=>p("searchQuery",""),"aria-label":"Clear search",children:g.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Clear"}),g.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"})]})})]})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Date Range"}),g.jsxs("div",{className:j.dateRangeVertical,children:[g.jsxs("div",{className:j.dateInputVerticalWrapper,children:[g.jsx("span",{className:j.dateInputVerticalLabel,children:"From"}),g.jsx("input",{type:"date",className:j.dateInputVertical,value:((h=t.dateRange.start)==null?void 0:h.toISOString().split("T")[0])??"",onChange:w=>{const b=w.target.value?new Date(w.target.value):null;p("dateRange",{...t.dateRange,start:b})},max:(m=t.dateRange.end)==null?void 0:m.toISOString().split("T")[0]})]}),g.jsxs("div",{className:j.dateInputVerticalWrapper,children:[g.jsx("span",{className:j.dateInputVerticalLabel,children:"To"}),g.jsx("input",{type:"date",className:j.dateInputVertical,value:((v=t.dateRange.end)==null?void 0:v.toISOString().split("T")[0])??"",onChange:w=>{const b=w.target.value?new Date(w.target.value):null;p("dateRange",{...t.dateRange,end:b})},min:(y=t.dateRange.start)==null?void 0:y.toISOString().split("T")[0]})]})]})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Author"}),g.jsx(Js,{label:"",options:u,selectedValue:t.authorEmail,onSelect:w=>p("authorEmail",w),placeholder:"All authors",emptyMessage:"No comments yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Mentioned Record"}),g.jsx(Js,{label:"",options:l,selectedValue:t.mentionedRecordId,onSelect:w=>p("mentionedRecordId",w),placeholder:"All records",emptyMessage:"No record mentions yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Mentioned Asset"}),g.jsx(Js,{label:"",options:c,selectedValue:t.mentionedAssetId,onSelect:w=>p("mentionedAssetId",w),placeholder:"All assets",emptyMessage:"No asset mentions yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Mentioned Model"}),g.jsx(Js,{label:"",options:d,selectedValue:t.mentionedModelId,onSelect:w=>p("mentionedModelId",w),placeholder:"All models",emptyMessage:"No model mentions yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"@Mentioned User"}),g.jsx(Js,{label:"",options:f,selectedValue:t.mentionedUserEmail,onSelect:w=>p("mentionedUserEmail",w),placeholder:"All users",emptyMessage:"No user mentions yet"})]})]}),g.jsxs("div",{className:j.filterSidebarFooter,children:[g.jsx("button",{type:"button",className:j.clearFiltersButton,onClick:r,disabled:!i&&!s,children:"Clear Filters"}),g.jsx("button",{type:"button",className:j.applyFiltersButton,onClick:o,disabled:!s,style:{"--accent-color":a},children:"Apply Filters"})]})]})},rb=3,Pq=500,Rq=8e3;async function Dq(t){let e=null;for(let n=0;n<=rb;n++)try{return await t()}catch(r){if(e=r instanceof Error?r:new Error(String(r)),n===rb)break;const o=PT(n,Pq,Rq,!0);await IT(o)}throw e??new Error("Fetch failed")}function jq(t,e){return t.type!=="mention"||t.mention.type!=="user"?!1:t.mention.email===e}function Lq(t,e){return t.some(n=>jq(n,e))}function Bq(t,e){return t.filter(n=>Lq(n.comment.content,e)).sort((n,r)=>new Date(r.comment.dateISO).getTime()-new Date(n.comment.dateISO).getTime())}function Fq(t,e){return t.filter(n=>!n.isGlobal).sort((n,r)=>new Date(r.comment.dateISO).getTime()-new Date(n.comment.dateISO).getTime()).slice(0,e)}function $q({client:t,mainLocale:e="en"}){const[n,r]=_.useState([]),[o,i]=_.useState(!0),[s,a]=_.useState(null),u=_.useRef(e);u.current=e;const l=_.useCallback(async()=>{if(!t){i(!1);return}try{const c=await Dq(()=>t.items.list({filter:{type:io},page:{limit:100}})),d=[],f=[];for(const p of c){const h=p.model_id,m=p.record_id;if(typeof h!="string"||typeof m!="string")continue;const v=h,y=m,w=gl(p.content),b=v===jy;b||f.push({recordId:y,modelId:v});for(const S of w)if(d.push({comment:S,modelId:v,recordId:y,commentRecordId:p.id,isGlobal:b,isReply:!1}),S.replies)for(const k of S.replies)d.push({comment:k,modelId:v,recordId:y,commentRecordId:p.id,isGlobal:b,isReply:!0,parentCommentId:S.id})}if(f.length>0){const p=await S9(t,f,u.current);for(const h of d)if(!h.isGlobal){const m=p.get(h.recordId);m&&(h.recordTitle=m.title,h.modelName=m.modelName,h.isSingleton=m.isSingleton)}}r(d),a(null)}catch(c){a(c instanceof Error?c:new Error(String(c)))}finally{i(!1)}},[t]);return _.useEffect(()=>{l()},[l]),_.useEffect(()=>{if(!t)return;const c=setInterval(l,Iu.POLLING_INTERVAL_MS);return()=>clearInterval(c)},[t,l]),{allComments:n,isLoading:o,error:s,refetch:l}}const yu={searchQuery:"",authorEmail:null,dateRange:{start:null,end:null},mentionedRecordId:null,mentionedAssetId:null,mentionedModelId:null,mentionedUserEmail:null};function zq(t){const e=[],n=[],r=[],o=[],i=[];for(const s of t)if(s.type==="text")i.push(s.content);else if(s.type==="mention")switch(s.mention.type){case"user":e.push(s.mention),i.push(s.mention.name);break;case"asset":n.push(s.mention),i.push(s.mention.filename);break;case"record":r.push(s.mention),i.push(s.mention.title);break;case"model":o.push(s.mention),i.push(s.mention.name);break;case"field":i.push(s.mention.label);break}return{userMentions:e,assetMentions:n,recordMentions:r,modelMentions:o,textParts:i}}function Uq(t,e){const n=new Set,r=new Set,o=new Set,i=new Set,s=new Set,a=[],{authorsMap:u,recordsMap:l,assetsMap:c,modelsMap:d,usersMap:f}=e;function p(h){s.add(h.author.email),a.push(h.author.name),u.has(h.author.email)||u.set(h.author.email,{email:h.author.email,name:h.author.name});const m=zq(h.content);for(const v of m.userMentions)n.add(v.email),f.has(v.email)||f.set(v.email,{email:v.email,name:v.name});for(const v of m.assetMentions)r.add(v.id),c.has(v.id)||c.set(v.id,{id:v.id,filename:v.filename});for(const v of m.recordMentions)o.add(v.id),l.has(v.id)||l.set(v.id,{id:v.id,title:v.title,modelName:v.modelName});for(const v of m.modelMentions)i.add(v.id),d.has(v.id)||d.set(v.id,{id:v.id,name:v.name});if(a.push(...m.textParts),h.replies)for(const v of h.replies)p(v)}return p(t),{comment:t,dateTimestamp:new Date(t.dateISO).getTime(),searchText:a.join(" ").toLowerCase(),userEmails:n,assetIds:r,recordIds:o,modelIds:i,authorEmails:s}}function Vq(t){const e={authorsMap:new Map,recordsMap:new Map,assetsMap:new Map,modelsMap:new Map,usersMap:new Map},n=[];for(const a of t){const u=Uq(a,e);n.push(u)}const r=(a,u)=>a.name.localeCompare(u.name),o=(a,u)=>a.filename.localeCompare(u.filename),i=(a,u)=>a.title.localeCompare(u.title),s={authors:[...e.authorsMap.values()].sort(r),mentionedRecords:[...e.recordsMap.values()].sort(i),mentionedAssets:[...e.assetsMap.values()].sort(o),mentionedModels:[...e.modelsMap.values()].sort(r),mentionedUsers:[...e.usersMap.values()].sort(r)};return{indexedComments:n,filterOptions:s}}function qq(t,e){var a;const n=e.searchQuery.toLowerCase().trim(),r=e.dateRange.start||e.dateRange.end,o=((a=e.dateRange.start)==null?void 0:a.getTime())??0,i=e.dateRange.end?new Date(e.dateRange.end).setHours(23,59,59,999):Number.MAX_SAFE_INTEGER,s=[];for(const u of t)r&&(u.dateTimestamp<o||u.dateTimestamp>i)||e.authorEmail&&!u.authorEmails.has(e.authorEmail)||e.mentionedUserEmail&&!u.userEmails.has(e.mentionedUserEmail)||e.mentionedAssetId&&!u.assetIds.has(e.mentionedAssetId)||e.mentionedRecordId&&!u.recordIds.has(e.mentionedRecordId)||e.mentionedModelId&&!u.modelIds.has(e.mentionedModelId)||n&&!u.searchText.includes(n)||s.push(u.comment);return s}function Hq(t){return t.searchQuery.trim()!==""||t.authorEmail!==null||t.dateRange.start!==null||t.dateRange.end!==null||t.mentionedRecordId!==null||t.mentionedAssetId!==null||t.mentionedModelId!==null||t.mentionedUserEmail!==null}function Wq(t,e){var n,r,o,i;return t.searchQuery===e.searchQuery&&t.authorEmail===e.authorEmail&&((n=t.dateRange.start)==null?void 0:n.getTime())===((r=e.dateRange.start)==null?void 0:r.getTime())&&((o=t.dateRange.end)==null?void 0:o.getTime())===((i=e.dateRange.end)==null?void 0:i.getTime())&&t.mentionedRecordId===e.mentionedRecordId&&t.mentionedAssetId===e.mentionedAssetId&&t.mentionedModelId===e.mentionedModelId&&t.mentionedUserEmail===e.mentionedUserEmail}function Kq(t){const[e,n]=_.useState(yu),[r,o]=_.useState(yu),{indexedComments:i,filterOptions:s}=_.useMemo(()=>Vq(t),[t]),a=_.useMemo(()=>qq(i,r),[i,r]),u=_.useMemo(()=>Hq(r),[r]),l=_.useMemo(()=>!Wq(e,r),[e,r]),c=_.useCallback(()=>{o(e)},[e]),d=_.useCallback(()=>{n(yu),o(yu)},[]),f=_.useCallback((p,h)=>{n(m=>({...m,[p]:h}))},[]);return{filters:e,setFilters:n,updateFilter:f,filterOptions:s,filteredComments:a,isFiltering:u,hasUnappliedChanges:l,applyFilters:c,clearFilters:d}}const Gq=({ctx:t})=>{const e=sf(t.plugin.attributes.parameters),n=e.cdaToken,r=T9(e),{email:o,name:i}=DT(t.currentUser),s=_.useMemo(()=>t.currentUserAccessToken?Sd({apiToken:t.currentUserAccessToken}):null,[t.currentUserAccessToken]),{projectUsers:a,projectModels:u,typedUsers:l}=jT(t),{canMentionAssets:c,canMentionModels:d,readableModels:f}=zT(t,u),p=t.site.attributes.locales[0],[h,m]=_.useState(!0),{comments:v,setComments:y,isLoading:w,error:b,status:S,fullResult:{commentsModelId:k,commentRecordId:E,setCommentRecordId:x}}=BT({context:"global",ctx:t,realTimeEnabled:r,cdaToken:n,client:s,isSyncAllowed:h}),{filters:T,setFilters:O,filterOptions:N,filteredComments:$,isFiltering:P,hasUnappliedChanges:D,applyFilters:q,clearFilters:B}=Kq(v),{allComments:z,isLoading:K}=$q({client:s,mainLocale:p}),I=_.useMemo(()=>Bq(z,o),[z,o]),L=_.useMemo(()=>Fq(z,20),[z]),F=_.useCallback((Ue,pt)=>{const Ve=`/editor/item_types/${Ue}/items/${pt}/edit`;t.navigateTo(Ve)},[t]),Z=_.useCallback(Ue=>{const pt=document.querySelector(`[data-comment-id="${Ue}"]`);pt&&(pt.scrollIntoView({behavior:"smooth",block:"center"}),pt.classList.add("highlight"),setTimeout(()=>pt.classList.remove("highlight"),2e3))},[]),ie=v.length>0,ke=t.theme.accentColor,[fe,Ne]=_.useState(!0),pe=[T.searchQuery.trim(),T.authorEmail,T.dateRange.start,T.dateRange.end,T.mentionedRecordId,T.mentionedAssetId,T.mentionedModelId,T.mentionedUserEmail].filter(Boolean).length,Ae=ie&&!fe;return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:j.dashboardContainer,children:[g.jsx("div",{className:j.mainChannel,children:g.jsx(sk,{projectUsers:a,projectModels:u,modelFields:[],currentUserEmail:o,typedUsers:l,children:g.jsx(VT,{canMentionFields:!1,canMentionAssets:c,canMentionModels:d,children:g.jsx(Eq,{ctx:t,client:s,userName:i,readableModels:f,accentColor:ke,comments:v,filteredComments:$,setComments:y,commentsModelId:k,commentRecordId:E,setCommentRecordId:x,isLoading:w,error:b,status:S,isFiltering:P,onSyncAllowedChange:m})})})}),g.jsxs("div",{className:j.sidebar,children:[Ae&&g.jsx("div",{className:j.filterColumn,children:g.jsx(Iq,{filters:T,filterOptions:N,onFiltersChange:O,onClearAll:B,onApply:q,isFiltering:P,hasUnappliedChanges:D,accentColor:ke})}),ie&&g.jsxs("button",{type:"button",className:`${j.filterToggleFab}${P?` ${j.filterToggleFabActive}`:""}${fe?"":` ${j.filterToggleFabExpanded}`}`,onClick:()=>Ne(!fe),style:{"--accent-color":ke},title:fe?"Show filters":"Hide filters",children:[g.jsxs("svg",{className:j.filterToggleFabIcon,viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Filters"}),g.jsx("path",{d:"M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2z"})]}),pe>0&&g.jsx("span",{className:j.filterToggleFabBadge,style:{backgroundColor:ke},children:pe})]}),g.jsxs("div",{className:j.sidebarInner,children:[g.jsx(Oq,{mentions:I,isLoading:K,onNavigateToRecord:F,onScrollToGlobalComment:Z}),g.jsx(Nq,{comments:L,isLoading:K,onNavigateToRecord:F,onScrollToGlobalComment:Z})]})]})]})})},Jq={locale:"en",long:{year:{previous:"last year",current:"this year",next:"next year",past:{one:"{0} year ago",other:"{0} years ago"},future:{one:"in {0} year",other:"in {0} years"}},quarter:{previous:"last quarter",current:"this quarter",next:"next quarter",past:{one:"{0} quarter ago",other:"{0} quarters ago"},future:{one:"in {0} quarter",other:"in {0} quarters"}},month:{previous:"last month",current:"this month",next:"next month",past:{one:"{0} month ago",other:"{0} months ago"},future:{one:"in {0} month",other:"in {0} months"}},week:{previous:"last week",current:"this week",next:"next week",past:{one:"{0} week ago",other:"{0} weeks ago"},future:{one:"in {0} week",other:"in {0} weeks"}},day:{previous:"yesterday",current:"today",next:"tomorrow",past:{one:"{0} day ago",other:"{0} days ago"},future:{one:"in {0} day",other:"in {0} days"}},hour:{current:"this hour",past:{one:"{0} hour ago",other:"{0} hours ago"},future:{one:"in {0} hour",other:"in {0} hours"}},minute:{current:"this minute",past:{one:"{0} minute ago",other:"{0} minutes ago"},future:{one:"in {0} minute",other:"in {0} minutes"}},second:{current:"now",past:{one:"{0} second ago",other:"{0} seconds ago"},future:{one:"in {0} second",other:"in {0} seconds"}}},short:{year:{previous:"last yr.",current:"this yr.",next:"next yr.",past:"{0} yr. ago",future:"in {0} yr."},quarter:{previous:"last qtr.",current:"this qtr.",next:"next qtr.",past:{one:"{0} qtr. ago",other:"{0} qtrs. ago"},future:{one:"in {0} qtr.",other:"in {0} qtrs."}},month:{previous:"last mo.",current:"this mo.",next:"next mo.",past:"{0} mo. ago",future:"in {0} mo."},week:{previous:"last wk.",current:"this wk.",next:"next wk.",past:"{0} wk. ago",future:"in {0} wk."},day:{previous:"yesterday",current:"today",next:"tomorrow",past:{one:"{0} day ago",other:"{0} days ago"},future:{one:"in {0} day",other:"in {0} days"}},hour:{current:"this hour",past:"{0} hr. ago",future:"in {0} hr."},minute:{current:"this minute",past:"{0} min. ago",future:"in {0} min."},second:{current:"now",past:"{0} sec. ago",future:"in {0} sec."}},narrow:{year:{previous:"last yr.",current:"this yr.",next:"next yr.",past:"{0}y ago",future:"in {0}y"},quarter:{previous:"last qtr.",current:"this qtr.",next:"next qtr.",past:"{0}q ago",future:"in {0}q"},month:{previous:"last mo.",current:"this mo.",next:"next mo.",past:"{0}mo ago",future:"in {0}mo"},week:{previous:"last wk.",current:"this wk.",next:"next wk.",past:"{0}w ago",future:"in {0}w"},day:{previous:"yesterday",current:"today",next:"tomorrow",past:"{0}d ago",future:"in {0}d"},hour:{current:"this hour",past:"{0}h ago",future:"in {0}h"},minute:{current:"this minute",past:"{0}m ago",future:"in {0}m"},second:{current:"now",past:"{0}s ago",future:"in {0}s"}},now:{now:{current:"now",future:"in a moment",past:"just now"}},mini:{year:"{0}yr",month:"{0}mo",week:"{0}wk",day:"{0}d",hour:"{0}h",minute:"{0}m",second:"{0}s",now:"now"},"short-time":{year:"{0} yr.",month:"{0} mo.",week:"{0} wk.",day:{one:"{0} day",other:"{0} days"},hour:"{0} hr.",minute:"{0} min.",second:"{0} sec."},"long-time":{year:{one:"{0} year",other:"{0} years"},month:{one:"{0} month",other:"{0} months"},week:{one:"{0} week",other:"{0} weeks"},day:{one:"{0} day",other:"{0} days"},hour:{one:"{0} hour",other:"{0} hours"},minute:{one:"{0} minute",other:"{0} minutes"},second:{one:"{0} second",other:"{0} seconds"}}};Sn.addDefaultLocale(Jq);async function Yq(t){if(!t.currentUserAccessToken)return;const e=Sd({apiToken:t.currentUserAccessToken});if((await e.itemTypes.list()).find(i=>i.api_key===io))return;const o=await e.itemTypes.create({name:"Project Comment",api_key:io,draft_mode_active:!1});await e.fields.create(o.id,{label:"Model ID",api_key:zf.MODEL_ID,field_type:"string",validators:{required:{}}}),await e.fields.create(o.id,{label:"Record ID",api_key:zf.RECORD_ID,field_type:"string",validators:{required:{},unique:{}}}),await e.fields.create(o.id,{label:"Content",api_key:zf.CONTENT,field_type:"json",validators:{required:{}}})}eM({async onBoot(t){try{await Yq(t)}catch(e){Te("Failed to ensure comments model exists during plugin boot",e,{hasAccessToken:!!t.currentUserAccessToken}),t.notice("Comments plugin initialization warning: Unable to verify comment storage. If this is your first time using the plugin, please check your permissions.")}},renderConfigScreen(t){jf(g.jsx(wq,{ctx:t}))},itemFormSidebars(){return[{id:Vs.SIDEBAR,label:"Comments"}]},renderItemFormSidebar(t,e){t===Vs.SIDEBAR&&jf(g.jsx(U5,{ctx:e,children:g.jsx(C9,{ctx:e})}))},contentAreaSidebarItems(t){return sf(t.plugin.attributes.parameters).dashboardEnabled?[{label:"Comments",icon:Vs.ICON,placement:["before","menuItems"],pointsTo:{pageId:Vs.PAGE}}]:[]},renderPage(t,e){t===Vs.PAGE&&jf(g.jsx(V5,{ctx:e,children:g.jsx(Gq,{ctx:e})}))}});
|