PageSourceSearch

https://discours.netlify.app/scripts/tiptap-ext-heavy-74451b08.js

js discours.netlify.app collected 2026-10-03 10:40:55 UTC 52,458 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkdiscours_io_frontend=globalThis.webpackChunkdiscours_io_frontend||[]).push([[929],{6436(e,t,n){n.d(t,{P:()=>a});var r=n(52781),o=n(8463);const a=r.bP.create({name:"mention",group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes:()=>({userId:{default:null,parseHTML:e=>e.getAttribute("data-mention-id"),renderHTML:e=>e.userId?{"data-mention-id":e.userId}:{}},userName:{default:null,parseHTML:e=>e.getAttribute("data-mention-name"),renderHTML:e=>e.userName?{"data-mention-name":e.userName}:{}},userPath:{default:null,parseHTML:e=>e.getAttribute("data-mention-path"),renderHTML:e=>e.userPath?{"data-mention-path":e.userPath}:{}}}),parseHTML:()=>[{tag:"a[data-mention-id]",priority:60}],renderHTML({HTMLAttributes:e}){const t=e["data-mention-path"]||"",n="@"+(e["data-mention-name"]||t||"unknown");return["a",(0,o.K)({class:"tiptap-mention",href:t?"/"+t:"#",contenteditable:"false"},e),n]},addCommands(){return{insertMention:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}})}
1,13240(e,t,n){n.d(t,{W9:()=>c});var r=n(52781),o=n(42845),a=n(84164),s=n(60471);const i=new o.hs("mentionSuggestions"),c=r.YY.create({name:"mentionSuggestions",addOptions:()=>({insertText:!1}),addProseMirrorPlugins(){const e=this.editor,t=this.options.insertText,n={hidePopup:null,popup:null,active:!1,items:[],selectedIndex:0,selectItem:null};return[new o.k_({key:i,view:function(){function r(){l&&(l.style.display="none"),f=!1,d=[],u=0,m=null,n.active=!1,n.items=[],n.selectedIndex=0}function o(){if(!l||!f)return;const t=e.view.coordsAtPos(e.state.selection.from),n=window.pageYOffset||document.documentElement.scrollTop,r=window.pageXOffset||document.documentElement.scrollLeft;l.style.position="absolute",l.style.left=t.left+r+"px",l.style.top=t.bottom+n+4+"px";const o=l.getBoundingClientRect();o.right>window.innerWidth&&(l.style.left=window.innerWidth-o.width-8+r+"px"),o.bottom>window.innerHeight&&(l.style.top=t.top+n-o.height-4+"px")}function i(n){if(m){if(t){const t=n.path||n.name;if(!t)return;const r="@["+(n.name||t)+"]("+t+")";g=r.substring(1),p=g,e.chain().focus().deleteRange(m).insertContent(r+" ").run()}else e.chain().focus().deleteRange(m).insertMention({userId:n._id,userName:n.name,userPath:n.path}).insertContent(" ").run();r()}}function c(t){f&&l&&e.view&&e.view.dom&&!l.contains(t.target)&&!e.view.dom.contains(t.target)&&r()}let l=null,d=[],u=0,p="",f=!1,m=null,g=null;const h=(0,a.dW)({fetchUsers:function(e,t){(0,s.x)(e,t,{limit:a.sr,excludeSelf:!1})}});return document.addEventListener("click",c),n.hidePopup=r,n.selectItem=i,{update:function(e,t){const s=function(e){const t=e.selection;if(!t.empty)return null;const n=t.$from,r=n.start();if(t.from===r)return null;const o=n.parent;let s=r,i="";for(let e=0;e<o.childCount;e++){const n=o.child(e),r=s+n.nodeSize;if(r>=t.from){n.isText&&(i=n.text.substring(0,t.from-s));break}s=r}if(!i)return null;const c=(0,a.k9)(i);return c?{range:{from:s+c.atIndex,to:t.from},query:c.query}:null}(e.state),c=s?s.query.replace(/\s+$/,""):"";if(!s||c.length<a.$v||c.length>a.H4)return f&&r(),p="",g=null,void h.cancel();m=s.range;const b=c;if(g){if(b===g||b.startsWith(g+" "))return f&&r(),void(p=b);g=null}b!==p?(p=b,h.search(b,function(e){b===p&&(d=e,u=0,n.items=d,n.selectedIndex=0,d.length>0||b.length>=a.$v?(l||l||(l=document.createElement("div"),l.className="mention-suggestions",l.style.display="none",document.body.appendChild(l),l.addEventListener("mousedown",function(e){e.preventDefault();const t=e.target.closest(".mention-suggestions__item");if(t){const e=parseInt(t.dataset.index,10);!isNaN(e)&&d[e]&&i(d[e])}})),l.style.display="",f=!0,n.popup=l,n.active=!0,(0,a.BV)(d,u,l,"mention-suggestions"),o()):r())})):f&&o()},destroy:function(){n.hidePopup=null,n.selectItem=null,n.popup=null,n.active=!1,n.items=[],n.selectedIndex=0,h.cancel(),document.removeEventListener("click",c),l&&l.parentNode&&l.parentNode.removeChild(l),l=null}}},props:{handleKeyDown:function(e,t){if(!n.active||!n.popup)return!1;const r=n.items;if(!r||0===r.length)return!1;const o=(0,a.US)(t,r.length,n.selectedIndex);if(!o.handled)return!1;if(t.preventDefault(),"navigate"===o.action){n.selectedIndex=o.newIndex;const e=n.popup.querySelectorAll(".mention-suggestions__item");for(let t=0;t<e.length;t++)e[t].classList.toggle("active",t===n.selectedIndex);const t=n.popup.querySelector(".mention-suggestions__item.active");t&&t.scrollIntoView({block:"nearest"})}else if("select"===o.action){const e=r[n.selectedIndex];e&&n.selectItem&&n.selectItem(e)}else"close"===o.action&&n.hidePopup&&n.hidePopup();return!0}}})]}})},46508(e,t,n){function r(e,t,n,r,o){const a=(0,D.Ao)(e.state.doc,n,r,o);if(0===a.length)return{applied:!1,hardDeleted:!1};if(1===a.length&&!a[0].isOwnAdd)return{applied:(0,D.K5)(e,t,n,r,o).applied,hardDeleted:!1};let s=!1,i=!1;for(let n=a.length-1;n>=0;n--){const r=a[n];r.isOwnAdd?(t.delete(r.from,r.to),i=!0,s=!0):(0,D.K5)(e,t,r.from,r.to,o).applied&&(s=!0)}return{applied:s,hardDeleted:i}}function o(e,t,n,o,a){const i=r(e,t,n,o,a),c=[];e.state.doc.nodesBetween(n,o,(e,t)=>{e.isAtom&&e.type.spec.attrs&&e.type.spec.attrs.suggestionType&&c.push({node:e,pos:t})});let l=!1;for(let e=c.length-1;e>=0;e--){const n=t.mapping.map(c[e].pos),r=t.doc.nodeAt(n);r&&r.eq(c[e].node)&&(l=s(t,n,r,a)||l)}return{applied:i.applied||l,hardDeleted:i.hardDeleted}}function a(e){const t=_.getState(e.state);return t&&t.enabled?{suggestionId:(0,D.Dc)("node"),suggestionType:"add",suggestionAuthorId:t.userId,suggestionCreatedAt:(new Date).toISOString()}:{}}function s(e,t,n,r){return"add"===n.attrs.suggestionType&&n.attrs.suggestionAuthorId===r?(e.delete(t,t+n.nodeSize),!0):"delete"!==n.attrs.suggestionType&&"update"!==n.attrs.suggestionType&&n.attrs.suggestionType!==z.Uq&&(e.setNodeMarkup(t,void 0,{...n.attrs,suggestionId:(0,D.Dc)("node"),suggestionType:"delete",suggestionAuthorId:r,suggestionCreatedAt:(new Date).toISOString()}),!0)}function i(e){N&&(clearTimeout(N),N=null),F=!0,N=setTimeout(()=>{F&&((0,x.UT)("[SuggestionMode] Safety timeout: resetting _skipSuggestionProcessing flag"),F=!1),N=null},500);try{e()}finally{F=!1,N&&(clearTimeout(N),N=null)}}function c(e,t,n,r){let o=!1;
1return e.nodesBetween(t,n,e=>{if(e.marks)for(const t of e.marks)t.type.name===r&&(o=!0)}),o}function l(e,t,n,r,o,a,s,i=null,c=null){const l=(0,D.Dc)("fmt"),d=t.marks.suggestionFormat.create({suggestionId:l,authorId:s,createdAt:(new Date).toISOString(),formatType:o,formatAction:a,formatValue:i,originalValue:c,...(0,D.oV)(s)}),p=[];"paragraphBreak"!==o&&e.doc.nodesBetween(n,r,(e,t)=>{u(e)&&p.push({pos:t,size:e.nodeSize})});let f=n;for(const t of p)t.pos>f&&e.addMark(f,t.pos,d),f=t.pos+t.size;return r>f&&e.addMark(f,r,d),l}function d(e){let t=0;return e.descendants(e=>!e.isTextblock||(t++,!1)),t}function u(e){return e&&e.isText&&e.text===U&&e.marks.find(e=>"suggestionFormat"===e.type.name&&"paragraphBreak"===e.attrs.formatType)||null}function p(e,t){const n=u(e);return Boolean(n&&n.attrs.authorId===t)}function f(e,t){return 1===e.childCount&&p(e.firstChild,t)}function m(e){for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return{pos:e.before(t+1),depth:e.depth-t};if(e.node(t).type.spec.isolating)return null}return null}function g(e,t){let n=!0;return e.forEach((e,r)=>{if(r>=t||e.marks.some(e=>"suggestionAdd"===e.type.name))return;const o=e.isText?e.text.slice(0,t-r):null;null!==o&&""===o.split(U).join("")||(n=!1)}),n}function h(e){if(e.isTextblock)return 0===e.content.size;if(e.isLeaf||0===e.childCount)return!1;let t=!0;return e.forEach(e=>{h(e)||(t=!1)}),t}function b(e,t){let n=e.resolve(t);for(;!n.nodeBefore&&"listItem"===n.parent.type.name;)n=e.resolve(n.before());const r=n.nodeBefore;let o=r,a=n.pos;for(;o&&!o.isTextblock;){if(o.isLeaf||0===o.childCount)return null;a-=1,o=o.lastChild}return o?{node:o,start:a-o.nodeSize+1,outer:r}:null}function y(e){for(let t=e.depth;t>0;t--){const n=e.node(t-1);if(t>1&&1===n.childCount)continue;const r=e.index(t-1);return n.canReplace(r,r+1)?{from:e.before(t),to:e.after(t)}:null}return null}function v(e,t,n={}){if(t<0||t>=e.doc.content.size)return null;if(e.doc.textBetween(t,t+1,"")!==U)return null;const r=new I.dL(e.doc),o=function(e,t,n){const r=e.doc.resolve(t),o=g(r.parent,r.parentOffset);if(e.delete(t,t+1),!o)return t;const a=e.doc.resolve(t),s=a.parent,i=m(a);if(i){const t=e.doc.resolve(i.pos).nodeBefore;try{return e.join(i.pos,i.depth),i.pos-i.depth}catch(e){}const n=function(e,t){let n=e,r=t;for(;!n.isTextblock;){if(n.isLeaf||0===n.childCount)return null;r+=n.nodeSize-1-n.lastChild.nodeSize,n=n.lastChild}return{block:n,end:r+n.nodeSize-1}}(t,i.pos-t.nodeSize),r=y(a);if(n&&n.block.canReplace(n.block.childCount,n.block.childCount,s.content)&&r)return e.delete(r.from,r.to),s.content.size>0&&e.insert(n.end,s.content),n.end}const c=0===s.content.size||n&&g(s,s.content.size)?y(a):null;return c?(e.delete(c.from,c.to),c.from):n?t:null}(r,t,Boolean(n.dropContent));return null===o?null:(r.steps.forEach(t=>e.step(t)),o)}function S(e){const t=[];if(e.descendants((e,n)=>{u(e)&&t.push(n)}),0===t.length)return e;const n=new I.dL(e);for(let e=t.length-1;e>=0;e--)v(n,n.mapping.map(t[e]),{dropContent:!0});return n.doc}function k(e){const{$from:t}=e.selection;if(t.parentOffset>0||0===t.parent.content.size)return t.start();const n=b(e.doc,t.before());return n&&h(n.outer)?n.start:t.start()}function w(e,t,n){let r=!0;return e.forEach((e,o)=>{o<n&&o+e.nodeSize>t&&!u(e)&&(r=!1)}),r}function T(e){return Boolean(u(e.firstChild))&&g(e,e.content.size)}function C(e,t,n){const r=function(e,t){const{$from:n,empty:r}=e.selection;if(!r||!n.parent.isTextblock)return null;const o=n.parent,a=n.parentOffset;if("Backspace"===t){if(!w(o,0,a))return null;const t=b(e.doc,n.before());return t&&T(t.node)?{lineStart:t.start,into:n.start()}:u(o.firstChild)?{lineStart:n.start()}:null}if(!w(o,a,o.content.size))return null;const s=function(e,t){let n=e.resolve(t);for(;!n.nodeAfter&&"listItem"===n.parent.type.name;)n=e.resolve(n.after());let r=n.nodeAfter,o=n.pos;for(;r&&!r.isTextblock;){if(r.isLeaf||0===r.childCount)return null;o+=1,r=r.firstChild}return r?{node:r,start:o+1}:null}(e.doc,n.after());if(T(o))return s?{lineStart:n.start(),into:s.start}:null;if(!s||!u(s.node.firstChild))return null;const i=m(e.doc.resolve(s.start));return i&&i.pos-i.depth===n.end()?{lineStart:s.start}:null}(e.state,t.key);if(!r)return!1;if(null!==n&&!function(e,t){let n=!0;
1return e.forEach(e=>{const r=u(e);r&&r.attrs.authorId!==t&&(n=!1)}),n}(e.state.doc.resolve(r.lineStart).parent,n))return t.preventDefault(),!0;const{tr:o}=e.state;if(void 0===r.into){const e=v(o,r.lineStart);if(null===e)return!1;o.setSelection(M.U3.near(o.doc.resolve(e),-1))}else{const e=function(e,t,n){const r=e.doc.resolve(t),o=y(r);if(!o)return null;const a=[];r.parent.forEach(e=>{u(e)||a.push(e)});const s=E.FK.from(a),i=new I.dL(e.doc);let c;try{i.delete(o.from,o.to),c=i.mapping.map(n),s.size>0&&i.insert(c,s)}catch(e){return null}return i.steps.forEach(t=>e.step(t)),c+s.size}(o,r.lineStart,r.into);if(null===e)return t.preventDefault(),!0;o.setSelection(M.U3.near(o.doc.resolve(e),1))}return o.setMeta(H,!0),e.dispatch(o.scrollIntoView()),t.preventDefault(),!0}function A(e={}){function t(e){if(h&&null!==h.pos)for(const t of e){const e=t.mapping.mapResult(h.pos,-1);if(e.deleted)return void(h.pos=null);h.pos=e.pos}}function n(e,t){const n=function(e){if(!h)return null;const{pos:t,marks:n}=h;if(h=null,null!==t)return{pos:t,marks:n};const{$from:r,empty:o}=e.selection;return!o||!r.parent.isTextblock||r.parent.content.size>0?null:{pos:r.pos,marks:n}}(t);return Boolean(n)&&function(e,t,n){const r=e.doc.resolve(e.mapping.map(t.pos,-1));if(!r.parent.isTextblock)return!1;const o=r.start();return e.doc.textBetween(o,Math.min(o+1,r.end()),"")!==U&&(e.insert(o,r.parent.type.schema.text(U,t.marks)),n&&e.setStoredMarks(n),!0)}(e,n,t.storedMarks)}function a(){c=Date.now()}let i=e.userId||"anonymous",c=0,u=0,g=null,h=null;return new M.k_({key:_,state:{init:()=>({enabled:!1,userId:i}),apply(e,t){const n=e.getMeta(_);return n?(!1===n.enabled&&!0===t.enabled&&(u=0,h=null,c=0),{...t,...n}):t}},appendTransaction(e,r,o){const a=_.getState(o);if(!a||!a.enabled)return null;if(t(e),F)return null;let s=!1;for(let t=0;t<e.length;t++)if(e[t].docChanged){s=!0;break}if(!s)return null;for(let t=0;t<e.length;t++){const n=e[t];if(n.getMeta(H))return null;for(const e of W)if(n.getMeta(e))return null}const i=a.userId,c=o.schema;let p=o.tr,f=!1;for(const t of e)t.docChanged&&t.steps.forEach((e,t)=>
1{e.getMap().forEach((e,t,n,r)=>{const o=r-n;if(o>0)try{const e=p.mapping.map(n),t=p.mapping.map(r);if(o<=2){const t=p.doc.nodeAt(e),n=t&&t.marks.find(e=>"suggestionAdd"===e.type.name);if(n&&n.attrs.authorId===i)return}else if((0,D.Ke)(p.doc,e,t,"suggestionAdd",i))return;let a=(0,D.EX)(p.doc,e,"suggestionAdd",i,"before");a||(a=(0,D.EX)(p.doc,t,"suggestionAdd",i,"after"));const s=a&&a.suggestionId&&a.createdAt,l=c.marks.suggestionAdd.create({suggestionId:s?a.suggestionId:(0,D.Dc)(),authorId:i,createdAt:s?a.createdAt:(new Date).toISOString(),...(0,D.oV)(i)});p.addMark(e,t,l),c.marks.suggestionDelete&&p.removeMark(e,t,c.marks.suggestionDelete),f=!0}catch(e){}})});return u>0&&d(o.doc)<=d(r.doc)?u=0:u>0&&(u--,f=function(e,t,n){try{const{schema:r}=t,o=k(t),{storedMarks:a}=t;return e.insert(o,r.text(U)),l(e,r,o,o+1,"paragraphBreak","add",n,null),a&&e.setStoredMarks(a),!0}catch(e){return!1}}(p,o,i)||f),n(p,o)&&(f=!0),f?(p.setMeta(H,!0),t([p]),p):null},props:{handleTextInput(e,t,n,o){const a=_.getState(e.state);if(!a||!a.enabled)return!1;try{const{tr:c}=e.state,l=e.state.doc.content.size,d=Math.max(0,Math.min(t,l)),u=Math.max(d,Math.min(n,l));var s=!1;d!==u&&(s=r(e,c,d,u,a.userId).applied);const p=c.mapping.map(u,1);var i;s?(i=(0,D.EX)(e.state.doc,u,"suggestionAdd",a.userId,"after"))||(i=(0,D.EX)(e.state.doc,d,"suggestionAdd",a.userId,"before")):(i=(0,D.EX)(e.state.doc,d,"suggestionAdd",a.userId,"before"))||(i=(0,D.EX)(e.state.doc,u,"suggestionAdd",a.userId,"after"));const f=i&&i.suggestionId&&i.createdAt,m=e.state.schema.marks.suggestionAdd.create({suggestionId:f?i.suggestionId:(0,D.Dc)(),authorId:a.userId,createdAt:f?i.createdAt:(new Date).toISOString(),...(0,D.oV)(a.userId)});return c.insertText(o,p,p),c.addMark(p,p+o.length,m),e.state.schema.marks.suggestionDelete&&c.removeMark(p,p+o.length,e.state.schema.marks.suggestionDelete),c.setMeta(H,!0),e.dispatch(c),!0}catch(e){return!1}},handlePaste(e,t,n){const r=_.getState(e.state);if(!r||!r.enabled)return!1;const{from:a,to:s,empty:i}=e.state.selection;if(i)return!1;try{const{tr:t,schema:i}=e.state,c=r.userId;o(e,t,a,s,c);const l=t.mapping.map(s,1),d=t.doc.content.size;t.replace(l,l,n);const u=t.doc.content.size-d;if(u>0){const e=l+u,n=i.marks.suggestionAdd.create({suggestionId:(0,D.Dc)(),authorId:c,createdAt:(new Date).toISOString(),...(0,D.oV)(c)});t.addMark(l,e,n),t.setSelection(M.U3.create(t.doc,e))}return t.setMeta(H,!0),e.dispatch(t),!0}catch(e){return!1}},handleKeyDown(e,t){const n=_.getState(e.state);if(!n||!n.enabled)return!1;if("Backspace"===t.key||"Delete"===t.key)try{const{selection:o}=e.state;if(o instanceof M.nh){const r=o.node,a=o.from;if(r&&r.type.spec.attrs&&r.type.spec.attrs.suggestionType){const{tr:o}=e.state;return s(o,a,r,n.userId),o.setMeta(H,!0),e.dispatch(o),t.preventDefault(),!0}}const{from:i,to:c,empty:l}=o,d=e.state.doc.content.size;let u,p;if(l){if(u="Backspace"===t.key?i-1:i,p="Backspace"===t.key?i:c+1,u<0||p>d)return!1;const r=e.state.doc.resolve(u);if(0===r.parentOffset&&"Backspace"===t.key&&0===r.parent.content.size)return!1;const o=(0,D.O_)(e.state.doc,u,"suggestionDelete");if(o){const{tr:n}=e.state;let r;return r="Backspace"===t.key?(0,D.jW)(e.state.doc,u,o.suggestionId):(0,D.U2)(e.state.doc,p,o.suggestionId),r!==i&&(n.setSelection(M.U3.create(n.doc,r)),n.setMeta(H,!0),e.dispatch(n)),a(),t.preventDefault(),!0}const l=e.state.doc.nodeAt(u);if(l&&l.isAtom&&l.type.spec.attrs&&l.type.spec.attrs.suggestionType){const{tr:r}=e.state;return s(r,u,l,n.userId)||"delete"!==l.attrs.suggestionType||r.setSelection(M.U3.create(r.doc,"Backspace"===t.key?u:u+l.nodeSize)),r.setMeta(H,!0),e.dispatch(r),t.preventDefault(),!0}}else if(u=Math.max(0,i),p=Math.min(c,d),u>=p)return!1;const{tr:f}=e.state,{applied:m}=r(e,f,u,p,n.userId);return m?(f.setMeta(H,!0),f.setSelection(M.U3.create(f.doc,f.mapping.map("Backspace"===t.key?u:p,-1))),e.dispatch(f),a(),t.preventDefault(),!0):(a(),t.preventDefault(),!0)}catch(e){return a(),t.preventDefault(),!0}return!1},handleDOMEvents:{keydown(e,t){if("Enter"===t.key)return function(e,t){const n=_.getState(e.state);if(!n||!n.enabled||!e.editable||t.isComposing)return!1;const r=function(e){const t=L.cX?e.metaKey:e.ctrlKey;return e.altKey||(L.cX?e.ctrlKey:e.metaKey)||t&&e.shiftKey?"command":e.shiftKey||t?"lineBreak":"paragraph"}(t);if("command"===r)return!1;const{selection:a}=e.state;if(a instanceof M.nh){if("lineBreak"===r)return t.preventDefault(),!0}else a.empty||function(e,t){const{selection:n,tr:r}=e.state;o(e,r,n.from,n.to,t);const a=r.doc.resolve(r.mapping.map(n.to,1));r.setSelection(M.U3.near(a,-1)),r.setMeta(H,!0),e.dispatch(r)}(e,n.userId);return"paragraph"===r&&function(e,t){const{$from:n}=e.state.selection;if(n.depth<=1||!f(n.parent,t))return;const r=n.node(n.depth-1);if(n.index(n.depth-1)!==r.childCount-1&&"listItem"!==r.type.name)return;const{storedMarks:o}=e.state,a=n.start(),{marks:s}=n.parent.firstChild,i=e.state.tr.delete(a,n.end());o&&i.setStoredMarks(o),i.setMeta(H,!0),e.dispatch(i),h={pos:a,marks:s}}(e,n.userId),u<10&&u++,g&&clearTimeout(g),g=setTimeout(()=>{u=0,g=null},2e3),!1}(e,t);if("Backspace"!==t.key&&"Delete"!==t.key)return!1;const n=_.getState(e.state);if(!n)return!1;if(!n.enabled)return e.editable&&!t.isComposing&&C(e,t,null);const{selection:s}=e.state;if(!s.empty){const{from:o,to:i}
1=s,c=e.state.doc.content.size,l=Math.max(0,o),d=Math.min(i,c);if(l>=d)return!1;const{tr:u}=e.state,{applied:p}=r(e,u,l,d,n.userId);return p&&(u.setMeta(H,!0),u.setSelection(M.U3.create(u.doc,u.mapping.map(d,-1))),e.dispatch(u)),t.preventDefault(),a(),!0}return!(!function(e,t,n){const r=function(e,t,n){const{$from:r}=e.selection;if(!r.parent.isTextblock)return null;if("Backspace"===t){const t=r.start();if(r.parentOffset<=1&&p(e.doc.nodeAt(t),n))return t;if(r.parentOffset>0)return null;const o=b(e.doc,r.before());return o&&f(o.node,n)?o.start:null}if(f(r.parent,n))return r.start();if(r.parentOffset!==r.parent.content.size)return null;const o=M.LN.findFrom(e.doc.resolve(r.after()),1,!0);if(!o||0!==o.$from.parentOffset)return null;const a=o.from;if(!p(e.doc.nodeAt(a),n))return null;const s=m(o.$from);return s&&s.pos-s.depth===r.pos?a:null}(e.state,t.key,n);if(null===r)return!1;const{$from:o}=e.state.selection,{tr:a}=e.state,s=v(a,r);return null===s?(function(e,t,n){if("Backspace"!==n)return;const{doc:r}=e.state,o=m(r.resolve(t)),a=o&&r.resolve(o.pos).nodeBefore;a&&M.nh.isSelectable(a)&&e.dispatch(e.state.tr.setSelection(M.nh.create(r,o.pos-a.nodeSize)))}(e,r,t.key),t.preventDefault(),!0):(r===o.start()&&"Backspace"===t.key?a.setSelection(M.U3.near(a.doc.resolve(s),-1)):r===o.start()&&a.setSelection(M.LN.near(a.doc.resolve(a.mapping.map(o.after(),1)),1)),a.setMeta(H,!0),e.dispatch(a),t.preventDefault(),!0)}(e,t,n.userId)&&!C(e,t,n.userId)||(a(),0))},keyup(e,t){if("Enter"!==t.key)return!1;u=0,g&&(clearTimeout(g),g=null);const{tr:r}=e.state;return n(r,e.state)&&e.dispatch(r.setMeta(H,!0)),!1},cut(e,t){const n=_.getState(e.state);if(!n||!n.enabled)return!1;const{selection:r}=e.state,{from:a,to:s,empty:i}=r;if(i)return!1;try{const i=e.state.doc.slice(a,s),c=e.state.doc.textBetween(a,s,"\n");if(t.clipboardData){t.clipboardData.setData("text/plain",c);const n=document.createElement("div"),r=e.domSerializer?e.domSerializer.serializeFragment(i.content):document.createDocumentFragment();n.appendChild(r),t.clipboardData.setData("text/html",n.innerHTML)}const{tr:l}=e.state,{applied:d}=o(e,l,a,s,n.userId);return d?(l.setMeta(H,!0),r instanceof M.nh||l.setSelection(M.U3.create(l.doc,l.mapping.map(s,-1))),e.dispatch(l),t.preventDefault(),!0):(t.preventDefault(),!0)}catch(e){return!1}},beforeinput(e,t){const n=_.getState(e.state);if(!n||!n.enabled)return!1;if("deleteContentBackward"===t.inputType||"deleteContentForward"===t.inputType||"deleteByCut"===t.inputType||"deleteByDrag"===t.inputType||"deleteWordBackward"===t.inputType||"deleteWordForward"===t.inputType||"deleteHardLineBackward"===t.inputType||"deleteHardLineForward"===t.inputType||"deleteSoftLineBackward"===t.inputType||"deleteSoftLineForward"===t.inputType){if(Date.now()-c<50)return t.preventDefault(),!0;(function(){const e=Date.now();c>0&&e-c>1e3&&(c=0)})();const{selection:o}=e.state,{from:a,to:s,empty:i}=o;if(!i)try{const{tr:o}=e.state,{applied:i}=r(e,o,a,s,n.userId);return i?(o.setMeta(H,!0),o.setSelection(M.U3.create(o.doc,o.mapping.map(s,-1))),e.dispatch(o),t.preventDefault(),!0):(t.preventDefault(),!0)}catch(e){return t.preventDefault(),!0}}return!1}}}})}n.r(t),n.d(t,{BLOCK_FORMAT_TYPES:()=>R,PARAGRAPH_BREAK_MARKER:()=>U,SUGGESTION_PROCESSED_META:()=>H,SuggestionAdd:()=>B.SS,SuggestionDelete:()=>B.Gr,SuggestionFormat:()=>B.ss,WRAPPER_FORMAT_TYPES:()=>O,applyDeletionToRange:()=>r,clearSuggestionAuthors:()=>D.kG,createDeletionMarkForRange:()=>D.K5,createFormatSuggestion:()=>l,createSuggestionModePlugin:()=>A,default:()=>q,generateSuggestionId:()=>D.Dc,getNodeSuggestionAttrs:()=>a,hasFormatMark:()=>c,markNodeForDeletion:()=>s,markSelectionForDeletion:()=>o,registerSuggestionAuthor:()=>D.Fv,revertParagraphBreak:()=>v,revertPendingParagraphBreaks:()=>S,suggestionCommands:()=>P.Z,suggestionModePluginKey:()=>_,withSkipSuggestionProcessing:()=>i});var E=n(58903),M=n(42845),I=n(38262),x=n(40154),L=n(51910),D=n(5528),B=n(32643),z=n(43592),P=n(7579);const U="​",R=["heading","alignment","bulletList","orderedList","blockquote","paragraphBreak","taSub","taBorderSub","taQuotation","taEpigraph","taSelectionFrame","spoilerBlock"];let F=!1,N=null;const O=["taSub","taBorderSub","taQuotation","taEpigraph","taSelectionFrame"],_=new M.hs("suggestionMode"),H="suggestionProcessed",W
1=["y-sync$","history$","collab$"],q={SuggestionAdd:B.SS,SuggestionDelete:B.Gr,SuggestionFormat:B.ss,createSuggestionModePlugin:A,suggestionModePluginKey:_,suggestionCommands:P.Z}},55079(e,t,n){function r(e){const t=(0,u.US)(e);return"youtube"===t?.provider?t.id:null}function o(e){return u.F3.youtube.getEmbedUrl(e)}n.d(t,{Eq:()=>o,F3:()=>u.F3,FT:()=>y,TE:()=>u.TE,US:()=>u.US,openEmbedInsertDialog:()=>p.l,s4:()=>r});var a=n(52781),s=n(8463),i=n(42845),c=n(7573),l=n(46508),d=n(40154),u=n(58412),p=n(31376),f=n(46813),m=n(59796),g=n(43592);const h="allow-scripts allow-same-origin allow-popups allow-forms allow-presentation",b="allow-scripts allow-same-origin allow-popups allow-forms allow-presentation allow-top-navigation-by-user-activation allow-downloads allow-storage-access-by-user-activation",y=a.bP.create({name:"socialEmbed",group:"block",atom:!0,addOptions:()=>({HTMLAttributes:{class:"social-embed-container"},allowedProviders:null}),addAttributes:()=>({src:{default:null},originalUrl:{default:null},provider:{default:"custom"},providerName:{default:"Embed"},aspectRatio:{default:"56.25%"},minHeight:{default:null},width:{default:"100%"},caption:{default:null},class:{default:"img-align-column"},suggestionId:{default:null,renderHTML:e=>e.suggestionId?{"data-suggestion-id":e.suggestionId}:{},parseHTML:e=>e.getAttribute("data-suggestion-id")},suggestionType:{default:null,renderHTML:e=>e.suggestionType?{"data-suggestion-type":e.suggestionType}:{},parseHTML:e=>e.getAttribute("data-suggestion-type")},suggestionAuthorId:{default:null,renderHTML:e=>e.suggestionAuthorId?{"data-suggestion-author-id":e.suggestionAuthorId}:{},parseHTML:e=>e.getAttribute("data-suggestion-author-id")},suggestionCreatedAt:{default:null,renderHTML:e=>e.suggestionCreatedAt?{"data-suggestion-created-at":e.suggestionCreatedAt}:{},parseHTML:e=>e.getAttribute("data-suggestion-created-at")},...(0,g.uA)()}),parseHTML:()=>[{tag:"figure",getAttrs:e=>{const t=e.querySelector("div.social-embed-container")||e.querySelector("div.ta-video-container");if(!t)return!1;const n=t.querySelector("iframe");if(!n)return!1;const r=n.getAttribute("src")||"",o=(0,u.US)(r),a=e.querySelector("figcaption"),{aspectRatio:s,minHeight:i}=(0,u.gG)(t,n,o);return{src:r,originalUrl:t.dataset.originalUrl||r,provider:o?.provider||t.dataset.provider||"custom",providerName:o?.providerName||"Embed",aspectRatio:s,minHeight:i,width:t.dataset.width||n.getAttribute("width")||"100%",caption:a?a.innerHTML:null,class:e.getAttribute("class")||"img-align-column"}}},{tag:"div.social-embed-container",getAttrs:e=>{const t=e.querySelector("iframe");if(!t)return!1;const n=t.getAttribute("src")||"",r=(0,u.US)(n),{aspectRatio:o,minHeight:a}=(0,u.gG)(e,t,r);return{src:n,originalUrl:e.dataset.originalUrl||n,provider:r?.provider||"custom",providerName:r?.providerName||"Embed",aspectRatio:o,minHeight:a,width:e.dataset.width||t.getAttribute("width")||"100%"}}},{tag:"div.ta-video-container",getAttrs:e=>{const t=e.querySelector("iframe");if(!t)return!1;const n=t.getAttribute("src")||"",r=(0,u.US)(n);return{src:n,originalUrl:n,provider:r?.provider||"custom",providerName:r?.providerName||"Embed",aspectRatio:r?.aspectRatio||"56.25%"}}},{tag:"iframe",getAttrs:e=>{let t=e.getAttribute("src")||"";if(t.startsWith("//")&&(t="https:"+t),!(0,u.TE)(t))return!1;const n=(0,u.US)(t),r=e.getAttribute("width"),o=e.getAttribute("height");let a=n?.aspectRatio||"56.25%",s=n?.minHeight||null;const i=r&&String(r).includes("%");let c=r?r+(i?"":"px"):"100%";if(r&&o&&!i){const e=parseInt(r,10),t=parseInt(o,10);if(e>0&&t>0){const n=t/e*100;n>60?(a="auto",s=t+"px"):a=n.toFixed(2)+"%"}}else if(o&&!s){const e=parseInt(o,10);e>0&&(s=e+"px")}return!s&&e.style?.minHeight&&(s=e.style.minHeight),{src:t,originalUrl:t,provider:n?.provider||"custom",providerName:n?.providerName||"Embed",aspectRatio:a,minHeight:s,width:c}}}],renderHTML({HTMLAttributes:e}){const{src:t,originalUrl:n,provider:r,aspectRatio:o,minHeight:a,width:i,caption:l,class:d}=e,p=[];if(o&&"auto"!==o&&(p.push("position: relative"),p.push(`padding-bottom: ${o}`)),a){const e=a.includes("(")?a:`min(${a}, 85vh)`;p.push(`min-height: ${e}`)}const f=a||"300px",m=f.includes("(")?f:`min(${f}, 85vh)`,y=o&&"auto"!==o?"position: absolute; top: 0; left: 0; width: 100%; height: 100%;":`width: 100%; min-height: ${m};`;if("undefined"!=typeof document){const s=document.createElement("figure");s.className=d||"img-align-column",(0,g.Rl)(s,e);const f=document.createElement("div");
1f.className=`social-embed-container social-embed-${r}`,f.dataset.provider=r,f.dataset.originalUrl=n||"",f.dataset.aspectRatio=o||"56.25%",a&&(f.dataset.minHeight=a),i&&"100%"!==i&&(f.dataset.width=i),p.length&&(f.style.cssText=p.join("; "));const m=document.createElement("iframe");m.src=t||"",m.width=i||"100%",m.frameBorder="0",m.allowFullscreen=!0,m.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",m.referrerPolicy="no-referrer-when-downgrade",m.style.cssText=y;const C=a?parseInt(a,10):0,A="piktochart"===r||"auto"===o&&C>=800,E=A||"knightlab"===r;A&&(C>0&&(m.height=C),m.setAttribute("scrolling","auto")),E||(m.loading="lazy");const M=["youtube","vimeo","rutube"].includes(r);m.setAttribute("sandbox",M?h:b);const I=u.F3[r]?u.F3[r].name:r;m.setAttribute("title",I);var v=t,S=i,k=y,w=I,T=n;m.onerror=function(){if(this.parentElement===f){var e=this;try{const t=document.createElement("div");t.className="social-embed-error";const n=document.createElement("span");n.className="social-embed-error__icon",n.textContent="⚠",t.appendChild(n);const r=document.createElement("span");r.className="social-embed-error__text",r.textContent="Не удалось загрузить "+w,t.appendChild(r);const o=document.createElement("button");o.type="button",o.className="social-embed-error__retry",o.textContent="↻ Повторить",o.addEventListener("click",function(){if(!t.parentElement)return;const n=document.createElement("iframe");n.src=v||"",n.width=S||"100%",n.frameBorder="0",n.allowFullscreen=!0,n.style.cssText=k,n.setAttribute("title",w),n.onerror=e.onerror,t.parentElement.classList.remove("embed-loaded"),n.addEventListener("load",function(){const e=n.closest(".social-embed-container");e&&e.classList.add("embed-loaded")},{once:!0}),t.parentElement.replaceChild(n,t)},{once:!0}),t.appendChild(o);const a=document.createElement("a");a.className="social-embed-error__link",a.href=T||v||"",a.target="_blank",a.rel="noopener noreferrer",a.textContent="Открыть по ссылке ↗",t.appendChild(a),f.replaceChild(t,e)}catch(e){}}};const x=document.createElement("a");if(x.href=n||t||"",x.target="_blank",x.rel="noopener noreferrer",x.className="social-embed-fallback",x.textContent="Открыть "+I,f.appendChild(m),f.appendChild(x),s.appendChild(f),l){const e=document.createElement("figcaption");e.innerHTML=(0,c.NT)(l),s.appendChild(e)}return s}const C=u.F3[r]?u.F3[r].name:r,A=a?parseInt(a,10):0,E="piktochart"===r||"auto"===o&&A>=800,M=E||"knightlab"===r,I=[["div",(0,s.K)(this.options.HTMLAttributes,{class:`social-embed-container social-embed-${r}`,"data-provider":r,"data-original-url":n,"data-aspect-ratio":o,...a?{"data-min-height":a}:{},style:p.join("; ")}),["iframe",{src:t,width:i||"100%",frameborder:"0",allowfullscreen:"true",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",style:y,title:C,referrerpolicy:"no-referrer-when-downgrade",...E?{...A>0?{height:String(A)}:{},scrolling:"auto"}:{},...M?{}:{loading:"lazy"},sandbox:["youtube","vimeo","rutube"].includes(r)?h:b}]]];return l&&I.push(["figcaption",{},l]),["figure",{class:d||"img-align-column"},...I]},addCommands(){return{setEmbed:e=>({commands:t})=>{const{url:n}=e;if(!n)return!1;const r=(0,u.US)(n);if(!r)return(0,d.UT)("[SocialEmbed] Could not parse URL:",n),!1;if(!r.embedUrl&&r.fallbackLink)return(0,d.UT)("[SocialEmbed] Провайдер",r.providerName,"— вставьте embed-код, а не обычную ссылку"),!1;if(!(0,u.TE)(r.embedUrl,"custom"===r.provider))return(0,d.UT)("[SocialEmbed] Invalid embed URL:",r.embedUrl),!1;const o=this.options.allowedProviders;if(o&&!o.includes(r.provider))return(0,d.UT)("[SocialEmbed] Provider not allowed:",r.provider),!1;const a=(0,l.getNodeSuggestionAttrs)(this.editor);return t.insertContent([{type:this.name,attrs:{src:r.embedUrl,originalUrl:r.originalUrl,provider:r.provider,providerName:r.providerName,aspectRatio:r.aspectRatio,minHeight:r.minHeight,...a}},{type:"paragraph"}])},setRawEmbed:e=>({commands:t})=>{const{src:n,aspectRatio:r="56.25%"}=e;return!(!n||!(0,u.TE)(n,!0))&&t.insertContent([{type:this.name,attrs:{src:n,originalUrl:n,provider:"custom",providerName:"Embed",aspectRatio:r}},{type:"paragraph"}])},setEmbedAlignment:e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n,a=n.doc.nodeAt(o.from);return!(!a||"socialEmbed"!==a.type.name||(r&&(t.setNodeMarkup(o.from,void 0,{...a.attrs,class:e}),r(t)),0))},setEmbedCaption:e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n,a=n.doc.nodeAt(o.from);return!(!a||"socialEmbed"!==a.type.name||(r&&(t.setNodeMarkup(o.from,void 0,{...a.attrs,caption:e||null}),r(t)),0))},deleteEmbed:()=>({tr:e,state:t,dispatch:n,editor:r})=>{const{selection:o}=t,a=t.doc.nodeAt(o.from);if(!a||"socialEmbed"!==a.type.name)return!1;const s=l.suggestionModePluginKey.getState(t);if(s&&s.enabled)return n&&((0,l.markNodeForDeletion)(e,o.from,a,s.userId),n(e)),!0;if(n){var i=a.attrs.src;e.delete(o.from,o.from+a.nodeSize),n(e),(0,m.Ic)(r,i)}return!0},openEmbedDialog:()=>({editor:e})=>((0,p.l)({onInsert:t=>{if(!e.commands.setEmbed({url:t})){const n=(0,u.US)(t);if(n&&!n.embedUrl&&n.fallbackLink){if(!e.commands.setLinkCard({url:n.originalUrl,needsRefresh:!0})){(0,d.UT)("[SocialEmbed]",n.providerName,"требует embed-код. linkCard unavailable.");const e=window.angular&&window.angular.element(document.body).injector()&&window.angular.element(document.body).injector().get("Notification");e&&e.warning(n.providerName+": вставьте embed-код (iframe), а не обычную ссылку")}return}e.commands.setRawEmbed({src:t})}},onRawIframeInsert:t=>{const n=(0,c.NT)(t,{allowAllTags:!1});n&&n.trim()?e.chain().focus().insertContent(n).run():(0,d.UT)("[SocialEmbed] Raw iframe HTML was rejected by sanitizer")}}),!0)}},addKeyboardShortcuts(){const e=e=>{const{state:t,view:n}=this.editor,{selection:r}=t,o=(e,t)=>{const n=e.attrs.src;this.editor.chain().focus().command(({tr:n})=>(n.delete(t,t+e.nodeSize),!0)).run(),(0,m.Ic)(this.editor,n)};if(r instanceof i.nh){const e=r.node;
1if(e&&"socialEmbed"===e.type.name)return o(e,r.from),!0}if(!r.empty)return!1;const{$from:a}=r;if("Delete"===e){if(a.parentOffset!==a.parent.content.size||!n.endOfTextblock("forward"))return!1;const e=a.depth-1;if(e<0)return!1;const t=a.node(e),r=a.index(e);if(r>=t.childCount-1)return!1;const s=t.child(r+1);return"socialEmbed"===s.type.name&&(o(s,a.after(a.depth)),!0)}if(0!==a.parentOffset||!n.endOfTextblock("backward"))return!1;const s=a.depth-1;if(s<0)return!1;const c=a.node(s),l=a.index(s);if(l<=0)return!1;const d=c.child(l-1);return"socialEmbed"===d.type.name&&(o(d,a.before(a.depth)-d.nodeSize),!0)};return{"Mod-Shift-e":()=>this.editor.commands.openEmbedDialog(),Delete:()=>e("Delete"),Backspace:()=>e("Backspace")}},addNodeView:()=>({node:e,editor:t,getPos:n})=>new f.I({node:e,editor:t,getPos:n}),onTransaction({editor:e,transaction:t}){if(t.getMeta("history$")||t.getMeta("y-sync$")&&t.getMeta("y-sync$").isUndoRedoOperation){var n=e._embedDeleteTimers;if(n)for(var r=Object.keys(n),o=0;o<r.length;o++)(0,m.eS)(e,r[o])}}})},68929(e,t,n){function r(){try{document.dispatchEvent(new CustomEvent("lt-loading-change"))}catch(e){}}function o(e){if(!e||"function"!=typeof e.getPrivacyState)return{allowed:!0,reason:"no-privacy-hook",status:null,isSharedDraft:!1,isPublicStatus:!0};try{const t=e.getPrivacyState()||{},n=t.status||null,r=!0===t.isSharedDraft,o=void 0!==t.isPublicStatus?!0===t.isPublicStatus:y.has(n);return{allowed:!1!==t.allowed,reason:t.reason||null,status:n,isSharedDraft:r,isPublicStatus:o}}catch(e){return{allowed:!0,reason:"privacy-hook-error",status:null,isSharedDraft:!1,isPublicStatus:!0}}}function a(e,t){t.storage.lastCheckedContent=null,t.storage.matches=[],t.storage.debounceTimer&&(clearTimeout(t.storage.debounceTimer),t.storage.debounceTimer=null),t.storage.abortController&&(t.storage.abortController.abort(),t.storage.abortController=null);try{const t=e.state.tr.setMeta(b,{matches:[],decorations:p.zF.empty});e.dispatch(t)}catch(e){}}async function s(e,t){try{await async function(e,t){if(!t.options.enabled)return;if(!e.state||0===e.state.doc.content.size)return;const n=o(t.options);if(t.storage.privacyState=n,t.storage.externalCheckAllowed=n.allowed,!n.allowed)return t.storage.loading=!1,a(e,t),void r();if(t.storage.rateLimitUntil){if(Date.now()<t.storage.rateLimitUntil)return t.storage.loading=!1,void r();t.storage.rateLimitError=!1,t.storage.rateLimitUntil=null}const i=(0,m.nq)(e.state.doc).text;if(!i||i.trim().length<3)return;if(i===t.storage.lastCheckedContent)return;t.storage.lastCheckedContent=i,t.storage.loading=!0,r();let c=[];if(i.length>18e3){t.storage.abortController&&t.storage.abortController.abort();const e=new AbortController;t.storage.abortController=e;const n=(0,m.Pt)(i,18e3);for(let o=0;o<n.length;o++){o>0&&await new Promise(e=>setTimeout(e,200));const a=await(0,g.t)(n[o].text,t.options,t,e);if(null===a)return t.storage.lastCheckedContent=null,t.storage.loading=!1,void r();for(const e of a)c.push({...e,offset:e.offset+n[o].textOffset})}}else{const e=await(0,g.t)(i,t.options,t);if(null===e)return t.storage.lastCheckedContent=null,t.storage.loading=!1,void r();c=e}if(t.storage.loading=!1,r(),!t.options.enabled)return;if(!o(t.options).allowed)return void a(e,t);const l=(0,m.nq)(e.state.doc),d=l.text;if(i!==d)return t.storage.lastCheckedContent=null,t.storage.debounceTimer&&clearTimeout(t.storage.debounceTimer),void(t.storage.debounceTimer=setTimeout(()=>{t.storage.debounceTimer=null;const e=t.editor&&t.editor.view;e&&s(e,t).catch(()=>{})},t.options.debounceMs));const u=c.filter(e=>{if(t.storage.ignoredRules.has(e.rule&&e.rule.id||""))return!1;const n=d.substring(e.offset,e.offset+e.length);return!t.storage.ignoredTexts.has(n)});t.storage.matches=u;try{if(!e.state||t.editor&&t.editor.isDestroyed)return;const n=function(e,t,n){const r=[];for(const o of t){const t=(0,m.zt)(o.offset,o.length,n);if(!t)continue;if(t.from>=t.to)continue;if(t.from<0||t.to>e.content.size)continue;let{from:a,to:s}=t;try{const t=e.resolve(a),n=e.resolve(s);if(t.parent!==n.parent&&(s=t.end(),a>=s))continue}catch(e){continue}const i=o.rule&&o.rule.category&&o.rule.category.id||"";r.push(p.NZ.inline(a,s,{class:"TYPOS"===i||"SPELL"===i||"CONFUSED_WORDS"===i||o.rule&&"misspelling"===o.rule.issueType?"lt-error":"lt-warning","data-lt-message":o.message||"","data-lt-replacements":JSON.stringify((o.replacements||[]).slice(0,5).map(e=>e.value)),"data-lt-rule-id":o.rule&&o.rule.id||""}))}return r.length>0?p.zF.create(e,r):p.zF.empty}(e.state.doc,u,l.segments),r=(n===p.zF.empty||n.find(),e.state.tr.setMeta(b,{matches:u,decorations:n}));e.dispatch(r)}catch(e){}}(e,t)}catch(e){t.storage.loading=!1,r()}}function i(e,t,n){const r=[[t,1],[t,0],[t+1,0]];for(const[t,n]of r)try{const r=e.domAtPos(t,n);let o=3===r.node.nodeType?r.node.parentElement:r.node;for(let t=0;t<5&&o&&o!==e.dom;t++){if(o.classList&&(o.classList.contains("lt-error")||o.classList.contains("lt-warning")))return o;o=o.parentElement}}catch(e){}return null}function c(e,t,n,r){const o=t.getAttribute("data-lt-message")||"Возможная ошибка",a=t.getAttribute("data-lt-rule-id")||"";let s=[];try{const e=t.getAttribute("data-lt-replacements");e&&(s=JSON.parse(e))}catch(e){}const c=b.getState(e.state),d=(c?c.decorations.find(0,e.state.doc.
1content.size):[]).slice().sort((e,t)=>e.from-t.from),u=d.length;let f=d.findIndex(e=>e.from<=n&&e.to>n);if(-1===f&&u>0){let e=1/0;for(let t=0;t<u;t++){const r=Math.min(Math.abs(d[t].from-n),Math.abs(d[t].to-n));r<e&&(e=r,f=t)}}let m=null;for(let t=1;t<=10&&f-t>=0;t++){const n=d[f-t];if(i(e,n.from)){m=n;break}}let g=null;for(let t=1;t<=10&&f+t<u;t++){const n=d[f+t];if(i(e,n.from)){g=n;break}}const y=f;(0,h.oM)({message:o,replacements:s,anchorRect:t.getBoundingClientRect(),anchorEl:t,navContext:u>1?{currentIndex:y,total:u,onPrev:m?()=>l(e,m,r,-1):null,onNext:g?()=>l(e,g,r,1):null}:null,onReplace:r=>{const o=e.state;if(!o)return;const s=b.getState(o);if(!s)return;const i=s.decorations.find(0,o.doc.content.size).filter(e=>{if(e.from>=e.to)return!1;try{return e.type.attrs["data-lt-rule-id"]===a&&o.doc.textBetween(e.from,e.to)===t.textContent}catch(e){return!1}}),c=i.length>0?i.reduce((e,t)=>Math.abs(t.from-n)<Math.abs(e.from-n)?t:e):null;if(c)try{const t=o.doc.resolve(c.from).marks(),n=o.tr.replaceWith(c.from,c.to,o.schema.text(r,t)),i=s.decorations.map(n.mapping,n.doc).find(0,n.doc.content.size),l=n.mapping.map(c.from,-1),d=i.filter(e=>!(e.from===l&&e.type.attrs["data-lt-rule-id"]===a)),u=d.length>0?p.zF.create(n.doc,d):p.zF.empty;let f=!1;const m=s.matches.filter(function(e){return!(!f&&e.rule&&e.rule.id===a&&(f=!0,1))});n.setMeta(b,{decorations:u,matches:m}),e.dispatch(n)}catch(e){}},onIgnore:()=>{a&&r.storage.ignoredRules.add(a);const n=t.textContent;n&&r.storage.ignoredTexts.add(n);if(r.storage.ignoredRules.size>500){const e=r.storage.ignoredRules.values();r.storage.ignoredRules.delete(e.next().value)}if(r.storage.ignoredTexts.size>500){const e=r.storage.ignoredTexts.values();r.storage.ignoredTexts.delete(e.next().value)}try{const e=[...r.storage.ignoredRules],t=[...r.storage.ignoredTexts];localStorage.setItem("lt-ignored",JSON.stringify({rules:e.slice(-500),texts:t.slice(-500)}))}catch(e){}const o=e.state,s=b.getState(o);if(s){const t=s.decorations.find(0,o.doc.content.size).filter(e=>{if(r.storage.ignoredRules.has(e.type.attrs["data-lt-rule-id"]||""))return!1;try{const t=o.doc.textBetween(e.from,e.to);if(r.storage.ignoredTexts.has(t))return!1}catch(e){return!1}return!0});try{const n=p.zF.create(o.doc,t),r=o.tr.setMeta(b,{decorations:n});e.dispatch(r)}catch(e){}}}},r)}function l(e,t,n,r){(0,h.RY)(),requestAnimationFrame(()=>{try{const o=i(e,t.from);if(!o){const o=r||1,a=b.getState(e.state);if(!a)return;const s=a.decorations.find(0,e.state.doc.content.size).slice().sort((e,t)=>e.from-t.from),c=s.findIndex(e=>e.from===t.from&&e.to===t.to);if(c<0)return;for(let t=1;t<=10;t++){const r=c+o*t;if(r<0||r>=s.length)break;if(i(e,s[r].from))return void l(e,s[r],n,o)}return}o.scrollIntoView({block:"center",behavior:f.eb}),function(e,t){let n=!1;const r=()=>{if(n)return;n=!0;let r=null,o=0;const a=()=>{if(!e.isConnected)return void t();const n=e.getBoundingClientRect().top;if(null!==r&&Math.abs(n-r)<.5){if(o++,o>=3)return void t()}else o=0;r=n,requestAnimationFrame(a)};requestAnimationFrame(a)};if("undefined"==typeof IntersectionObserver)return void setTimeout(r,600);const o=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting)return o.disconnect(),void r()},{threshold:.1});o.observe(e),setTimeout(()=>{o.disconnect(),r()},1500)}(o,()=>{if(n.editor&&n.editor.isDestroyed)return;const r=i(e,t.from);r&&(r.classList.add("lt-flash"),setTimeout(()=>{r.isConnected&&r.classList.remove("lt-flash")},900),c(e,r,t.from,n))})}catch(e){}})}n.d(t,{n:()=>v});var d=n(52781),u=n(42845),p=n(1575),f=n(51910),m=n(31405),g=n(63960),h=n(40148);const b=new u.hs("languageTool"),y=new Set(["posted","published","featured","recalled"]),v=d.YY.create({name:"languageTool",addOptions:()=>({language:"ru-RU",apiUrl:"https://api.languagetool.org/v2/check",debounceMs:5e3,enabled:!0,disabledRules:"WHITESPACE_RULE"}),addStorage(){let e={rules:[],texts:[]};try{const t=localStorage.getItem("lt-ignored");t&&(e=JSON.parse(t))}catch(e){}return{matches:[],loading:!1,ignoredRules:new Set(Array.isArray(e.rules)?e.rules:[]),ignoredTexts:new Set(Array.isArray(e.texts)?e.texts:[]),abortController:null,lastCheckedContent:null,debounceTimer:null,privacyState:{allowed:!0,reason:"init"},externalCheckAllowed:!0,rateLimitError:!1,rateLimitUntil:null}},onCreate(){if(!this.options.enabled)return;const e=this;e.storage.initTimer=setTimeout(()=>{e.storage.initTimer=null,e.editor&&!e.editor.isDestroyed&&e.editor.view&&s(e.editor.view,e).catch(()=>{})},800)},addCommands(){const e=this;return{enableLanguageTool:()=>({editor:t})=>{const n=o(e.options);return e.storage.privacyState=n,e.storage.externalCheckAllowed=n.allowed,n.allowed?(e.options.enabled=!0,e.storage.lastCheckedContent=null,e.storage.rateLimitError=!1,e.storage.rateLimitUntil=null,s(t.view,e).catch(()=>{}),!0):(e.options.enabled=!1,a(t.view,e),r(),!1)},disableLanguageTool:()=>({editor:t})=>(e.options.enabled=!1,(0,h.RY)(e),a(t.view,e),!0),checkNow:()=>({editor:t})=>(e.storage.lastCheckedContent=null,e.storage.debounceTimer&&(clearTimeout(e.storage.debounceTimer),e.storage.debounceTimer=null),s(t.view,e).catch(()=>{}),!0)}},addProseMirrorPlugins(){const e=this;return[new u.k_({key:b,state:{init:()=>({decorations:p.zF.empty,matches:[]}),apply(t,n,r,o){const a=t.getMeta(b);if(a)return{decorations:a.decorations||p.zF.empty,matches:a.matches||[]};if(t.docChanged){const r=n.decorations.map(t.mapping,o.doc),a=t.getMeta("y-sync$")||t.steps.length>3;if(n.matches.length>0&&n.decorations!==p.zF.empty&&a){const t=n.matches.length,o=r.find().length;(0===o||o<t)&&(e.storage.lastCheckedContent=null)}return{decorations:r,matches:n.matches}}return n}},props:{decorations:e=>b.getState(e).decorations,handleClick(t,n,r){let o=null,a=r.target;for(let e=0;e<5&&a&&a!==t.dom;e++){if(a.classList&&(a.classList.contains("lt-error")||a.classList.contains("lt-warning"))){o=a;break}a=a.parentElement}return o?(c(t,o,n,e),!1):((0,h.RY)(),!1)}},view:t=>({update(t,n){if(!e.options.enabled)return;if(t.state.doc===n.doc)return;(0,h.RY)(e);
1const r=!e.storage.lastCheckedContent&&t.state.doc.content.size>3;e.storage.debounceTimer&&clearTimeout(e.storage.debounceTimer),e.storage.debounceTimer=r?setTimeout(()=>{e.storage.debounceTimer=null,s(t,e).catch(()=>{})},500):setTimeout(()=>{e.storage.debounceTimer=null,s(t,e).catch(()=>{})},e.options.debounceMs)},destroy(){e.storage.initTimer&&(clearTimeout(e.storage.initTimer),e.storage.initTimer=null),e.storage.debounceTimer&&(clearTimeout(e.storage.debounceTimer),e.storage.debounceTimer=null),e.storage.abortController&&(e.storage.abortController.abort(),e.storage.abortController=null),(0,h.RY)(e),e.storage.lastCheckedContent=null}})})]}})},99159(e,t,n){n.r(t),n.d(t,{DELETABLE_BLOCK_TYPES:()=>i,EXITABLE_BLOCK_TYPES:()=>s,WRAPPER_TYPES:()=>a,default:()=>k,findActiveWrapper:()=>p,findAllWrappersInSelection:()=>f,getValidationErrorMessage:()=>u,handleWrapperExitOnEnter:()=>S,liftAllWrappers:()=>b,liftWrapper:()=>g,setWrapper:()=>h,toggleWrapperCommand:()=>v,toggleWrapperWithExclusion:()=>y,validateContentForWrapper:()=>d});var r=n(42845),o=n(58903);const a=["taSub","taBorderSub","taQuotation","taEpigraph","taSelectionFrame","blockquote"],s=[...a,"spoilerBlock","tocBlock","readAlsoBlock"],i=["spoilerBlock","tocBlock","readAlsoBlock"],c=e=>{try{const{$from:t,$to:n}=e.state.selection;let r=0;return e.state.doc.nodesBetween(t.pos,n.pos,e=>{"paragraph"===e.type.name&&r++}),r}catch(e){return 1}},l=e=>{try{const{$from:t,$to:n}=e.state.selection,r=new Map;if(e.state.doc.nodesBetween(t.pos,n.pos,(e,t,n)=>{"listItem"===e.type.name&&(!n||"bulletList"!==n.type.name&&"orderedList"!==n.type.name||(r.has(n)||r.set(n,new Set),r.get(n).add(t)))}),0===r.size)return{isPartial:!1,hasLists:!1};for(const[e,t]of r){let n=0;if(e.forEach(e=>{"listItem"===e.type.name&&n++}),t.size<n)return{isPartial:!0,hasLists:!0}}return{isPartial:!1,hasLists:!0}}catch(e){return{isPartial:!1,hasLists:!1}}},d=(e,t)=>{try{const{$from:n,$to:r}=e.state.selection,o="taSub"===t||"taBorderSub"===t,a="taSelectionFrame"===t||"taSub"===t||"taBorderSub"===t,s="blockquote"===t,i=new Set;let d=!1;if(e.state.doc.nodesBetween(n.pos,r.pos,e=>
1{e.type.name&&i.add(e.type.name),"image"!==e.type.name&&"figure"!==e.type.name&&"discoursImage"!==e.type.name||i.add("image"),"heading"===e.type.name&&3!==e.attrs.level&&(d=!0)}),!o&&(i.has("image")||i.has("figure")||i.has("discoursImage")))return{ok:!1,reason:"images"};if(s||"taQuotation"===t);else if(a){if(d)return{ok:!1,reason:"headings"}}else if(i.has("heading"))return{ok:!1,reason:"headings"};const u=i.has("bulletList")||i.has("orderedList")||i.has("listItem");return!a&&u?{ok:!1,reason:"lists"}:a&&u&&l(e).isPartial?{ok:!1,reason:"listsPartial"}:i.has("table")||i.has("tableRow")||i.has("tableCell")?{ok:!1,reason:"tables"}:i.has("codeBlock")||i.has("pre")?{ok:!1,reason:"pre"}:s&&c(e)>1?{ok:!1,reason:"blockquoteSingleParagraph"}:{ok:!0}}catch(e){return{ok:!0}}},u=(e,t)=>({images:"Подвёрстки неприменимы к картинкам",headings:"Подвёрстки неприменимы к заголовкам",lists:"blockquote"===t?"Цитаты неприменимы к спискам":"Подвёрстки неприменимы к спискам",listsPartial:"Подвёрстку можно применять к спискам только целиком. Пожалуйста, выделите весь список",tables:"Подвёрстки неприменимы к таблицам",pre:"Подвёрстки неприменимы к преформатированному тексту",blockquoteSingleParagraph:"«Ударной цитатой» можно оформить только один абзац за раз"}[e]||"Невозможно применить подвёрстку к выделенному фрагменту"),p=e=>{for(const t of a)if(e.isActive(t))return t;return null},f=e=>{const t=new Set;try{const{$from:n,$to:r}=e.state.selection;e.state.doc.nodesBetween(n.pos,r.pos,e=>{const n=e.type.name;a.includes(n)&&t.add(n)});for(let e=n.depth;e>0;e--){const r=n.node(e).type.name;a.includes(r)&&t.add(r)}for(let e=r.depth;e>0;e--){const n=r.node(e).type.name;a.includes(n)&&t.add(n)}}catch(e){}return t},m=(e,t)=>{try{const{$from:n}=e.state.selection;for(let e=n.depth;e>0;e--){const r=n.node(e);if(r.type.name===t)return{pos:n.before(e),node:r,depth:e}}}catch(e){}return null},g=(e,t)=>{try{const n=m(e,t);if(n){const{state:a}=e,{tr:s}=a,{selection:i}=a,c=n.pos,l=c+n.node.nodeSize,d=c+1;let u=i.from-d,p=i.to-d;const f=n.node.content;let m=f;if("spoilerBlock"===t){const e=(n.node.attrs&&n.node.attrs.title||"").trim();if(e){const t=a.schema.nodes.paragraph.create(null,a.schema.text(e));m=o.FK.from(t).append(f),u+=t.nodeSize,p+=t.nodeSize}}s.replaceWith(c,l,m);const g=Math.max(c,c+u),h=Math.max(g,c+p),b=s.doc.content.size,y=Math.min(Math.max(0,g),b),v=Math.min(Math.max(y,h),b);try{const e=r.U3.create(s.doc,y,v);s.setSelection(e)}catch(e){try{const e=r.U3.create(s.doc,Math.min(c,b));s.setSelection(e)}catch(e){}}return e.view.dispatch(s),!0}if("blockquote"===t)return e.chain().lift("blockquote").run();const a="unset"+t.charAt(0).toUpperCase()+t.slice(1);return e.commands[a]?e.chain()[a]().run():e.chain().lift(t).run()}catch(e){return!1}},h=(e,t)=>{try{if("blockquote"!==t&&"taQuotation"!==t||(e=>{try{const{$from:t,$to:n}=e.state.selection;let r=!1;return e.state.doc.nodesBetween(t.pos,n.pos,e=>{"heading"===e.type.name&&(r=!0)}),!!r&&(e.chain().focus().setParagraph().run(),!0)}catch(e){return!1}})(e),"blockquote"===t)return e.chain().setBlockquote().run();const n="set"+t.charAt(0).toUpperCase()+t.slice(1);let s=!1;return s=e.commands[n]?e.chain()[n]().run():e.chain().wrapIn(t).run(),s||(s=((e,t)=>{try{const{state:n}=e,{selection:s}=n,{$from:i,$to:c}=s;let l=-1;for(let e=i.depth;e>0;e--){const t=i.node(e);if("bulletList"===t.type.name||"orderedList"===t.type.name){const n=i.before(e);if(c.pos>=n&&c.pos<=n+t.nodeSize){l=e;break}}if(a.includes(t.type.name))break}if(l<0)return!1;const d=i.node(l),u=i.before(l),p=u+d.nodeSize,f=n.schema.nodes[t];if(!f)return!1;const m=f.create(null,o.FK.from(d)),{tr:g}=n;g.replaceWith(u,p,m);try{const e=g.doc.content.size,t=Math.min(s.from+1,e),n=Math.min(s.to+1,e);g.setSelection(r.U3.create(g.doc,t,n))}catch(e){}return e.view.dispatch(g),!0}catch(e){return!1}})(e,t)),s}catch(e){return!1}},b=(e,t)=>{let n=!1;const r=Array.isArray(t)?t:Array.from(t);let o=10;for(;o>0;){o--;let t=!1;const a=f(e);for(const o of r)if(a.has(o)&&m(e,o)&&g(e,o)){n=!0,t=!0;break}if(!t)break}return n},y=(e,t,n=null)=>{const r=f(e);
1if(e.isActive(t)&&1===r.size&&r.has(t))return g(e,t);if(r.size>0){const o=d(e,t);if(!o.ok){const r=u(o.reason,t);return n&&n(o.reason,r),e.notificationService&&"function"==typeof e.notificationService.warning&&e.notificationService.warning(r),!1}return b(e,r),h(e,t)}const o=d(e,t);if(!o.ok){const r=u(o.reason,t);return n&&n(o.reason,r),e.notificationService&&"function"==typeof e.notificationService.warning&&e.notificationService.warning(r),!1}return h(e,t)},v=(e,t,n=null)=>{const{editor:r,tr:o,dispatch:a}=e;if(o.setMeta("preventDispatch",!0),!a){const e=f(r);return r.isActive(t)&&1===e.size&&e.has(t)||d(r,t).ok}return y(r,t,n)},S=e=>{try{const{state:t}=e,{selection:n}=t,{$from:o}=n;if(!n.empty)return!1;const a=o.parent;if("paragraph"!==a.type.name)return!1;if(!(0===a.content.size||a.textContent&&""===a.textContent.trim()))return!1;let i=null,c=-1;for(let e=o.depth;e>0;e--){const t=o.node(e);if(s.includes(t.type.name)){i=t.type.name,c=e;break}}if(!i||c<0)return!1;const l=o.node(c),d=o.before(c),u=d+l.nodeSize;if(!(u-o.pos<=3||o.pos-d>l.nodeSize-10))return!1;let p=0;l.forEach(e=>{"paragraph"===e.type.name?e.content.size>0&&""!==e.textContent.trim()&&p++:p++});const{tr:f}=t,m=o.before(o.depth),g=o.after(o.depth);if(f.delete(m,g),0===p){const e=f.mapping.map(d),n=f.mapping.map(u),o=t.schema.nodes.paragraph.create();f.replaceWith(e,n,o),f.setSelection(r.U3.create(f.doc,e+1))}else{const e=f.mapping.map(u),n=t.schema.nodes.paragraph.create();f.insert(e,n),f.setSelection(r.U3.create(f.doc,e+1))}return e.view.dispatch(f),!0}catch(e){return!1}},k={WRAPPER_TYPES:a,EXITABLE_BLOCK_TYPES:s,DELETABLE_BLOCK_TYPES:i,validateContentForWrapper:d,getValidationErrorMessage:u,findActiveWrapper:p,findAllWrappersInSelection:f,liftWrapper:g,liftAllWrappers:b,setWrapper:h,toggleWrapperWithExclusion:y,toggleWrapperCommand:v,handleWrapperExitO
1nEnter:S,countParagraphsInSelection:c,checkPartialListSelection:l}}}]);

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.