PageSourceSearch

https://pronervium-enhance-rnt0gfo.gamma.site/_next/static/chunks/4001-0e12bce7be5b74fb.js

js pronervium-enhance-rnt0gfo.gamma.site collected 2026-10-03 04:11:05 UTC 57,234 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4001],{62040:function(e,t,n){n.d(t,{n:function(){return i}});var o=n(62564),r=n(2784),s=n(14274),a=n(42111);let i=e=>{let t=(0,a.ye)("debugLogging");(0,r.useEffect)(()=>{if(e){if(t){console.debug("[Prosemirror DevTools] Activating prosemirror-dev-tools");try{(0,o.h)(e.view)}catch(e){}}else(0,o.P)();return s.v.DEBUG_ENABLED&&(window.openPMDT=()=>(0,o.h)(e.view)),()=>{(0,o.P)(),delete window.openPMDT}}},[e,t])}},7636:function(e,t,n){n.d(t,{f:function(){return i}});var o=n(52322),r=n(43997),s=n(85069),a=n(36835);let i=e=>{let{...t}=e,{reduxData:n,...i}=t,l=(0,s.c)(n);return(0,o.jsx)(r.zt,{store:l,children:(0,o.jsx)(a.y,{...i,readOnly:!0,isStatic:!0,animationsEnabled:!1})})}},27058:function(e,t,n){n.d(t,{F:function(){return a}});var o=n(72338),r=n(50125),s=n(88017);let a=o.hj.create({name:"animations",addOptions:()=>({}),addCommands:()=>({addAnimationPositions:(e,t)=>n=>{let{state:o,dispatch:r}=n;return r&&o.tr.setMeta(s.$,{type:"addAnimationPositions",isPresentMode:t,pos:e}),!0},enableAnimations:e=>t=>{let{state:n,dispatch:o}=t;return o&&n.tr.setMeta(s.$,{type:"enableAnimations",enabled:e}),!0},resetAnimationPositions:e=>t=>{let{state:n,dispatch:o}=t;return o&&n.tr.setMeta(s.$,{type:"resetAnimationPositions",isPresentMode:e}),!0}}),addProseMirrorPlugins:()=>[(0,r.Q2)()]})},50125:function(e,t,n){n.d(t,{iI:function(){return D},GD:function(){return C},l:function(){return I},VM:function(){return P},Q2:function(){return j},RN:function(){return E},PY:function(){return T}});var o=n(73200),r=n(72338),s=n(27191),a=n(52780),i=n(91994),l=n(47968),c=n(90604),d=n(91073),u=n(88017),h=n(38564),p=n(46795);let m=()=>({absPositions:[],relPositions:[]});class f{getPositions(e){return e?this.presentModePositions:this.editModePositions}apply(e,t){let n=e.getMeta(u.$);if(n)switch(n.type){case"addAnimationPositions":this.addAnimationPositions(n.pos,t,n.isPresentMode);break;case"resetAnimationPositions":this.resetAnimationPositions(n.isPresentMode);break;case"enableAnimations":this.enabled=n.enabled;break;default:console.warn("AnimationsState: unknown action type",n)}return this}addAnimationPositions(e,t,n){let o=this.getPositions(n);e.forEach(e=>{o.absPositions.push(e);let n=(0,p.jS)(t,e);n&&o.relPositions.push(n)})}resetAnimationPositions(e){e?this.presentModePositions=m():this.editModePositions=m()}getAnimationPositionsAbs(e,t){let n=h.Gt.getState(e),o=this.getPositions(t);return n?o.relPositions.map(t=>(0,p.XV)(e,t)).filter(Boolean):o.absPositions}constructor(){this.enabled=!0,this.presentModePositions=m(),this.editModePositions=m()}}var g=n(14657);let v=e=>"buttonGroup"===e.type.name;var y=n(57863),b=n(52332),w=n(15468),A=n(27835),S=n(26282),M=n(82400),k=n(59322);let E="animate-has-animated",C="animatable-on-load",D="animatable-on-load-as-block",P="animatable-on-load-content-parent",I="animatable-on-load-content-child",x=e=>{switch(e.type.name){case"card":return!0===(0,b.HD)(e);case"cardAccentLayoutItem":return(0,w.pt)(e);case"calloutBox":case"gallery":case"smartLayout":case"divider":return!0;default:return(0,M.yV)(e)}},R=(e,t)=>(0,S.E)(e)||(0,A.u5)(t),T=(e,t)=>{let n=e.view.state.doc.resolve(t);if(!n)return;let o=e.state.doc.nodeAt(t);if(o&&x(o)&&!R(o,n)){let e=o.isLeaf||o.isAtom?0:-1;return{pos:n.pos+e,start:n.pos,depth:n.depth,node:o}}return(0,r.qv)(n,x)},_=(e,t)=>{let n=t.getAnimationPositionsAbs(e,(0,l.gh)((0,i.bh)().getState())===c.q.SLIDE_VIEW),o=n.reduce((e,t)=>Math.max(e,t),0),r=e.doc.nodeAt(o),s=r&&o>0?r.nodeSize:0;return o+s},j=()=>new s.Sy({key:u.$,state:{init:()=>new f,apply:(e,t,n,o)=>t.apply(e,o)},props:{decorations(e){let t=[],n=this.getState(e);if(!1===n.enabled)return a.EH.create(e.doc,t);let r=_(e,n);return e.doc.descendants((n,s,i,l)=>{let c=e.doc.resolve(s),u=x(n)||R(n,c);if(s<r&&u&&t.push(a.p.node(s,s+n.nodeSize,{class:E})),(0,S.G)(n)||(0,A.N5)(n))t.push(a.p.node(s,s+n.nodeSize,{class:P}));else if(v(n)||(0,y.m)(n)||(0,k.CU)(n))t.push(a.p.node(s,s+n.nodeSize,{class:D}));else if(R(n,c))t.push(a.p.node(s,s+n.nodeSize,{class:I,style:"--animate-index: ".concat(l+1)}));else if(x(n)){let e=!!i&&(0,g.R1)(n,i),r=n.isAtom;t.push(a.p.node(s,s+n.nodeSize,{class:(0,o.cx)(C,e&&"animatable-on-load-annotatable",r&&"animatable-on-load-atom")})),(0,w.pt)(n)&&t.push(a.p.node(s,s+n.nodeSize,{class:"animatable-on-load-accent"}))}let h=(0,d.KH)(n)&&c.depth>1;return!(h||(0,S.E)(n)||v(n)||(0,y.m)(n)||(0,k.CU)(n))}),a.EH.create(e.doc,t)}}})},88017:function(e,t,n){n.d(t,{$:function(){return r}});var o=n(27191);let r=new o.H$("animation")},16268:function(e,t,n){n.d(t,{R:function(){return i},p:function(){return l}});var o=n(72338),r=n(27191),s=n(69180);let a=new r.H$("yDocSize"),i=e=>{let t=a.getState(e.state);return t?t.getYDocSize():null},l=o.hj.create({name:"yDocSize",addProseMirrorPlugins(){let{document:e}=this.options;return[new r.Sy({key:a,state:{init:()=>new c(e),apply:(e,t)=>t}})]}});class c{getYDocSize(){return s.D$(this.ydoc).byteLength}constructor(e){this.ydoc=e}}},26900:function(e,t,n){n.d(t,{g:function(){return c},j:function(){return d}});var o=n(18149),r=n.n(o),s=n(2784),a=n(91994),i=n(47968),l=n(82400);let c=e=>{let t=(0,a.CG)(i.k8,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r()(...t)});return(0,s.useMemo)(()=>({enabled:!!(e&&t&&(0,l.Jg)(e,t)),pos:null==t?void 0:t.pos}),[e,t])},d=e=>{let t=(0,a.CG)(i.ks),n=(0,a.CG)(i.Vt,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r()(...t)});(0,s.useEffect)(()=>
1{if(!e||!t||!n)return;console.debug("[useScrollAndSpotlightSync] collaboratorBeingFollowed spotlight or scroll changed",JSON.stringify(n,null,2));let{spotlight:o,scroll:r}=n;e.commands.syncSpotlightAndScroll({spotlight:o,scroll:r,scrollOffset:100,isFollowing:!0})},[e,t,n])}},61750:function(e,t,n){n.d(t,{$1:function(){return o.$1},gZ:function(){return r.g},jB:function(){return r.j}});var o=n(82400),r=n(26900)},56356:function(e,t,n){n.d(t,{Ge:function(){return tU},yE:function(){return C.y},fb:function(){return tq.f},R$:function(){return tV.R$},bx:function(){return tV.bx},VK:function(){return tV.VK},vL:function(){return tV.vL}});var o=n(52780);o.tk.prototype.updateState=function(e){this.docView&&this.updateStateInner(e,this.state.plugins!=e.plugins)};var r=n(52322),s=n(73487),a=n(28535),i=n(42822),l=n(43297),c=n(81540),d=n(77533),u=n(79522),h=n(44058),p=n(64652),m=n(2784),f=n(91760),g=n(69180),v=n(14274),y=n(93202),b=n(42111),w=n(23405),A=n(25944),S=n(91994),M=n(29318),k=n(16268),E=n(36651),C=n(36835),D=n(72338),P=n(27191),I=n(41774),x=n(38322),R=n(96255);let T=()=>{let e=document.createElement("span");e.classList.add("collaboration-cursor__caret","streaming-cursor"),e.setAttribute("style","border-color: var(--chakra-colors-trueblue-100)");let t=document.createElement("div");return t.classList.add("collaboration-cursor__label","streaming-cursor__label"),t.setAttribute("style","background-color: var(--chakra-colors-trueblue-100); color: var(--chakra-colors-trueblue-400)"),e.insertBefore(t,null),e},_=D.hj.create({name:"aiGeneration",addOptions:()=>({provider:null}),addStorage:()=>({generationEnabled:!1}),onCreate(){let{provider:e}=this.options;e&&e.awareness&&e.awareness.on("change",()=>{if(!e.awareness)return;let t=!1;for(let[n,o]of e.awareness.getStates())o.isStreaming&&n!==e.awareness.clientID&&(t=!0);let n=(0,S.bh)(),o=(0,I.nl)(n.getState());o!==t&&n.dispatch((0,I.R4)(t))})},addCommands(){return{setAIGenerationRunning:e=>()=>{var t,n;return this.storage.generationEnabled=e,null===(n=this.options.provider)||void 0===n||null===(t=n.awareness)||void 0===t||t.setLocalStateField("isStreaming",e),!0}}},addProseMirrorPlugins(){let{storage:e}=this;return[new P.Sy({key:new P.H$("aiGeneration"),props:{decorations(t){if(!e.generationEnabled)return o.EH.empty;let n=[],r=t.doc.content.size-2,s=(0,D.qv)(t.doc.resolve(r),R.KH),a=s?(0,x.t)(t.doc.resolve(s.pos),-1):null;return a&&s&&(n.push(o.p.widget(a.from,T,{key:"sal",side:10})),n.push(o.p.node(s.pos,s.pos+s.node.nodeSize,{class:"ai-generate-streaming-card"}))),o.EH.create(t.doc,n)}}})]}});var j=n(8445);let z=()=>new P.Sy({key:j.i,state:{init:()=>new j.Y,apply:(e,t,n,o)=>t.apply(e,o)}}),B=D.hj.create({name:"aiModifications",onCreate(){this.options.document.on("afterAllTransactions",e=>{let t=j.i.getState(this.editor.view.state);t&&t.flushMoveInstructionQueue(this.editor.view.state)})},addProseMirrorPlugins:()=>[z()],addCommands:()=>({setInteractionRange:(e,t)=>
1n=>{let{tr:o}=n;return o.setMeta("aiModificationAction",{type:"setInteractionRange",rangeId:e,range:t}),!0}})});var H=n(47016),O=n(73200),N=n(11093);let L=(e,t)=>new P.Sy({props:{attributes:()=>t.salPanelOpen?{class:"sal-active"}:{class:""},decorations:n=>{let{doc:r,selection:s}=n;if(!t.salPanelOpen)return;let{from:a,to:i}=s,l=[],c=(0,N.Ru)(s.$from,R.KH);return c.forEach((e,t)=>{l.push(o.p.node(e.pos,e.pos+e.node.nodeSize,{class:(0,O.cx)(0==t?"sal-active-card":"sal-active-card-parent")}))}),(0,N.KB)(e)||(s instanceof P.Bs?l.push(o.p.inline(a,i,{class:(0,O.cx)("sal-selection-text")})):s instanceof P.qv&&l.push(o.p.node(a,i,{class:(0,O.cx)("sal-selection-node")}))),o.EH.create(r,l)}}}),U=D.hj.create({name:"salExtension",addStorage:()=>({salPanelOpen:!1}),addProseMirrorPlugins(){return[L(this.editor,this.storage)]},addCommands(){return{setSalOpen:e=>t=>{let{state:n,dispatch:o}=t;return this.storage.salPanelOpen=e,!0}}}});var V=n(27058),q=n(38564),K=n(54073),F=n.n(K),G=n(26151),$=n(6092);class Q extends $.y{[Symbol.iterator](){return this.yarray[Symbol.iterator]()}values(){let e=this.yarray.length,t=-1;return{[Symbol.iterator]:()=>({next(){return++t===e?{value:void 0,done:!0}:{value:this.yarray.get(t),done:!1}}})}}forEach(e){return this.yarray.forEach(e)}set(e,t){return this.doc.transact(n=>{this.map.has(e)&&this.delete(e),this.yarray.push([{key:e,val:t}])}),t}delete(e){let t=0;for(let n of this.yarray){if(n.key===e){this.yarray.delete(t);break}t++}}get(e){let t=this.map.get(e);return t&&t.val}has(e){return this.map.has(e)}constructor(e){super(),this.yarray=e,this.doc=e.doc,this.map=new Map;let t=e.toArray();this.doc.transact(n=>{for(let n=t.length-1;n>=0;n--){let o=t[n];this.map.has(o.key)?e.delete(n):this.map.set(o.key,o)}}),e.observe(t=>{let n=new Map,o=Array.from(t.changes.added);t.changes.deleted.forEach(e=>{e.content.getContent().forEach(e=>{this.map.get(e.key)===e&&(this.map.delete(e.key),n.set(e.key,{action:"delete",oldValue:e.val}))})});let r=new Map;o.map(e=>e.content.getContent()).flat().forEach(e=>{r.set(e.key,e)});let s=new Set,a=e.toArray();this.doc.transact(t=>{for(let t=a.length-1;t>=0&&(r.size>0||s.size>0);t--){let o=a[t];if(s.has(o.key))s.delete(o.key),e.delete(t,1);else if(r.get(o.key)===o){let e=this.map.get(o.key);if(e)s.add(o.key),n.set(o.key,{action:"update",oldValue:e.val,newValue:o.val});else{let e=n.get(o.key);e&&"delete"===e.action?n.set(o.key,{action:"update",newValue:o.val,oldValue:e.oldValue}):n.set(o.key,{action:"add",newValue:o.val})}r.delete(o.key),this.map.set(o.key,o)}else r.has(o.key)&&(s.add(o.key),r.delete(o.key))}}),n.size>0&&this.emit("change",[n])})}}class Y{run(e){}}class W extends Y{createKeyValue(e,t){let n=e.getArray(t),o=new Q(n);return o}getRestoreMap(e){return e.getMap("annotationsAbsolute")}run(e){let t=this.createKeyValue(e,"annotationsAbsoluteKV"),n=this.getRestoreMap(e);for(let[e,o]of n.entries())t.set(e,o)}constructor(...e){super(...e),this.name="AnnotationsYKeyValue"}}class Z{runMigrations(){let e=this.getMigrationsMap();for(let t of this.migrations)if(!this.hasRunMigration(t.name))try{t.run(this.document),e.set(t.name,!0)}catch(e){}}getMigrationsMap(){return this.document.getMap(Z.ANNOTATION_MIGRATIONS_KEY)}hasRunMigration(e){return this.getMigrationsMap().get(e)||!1}constructor(e){this.migrations=[new W],this.document=e,this.document.transact(()=>{this.runMigrations()}),this.annotations=this.document.getMap("annotations"),this.annotationsAbsolute=new Q(this.document.getArray("annotationsAbsoluteKV"))}}Z.ANNOTATION_MIGRATIONS_KEY="annotationMigrations";class J{get id(){return this.decoration.type.spec.id}get from(){return this.decoration.from}get data(){return this.decoration.type.spec.data}get HTMLAttributes(){return this.decoration.type.attrs}toString(){return JSON.stringify({id:this.id,data:this.data,from:this.from,HTMLAttributes:this.HTMLAttributes})}constructor(e){this.decoration=e}}var X=n(50105),ee=n(36069),et=n(9850),en=n.n(et),eo=n(35838),er=n.n(eo),es=n(84636),ea=n.n(es),ei=n(46795),el=n(14657);function ec(e){let t=[];for(let n=e.length-1;n>=0;n--){let o=e[n];t.push({...o,prev:o.next,next:o.prev})}return t}class ed{flushUndoQueue(){let{undoQueue:e}=this;return this.undoQueue=[],e}set(e,t){let n=this.map.get(e);return this.undoQueue.unshift({type:"set",key:e,next:n,prev:t}),this.map.set(e,t)}delete(e){let t=this.map.get(e);return void 0===t||this.undoQueue.unshift({type:"set",key:e,next:t,prev:void 0}),this.map.delete(e)}constructor(e){this.map=e,this.undoQueue=[]}}class eu{persistRestoreMap(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={deletion:0,relToAbs:0,setting:0,total:0},o=performance.now();(t||this.hasChanges)&&(this.transactYDoc(()=>{let t=performance.now();for(let{key:e}of this.restoreMap)this.restoreMap.delete(e);
1n.deletion=performance.now()-t,this.map.forEach(t=>{let{id:o,pos:r,data:s}=t;try{let t=performance.now(),a=this.relToAbs(e,r);n.relToAbs+=performance.now()-t;let i=performance.now();this.restoreMap.set(o,{id:o,data:s,absPos:a}),n.setting+=performance.now()-i}catch(e){console.error("[Annotations] persistRestoreMap error: ",e.message)}})}),n.total=performance.now()-o,this.log("[Annotations] persistRestoreMap in ".concat(n.total,"ms"),{values:this.restoreMap.yarray.toArray(),performance:n}),this.hasChanges=!1)}flushMoveInstructionQueue(){let{moveInstructionMap:e}=this;return this.moveInstructionMap={},Object.values(e)}clearCutData(){this.cutData=null,this.filmstripCutData=null}getAnnotationsBetween(e,t,n){let o=[];for(let r of this.map.values())try{let s=this.relToAbs(e,r.pos);if(null===s)continue;t<=s&&s<n&&o.push({id:r.id,data:r.data,pos:s,relativePos:r.pos})}catch(e){console.warn("[Annotations] getAnnotationsBetween error: ",e.message)}return o}apply(e,t){let n=q.Gt.getState(t);if(n.isChangeOrigin){try{this.createDecorations(t)}catch(e){console.warn("[Annotations] handle remote change, not create decorations: ".concat(e.message))}return this}let o=e.getMeta(X.Z);if(o){switch(o.type){case"addAnnotation":this.addAnnotation(o,t);break;case"restoreAnnotations":this.restoreAnnotations(o);break;case"clearAnnotations":this.clearAnnotations();break;case"deleteAnnotation":this.deleteAnnotation(o.id);break;case"refreshAnnotationDecorations":try{this.createDecorations(t)}catch(e){console.warn("could not create decorations: ".concat(e.message))}break;case"moveAnnotations":this.moveAnnotations(t,o.toMove)}return this.hasChanges=!0,this}let r=e.getMeta("uiEvent");switch(r){case"cut":this.handleCutTransaction(t,e);break;case"paste":this.handlePasteTransaction(t,e)}let s=e.getMeta("annotationEvent");switch(null==s?void 0:s.type){case"split-card":this.handleSplitCard(t,e,s);break;case"split-block":this.handleSplitBlock(t,e,s);break;case"join-forward":this.handleJoinForward(t,e,s);break;case"join-backward":this.handleJoinBackward(t,e,s);break;case"update-node-attrs":this.handleUpdateNodeAttrs(t,e,s);break;case"rearrange-cards":this.handleRearrangeCards(t,e,s);break;case"move":this.handleMove(t,e,s);break;case"merge-cards":this.handleMergeCards(t,e,s);break;case"drop":this.handleDropAnnotations(t,e,s);break;case"unwrap-node":this.handleUnwrapNode(t,e,s);break;case"wrap-nodes":this.handleWrapNodes(t,e,s);break;case"filmstrip-cut":this.handleFilmstripCut(t,e,s);break;case"filmstrip-paste":this.handleFilmstripPaste(t,e,s);break;default:e.getMeta("appendedTransaction")||(this.handleReplaceTransaction(t,e),this.handleReplaceAroundTransaction(t,e))}return e.docChanged&&(this.hasChanges=!0),this.handleLocalChange(e)}restore(e,t){t.forEach(t=>{let{next:n,key:o}=t;void 0===n?this.map.delete(o):this.map.set(o,{...n,pos:this.refreshRelativePos(e,n.pos)})}),this.persistRestoreMap(e,!0)}handleUnwrapNode(e,t,n){let{pos:o}=n,r=t.before.resolve(o),s=r.start(r.depth+1),a=t.before.resolve(s).end(),i=this.getAnnotationsBetween(e,s,a).map(t=>{let{id:n,relativePos:r}=t,a=this.relToAbs(e,r);if(null===a)return null;let i=a-s;return{id:n,newPos:o+i}}).filter(e=>!!e);this.log("%c[Annotations] unwrap node","color: green",{tr:t,pos:o,start:s,end:a,toMove:i}),i.length>0&&this.enqueueMoveInstructions(i)}handleWrapNodes(e,t,n){let{start:o,end:r,level:s}=n,a=this.getAnnotationsBetween(e,o,r).map(e=>{let{id:t,pos:n}=e;return{id:t,newPos:n+s}}).filter(e=>!!e);this.log("%c[Annotations] wrap nodes","color: green",{tr:t,start:o,end:r,toMove:a}),a.length>0&&this.enqueueMoveInstructions(a)}handleMergeCards(e,t,n){let{insertPos:o,contentPos:r}=n,s=t.before.nodeAt(r);if(!s){console.error("[AnnotationState] trying to merge cards, but cannot resolve content wrapper");return}let a=this.getAnnotationsBetween(e,r,r+s.nodeSize).map(e=>{let{id:t,pos:n}=e,s=n-r-1;return{id:t,newPos:o+s}});this.log("%c[Annotations] merge cards","color: green",{transaction:t,insertPos:o,contentPos:r,toMove:a}),a.length>0&&this.enqueueMoveInstructions(a)}handleRearrangeCards(e,t,n){let{rearrangedCardPositions:o,insertPos:r}=n,s=o.flatMap(n=>{let{newPos:o,oldPos:r}=n,s=t.before.resolve(r);return this.getAnnotationsBetween(e,r,r+s.nodeAfter.nodeSize).map(e=>{let{id:t,pos:n}=e;return{id:t,newPos:o+(n-r)}})}),a=[],i=(0,R.Y0)(t.before);if(i){let n=o[0].oldPos,s=Math.min(n,r),l=Math.max(n,r);a=i.flatMap(n=>{let{node:r,pos:a}=n,i=a>=s&&a<=l,c=i&&!o.find(e=>e.id===r.attrs.id);if(!c)return[];{let n=t.before.resolve(a),o=a+n.nodeAfter.nodeSize;return this.getAnnotationsBetween(e,a,o).map(e=>{let{id:n,pos:o}=e;return{id:n,newPos:t.mapping.map(o)}})}})}this.log("%c[Annotations] rearrange cards","color: green",{transaction:t,rearrangedCardPositions:o,annotationsInRearrangedCards:s,jumpedAnnotations:a});let l=[...s,...a];l.length>0&&this.enqueueMoveInstructions(l)}handleMove(e,t,n){let{insertPos:o,insertPosRaw:r,pos:s,end:a}=n,i=this.getAnnotationsBetween(e,s,a).map(e=>{let{id:t,pos:n}=e;return{id:t,newPos:o+(n-s)}}),l=this.getAnnotationsBetween(e,Math.min(r,a),Math.max(r,s)).map(e=>{let{id:n,pos:o}=e;return{id:n,newPos:t.mapping.map(o)}});this.log("%c[Annotations] move","color: green",{transaction:t,insertPos:o,insertPosRaw:r,pos:s,end:a,annotationsInCard:i,jumpedAnnotations:l});let c=[...i,...l];c.length>0&&this.enqueueMoveInstructions(c)}handleUpdateNodeAttrs(e,t,n){let{pos:o}=n,r=t.doc.nodeAt(o);if(!r)return;
1let s=this.getAnnotationsBetween(e,o,o+r.nodeSize).map(e=>{let{id:t,pos:n}=e;return{id:t,newPos:n}});this.log("%c[Annotations] update node attrs","color: green",{transaction:t,pos:o,toMove:s}),s.length>0&&this.enqueueMoveInstructions(s)}handleJoinBackward(e,t,n){let{atBeginning:o,joinPos:r}=n;if(!o)return;let s=t.before.resolve(r),a=t.before.resolve(s.before()),i=a.nodeBefore,l=a.nodeAfter;if(!i||!l)return;let c=a.pos+l.nodeSize,d=a.pos-i.nodeSize,u=e.selection.from;this.log("%c[Annotations] join backward","color: green",{transaction:t,prevBlock:i,nextBlock:l,nextBlockPos:a.pos,nextBlockEnd:c,prevBlockPos:d,joinPoint:u});let h=this.getAnnotationsBetween(e,a.pos,c);if(0===h.length){this.enqueueRefreshDecorations();return}0===l.content.size?(h.forEach(e=>{let{id:t}=e;return this.undoableMap.delete(t)}),requestAnimationFrame(()=>{this.writeUndoStack(e)})):this.enqueueMoveInstructions(h.map(e=>{let{id:t,pos:n}=e,o=Math.max(n-a.pos-1,0),r=0===i.content.size?d:u;return{id:t,newPos:r+o}}))}handleJoinForward(e,t,n){let{atEnd:o,joinPos:r}=n;if(!o)return;let s=t.before.resolve(r),{pos:a,node:i}=(0,N.nv)(s,e=>e.isBlock)[0],l=t.before.resolve(s.after()),c=l.nodeAfter;if(!c)return;let d=l.pos+c.nodeSize;this.log("%c[Annotations] join forward","color: green",{sel:e.selection,prevBlock:i,transaction:t,deleteAnnotations:!!c.isAtom,joinPos:s.pos,prevBlockPos:a,nextBlockPos:l.pos,nextBlock:c});let u=this.getAnnotationsBetween(e,a,a+i.nodeSize),h=this.getAnnotationsBetween(e,l.pos,d);if(0===h.length&&0===u.length){this.enqueueRefreshDecorations();return}let p=t=>{t.forEach(e=>{let{id:t}=e;return this.undoableMap.delete(t)}),requestAnimationFrame(()=>{this.writeUndoStack(e)})};c.isAtom&&i.content.size>0?p(h):0===i.content.size?p(u):this.enqueueMoveInstructions(h.map(e=>{let{id:t,pos:n}=e,o=Math.max(n-l.pos-1,0),s=0===i.content.size?a:r;return{id:t,newPos:s+o}}))}handleSplitBlock(e,t,n){let{splitPos:o,atBeginning:r}=n;if(r){this.enqueueRefreshDecorations();return}let s=t.before.resolve(o),{pos:a,node:i}=(0,N.nv)(s,e=>e.isBlock)[0],{$from:l}=e.selection,c=(0,N.nv)(l,e=>e.isBlock)[0],d=this.getAnnotationsBetween(e,o,a+i.nodeSize).map(e=>{let{id:t,pos:n}=e,r=n-o;return{id:t,newPos:c.pos+(0===r?r:r+1)}});d.length>0?this.enqueueMoveInstructions(d):this.enqueueRefreshDecorations(),this.log("%c[Annotations] split block","color: green",{sel:e.selection,transaction:t,splitPos:o,toMove:d,$before:s})}handleSplitCard(e,t,n){let{splitPos:o}=n,r=t.before.resolve(o),s=(0,N.nv)(r,R.KH)[0];if(!s)return;let a=s.pos,i=s.pos+s.node.nodeSize,l=this.getAnnotationsBetween(e,a,i).map(e=>{let{id:n,pos:r}=e;return{id:n,newPos:r===o?t.mapping.map(r+1)-1:t.mapping.map(r)}});this.log("%c[Annotations] split card","color: green",{transaction:t,splitPos:o,parentEnd:i,toMove:l}),this.enqueueMoveInstructions(l)}handlePasteTransaction(e,t){if(!this.cutData&&!this.filmstripCutData)return;let n=t.steps.find(e=>"replace"===e.jsonID);if(!n)return;let{from:o,to:r,slice:{openStart:s}}=n,a=e.doc.resolve(n.from),i=r===o?o:o+1,l=null==a.nodeBefore&&a.parent.isBlock,c=!s||l;if(this.log("%c[Annotations] paste transaction","color: green",{transaction:t,insertPos:o,resolved:a,isPasteBeginning:l,pasteType:this.cutData?"cut":"filmstrip-cut"}),this.cutData){let e=this.cutData;this.cutData=null;let t=e.toMove.map(e=>{let{id:t,offset:n}=e;return{id:t,newPos:i+(c?n:Math.max(0,n))}});t&&t.length>0&&(this.log("[Annotations] paste from cut final move",t),this.enqueueMoveInstructions(t))}else if(this.filmstripCutData){let n=this.filmstripCutData;this.filmstripCutData=null;let o=i-1;for(;o<e.doc.nodeSize;){let t=e.doc.nodeAt(o);if(t&&(0,R.KH)(t))break;o++}let r=this.getMoveInstructionsForFilmstripPaste(t,n,o);r&&r.length>0&&(this.log("[Annotations] paste from filmstrip cut final move",r),this.enqueueMoveInstructions(r))}}getMoveInstructionsForFilmstripPaste(e,t,n){if(!t)return;let o=(0,D.N2)(e.doc,R.KH);if(!o)return;let r=e.doc.resolve(n).depth,s=o.filter(t=>{let{pos:n}=t;return e.doc.resolve(n).depth===r}),a=s.findIndex(e=>e.pos===n);if(-1===a)return;let i=s.slice(a),l=t.flatMap(e=>{let{cardIndex:t,annotations:n}=e;return n.map(e=>{let{id:n,offset:o}=e,r=i[t];if(r)return{id:n,newPos:r.pos+o}}).filter(e=>!!e)});return l}handleFilmstripPaste(e,t,n){if(!this.cutData&&!this.filmstripCutData)return;let{insertPos:o}=n;if(this.cutData){let e=this.cutData;this.cutData=null;let n=e.toMove.map(e=>{let{id:t,offset:n}=e;return{id:t,newPos:o+n}});n&&n.length>0&&(this.log("[Annotations] filmstripPaste from cut final move",{tr:t,cutData:e,moveInstructions:n}),this.enqueueMoveInstructions(n))}else if(this.filmstripCutData){let e=this.filmstripCutData;this.filmstripCutData=null;let n=this.getMoveInstructionsForFilmstripPaste(t,e,o);n&&n.length>0&&(this.log("%c[Annotations] filmstripPaste from filmstrip cut final move","color: green",{tr:t,filmstripCutData:e,moveInstructions:n}),this.enqueueMoveInstructions(n))}}handleFilmstripCut(e,t,n){this.cutData=null,this.filmstripCutData=n.deleted.map(n=>{let{cardIndex:o,pos:r}=n,s=t.before.resolve(r),a=r+s.nodeAfter.nodeSize,i=this.getAnnotationsBetween(e,r,a).map(e=>{let{id:t,pos:n}=e;return{id:t,offset:n-r}});return{cardIndex:o,annotations:i}}),this.log("%c[Annotations] filmstripCut","color: green",{tr:t,filmstripCutData:this.filmstripCutData})}handleCutTransaction(e,t){let n=t.steps.find(e=>"replace"===e.jsonID);if(!n)return;this.filmstripCutData=null;let{from:o,to:r}=n,s=e.doc.resolve(o),a=null==s.nodeAfter&&null==s.nodeBefore&&s.parent.isBlock,i=this.getAnnotationsBetween(e,o-(a?1:0),r),l=i.map(t=>{let n=this.relToAbs(e,t.relativePos);return{id:t.id,offset:n-o}});
1this.cutData={slice:n.slice,toMove:l},this.log("%c[Annotations] cut transaction","color:green",{isWholeBlock:a,resolved:s,transaction:t,annotations:i,moveData:l})}handlePrependContentToBlock(e,t){let n=t.steps.find(e=>"replace"===e.jsonID);if(!n)return;let{from:o}=n,r=t.before.resolve(o);if(!r.nodeAfter)return;let s=this.getAnnotationsBetween(e,o,o+r.nodeAfter.nodeSize).map(n=>{let{id:r,relativePos:s}=n,a=this.relToAbs(e,s),i=a===o?t.mapping.map(a+1)-1:t.mapping.map(a);return{id:r,newPos:i}});s.length>0&&(this.log("%c[Annotations] replace transaction - prepend content","color:green",{tr:t,annotationsToMove:s}),this.enqueueMoveInstructions(s))}handleReplaceTransaction(e,t){let n=t.steps.find(e=>"replace"===e.jsonID);if(!n)return;let{from:o,to:r}=n,s=t.before.resolve(o),a=t.before.resolve(r),i=s.parent!==a.parent,l=0==n.slice.content.size,c=0===s.parentOffset&&r>=o+s.parent.nodeSize-2,d=c&&l,u=0===a.parentOffset&&a.depth===s.depth+1&&a.pos-s.pos==1;if(u)return this.handlePrependContentToBlock(e,t);let h=!1;if(i){var p;let n=d?[]:this.getAnnotationsBetween(e,o-s.parentOffset-1,o).map(t=>{let{id:n,relativePos:o}=t;return{id:n,newPos:this.relToAbs(e,o)}}),i=this.getAnnotationsBetween(e,r,r+(null===(p=a.nodeAfter)||void 0===p?void 0:p.nodeSize)+1).map(n=>{let{id:o,relativePos:r}=n;return{id:o,newPos:t.mapping.map(this.relToAbs(e,r))}}),l=[...n,...i];this.log("[Annotations] multiline to move",l),l.length>0&&(h=!0,this.enqueueMoveInstructions(l))}let m=this.getAnnotationsBetween(e,o-(d||i&&0===s.parentOffset?1:0),r);m.length>0&&(h=!0,this.log("[Annotations] to delete",m),m.forEach(e=>{this.undoableMap.delete(e.id)})),h&&(this.log("%c[Annotations] replace transaction","color:green",{tr:t,annotationsToDelete:m,isWholeBlock:d,isMultiline:i,replacingEntireFromBlock:c,replacingWithNothing:l}),requestAnimationFrame(()=>{this.writeUndoStack(e)}))}handleReplaceAroundTransaction(e,t){let n=er()(t.steps.filter(e=>"replaceAround"===e.jsonID),t=>{let{from:n,to:o}=t;return this.getAnnotationsBetween(e,n,o)}),o=ea()(n,e=>e.id).map(e=>{let{id:n,pos:o}=e;return{id:n,newPos:t.mapping.map(o)}});return o.length>0&&this.log("%c[Annotations] replaceAround transaction","color:green",{tr:t,moveInsturctions:o}),0!==o.length&&(this.enqueueMoveInstructions(o),!0)}clearAnnotations(){this.transactYDoc(()=>{this.map.forEach((e,t)=>{this.map.delete(t)})})}restoreAnnotations(e){this.log("%c[Annotations] restoreAnnotations","color: green",e);let{toRestore:t}=e;this.clearAnnotations(),this.enqueueMoveInstructions(t.filter(e=>{let{absPos:t}=e;return null!=t}).map(e=>{let{absPos:t,id:n}=e;return{id:n,newPos:t}}))}addAnnotation(e,t){this.log("%c[Annotations] addAnnotation","color: green",e);let{pos:n,id:o,data:r}=e,s=this.absToRel(t,n);this.map.set(o,{id:o,pos:s,data:r})}deleteAnnotation(e){this.log("%c[Annotations] deleteAnnotation","color: green",e),this.map.delete(e)}moveAnnotations(e,t){let{map:n}=this;this.log("%c[Annotations] moveAnnotations","color: green",t),this.transactYDoc(()=>{t.forEach(t=>{let{id:o,newPos:r}=t,s=n.get(o)||{id:o};this.undoableMap.set(o,{...s,pos:this.absToRel(e,r)})})}),this.writeUndoStack(e)}writeUndoStack(e){let t=q.Gk.getState(e).undoManager;if(0===t.undoStack.length)return;let n=this.undoableMap.flushUndoQueue();if(0===n.length)return;let o=t.undoStack[t.undoStack.length-1],r="annotations",s=o.meta.get(r)||[];s.length>0&&this.log("[Annotations] existing undo stack",{existing:s,toWrite:n,stack:t.undoStack});let a=[...n,...s];o.meta.set(r,a),this.log("[Annotations] writing to undo stack",a)}createDecorations(e){let{map:t}=this.options;this.refreshDecorations=!1;let n=[],r=[];t.forEach((t,s)=>{let a=(0,ei.XV)(e,t.pos);if(null==a)return;let i=e.doc.nodeAt(a);i&&((null==i?void 0:i.isInline)?n.push(o.p.inline(a,a+1,{class:"debug-comment-cursor"})):n.push(o.p.node(a,a+i.nodeSize,{class:"debug-comment-block"}))),r.push({id:s,data:t.data,relativePos:t.pos,pos:a})}),e.doc.descendants((e,t,s)=>{if(t>0&&!(0,el.ZM)(s)&&!(0,el.ZM)(e))return!1;let a=r.filter(n=>n.pos>=t&&n.pos<t+e.nodeSize);return a.forEach(r=>{let{id:s,data:a}=r;n.push(o.p.node(t,t+e.nodeSize,{},{isAnnotation:!0,id:s,data:a}))}),!0}),this.decorations=o.EH.create(e.doc,n),this.annotations=r}handleDropAnnotations(e,t,n){let{dragging:{origNodePos:o,inBlock:r,
1inCard:s},droppedBlockPos:a}=n,i=[];r.forEach(e=>{let t=e.pos-o,n=a+t;i.push({id:e.id,newPos:n})}),this.getAnnotationsBetween(e,a,a+1).filter(e=>!i.find(t=>t.id===e.id)).forEach(e=>{i.push({id:e.id,newPos:t.mapping.map(e.pos)})}),s.filter(e=>!i.find(t=>t.id===e.id)).forEach(e=>{let n=t.mapping.map(e.pos);i.push({newPos:n,id:e.id})}),this.log("%c[Annotations] handleDropAnnotations","color: green",{action:n,tr:t,toMove:i}),i.length>0&&this.enqueueMoveInstructions(i)}handleLocalChange(e){let t=[...this.decorations.find(void 0,void 0,e=>e.isAnnotation&&this.moveInstructionMap[e.id])],n=this.decorations.remove(en()(t)).map(e.mapping,e.doc).add(e.doc,t);return this.decorations=n,this}absToRel(e,t){let n=(0,ei.jS)(e,t);if(!n)throw Error("Y.State non initialized");return n}relToAbs(e,t){return(0,ei.XV)(e,t)}refreshRelativePos(e,t){let n=q.Gt.getState(e),{doc:o,type:r,binding:s}=n,a=(0,ee.SF)(o,r,t,s.mapping);return(0,ee.JR)(a,r,s.mapping)}enqueueMoveInstructions(e){e.forEach(e=>{let t=this.moveInstructionMap[e.id];t&&console.error("[AnnotationState] trying to enqueue two move instructions for annotation with targetId=".concat(e.id)),this.moveInstructionMap[e.id]=e})}enqueueRefreshDecorations(){this.refreshDecorations=!0}transactYDoc(e){this.options.document.transact(e)}log(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];b.VH.get("debugComments")?console.log(...t):console.debug(...t)}constructor(e){this.options=e,this.decorations=o.EH.empty,this.annotations=[],this.refreshDecorations=!1,this.hasChanges=!1,this.filmstripCutData=null,this.cutData=null,this.moveInstructionMap={},this.map=e.map,this.restoreMap=e.restoreMap,this.undoableMap=new ed(this.map)}}let eh=e=>{let t=F()(e=>{let t=X.Z.getState(e.state);t.persistRestoreMap(e.state)},500);return new P.Sy({key:X.Z,state:{init:()=>new eu(e),apply:(e,t,n,o)=>t.apply(e,o)},view:()=>({update(e){t(e)}}),props:{transformPasted(t){var n;let o=this.getState(e.editor.state),r=null===(n=t.content.firstChild)||void 0===n?void 0:n.attrs.docId;return r&&r!==e.editor.gammaDocId&&o.clearCutData(),t},handleDOMEvents:{copy(e){return this.getState(e.state).clearCutData(),!1}},decorations(t){let{decorations:n,annotations:o}=this.getState(t);return e.onUpdate&&e.onUpdate(n.find().map(e=>new J(e)),o),n}}})},ep=D.hj.create({name:"annotation",onCreate(){let e=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];b.VH.get("debugComments")?console.log(...t):console.debug(...t)};this.options.document.on("afterAllTransactions",t=>{let n=X.Z.getState(this.editor.view.state),o=n.flushMoveInstructionQueue();o.length>0?(e("%c[Annotations] afterAllTransactions handling queued moves","color:pink",o),this.editor.commands.moveAnnotations(o)):n.refreshDecorations&&(e("%c[Annotations] afterAllTransactions refreshDecorations","color:pink"),this.editor.commands.refreshDecorations())});let t=X.Z.getState(this.editor.state);window.gammaAnnotations=t;let n=q.Gk.getState(this.editor.state).undoManager;setTimeout(()=>{n.on("stack-item-popped",e=>{let o=e.stackItem.meta.get("annotations");if(!o){t.persistRestoreMap(this.editor.state,!0);return}let{undoStack:r,redoStack:s}=n;"undo"===e.type&&s.length>0?s[s.length-1].meta.set("annotations",ec(o)):"redo"===e.type&&r.length>0&&r[r.length-1].meta.set("annotations",ec(o)),t.restore(this.editor.state,o)})},0),t.map.observe(F()(()=>{e("[Annotations] map observe -> resfreshDecorations"),this.editor.commands.refreshDecorations()})),this.editor.commands.refreshDecorations()},addCommands:()=>({restoreAnnotations:e=>t=>{let{dispatch:n,tr:o}=t;return n&&(o.setMeta(X.Z,{type:"restoreAnnotations",toRestore:Object.values(e)}),n(o)),!0},updateAttributes:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{var o,r;let{tr:s,state:a,dispatch:i}=n,l=null,c=null,d=(o="string"==typeof e?e:e.name,(r=a.schema).nodes[o]?"node":r.marks[o]?"mark":null);return!!d&&("node"===d&&(l=(0,D.jo)(e,a.schema)),"mark"===d&&(c=(0,D.TP)(e,a.schema)),i&&s.selection.ranges.forEach(e=>{let n=e.$from.pos,o=e.$to.pos;a.doc.nodesBetween(n,o,(e,r)=>{l&&l===e.type&&s.setNodeMarkup(r,void 0,{...e.attrs,...t}).setMeta("annotationEvent",{type:"update-node-attrs",pos:r}),c&&e.marks.length&&e.marks.forEach(a=>{if(c===a.type){let i=Math.max(r,n),l=Math.min(r+e.nodeSize,o);s.addMark(i,l,c.create({...a.attrs,...t}))}})})}),!0)}},wrapWithAnnotations:(e,t)=>n=>{let{state:o,tr:r,dispatch:s}=n,a=o.schema.nodes[e],{$from:i,$to:l}=o.selection,c=i.blockRange(l),d=c&&(0,G.nd)(c,a,t);if(!d||!c)return!1;let{start:u,end:h}=c;return!s||(r.wrap(c,d).setMeta("annotationEvent",{type:"wrap-nodes",start:u,end:h,level:1}).scrollIntoView(),!0)},moveAnnotations:e=>t=>{let{dispatch:n,tr:o}=t;return n&&(o.setMeta(X.Z,{type:"moveAnnotations",toMove:e}),n(o)),!0},clearAnnotations:()=>e=>{let{dispatch:t,tr:n}=e;return t&&(n.setMeta(X.Z,{type:"clearAnnotations"}),t(n)),!0},refreshDecorations:()=>e=>{let{dispatch:t,tr:n}=e;return t&&(n.setMeta(X.Z,{type:"refreshAnnotationDecorations"}),t(n)),!0},addAnnotation:e=>{let{pos:t,id:n,data:o}=e;return e=>{let{dispatch:r,state:s}=e;return r&&s.tr.setMeta(X.Z,{type:"addAnnotation",id:n,data:o,pos:t}),!0}},deleteAnnotation:e=>t=>{let{dispatch:n,state:o}=t;return n&&o.tr.setMeta(X.Z,{type:"deleteAnnotation",id:e}),!0}}),addProseMirrorPlugins(){let{document:e,onUpdate:t}=this.options,n=new Z(e);return[eh({document:e,editor:this.editor,map:n.annotations,restoreMap:n.annotationsAbsolute,onUpdate:t})]}});var em=n(17010);let ef=D.hj.create({name:"draftComments",addCommands:()=>({removeDraftComments:e=>t=>{let{dispatch:n,tr:o}=t;if(n){let t={type:"removeDraftComment",comments:Array.isArray(e)?e:[e]};o.setMeta(em.N,t),n(o)}return!0},createDraftComment:e=>t=>{let{dispatch:n,tr:o}=t;return n&&(o.setMeta(em.N,{type:"createDraftComment",comment:e}),n(o)),!0}}),addProseMirrorPlugins:()=>[(0,em.O)()]});var eg=n(90221);let ev=new P.H$("mobileAnnotationPluginKey");class ey{apply(e,t){let n=e.getMeta(ev);return n&&"setPos"in n&&(this.pos=n.setPos),this}constructor(){this.pos=null}}let eb=D.hj.create({name:"mobileAnnotation",addCommands:()=>({setMobileAddBlockComment:e=>t=>{let{dispatch:n,tr:o,view:r}=t;if(!n)return!1;if(null===e)return o.setMeta(ev,{setPos:null}),n(o),!0;let{clientX:s,clientY:a}=e,i=r.posAtCoords({left:s,top:a});if(null===i)return!0;let l=(0,el.f$)(i.inside,r);if(!l)return!1;let c=r.coordsAtPos(l.pos),d=s-c.left,u=a-c.top;return o.setMeta(ev,{setPos:{pos:l.pos,end:l.end,offsetX:d,offsetY:u}}),n(o),!0}}),addProseMirrorPlugins(){return[function(e){let t=new P.Sy({key:ev,state:{init:()=>new ey,apply:(e,t,n,o)=>t.apply(e,o)},props:{handleDOMEvents:{click(t,n){if(!(0,eg.s2)())return!1;let o=n.target;if(o.closest("[data-comments-wrapper]"))return;let r=ev.getState(t.state);r.pos||(r.timeout?(clearTimeout(r.timeout),r.timeout=null,e.commands.setMobileAddBlockComment(n)):r.timeout=setTimeout(()=>{r.timeout=null},300))}},decorations(e){let t=ev.getState(e),n=t.pos;if(null===n)return o.EH.empty;let r=o.p.node(n.pos,n.end,{},{isMobileAnnotation:!0,type:"show-buttons",offsetX:n.offsetX,offsetY:n.offsetY});return o.EH.create(e.doc,[r])}}});return t}(this.editor)]}});var ew=n(62047);let eA=D.hj.create({name:"BlockHover",addProseMirrorPlugins(){return[(0,ew.RT)(this.editor)]}});var eS=n(77220);let eM=D.hj.create({name:"generateCard",addCommands:()=>({removeGeneratorInputsOnLoad:()=>e=>{let{tr:t,state:n,editor:o}=e;if(!o.isEditable)return!1;let r=(0,D.N2)(n.doc,e=>{var t;return(0,R.KH)(e)&&(null===(t=e.attrs.generatorInput)||void 0===t?void 0:t.status)==="done"});
1return r.forEach(e=>{let{pos:n}=e;t.setNodeAttribute(n,"generatorInput",null)}),!0}})});var ek=n(56143),eE=n(45511),eC=n(19283);let eD=D.hj.create({name:"collaboration",priority:eC.a.Collaboration,addOptions:()=>({document:null,field:"default",fragment:null}),onCreate(){this.editor.extensionManager.extensions.find(e=>"history"===e.name)&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands:()=>({undo:()=>e=>{let{tr:t,state:n,dispatch:o}=e;t.setMeta("preventDispatch",!0);let r=q.Gk.getState(n).undoManager;return 0!==r.undoStack.length&&(!o||(0,ek.Yw)(n)||!0)},redo:()=>e=>{let{tr:t,state:n,dispatch:o}=e;t.setMeta("preventDispatch",!0);let r=q.Gk.getState(n).undoManager;return 0!==r.redoStack.length&&(!o||(0,ek.KX)(n)||!0)}}),addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field);return[(0,eE.Z)(e),(0,ek.v0)()]}}),eP=()=>new P.Sy({key:new P.H$("undoHistoryPlugin"),appendTransaction(e,t,n){if(e.some(e=>!1==e.getMeta("addToHistory"))){let e=n.tr;return e.setMeta("addToHistory",!1),e}return null}}),eI=D.hj.create({name:"undoHistory",priority:eC.a.UndoHistory,addProseMirrorPlugins:()=>[eP()],addCommands:()=>({noUndo:()=>e=>{let{tr:t}=e;return t.setMeta("addToHistory",!1),!0}})});var ex=n(67702),eR=n(98537),eT=n.n(eR),e_=n(98621),ej=n.n(e_);let ez=()=>null,eB=e=>Array.from(e.entries()).map(e=>{let[t,n]=e;return{clientId:t,...n.user}}),eH=D.hj.create({name:"collaborationCursor",addOptions:()=>({provider:null,user:{name:null,color:null},render:e=>{let t=document.createElement("span");if(!e.isReady)return t;t.classList.add("collaboration-cursor__caret"),t.setAttribute("style","border-color: ".concat(e.color));let n=document.createElement("div");n.classList.add("collaboration-cursor__label"),n.setAttribute("style","background-color: ".concat(e.color,"; color: ").concat(ej()(e.color).isDark()?"white":"black"));let o=e.name.split(" ")[0];return n.insertBefore(document.createTextNode(o),null),t.insertBefore(n,null),t},onUpdate:ez}),addStorage:()=>({users:[]}),addCommands(){return{user:e=>()=>(this.options.user=eT()({},this.options.user,e),this.options.provider.awareness.setLocalStateField("user",this.options.user),!0)}},addProseMirrorPlugins(){return[(0,ex.JL)((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=eB(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=eB(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render})]}});var eO=n(65301);let eN=D.hj.create({name:"globalDragHandle",priority:eC.a.GlobalDragHandle,addOptions:()=>({scrollerSelector:"body"}),addStorage:()=>({enabled:!0}),addProseMirrorPlugins(){return[(0,eO.f)({editor:this.editor,storage:this.storage,scrollerSelector:this.options.scrollerSelector})]},extendNodeSchema(e){var t;return{containerHandle:null!==(t=(0,D.nU)((0,D.Nl)(e,"containerHandle",e)))&&void 0!==t&&t}}});var eL=n(17487),eU=n(97857),eV=n(22662);let eq=D.hj.create({name:"filmstrip",onCreate(){let e=q.Gk.getState(this.editor.state).undoManager;e.on("stack-item-popped",t=>{let{undoStack:n,redoStack:o}=e,r=t.stackItem.meta.get("filmstripState");if(!r)return;let s=(0,eV.sy)((0,S.bh)().getState());"undo"===t.type&&o.length>0?o[o.length-1].meta.set("filmstripState",s):"redo"===t.type&&n.length>0&&n[n.length-1].meta.set("filmstripState",s),(0,S.bh)().dispatch((0,eV.tE)(r))})}});var eK=n(45534),eF=n(97253),eG=n(23450),e$=n(13608);let eQ=D.hj.create({name:"scrollMargin",addProseMirrorPlugins:()=>[new P.Sy({props:{scrollMargin:e$.Sf,scrollThreshold:e$.Sf}})]});var eY=n(13653),eW=n(74585),eZ=n(61750),eJ=n(47968),eX=n(41425),e0=n(332),e1=n(38035),e2=n(82554),e5=n(82108),e3=n.n(e5),e4=n(67748);let e8=e=>{let{editor:t}=e,[n,o]=(0,m.useState)(null);(0,m.useEffect)(()=>
1{if(!t)return;let e=()=>{o(t.state.selection)};return e(),t.on("selectionUpdate",e),()=>{t.off("selectionUpdate",e)}},[t]);let s=n instanceof P.qv,a=n instanceof e4.c,i=e3()((null==n?void 0:n.toJSON().type)||"none"),c=e3()(s&&(null==n?void 0:n.node.type.name)||""),d=a?void 0:s?"blue":"green";return(0,r.jsx)(e0.h,{children:(0,r.jsx)(e1.k,{className:"selection-debugger",position:"absolute",top:"50px",left:"10px",zIndex:"999999",children:(0,r.jsxs)(l.K,{direction:"column",children:[(0,r.jsxs)(e2.C,{colorScheme:d,children:[i,c&&(0,r.jsxs)("i",{children:[" (",c,")"]})]}),n&&(0,r.jsxs)(e2.C,{colorScheme:"gray",children:["f:",n.from," - t:",n.to,a&&" | side:".concat(n.side)]})]})})})};var e7=n(37164),e6=n(43997),e9=n(18733),te=n(88640);let tt=(0,e7.kP)("1234567890",10),tn=()=>{let e=e9.Q.getItem(te.H.sessionId);if(e)return e;let t="".concat(+new Date,"__").concat(tt());return e9.Q.setItem(te.H.sessionId,t),t},to=(e,t)=>{let{user:n,isUserLoading:o,anonymousUser:r,color:s}=(0,E.SE)(),a=(0,m.useRef)(!1),i=(0,e6.I0)(),l=(0,m.useMemo)(()=>tn(),[]),c=(0,S.CG)(eJ._O),d=(0,m.useMemo)(()=>{let e=(null==n?void 0:n.id)||r.id;return{id:e,color:s.value,sessionId:c?l+"__pv":l,isPresenterView:c,idleSince:null,name:(null==n?void 0:n.displayName)||r.displayName||"",profileImageUrl:(null==n?void 0:n.profileImageUrl)||"",isReady:!o,spotlight:{pos:null,cardId:null}}},[n,s,o,c,r,l]);(0,m.useEffect)(()=>{if(!e||e.isDestroyed||!(null==t?void 0:t.awareness))return;e.commands.user(d),!a.current&&d.isReady&&(e.chain().blur().focusDelayed().run(),a.current=!0),i((0,eJ.MU)({sessionId:d.sessionId}));let n=(e,n)=>{let{added:o,updated:r,removed:s}=e;requestIdleCallback(()=>{if(!t.awareness)return;let e=eB(t.awareness.states);i((0,eJ.Tx)({collaborators:e}))},{timeout:500})};t.awareness.on("change",n);let o=F()(n,eJ.Jp);return t.awareness.on("update",o),()=>{var e,r;null===(e=t.awareness)||void 0===e||e.off("change",n),null===(r=t.awareness)||void 0===r||r.off("update",o)}},[d,e,t,i]),(0,m.useEffect)(()=>{if(!e)return;let t=F()(t=>{e.commands.user(t)},10);return(0,S.tC)(eJ.gL,t)},[e])};var tr=n(68015),ts=n.n(tr);let ta=e=>{let[t,n]=(0,m.useState)([]),o=(0,m.useCallback)(t=>{if(!e)return;
1let o=performance.now(),r={msg:t,timestamp:o};n(e=>{if(0===e.length)return[...e,r];let n=e.find(e=>e.msg===t);if(n)return e;let s=e[e.length-1];return s.msg===t?e:(r.duration=ts()(o-e[e.length-1].timestamp,2),[...e,r])})},[e]),r=(0,m.useCallback)(()=>{e&&n(e=>{try{console.table(e)}catch(e){}return[]})},[e]);return{logMessages:t,logPerfMessage:o,dumpLog:r}};var ti=n(62040),tl=n(60589);let tc="custom",td="updates",tu=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},[n]=tl.ay(e.db,[td]);return tl.go(n,tl.sc(e._dbref,!1)).then(o=>{t(n),g.ay(e.doc,()=>{o.forEach(t=>g.NG(e.doc,t))},e,!1)}).then(()=>tl.S_(n).then(t=>{e._dbref=t+1})).then(()=>tl.QX(n).then(t=>{e._dbsize=t})).then(()=>n)},th=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return tu(e).then(n=>{(t||e._dbsize>=500)&&tl.yP(n,g.D$(e.doc)).then(()=>tl.IV(n,tl.UE(e._dbref,!0))).then(()=>tl.QX(n).then(t=>{e._dbsize=t}))})};class tp extends $.y{destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off("update",this._storeUpdate),this.doc.off("destroy",this.destroy),this._destroyed=!0,this._db.then(e=>{e.close()})}clearData(){return this.destroy().then(()=>{tl.Lj(this.name)})}get(e){return this._db.then(t=>{let[n]=tl.ay(t,[tc],"readonly");return tl.U2(n,e)})}set(e,t){return this._db.then(n=>{let[o]=tl.ay(n,[tc]);return tl.gz(o,t,e)})}del(e){return this._db.then(t=>{let[n]=tl.ay(t,[tc]);return tl.IV(n,e)})}constructor(e,t){super(),this.doc=t,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=tl.X3(e,e=>tl._w(e,[["updates",{autoIncrement:!0}],["custom"]])),this.whenSynced=this._db.then(e=>(this.db=e,tu(this,e=>tl.yP(e,g.D$(t))).then(()=>(this._destroyed||(this.emit("synced",[this]),this.synced=!0),this)))),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(e,t)=>{if(this.db&&t!==this){let[t]=tl.ay(this.db,[td]);tl.yP(t,e),++this._dbsize>=500&&(null!==this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{th(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},t.on("update",this._storeUpdate),this.destroy=this.destroy.bind(this),t.on("destroy",this.destroy)}}
1let tm=(e,t,n)=>{let o=new tp(e,t),r=F()(()=>{let e=t.getMap("SCHEMA_VERSION").get("REQUIRED_VERSION");o.set("lastUpdated",new Date().toISOString()),o.set("schemaVersion",e||"")},1e3);return t.on("update",r),o.on("synced",()=>{null==n||n()}),o};var tf=n(74008),tg=n(70065),tv=n(82655),ty=n(49929),tb=n(5879),tw=n(48832),tA=n(11050),tS=n(4878);n(23147);let tM=async(e,t,n,o)=>{try{let{id:r,length:s}=n||{},a=await fetch("".concat(v.v.MULTIPLAYER_WS_URL.replace("wss","https"),"/").concat(e,"/verify/").concat(t),{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:r,length:s,clientCount:null==o?void 0:o.clientCount,totalCount:null==o?void 0:o.totalCount})}),i=await a.json();return i}catch(e){}},tk=e=>{let t=e.document.store.clients.get(e.document.clientID);if(t&&t.length)return t[t.length-1]},tE=e=>{let t=e.document.store.clients.size,n=[...e.document.store.clients.values()].reduce((e,t)=>e+t.reduce((e,t)=>e+t.length,0),0);return{clientCount:t,totalCount:n}},tC=async(e,t,n)=>{let o=tk(t),r=tE(t),s=await tM(e.gammaDocId,t.document.clientID,o,r);if(!s)return console.warn("[compareClocks] Failed to fetch remote clock"),!1;try{var a;let e=((null==o?void 0:o.id.clock)||0)+((null==o?void 0:o.length)||0),t=((null==s?void 0:null===(a=s.lastKnownItem.id)||void 0===a?void 0:a.clock)||0)+((null==s?void 0:s.lastKnownItem.length)||0),i=e-t;i>0&&console.warn("[compareClocks] Clock drift detected",{diffLastItem:i});let l=r.clientCount-(s.itemSummary.clientCount||0),c=r.totalCount-(s.itemSummary.totalCount||0);return l>0&&console.warn("[compareClocks] clientCount drift detected",{diffClientCount:l}),c>0&&console.warn("[compareClocks] totalCount drift detected",{diffTotalCount:c}),0===l&&c<=n&&i<=n}catch(e){console.warn("[compareClocks] Failed to fetch remote clock")}return!1},tD=e=>{let{editor:t,yProvider:n,enabled:o,pollingInterval:r}=e,[s,a]=(0,m.useState)(Date.now()),[i,l]=(0,m.useState)(0),[c,d]=(0,m.useState)(0),u=(0,b.ye)("dataSyncClockDriftTolerance");return(0,m.useEffect)(()=>{let e;if(!t||!n||!o)return;let s=!0,i=async()=>{if(!t.gammaDocId)return;let o=await tC(t,n,u);o?a(Date.now()):console.warn("[useDataPersistenceSync_2] Clocks out of sync for doc",t.gammaDocId),requestIdleCallback(()=>{l(e=>o?0:e+1),d(e=>0),s&&(e=window.setTimeout(i,r))})};return i(),()=>{clearTimeout(e),s=!1}},[t,n,o,r,u]),{errorCountClock:i,errorCountPMState:c,yDocLastSynced:s}},tP=/^[\w\d\t\n ,./<>?;:"'`!@#$%^&*()[\]{}_+=|\\-]$/u,tI=e=>{let{editor:t,pollingInterval:n}=e,o=(0,m.useRef)(Date.now()),r=(0,m.useRef)(Date.now()),[s,a]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(!t)return;let e=e=>{!e.metaKey&&e.key.match(tP)&&(o.current=Date.now())},s=e=>{let{transaction:t}=e;t.docChanged&&(o.current=Date.now(),r.current=Date.now())};t.on("update",s),t.view.dom.addEventListener("keydown",e,!0);let i=setInterval(()=>{let e=r.current-o.current;e>500?(console.error("[useDataPersistenceSync_0] Delay to capture changes has exceeded threshold"),a(e=>e+1)):a(0)},n);return()=>{clearInterval(i),t.off("update",s),t.view.dom.removeEventListener("keydown",e,!0)}},[t,n]),s},tx="data-sync-error-toast",tR=(0,r.jsx)(ty.G,{icon:tv.xHz,size:"2x"}),tT=(0,r.jsx)(ty.G,{icon:tv.ik8,size:"2x"}),t_=e=>{let{type:t,yDocLastSynced:n}=e;return()=>(0,r.jsx)(e1.k,{direction:"column",p:4,color:"white",bg:"warn"===t?"yellow.500":"red.500",borderRadius:"md",children:(0,r.jsxs)(e1.k,{alignItems:"center",children:["warn"===t?tR:tT,(0,r.jsxs)(a.xu,{ml:3,children:[(0,r.jsx)(d.x,{lineHeight:6,fontSize:"sm",fontWeight:"bold",children:"warn"===t?(0,r.jsx)(tb.cC,{id:"IkN23t"}):(0,r.jsx)(tb.cC,{id:"kXEHsK"})}),n&&(0,r.jsx)(d.x,{lineHeight:6,fontSize:"sm",children:(0,r.jsx)(tb.cC,{id:"VxWwaW",values:{0:(0,tw.Dw)(new Date(n).toISOString())}})}),"error"===t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tf.i,{pt:2}),(0,r.jsx)(d.x,{lineHeight:6,fontSize:"sm",pt:2,children:(0,r.jsx)(tb.cC,{id:"Pw5K5r"})})]})]})]})})},tj=e=>{let{editor:t,yProvider:n,enabled:o}=e,r=(0,S.CG)(eJ.Tf),s=(0,tS.Br)("comment"),a=(0,S.CG)(eJ.q7),[i,l]=(0,m.useState)(2e4),c=(0,tA.z$)(),d=(0,tg.p)(),{user:u}=(0,E.SE)(),h=(0,m.useRef)(),p=(0,b.ye)("dataSyncErrorThreshold"),f=tI({editor:t,pollingInterval:i}),{errorCountPMState:g,errorCountClock:v,yDocLastSynced:y}=tD({editor:t,yProvider:n,enabled:o&&s,pollingInterval:i}),w={docSavedTime:a,yDocLastSynced:y,errorCountKeyboard:f,errorCountPMState:g,errorCountClock:v,clientID:null==n?void 0:n.document.clientID,userId:null==u?void 0:u.id},A=(0,m.useRef)(w);A.current=w;let M=v+g;(0,m.useEffect)(()=>
1{l(0===M?2e4:4e3)},[M]);let k=o&&-1!==p&&M>p,C=o&&-1!==p&&M/p>2;return(0,m.useEffect)(()=>{if(!k||r){if(d.isActive(tx)){d.close(tx);let e=h.current?+new Date-+h.current:void 0;null==c||c.trackDocEvent(tA.xW.DATA_SYNC_RECOVER,{...A.current,duration:e}),h.current=void 0}return}let e=t_({type:C?"error":"warn",yDocLastSynced:y});d.isActive(tx)?d.update(tx,{render:e}):(null==c||c.trackDocEvent(tA.xW.DATA_SYNC_ERROR,A.current),h.current=new Date,d({render:e,duration:null,id:tx})),C&&console.error("[useDataPersistenceSync] ERROR_THRESHOLD_EXCEEDED. docId:",null==t?void 0:t.gammaDocId)},[t,d,c,C,k,a,y,r]),C},tz=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=(0,m.useRef)(0),o=(0,m.useRef)(0),[r,s]=(0,m.useState)(!1),[a,i]=(0,m.useState)(0),[l,c]=(0,m.useState)(document.hidden),d=(0,m.useRef)(()=>{n.current++;let a=n.current>=t;if(a&&(console.warn("[useRateLimiter] Limit hit! (".concat(t," per ").concat(e/1e3,"s)")),r||(s(!0),i(e=>e+1))),!o.current){let r=e/t;o.current=f.Zi(()=>{n.current>0?n.current--:(s(!1),f.cv(o.current),o.current=0)},r)}});return(0,m.useEffect)(()=>{let e=()=>{c(document.hidden),d.current()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),[d.current,r,a,l]};var tB=n(17993),tH=n(62614);let tO=()=>(0,r.jsxs)(tB.g,{align:"flex-end",borderRadius:"base",shadow:"lg",p:3,bg:"gray.100",spacing:4,maxW:"300px",direction:"row",children:[(0,r.jsxs)(a.xu,{children:[(0,r.jsx)(d.x,{fontSize:"md",fontWeight:"bold",children:(0,r.jsx)(tb.cC,{id:"oSUMyx"})}),(0,r.jsxs)(d.x,{fontSize:"sm",children:[(0,r.jsx)(tb.cC,{id:"CDva2g"})," ",(0,r.jsx)("em",{children:(0,r.jsx)(tb.cC,{id:"/vuJlA"})})," ","\uD83D\uDE0E"]})]}),(0,r.jsx)(a.xu,{children:(0,r.jsx)(tH.z,{size:"sm",onClick:()=>{window.location.reload()},children:(0,r.jsx)(tb.cC,{id:"HpK/8d"})})})]}),tN=e=>{let t=(0,tg.p)(),[n,o]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{if(!e)return;let t=()=>{let t=e.getMap("SCHEMA_VERSION").get("REQUIRED_VERSION"),n=!!(t&&t>eX.bI);o(n),console[n?"warn":"debug"]("[SchemaVerifier] onUpdate",{requiredVersion:t,MY_VERSION:eX.bI,outdated:n})};return e.on("update",t),()=>{e.off("update",t)}},[e]),(0,m.useEffect)(()=>{n&&!t.isActive("schema_outdated")&&t({id:"schema_outdated",duration:null,status:"warning",isClosable:!1,position:"bottom-left",render:tO})},[n,t]),n},tL=e=>({DOC_ID:e,SCHEMA_VERSION:String(eX.bI),SHARE_TOKEN:v.v.SHARE_TOKEN}),tU=(0,m.memo)(e=>{let{doc:t,docId:n,onCreate:o,readOnly:D=!1,scrollingParentSelector:P,hideForPreview:I=!1,animationsExtensionEnabled:x=!1}=e,{timeOnCreate:R,timeOnSetupProvider:T,timeOnDownloadDoc:j}=(0,A.bf)(),z=(0,M.Yy)(),[O,N]=(0,m.useState)("connecting"),[L,q]=(0,m.useState)(!1),K=(0,m.useRef)(!1);K.current=L;let[F,G]=(0,m.useState)(!1),$=(0,m.useRef)([]),[Q,Y]=(0,m.useState)(),[W,Z]=(0,m.useState)(),[J,X]=(0,m.useState)(),[ee,et]=(0,m.useState)(),en=tN(W);to(Q,J),(0,eZ.jB)(Q);let[eo,er,es,ea]=tz(),ei=t&&t.organization&&t.organization.id,{isConnected:el,setHocuspocusConnected:ec}=(0,y.$gs)(),ed=tj({editor:Q,yProvider:J,enabled:el&&!ea&&!D}),eu=(0,w.y)("debugLogging"),eh=(0,w.y)("debugCardViewed"),em=(0,w.y)("offline"),eg=(0,S.TL)(),{logMessages:ev,logPerfMessage:ey,dumpLog:ew}=ta(eu);(0,m.useEffect)(()=>{em&&J&&!ee&&et(tm(n,J.document,()=>{let e=J.document.getMap("SCHEMA_VERSION").get("REQUIRED_VERSION");"number"==typeof e&&(q(!0),G(!0))}))},[em,J,n,ee]),(0,E.$K)((0,m.useCallback)(()=>{J&&(J.disconnect(),J.configuration.parameters=tL(n),setTimeout(()=>J.connect(),500))},[J,n])),(0,ti.n)(Q),(0,m.useEffect)(()=>{ec(K.current||"connected"===O||ea)},[ec,O,ea]),(0,s.z)(()=>ec(null),[]),(0,m.useEffect)(()=>{J&&K.current&&"connected"===O&&(console.debug("[CollaborativeEditor] Force syncing on reconnect."),J.forceSync())},[J,O]),(0,m.useEffect)(()=>{let e;if(!J)return;let t=es>10;if(er){console.warn("[CollaborativeEditor] Attempted to re-connect while rate limited (".concat(es," of ").concat(10,").")),J.disconnect();return}if(t){console.error("[CollaborativeEditor - RECONNECT_RATE_LIMIT] Max rate limit violations reached (".concat(10,"). Will reload.")),setTimeout(()=>{window.location.reload()},500);return}
1if(L)return ea?(console.debug("[CollaborativeEditor] Backgrounded, will wait ".concat(12e4,"s before disconnect")),e=f.iK(()=>{console.debug("[CollaborativeEditor] Disconnecting after grace period"),J.disconnect()},12e4)):(console.debug("[CollaborativeEditor] Foregrounded, so re-connecting"),J.connect()),()=>{e&&f.gr(e)}},[J,L,ea,er,es]),(0,m.useEffect)(()=>{Q&&!Q.isDestroyed&&ei&&(Q.commands.initializeUploadExtension(ei),Q.commands.removeGeneratorInputsOnLoad())},[Q,ei]),(0,m.useEffect)(()=>{console.debug("[CollaborativeEditor] Creating yProvider for doc",n);let e=new g.QW({});Z(e),ey("Setting up hocuspocus"),T();let t=new h.Ui({name:n,document:e,forceSyncInterval:15e3,token:tL(n).SHARE_TOKEN||"null",websocketProvider:new h.cA({url:v.v.MULTIPLAYER_WS_URL,maxAttempts:25,parameters:tL(n)}),preserveConnection:!1,onOpen(){if(!0===b.VH.get("hocuspocusOnAuthenticate")){console.log("[CollaborativeEditor] Provider opened. onAuthenticate is enabled so this is a no-op.");return}t.isAuthenticated=!0,console.log("[CollaborativeEditor] Provider opened.  Setting isAuthenticated to true.")},onStatus(e){let{status:t}=e;console.debug("[CollaborativeEditor][onStatus]",{status:t}),N(t),"connected"===t?(ey("Hocuspocus connected"),q(!0)):"connecting"===t&&(ey("Hocuspocus connecting"),eo())},onSynced(){console.debug("[CollaborativeEditor] Provider synced"),G(!0),ey("Document data downloaded")},onDisconnect(e){let{event:t}=e;console.debug("[CollaborativeEditor][onDisconnect]",{event:t}),t.code===u.NI.code&&console.error('[CollaborativeEditor] Provider disconnected with "Unauthorized.code", which is unexpected.',t)}});return t.subscribeToBroadcastChannel(),X(t),eg((0,eJ.Y8)({hocuspocusProvider:t})),v.v.DEBUG_ENABLED&&(window.gammaEditorProvider=t),$.current=[...x?[V.F]:[],eK.zL,eQ,eZ.$1.configure({scrollerSelector:P}),eD.configure({document:e}),eI,_.configure({provider:t}),eH.configure({provider:t}),ep.configure({document:e}),eb,eA,ef.configure(),eS.NM,eW.W,B.configure({document:e}),U,eG.L,eL.Pi,eF.R,eU._g,eY.Jn,p.ZT.configure({openDoubleQuote:!1,closeDoubleQuote:!1,openSingleQuote:!1,closeSingleQuote:!1}),eN.configure({scrollerSelector:P}),H.F,eM,eq,k.p.configure({document:e})],()=>{console.warn("[CollaborativeEditor] Destroying yProvider for doc ➡️",n),t.disconnect(),t.destroy(),delete window.gammaEditorProvider,X(void 0),G(!1),q(!1),setTimeout(()=>{if(t&&t.awareness)try{t.awareness.destroy()}catch(e){console.warn("[CollaborativeEditor] Error destroying awareness provider.")}})}},[x,eg,n,ey,eo,P,T]);let ek=!!(L&&F);(0,m.useEffect)(()=>{ek&&(ey("Is ready for TipTap"),j())},[ek,j,ey]);let eE=!em&&(!el||ed);return(0,r.jsxs)(a.xu,{display:I?"none":"block",w:"100%","data-testid":"collaborative-editor-wrapper",children:[ek&&eh&&(0,r.jsx)(e8,{editor:Q}),!Q&&(0,r.jsx)(a.xu,{flexDirection:"column",flex:"1",w:"100%",h:"var(--100vh)",bg:z?"gray.900":"gray.100",zIndex:"overlay","data-testid":"collaborative-editor-skeleton",inset:0,children:(0,r.jsx)(i.M,{h:"100%",children:(0,r.jsxs)(l.K,{align:"center",children:[(0,r.jsx)(c.$,{}),ev.map((e,t)=>{let{msg:n}=e;return(0,r.jsx)(d.x,{children:n},t)})]})})}),ek&&(0,r.jsx)(C.y,{extensions:$.current,doc:t,docId:n,editorId:"main",onCreate:e=>{let{editor:t}=e;setTimeout(()=>{Y(t),o&&o(t),requestAnimationFrame(()=>{ey("Editor rendered"),R(),ew()})},10)},readOnly:en||D||eE,shouldSupportComments:!0,shouldSupportMenus:!0,scrollingParentSelector:P})]})});var tV=n(31709),tq=n(7636)},41425:function(e,t,n){n.d(t,{bI:function(){return s}}),n(56356);let o=new URLSearchParams(window.location.search),r=o.get("SCHEMA_VERSION")?Number(o.get("SCHEMA_VERSION")):null,s=r||99}}]);
2//# sourceMappingURL=4001-0e12bce7be5b74fb.js.map

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