PageSourceSearch

https://dtf.ru/assets/Editor-BWgpX0qK.js

js dtf.ru collected 2026-09-24 08:37:15 UTC 43,395 bytes, 4 lines download raw bytes

1var ze=Object.defineProperty;var Fe=(i,n,t)=>n in i?ze(i,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[n]=t;var d=(i,n,t)=>Fe(i,typeof n!="symbol"?n+"":n,t);import{d as F,ba as T,bb as q,r as w,al as Ue,aq as ot,a as h,b as _,p as z,e as C,w as K,P as j,t as R,f as e,af as st,aS as Yt,bc as Me,c as D,bd as Ne,E as ye,N as it,O as He,be,s as L,v as O,bf as It,aj as ge,ao as ke,ap as Wt,y as bt,o as Zt,u as te,a$ as qe,bg as Re,aC as we,aO as ee,X as ie,$ as je,l as Ot,m as ae,bh as Ke,bi as We,bj as xe,S as Ee,bk as ue,F as at,L as Pt,aM as Ye,bl as M,bm as H,bn as Xe,bo as $,bp as Ge,bq as Q,br as dt,bs as Xt,bt as Je,bu as Qe,bv as Ze,z as ut,bw as J,bx as ti,as as _e,ac as St,by as ei,bz as ce,bA as pe,bB as $e,D as oe,bC as ii,bD as Gt,bE as ai,bF as oi,bG as si,bH as ht,aR as ri,bI as ni,bJ as li,bK as Ce,bL as Ae,j as di,aH as ui,bM as ci,bN as Pe,bO as pi,b2 as vi,am as mi,bP as hi,bQ as fi,bR as yi,bS as bi,bT as gi,ah as ki,bU as At,bV as wi,bW as xi,bX as Ei,bY as _i,bZ as $i,b_ as Ci,b$ as Ai,c0 as Pi,c1 as Si,c2 as Bi,av as ve,c3 as Ti,c4 as Di}from"./index-DEIWCX15.js";import"./photoswipe-n7lXYKL2.js";import{u as Li}from"./useCommentingPermissions-D8O51qAt.js";const Vi={class:"editor-topic-picker"},Oi={class:"editor-topic-picker__inner"},Ii={class:"editor-topic-picker__topic-label"},zi={class:"editor-topic-picker__select"},Fi={class:"editor-topic-picker__search"},me=F({__name:"EditorTopicPicker",props:{topic:{},author:{},findTopics:{type:Function},getTopic:{type:Function}},emits:["update:topic"],setup(i,{emit:n}){const t=i,{t:a}=T(q.Entry),o=n,v=O(()=>t.topic.value!==t.author.value),c=w(t.topic.value),m=w(""),u=w([]),s=w(!1),r=w(!1),y=w(),l=O(()=>s.value?"chevron_up":"chevron_down"),x=O(()=>v.value?{image:Yt({uuid:t.topic.image,width:36,height:36}),link:""}:void 0);function p(){s.value=!s.value}async function b(A){const f=t.getTopic(A);if(f===void 0)throw new Error("Could not find topic");o("update:topic",f.isNoTheme===!0?t.author:f)}async function E(A){try{u.value=[],r.value=!0,u.value=await t.findTopics(A),r.value=!1}catch{}}return Ue(m,A=>{E(A)},{debounce:300}),ot(s,A=>{A&&u.value.length===0&&E(m.value)}),(A,f)=>(h(),_("div",Vi,[z("div",Oi,[C(e(Me),{id:i.author.value,avatar:e(Yt)({uuid:i.author.image,width:36,height:36}),"avatar-sticker":x.value,name:i.author.label,"badge-id":i.author.badgeId,"favorite-collectible":i.author.favoriteCollectible},{secondary:K(()=>[z("div",{class:"editor-topic-picker__topic",onClick:j(p,["stop"])},[z("span",Ii,R(v.value?i.topic.label:e(a)("editor.withoutTopic")),1),C(e(st),{name:l.value,width:17,height:17},null,8,["name"])])]),_:1},8,["id","avatar","avatar-sticker","name","badge-id","favorite-collectible"]),s.value?(h(),D(e(Ne),{key:0,onLeave:f[8]||(f[8]=j(P=>p(),["stop"]))},{default:K(()=>[z("div",zi,[z("div",Fi,[C(e(ye),{ref:"searchInput",modelValue:m.value,"onUpdate:modelValue":f[0]||(f[0]=P=>m.value=P),size:e(He).Small,icon:"search",placeholder:"Поиск",autofocus:!0,onKeydown:[f[1]||(f[1]=it(j(P=>{var S;return(S=y.value)==null?void 0:S.navigateDown()},["prevent"]),["down"])),f[2]||(f[2]=it(j(P=>{var S;return(S=y.value)==null?void 0:S.navigateUp()},["prevent"]),["up"])),f[3]||(f[3]=it(j(P=>{var S;return(S=y.value)==null?void 0:S.navigateSubmit(P)},["prevent"]),["enter"])),f[4]||(f[4]=it(j(P=>p(),["prevent"]),["esc"])),f[5]||(f[5]=it(j(P=>{var S;return(S=y.value)==null?void 0:S.navigateDown()},["prevent"]),["tab"]))]},null,8,["modelValue","size"])]),C(e(be),{ref_key:"list",ref:y,selected:c.value,"onUpdate:selected":[f[6]||(f[6]=P=>c.value=P),b],data:u.value,selectable:!0,"visible-options":4,loading:r.value,onLeave:f[7]||(f[7]=j(P=>p(),["stop"]))},null,8,["selected","data","loading"])])]),_:1})):L("",!0)])]))}});function Ui(i){var A;const{[q.Entry]:n}=It(),{t}=T(),{user:a}=ge(),o=(A=ke)==null?void 0:A(),{permissionOptions:v,ensurePermissionAllowed:c}=Li({[Wt.OnlyDonators]:{isDisallowed:()=>(o==null?void 0:o.isConfirmed.value)===!1,onDisallowed:()=>{o==null||o.promoteRegistrationForComments()}}}),{alert:m,AlertType:u}=bt(),s=O(()=>{var f;return((f=a.value)==null?void 0:f.commentingPermissions)??Wt.Everybody}),r=w(s.value),y=O(()=>v.value.filter(f=>!(f.value===Wt.OnlyDonators&&(o==null?void 0:o.isConfirmed.value)===!1)).map(f=>({...f,selectable:!0,details:b(f.value),action:async()=>await E(f.value)})));Zt(async()=>{r.value=await x()??s.value});async function l(f){await n.setCommentingPermissionForPostId(i,f)}
1async function x(){return await n.getCommentingPermissionForPostId(i)}async function p(){await n.resetCommentingPermissionForPostId(i)}function b(f){return s.value===f?t("shared.default"):""}async function E(f){if(s.value===f){r.value=s.value,p();return}if(!c(f))return;const P=r.value;r.value=f;try{await l(f)}catch(S){throw r.value=P,m({type:u.Error,text:S instanceof Error?S.message:t("shared.unknownError")}),S}}return{permissionList:y,currentPermission:r}}const Mi={key:0,class:"editor-commenting-permissions__dot"},Ni=F({__name:"PostCommentingPermissions",props:{postId:{}},setup(i){const n=i,{t}=T(),{open:a}=te(),{trackEvent:o}=qe(),{currentPermission:v,permissionList:c}=Ui(n.postId),m=Re("is-post-commenting-permissions-clicked",!1),u=w();function s(){a(be,{title:t("common.commentingPermissions.postTitle"),data:c.value,selected:v.value,selectable:!0},{width:"max-content",positionX:"left",target:u.value}),m.value=!0,o("Editor — Commenting Permissions — Click")}return(r,y)=>(h(),_("div",{ref_key:"rootElement",ref:u,class:"editor-commenting-permissions"},[e(m)?L("",!0):(h(),_("div",Mi)),C(e(we),{icon:"comment",onClick:y[0]||(y[0]=l=>s())})],512))}}),Hi={class:"editor-control-bar"},qi={class:"editor-control-bar__controls"},Ri={key:2,class:"editor-control-bar__autosave"},ji=F({__name:"EditorControlBar",props:{options:{},postId:{},isPublished:{type:Boolean},isEditorEmpty:{type:Boolean},isBlocksLimitExceeded:{type:Boolean},isAutosaving:{type:Boolean},isAutosaved:{type:Boolean},isSaving:{type:Boolean},isOnline:{type:Boolean}},emits:["submit"],setup(i,{emit:n}){const t=i,a=n,{isOneColumn:o,isTwoColumns:v}=ee(),{t:c}=T(),{close:m}=ie(),u=O(()=>t.isPublished?c("entry.editor.save"):c("entry.editor.publish")),s=O(()=>!t.isOnline||t.isEditorEmpty||t.isSaving||t.isAutosaving||t.isBlocksLimitExceeded),r=O(()=>t.isAutosaving?c("entry.editor.saving"):t.isAutosaved?c("entry.editor.saved"):"");return(y,l)=>(h(),_("div",Hi,[e(o)?(h(),_("div",{key:0,class:"editor-control-bar__back-button",onClick:l[0]||(l[0]=(...x)=>e(m)&&e(m)(...x))},[C(e(st),{name:"chevron_left_big",width:24,height:24})])):L("",!0),y.$slots.default?je(y.$slots,"default",{key:1}):L("",!0),z("div",qi,[e(o)?(h(),D(e(Ot),{key:0,icon:i.isPublished?"save":"arrow_up",disabled:s.value,"is-loading":i.isSaving||i.isAutosaving,"is-circle":!0,onClick:l[1]||(l[1]=x=>a("submit"))},null,8,["icon","disabled","is-loading"])):e(v)?(h(),D(e(Ot),{key:1,size:"l",disabled:s.value,rounded:"",onClick:l[2]||(l[2]=x=>a("submit"))},{default:K(()=>[ae(R(u.value),1)]),_:1},8,["disabled"])):L("",!0),i.postId?(h(),D(Ni,{key:2,"post-id":i.postId},null,8,["post-id"])):L("",!0),i.options.length?(h(),D(e(Ke),{key:3,data:i.options},null,8,["data"])):L("",!0)]),!i.isPublished&&r.value&&!e(o)?(h(),_("div",Ri,[C(e(We),{text:r.value,"is-loading":i.isAutosaving},null,8,["text","is-loading"]),i.isAutosaved?(h(),D(e(st),{key:0,name:"tick",width:16,height:16})):L("",!0)])):L("",!0)]))}}),Ki={key:0,class:"editor-version-history__loader"},Wi={class:"skeleton-grid"},Yi={key:1,class:"editor-version-history__empty"},Xi={class:"editor-version-history__date"},Se=F({__name:"EditorVersionHistory",props:{getHistory:{type:Function},applyVersion:{type:Function}},setup(i){const{close:n}=te(),t=i,{t:a,getCurrentLocale:o}=T(),v=o(),c=w([]),m=w(!1),u=w(0);async function s(){try{m.value=!0,c.value=await t.getHistory()}catch{n()}finally{m.value=!1}}async function r(p){u.value=p.id,await t.applyVersion(p.id),u.value=0}const y=O(()=>[...c.value].sort((p,b)=>b.dateCreated-p.dateCreated).reduce((p,b)=>{const E=l(b.dateCreated),A=x(b.dateCreated);return p[E]??(p[E]=[]),p[E].push({...b,time:A}),p},{}));function l(p){const b=new Date(p),E=new Date().getFullYear(),A={day:"numeric",month:"long",...b.getFullYear()!==E&&{year:"numeric"}};return b.toLocaleDateString(v,A)}function x(p){return new Date(p).toLocaleTimeString(v,{hour:"2-digit",minute:"2-digit"})}return Zt(s),(p,b)=>(h(),D(e(xe),{class:Ee(["editor-version-history",u.value>0&&"editor-version-history--loading"])},{default:K(()=>[m.value?(h(),_("div",Ki,[C(e(ue),{width:"33%"}),z("div",Wi,[(h(),_(at,null,Pt(7,E=>C(e(ue),{key:E,width:"66px",height:"34px"})),64))])])):c.value.length===0?(h(),_("div",Yi,R(e(a)("entry.editor.history.empty")),1)):(h(!0),_(at,{key:2},Pt(Object.keys(y.value),E=>(h(),_("div",{key:E,class:"editor-version-history__day"},[z("p",Xi,R(E),1),(h(!0),_(at,null,Pt(y.value[E],A=>(h(),D(e(Ot),{key:A.id,"editor-version-history__time":"",type:"minimal","is-loading":u.value===A.id,onClick:f=>r(A)},{default:K(()=>[ae(R(A.time),1)]),_:2},1032,["is-loading","onClick"]))),128))]))),128))]),_:1},8,["class"]))}}),Gi={class:"editor-history-popup"},Ji=F({__name:"EditorHistoryPopup",props:{getHistory:{type:Function},applyVersion:{type:Function}},emits:["back"],setup(i,{emit:n}){const{t}=T(),a=i,o=n;async function v(c){await a.applyVersion(c),o("back")}return(c,m)=>(h(),_("div",Gi,[C(e(Ye),{class:"editor-history-popup__navbar",title:e(t)("entry.editor.history.title")},{left:K(()=>[C(e(we),{icon:"chevron_left_big",onClick:m[0]||(m[0]=u=>c.$emit("back"))})]),_:1},8,["title"]),C(Se,{getHistory:i.getHistory,applyVersion:v,class:"editor-history-popup__history"},null,8,["getHistory"])]))}});class Qi extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"block")}render(t){return this.data=t,this.block=H(Xe,{data:this.data.link.data}),this.wrapper=document.createElement("div"),$(this.block,this.wrapper),this.wrapper}validate(t){return t!==void 0&&"link"in t}save(){if(this.data===void 0)throw new Error("Link block saving error");return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,super.destroy()}}const Zi=F({__name:"ExternalVideoTool",props:{data:{},editorApi:{}},emits:["update"],setup(i,{emit:n}){const{t}=T(q.Shared),{mediaMaxWidth:a,mediaMaxHeight:o}=ee(),v=i,c=n,m=w(v.data.title??"");return(u,s)=>(h(),_(at,null,[C(e(Ge),{data:i.data.video.data,maxSize:[e(a),e(o)],bordered:!0,rounded:10},null,8,["data","maxSize"]),C(e(Q),{modelValue:m.value,"onUpdate:modelValue":[s[0]||(s[0]=r=>m.value=r),s[1]||(s[1]=r=>c("update",r))],placeholder:e(t)("caption"),"text-size":e(dt).Small,limit:256,onEnter:s[2]||(s[2]=r=>i.editorApi.navigateNext()),onBackspaceAtStart:s[3]||(s[3]=r=>i.editorApi.navigatePrevious())},null,8,["modelValue","placeholder","text-size"])],64))}});class Jt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"block")}render(t){return this.data=t,this.block=H(Zi,{data:this.data,editorApi:this.editorApi,onUpdate:a=>{this.data!==void 0&&(this.data.title=a)}}),this.wrapper=document.createElement("div"),$(this.block,this.wrapper),this.wrapper}validate(t){return t!==void 0&&"video"in t}save(){if(this.data===void 0)throw new Error("Video block saving error");return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,super.destroy()}}d(Jt,"inlineToolbar",!0),d(Jt,"enableLineBreaks",!0);
1const ta=F({__name:"AndropovTool",props:{extract:{type:Function}},setup(i,{expose:n}){const{t}=T(q.Entry),a=i,o=w(""),v=w(!1);async function c(r){v.value=!0,await a.extract(r,!1),v.value=!1}function m(r){r.stopPropagation()}function u(r){r.key==="Enter"&&(r.preventDefault(),c(o.value))}function s(r){r.clipboardData!==null&&(r.preventDefault(),o.value=r.clipboardData.getData("Text").trim(),c(o.value))}return n({setInput:r=>{o.value=r,v.value=!0}}),(r,y)=>(h(),D(e(ye),{modelValue:o.value,"onUpdate:modelValue":y[0]||(y[0]=l=>o.value=l),placeholder:e(t)("editor.tools.andropov.insert"),disabled:v.value,onInput:m,onKeydown:u,onPaste:s},null,8,["modelValue","placeholder","disabled"]))}});function Be(){const{[q.Entry]:i}=It();async function n(t){const a=await i.getEntryWith(t);return{osnovaEmbed:{type:Xt.OsnovaEmbed,data:{original_id:a.id,date:a.date,author:a.author,subsite:a.subsite,title:a.title,blocks:a.blocks,comments:a.counters.comments,isBlur:a.isBlur,isEditorial:a.isEditorial,isNotAvailable:!a.isPublished}}}}return{getOsnovaEmbedDataByPostId:n}}const{t:he}=T();class ft{constructor({api:n}){d(this,"editorApi");d(this,"wrapper");d(this,"block");this.editorApi=n}async pastePatternParsed(n,t=!0){var c,m,u;(u=(m=(c=this.block)==null?void 0:c.component)==null?void 0:m.exposed)==null||u.setInput(n);const a=this.editorApi.getCurrentBlockId(),{extract:o}=Je(),{getOsnovaEmbedDataByPostId:v}=Be();try{const s=await(o==null?void 0:o(n));let r;switch(s==null?void 0:s.type){case"osnovaEmbed":r={type:"osnovaEmbed",cover:!1,hidden:!1,anchor:"",data:await v(s.data.original_id)};break;case"link":r={type:"link",cover:!1,hidden:!1,anchor:"",data:{link:s}};break;case"video":r={type:"video",cover:!1,hidden:!1,anchor:"",data:{title:"",video:s}};break;case"image":r={type:"media",cover:!1,hidden:!1,anchor:"",data:{items:[{title:"",image:s}]}};break;case"telegram":r={type:"telegram",cover:!1,hidden:!1,anchor:"",data:{title:"",telegram:s}};break;case"universalbox":switch(s.data.service){case"yamusic":r={type:"yamusic",cover:!1,hidden:!1,anchor:"",data:{yamusic:{type:"universalbox",data:s.data}}};break;case"spotify":r={type:"spotify",cover:!1,hidden:!1,anchor:"",data:{spotify:{type:"universalbox",data:s.data}}};break;default:throw new Error("Url is not processed")}break;default:throw new Error("Url is not processed")}a!==void 0&&this.editorApi.oustBlock(a,r)}catch(s){Qe("Editor",Ze.Pink,s.message);const{alert:r,AlertType:y}=bt();r({type:y.Error,text:he("entry.editor.tools.andropov.error")}),t&&a!==void 0&&this.editorApi.removeBlock(a)}}render(){return this.wrapper=document.createElement("div"),this.block=H(ta,{extract:this.pastePatternParsed.bind(this)}),$(this.block,this.wrapper),this.wrapper}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.wrapper=void 0,this.block=void 0}}d(ft,"title",he("entry.editor.tools.andropov.title")),d(ft,"iconClassname","editor-andropov-tool-icon"),d(ft,"enableLineBreaks",!0),d(ft,"renderOnPastePatterns",[{regex:/^https?:\/\/\S+/}]);const ea={class:"editor-quote-tool"},ia=F({__name:"QuoteTool",props:{data:{},editorApi:{}},emits:["update"],setup(i,{emit:n}){const{t}=T(),a=i,o=n,v=w(a.data.text),c=w(a.data.subline1),m=O(()=>{const u=v.value.length,s=200,r=100,y=20;if(!(u>s))return u>r?dt.Medium:u>y?dt.Large:dt.ExtraLarge});return ot([v,c],u=>{o("update",{text:u[0],subline1:u[1]})}),(u,s)=>(h(),_("div",ea,[C(e(Q),{modelValue:v.value,"onUpdate:modelValue":s[0]||(s[0]=r=>v.value=r),placeholder:e(t)("entry.editor.tools.quote.text"),"is-multiline":"","text-size":m.value,onBackspaceAtStart:s[1]||(s[1]=r=>i.editorApi.navigatePrevious())},null,8,["modelValue","placeholder","text-size"]),C(e(Q),{modelValue:c.value,"onUpdate:modelValue":s[2]||(s[2]=r=>c.value=r),placeholder:e(t)("entry.editor.tools.quote.caption"),"text-size":e(dt).Small,limit:80,onBackspaceAtStart:s[3]||(s[3]=r=>i.editorApi.navigatePrevious()),onEnter:s[4]||(s[4]=r=>i.editorApi.navigateNext())},null,8,["modelValue","placeholder","text-size"])]))}}),{t:aa}=T();class lt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data")}render(t){this.data=this.isRenderable(t)?t:{text:"",subline1:""},this.wrapper=document.createElement("div");const a=H(ia,{data:this.data,editorApi:this.editorApi,onUpdate:o=>{this.data=o,this.blockApi.dispatchModifiedEvent()}});return $(a,this.wrapper),this.wrapper}validate(t){return ut(t.text)}save(){if(this.data===void 0)throw new Error("Quote block saving error");return{text:this.sanitize(this.data.text,{tags:{a:t=>J(t)&&{href:!0,target:"_blank",rel:"nofollow noreferrer noopener"},p:J,b:J,i:J,br:{}}}),subline1:this.sanitize(this.data.subline1,{tags:{a:t=>J(t)&&{href:!0,target:"_blank",rel:"nofollow noreferrer noopener"},b:J,i:J}})}}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),super.destroy()}}d(lt,"title",aa("entry.editor.tools.quote.title")),d(lt,"iconClassname","editor-quote-tool-icon"),d(lt,"enableLineBreaks",!0),d(lt,"inlineToolbar",!0),d(lt,"contentless",!0);const{t:oa}=T();class Bt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data",{type:"default"})}render(){return this.wrapper=document.createElement("div"),this.wrapper.classList.add("editor-delimiter-tool"),this.wrapper}validate(){return!0}save(){return this.data}}d(Bt,"title",oa("entry.editor.tools.delimiter.title")),d(Bt,"iconClassname","editor-delimiter-tool-icon"),d(Bt,"contentless",!0);class Te extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"isInvisible",!0)}render(t){if(!this.isRenderable(t))throw new Error("Game block rendering error");return this.data=t,this.wrapper=document.createElement("div"),this.wrapper.hidden=!0,this.wrapper}validate(t){return t!==void 0}save(){if(this.data===void 0)throw new Error("Game block save error");return this.data}}d(Te,"contentless",!0);class sa extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"block")}render(t){var a;return this.data=t,this.wrapper=document.createElement("div"),this.block=H(ti,{data:t.osnovaEmbed.data,isPlainLink:!0}),((a=this.config)==null?void 0:a.appContext)!==void 0&&(this.block.appContext=this.config.appContext),$(this.block,this.wrapper),this.wrapper}validate(t){return t!==void 0&&"osnovaEmbed"in t}save(){if(this.data===void 0)throw new Error("Osnova embed block save error");return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,super.destroy()}}const{t:ra}=T();class Tt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data",{text:"",lang:""})}render(t){this.isRenderable(t)&&(this.data=t);const a=H(_e,{modelValue:this.data.text,"onUpdate:modelValue":o=>{a.component!==null&&(a.component.props.modelValue=o),this.data={text:o.trim(),lang:""}}});return this.wrapper=document.createElement("div"),this.wrapper.classList.add("editor-code-tool"),$(a,this.wrapper),this.wrapper}validate(t){return ut(t.text)}save(){return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),super.destroy()}}d(Tt,"title",ra("entry.editor.tools.code.title")),d(Tt,"iconClassname","editor-code-tool-icon"),d(Tt,"enableLineBreaks",!0);class Dt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data",{raw:""})}render(t){this.isRenderable(t)&&(this.data=t);const a=H(_e,{modelValue:this.data.raw,"onUpdate:modelValue":o=>{a.component!==null&&(a.component.props.modelValue=o),this.data={raw:o.trim()}}});return this.wrapper=document.createElement("div"),this.wrapper.classList.add("editor-raw-html-tool"),$(a,this.wrapper),this.wrapper}validate(t){return ut(t.raw)}save(){return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),super.destroy()}}d(Dt,"title","HTML"),d(Dt,"iconClassname","editor-raw-html-tool-icon"),d(Dt,"enableLineBreaks",!0);const na=["data-value"],la={key:0,class:"editor-special-button-tool__placeholder"},da={key:1,class:"editor-special-button-tool__sizer"},ua={key:2,class:"editor-special-button-tool__link"},ca=["placeholder"],pa=F({__name:"SpecialButtonTool",props:{data:{},editorApi:{}},emits:["update"],setup(i,{emit:n}){const t=i,a=n,{t:o}=T(q.Entry),{alert:v,AlertType:c}=bt(),m=w(t.data.text),u=w(t.data.url),s=w(!1);function r(x){try{return!!new URL(x)}catch{return!1}}function y(){r(u.value)||v({type:c.Error,text:o("editor.tools.specialButton.urlError")})}function l(){s.value=!1}return ot([m,u],([x,p])=>{a("update",{text:x.trim(),url:r(p.trim())?p.trim():"",textColor:"",backgroundColor:""})}),(x,p)=>St((h(),_("div",{"data-value":m.value,class:"editor-special-button-tool"},[m.value.length===0?(h(),_("div",la,R(e(o)("editor.tools.specialButton.placeholder")),1)):(h(),_("div",da,R(m.value),1)),St(z("input",{"onUpdate:modelValue":p[0]||(p[0]=b=>m.value=b),type:"text",size:"1",maxlength:"25",onFocus:p[1]||(p[1]=b=>s.value=!0),onKeydown:p[2]||(p[2]=it(j((...b)=>i.editorApi.navigateNext&&i.editorApi.navigateNext(...b),["prevent","stop"]),["enter"]))},null,544),[[ce,m.value]]),s.value?(h(),_("div",ua,[C(e(st),{name:"link",width:20,height:20}),St(z("input",{"onUpdate:modelValue":p[3]||(p[3]=b=>u.value=b),type:"url",placeholder:e(o)("editor.tools.andropov.insert"),onBlur:y,onKeydown:p[4]||(p[4]=it(j((...b)=>i.editorApi.navigateNext&&i.editorApi.navigateNext(...b),["prevent","stop"]),["enter"]))}
1,null,40,ca),[[ce,u.value]])])):L("",!0)],8,na)),[[e(ei),l]])}}),{t:va}=T();class Lt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data",{text:"",url:"",textColor:"",backgroundColor:""});d(this,"block")}render(t){this.isRenderable(t)&&(this.data=t),this.wrapper=document.createElement("div");const{editorApi:a,blockApi:o}=this;return this.block=H(pa,{data:this.data,editorApi:a,onUpdate:v=>{this.data=v,o.dispatchModifiedEvent()}}),$(this.block,this.wrapper),this.wrapper}validate(t){return pe(t.text)&&pe(t.url)}save(){return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),super.destroy()}}d(Lt,"title",va("entry.editor.tools.specialButton.title")),d(Lt,"iconClassname","editor-special-button-tool-icon"),d(Lt,"enableLineBreaks",!0);const ma={class:"editor-audio-tool"},ha={key:0,class:"editor-audio-tool__preview"},fa=["src"],ya=F({__name:"AudioTool",props:{data:{}},emits:["update"],setup(i,{expose:n,emit:t}){const a=i,o=t,{t:v}=T(q.Entry),c=w(a.data!==void 0?[a.data]:[]);function m(l){const x=l[0];x.type===Xt.Audio&&o("update",x)}const{nodes:u,openFileDialog:s,attach:r}=$e({model:c,accept:".mp3",limit:1,onChange:m}),y=O(()=>{const l=u==null?void 0:u.value[0];if(l!==void 0&&("url"in l.item||l.item.type===Xt.Audio))return l.item});return n({openFileDialog:s,handleFiles:r}),(l,x)=>(h(),_("div",ma,[y.value?(h(),_(at,{key:0},["url"in y.value?(h(),_("div",ha,[z("audio",{src:y.value.url,preload:"metadata",controls:""},null,8,fa),C(e(oe))])):(h(),D(ii,{key:1,data:y.value.data},null,8,["data"]))],64)):(h(),D(e(Ot),{key:1,type:"minimal",size:"l",icon:"plus",onClick:x[0]||(x[0]=p=>{var b;return(b=e(s))==null?void 0:b()})},{default:K(()=>[ae(R(e(v)("editor.tools.audio.add")),1)]),_:1}))]))}}),{t:fe}=T();class Vt extends M{constructor(t){super(t);d(this,"wrapper");d(this,"data");d(this,"block");d(this,"settingsButton");this.openFileDialog=this.openFileDialog.bind(this)}onPaste({file:t}){var a,o,v;(v=(o=(a=this.block)==null?void 0:a.component)==null?void 0:o.exposed)==null||v.handleFiles([t])}appendCallback(){this.openFileDialog()}makeSettings(){const t=document.createElement("div");return this.settingsButton=document.createElement("div"),this.settingsButton.classList.add("ce-block-settings__item"),this.settingsButton.innerHTML=`
2      <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 12a9 9 0 0 1 9-9c4.132 0 7.706 2.702 8.754 6.537l.085-.147a1 1 0 1 1 1.732 1l-1.415 2.45a1 1 0 0 1-1.366.366l-2.45-1.414a1 1 0 0 1 1-1.732l.563.324C18.213 7.277 15.377 5 12 5a7 7 0 1 0 5 11.899 1 1 0 0 1 1.429 1.4A9 9 0 0 1 3 12Z"/></svg>
3      ${fe("entry.editor.tools.audio.replace")}
4    `,t.appendChild(this.settingsButton),this.settingsButton.addEventListener("click",this.openFileDialog),t}render(t){var v;this.isRenderable(t)&&(this.data=t);const{blockApi:a,config:o}=this;return this.wrapper=document.createElement("div"),this.block=H(ya,{data:(v=this.data)==null?void 0:v.audio,onUpdate:c=>{this.data={title:"",hash:"",audio:c},a.dispatchModifiedEvent()}}),(o==null?void 0:o.appContext)!==void 0&&(this.block.appContext=o.appContext),$(this.block,this.wrapper),this.wrapper}validate(){return!0}save(){if(this.data===void 0)throw new Error("Audio block saving error");return this.data}destroy(){var t;this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,(t=this.settingsButton)==null||t.removeEventListener("click",this.openFileDialog),super.destroy()}openFileDialog(){var t,a,o;(o=(a=(t=this.block)==null?void 0:t.component)==null?void 0:a.exposed)==null||o.openFileDialog()}}d(Vt,"title",fe("entry.editor.tools.audio.title")),d(Vt,"iconClassname","editor-audio-tool-icon"),d(Vt,"handleFiles",{mime:["audio/mpeg"]});const ba={class:"editor-quiz-tool"},ga={class:"editor-quiz-tool__options"},ka={class:"editor-quiz-tool__number"},wa={class:"editor-quiz-tool__number"},xa={class:"editor-quiz-tool__input"},Ea=10,_a=F({__name:"QuizTool",props:{data:{},editorApi:{}},emits:["update"],setup(i,{emit:n}){const t=i,a=n,{t:o}=T(q.Entry),v=w(t.data.title),c=Gt(new Map(Object.entries(t.data.items))),m=O(()=>c.size>=Ea),u=w();function s(){const p=`o${Math.floor(new Date().getTime()/1e3)}${c.size}`;c.set(p,""),u.value=p,requestAnimationFrame(()=>{t.editorApi.updateCurrentInputIndex()})}function r(p){c.delete(p),l()}function y(p){const b=[...c.keys()].pop(),E=c.get(p);p===b&&!m.value&&E!==void 0&&E.trim().length>0?s():t.editorApi.navigateNext()}function l(){a("update",{hash:t.data.hash,title:v.value,items:Object.fromEntries([...c].filter(([p,b])=>b.trim().length>0))})}function x(p,b){c.set(p,t.editorApi.sanitize(b,{tags:{}},!0)),l()}return ai(()=>{c.size===0&&s()}),(p,b)=>(h(),_("div",ba,[C(e(Q),{modelValue:v.value,"onUpdate:modelValue":[b[0]||(b[0]=E=>v.value=E),l],placeholder:e(o)("editor.tools.quiz.heading"),class:"editor-quiz-tool__title",onEnter:b[1]||(b[1]=E=>i.editorApi.navigateNext()),onBackspaceAtStart:b[2]||(b[2]=E=>i.editorApi.navigatePrevious())},null,8,["modelValue","placeholder"]),z("div",ga,[(h(!0),_(at,null,Pt(c,([E,A],f)=>(h(),_("div",{key:E,class:"editor-quiz-tool__option"},[z("div",ka,R(`${f+1}.`),1),C(e(Q),{"model-value":A,placeholder:e(o)("editor.tools.quiz.option"),autofocus:u.value===E,limit:256,class:"editor-quiz-tool__input",onEnter:P=>y(E),onBackspaceAtStart:b[3]||(b[3]=P=>i.editorApi.navigatePrevious()),"onUpdate:modelValue":P=>x(E,P)},null,8,["model-value","placeholder","autofocus","onEnter","onUpdate:modelValue"]),c.size>1?(h(),D(e(st),{key:0,name:"cross",width:20,height:20,class:"editor-quiz-tool__remove",onClick:P=>r(E)},null,8,["onClick"])):L("",!0)]))),128)),m.value?L("",!0):(h(),_("div",{key:0,class:"editor-quiz-tool__option editor-quiz-tool__option--add",onClick:s},[z("div",wa,[C(e(st),{name:"plus",width:20,height:20})]),z("div",xa,R(e(o)("editor.tools.quiz.add")),1)]))])]))}}),{t:$a}=T();class Qt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"block")}render(t){return this.data=this.isRenderable(t)?t:{hash:oi(),items:{},title:""},this.block=H(_a,{data:this.data,editorApi:this.editorApi,onUpdate:a=>{this.data=a,this.blockApi.dispatchModifiedEvent()}}),this.wrapper=document.createElement("div"),$(this.block,this.wrapper),this.wrapper}validate(t){return!si(t.items)}save(){if(this.data===void 0)throw new Error("Quiz saving error");return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,super.destroy()}}d(Qt,"title",$a("entry.editor.tools.quiz.title")),d(Qt,"iconClassname","editor-quiz-tool-icon");const Ca={class:"person-tool"},Aa=F({__name:"PersonTool",props:{data:{},editorApi:{}},emits:["update"],setup(i,{emit:n}){const{t}=T(),a=i,o=n,v=w(!1),c=w(a.data.title??""),m=w(a.data.description??""),u=O(()=>{var y;return a.data.image!==null&&!Array.isArray(a.data.image)?a.data.image:((y=s==null?void 0:s.value)==null?void 0:y[0])??null});ot([c,m],()=>{o("update",{image:ht(u),title:ht(c),description:ht(m)})});const{uploaded:s,openFileDialog:r}=$e({limit:1,accept:".png,.jpg,.jpeg",onChange:y=>{v.value=!1,o("update",{title:ht(c),description:ht(m),image:y[0]})},onValidated:()=>{v.value=!0}});return(y,l)=>(h(),_("div",Ca,[z("div",{class:Ee(["person-tool__image",e(ut)(u.value)&&"person-tool__image--uploaded"]),onClick:l[0]||(l[0]=x=>{var p;return(p=e(r))==null?void 0:p()})},[v.value?(h(),D(e(oe),{key:0})):e(ut)(u.value)?(h(),D(e(ri),{key:1,data:u.value.data,cropped:!0,rounded:!0,size:150,bordered:!0,class:"person-tool__andropov-media"},null,8,["data"])):L("",!0),v.value?L("",!0):(h(),D(e(st),{key:2,class:"person-tool__icon",name:"image",width:40,height:40}))],2),C(e(Q),{modelValue:c.value,"onUpdate:modelValue":l[1]||(l[1]=x=>c.value=x),placeholder:e(t)("entry.editor.tools.person.name"),limit:50,class:"person-tool__title",onBackspaceAtStart:l[2]||(l[2]=x=>i.editorApi.navigatePrevious()),onEnter:l[3]||(l[3]=x=>i.editorApi.navigateNext())},null,8,["modelValue","placeholder"]),C(e(Q),{modelValue:m.value,"onUpdate:modelValue":l[4]||(l[4]=x=>m.value=x),placeholder:e(t)("entry.editor.tools.person.description"),limit:100,class:"person-tool__description",onBackspaceAtStart:l[5]||(l[5]=x=>i.editorApi.navigatePrevious()),onEnter:l[6]||(l[6]=x=>i.editorApi.navigateNext())},null,8,["modelValue","placeholder"])]))}}),{t:Pa}=T();class yt extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data")}render(t){var o;this.data=this.isRenderable(t)?t:{image:null,title:"",description:""},this.wrapper=document.createElement("div");const a=H(Aa,{data:this.data,editorApi:this.editorApi,onUpdate:v=>{this.data=v,this.blockApi.dispatchModifiedEvent()}});return((o=this.config)==null?void 0:o.appContext)!==void 0&&(a.appContext=this.config.appContext),$(a,this.wrapper),this.wrapper}validate(t){return ut(t.title)}save(){if(this.data===void 0)throw new Error("Person block saving error");const t={tags:{a:a=>J(a)&&{href:!0,target:"_blank",rel:"nofollow noreferrer noopener"}}};return this.data.title=this.sanitize(this.data.title,t),this.data.description=this.sanitize(this.data.description,t),this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),super.destroy()}}d(yt,"title",Pa("entry.editor.tools.person.title")),d(yt,"iconClassname","editor-person-tool-icon"),d(yt,"contentless",!0),d(yt,"inlineToolbar",["link"]);const Sa=F({__name:"TelegramTool",props:{data:{},editorApi:{}},emits:["update"],setup(i,{emit:n}){const t=i,a=n,{t:o}=T(q.Shared),v=w(t.data.title??""),c=ni(t.data.telegram.data);return(m,u)=>(h(),_(at,null,[C(li,{data:e(c),provider:"telegram"},null,8,["data"]),C(e(Q),{modelValue:v.value,"onUpdate:modelValue":[u[0]||(u[0]=s=>v.value=s),u[1]||(u[1]=s=>a("update",s))],placeholder:e(o)("caption"),"text-size":e(dt).Small,limit:256,onEnter:u[2]||(u[2]=s=>i.editorApi.navigateNext()),onBackspaceAtStart:u[3]||(u[3]=s=>i.editorApi.navigatePrevious())},null,8,["modelValue","placeholder","text-size"])],64))}});class Ba extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"block")}render(t){return this.data=t,this.wrapper=document.createElement("div"),this.block=H(Sa,{data:t,editorApi:this.editorApi,onUpdate:a=>{this.data!==void 0&&(this.data.title=a)}}),$(this.block,this.wrapper),this.wrapper}validate(t){return t!==void 0&&"telegram"in t}save(){if(this.data===void 0)throw new Error("Telegram embed block save error");return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,super.destroy()}}const Ta=F({__name:"YaMusicTool",props:{data:{}},setup(i){return(n,t)=>(h(),D(Ae,{data:i.data.yamusic,service:e(Ce).YaMusic},null,8,["data","service"]))}});class Da extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"block")}render(t){return this.data=t,this.wrapper=document.createElement("div"),this.block=H(Ta,{data:t}),$(this.block,this.wrapper),this.wrapper}validate(t){return t!==void 0&&"yamusic"in t}save(){if(this.data===void 0)throw new Error("YaMusic block save error");return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,super.destroy()}}const La=F({__name:"SpotifyTool",props:{data:{}},setup(i){return(n,t)=>(h(),D(Ae,{data:i.data.spotify,service:e(Ce).Spotify},null,8,["data","service"]))}});class Va extends M{constructor(){super(...arguments);d(this,"wrapper");d(this,"data");d(this,"block")}render(t){return this.data=t,this.wrapper=document.createElement("div"),this.block=H(La,{data:t}),$(this.block,this.wrapper),this.wrapper}validate(t){return t!==void 0&&"spotify"in t}save(){if(this.data===void 0)throw new Error("Spotify block save error");return this.data}destroy(){this.wrapper!==void 0&&$(null,this.wrapper),this.block=void 0,super.destroy()}}async function Oa(i){return await new Promise(n=>setTimeout(n,i))}function Ia(i,n,t){var _t,et;const{[q.Editor]:o,[q.Subsite]:v,[q.Entry]:c}=It(),m=di(),{alert:u,AlertType:s}=bt(),{t:r,tf:y}=T(),l=(_t=ke)==null?void 0:_t(),{confirmClose:x,open:p,close:b,back:E}=ie(),{getOsnovaEmbedDataByPostId:A}=Be(),f=(et=ui)==null?void 0:et(),{isProSubscriber:P}=ge(),{isOnline:S}=ci(),N=w(i),zt=w(!0),ct=w(!1),W=w(!1),rt=Gt({isAdminFeaturesAvailable:!1,isProFeaturesAvailable:!1,isAdultFeatureAvailable:!1,isTelegramFeaturesAvailable:!1}),I=Gt(o.getBaseEntryData()),pt=w(),V=O(()=>bi(JSON.stringify(I))),nt=O(()=>{if(I.blocks.length===0)return!0;const g=I.blocks.reduce((B,G)=>{if(G.type!=="text")return B;const Y=new DOMParser().parseFromString(G.data.text,"text/html");return(Y.body.textContent===null?"":Y.body.textContent).trim().length===0&&(B+=1),B},0);return I.blocks.length===g}),gt=O(()=>pt.value!==V.value);function Z(){pt.value=V.value}x.value=()=>{if(nt.value)return!0;
4if(I.isPublished){if(!gt.value)return!0}else return S.value?vt().then(()=>{u({type:s.Success,text:r("entry.editor.saveDraft")})}).catch(()=>{}):u({type:s.Error,text:r("shared.connectionLost")}),!0;return confirm(r("entry.editor.confirm"))};async function kt(g){const B=[];return(await o.getSubsitesToWriteIn(g)).forEach(Y=>{B.push({title:Y.title,items:Y.items.map(({label:$t,value:jt,image:Ct,isNoTheme:Kt})=>{const mt={label:$t,value:jt};return Kt===!0?mt.icon="no_theme":mt.media=Yt({uuid:Ct,width:32,height:32}),mt})})}),B}function Ft(g){return o.getSubsiteById(g)}function Ut(g){return{value:g.id,label:g.name,image:yi({uuid:g.avatar.data.uuid})}}function wt(g){g instanceof Error&&(g.message==="PRO_LIMIT_EXCEED"&&f!==void 0?p(pi,{text:P.value?r("entry.editor.proLimitExceeded"):r("entry.editor.nonProLimitExceeded"),confirmText:P.value?r("shared.contact"):r("shared.purchase"),isNonCancelable:!0,cancelHandler:()=>{E()},confirmHandler:()=>{f.managementUrl!==void 0&&(P.value?vi(f.managementUrl,"_blank"):m.push({name:"BuyPro",params:{source:mi.EditorLimit}}))}},{title:r("entry.editor.errors.PRO_LIMIT_EXCEED")}):g.message==="POST_CONTENT_BLOCKS_LIMIT_EXCEEDED"?u({type:s.Error,text:r("entry.editor.postBlocksLimitExceeded")}):u({type:s.Error,text:y(`entry.editor.errors.${g.message}`,"entry.editor.unknownError")}))}async function vt(){let g=0;try{g=await o.saveEntry(N.value,Pe(I))}catch(B){throw wt(B),B}return Z(),g}const Mt=fi((g=G=>{},B=()=>{})=>{if(nt.value){B();return}vt().then(g).catch(B)},1e3);function tt(){!S.value||I.isPublished||nt.value||!gt.value&&!W.value||(ct.value=!1,W.value=!0,Mt(g=>{W.value=!1,ct.value=!0,N.value===0&&(N.value=g,m.replace({name:"Editor",params:{action:"edit",id:g}}))},()=>{W.value=!1}))}async function Nt(){if(S.value)try{await vt(),u({type:s.Success,text:r("entry.editor.savePublication")})}catch{}}async function xt(){if(S.value&&confirm(r("entry.editor.confirmPublication"))){I.isPublished=!0;try{const g=I.repost!==void 0?await hi().getPayload():void 0;await o.publish(N.value,g),Z(),await m.push({name:"Post",params:{id:N.value}}),await Oa(1500),l==null||l.promoteRegistrationForPosts()}catch(g){I.isPublished=!1,Z(),wt(g)}}}function Et(){if(confirm(r("entry.editor.remove.confirm")))try{c.removeEntryById(N.value),u({type:s.Success,text:r("entry.editor.remove.success")}),Z(),b();const{name:g,params:B}=m.currentRoute.value;g==="Post"&&B.id===N.value.toString()&&m.push({name:"HomePage"})}catch{u({type:s.Error,text:r("shared.errorText")})}}async function Ht(){const g=await o.getEditorData(N.value);if(Object.assign(rt,g.editorSettings),Object.assign(I,g.entryData),i===0&&n!==void 0)try{const B=await A(n);Object.assign(I,{repost:B.osnovaEmbed})}catch{u({type:s.Error,text:r("entry.editor.tools.andropov.error")})}else if(i===0&&t!==void 0){const B=await v.loadSubsiteWith(t);B!==void 0&&Object.assign(I,{subsite:Ut(B)})}}async function qt(){try{return await o.getPostHistory(N.value)}catch{u({type:s.Error,text:r("shared.errorText")})}return await o.getPostHistory(N.value)}async function Rt(g){return await o.getPostVersion(N.value,g)}return ot(S,g=>{g&&tt()}),{POST_CONTENT_BLOCKS_LIMIT:1e3,isLoading:zt,editorSettings:rt,entryData:I,findSubsites:kt,findSubsiteById:Ft,initEditorData:Ht,resetUnsavedChanges:Z,autosave:tt,manualsave:Nt,publish:xt,remove:Et,getHistory:qt,getVersion:Rt,isEditorEmpty:nt,isAutosaved:ct,isAutosaving:W,isOnline:S}}function za(){const{[q.Entry]:i}=It();return{getQuery:n=>{const t=/(?:^|\s)(#[^#\s]+?[^#]*?)$/i,a=n.match(t);return(a==null?void 0:a[1])??null},getSuggestions:async n=>(await i.searchHashtag(n)).map(a=>({value:a.text,label:`#${a.text}`})),getReplacementNode:({value:n})=>{const t=document.createElement("a"),a=n;return t.textContent=`#${a}`,t.dataset.hashtag=a,t.dataset.suggested="true",t.href=`/tag/${a}`,t.spellcheck=!1,t},textToHtml:n=>n.replace(/(?=^|\s|\B|(<p>))(?:#([\wа-яё]+?))(?=$|\s|(?=<\/p>))/g,'<a data-hashtag="$2" data-suggested="true" spellcheck="false" href="/tag/$2">#$2</a>'),htmlToText:n=>n.replace(/<a.*?(?:data-hashtag="(.+?)".*?)>.*?<\/a>/g,"#$1")}}const Fa={class:"editor-wrapper"},Ua={class:"editor"},Ma={class:"editor__content"},ja=F({inheritAttrs:!1,__name:"Editor",props:{action:{default:void 0},id:{default:0}},setup(i){var se,re,ne,le,de;const n=i,{Cmd_S:t,Ctrl_S:a}=gi({passive:!1,onEventFired:k=>
4{(k.ctrlKey||k.metaKey)&&k.key==="s"&&k.type==="keydown"&&k.preventDefault()}}),o=O(()=>n.action==="edit"?n.id:0),v=n.action==="repost"?n.id:void 0,c=n.action==="topic"?n.id:void 0,{POST_CONTENT_BLOCKS_LIMIT:m,isLoading:u,initEditorData:s,resetUnsavedChanges:r,editorSettings:y,entryData:l,findSubsites:x,findSubsiteById:p,autosave:b,manualsave:E,publish:A,remove:f,getHistory:P,getVersion:S,isEditorEmpty:N,isAutosaved:zt,isAutosaving:ct,isOnline:W}=Ia(o.value,v,c),{alert:rt,AlertType:I}=bt(),{setPageProperties:pt}=ki(),{t:V,tf:nt,tm:gt,rt:Z}=T(),{isOneColumn:kt,isWiderThanContent:Ft}=ee(),{open:Ut,close:wt,popoverTarget:vt}=te(),{close:Mt}=ie(),tt=w(),Nt=[{type:"header",cover:!1,hidden:!1,anchor:"",data:{text:"",style:"h2"}}],xt=w(!1),Et=w(!1),Ht=O(()=>{if(o.value===0)return[];const k=[{label:V("entry.editor.preview"),icon:"eye",url:Di({id:o.value}),target:"_blank"}];return y.isAdultFeatureAvailable&&k.push({label:l.settings.isAdult?V("entry.editor.unmarkNSFW"):V("entry.editor.markNSFW"),icon:"adult",action:()=>{l.settings.isAdult=!l.settings.isAdult}}),y.isAdminFeaturesAvailable&&k.push({label:l.settings.isEditorial?V("entry.editor.unmarkEditorial"):V("entry.editor.markEditorial"),icon:"tick_redaction",action:()=>{l.settings.isEditorial=!l.settings.isEditorial}}),k.push({label:V("entry.editor.history.title"),icon:"version",action:async()=>{if(Ft.value){const U=vt.value;wt(),await ve(),U!==null&&Ut(Se,{getHistory:P,applyVersion:Ct},{target:U,positionX:"left",width:338})}else G.value=!0}}),k.push({label:V("entry.comments.etc.remove"),icon:"delete",action:()=>{f()}}),k}),qt=gt("entry.editor.tools.text.placeholders"),Rt={defaultPlaceholder:V("entry.editor.tools.text.defaultPlaceholder"),placeholders:qt.map(k=>Z(k)),makeHeader:V("entry.editor.tools.text.makeHeader"),makeH2:V("entry.editor.tools.text.makeH2"),makeH3:V("entry.editor.tools.text.makeH3")},_t={description:V("entry.editor.tools.media.description")},et={text:{class:Si,config:{messages:Rt,suggestPlugins:[za()]}},header:Pi,game:Te,media:{class:Ai,config:{messages:_t,appContext:(se=At())==null?void 0:se.appContext}},link:Qi,video:Jt,andropov:ft,quote:lt,list:Ci,code:Tt,delimiter:Bt,osnovaEmbed:{class:sa,config:{appContext:(re=At())==null?void 0:re.appContext}},audio:{class:Vt,config:{appContext:(ne=At())==null?void 0:ne.appContext}},quiz:Qt,person:{class:yt,config:{appContext:(le=At())==null?void 0:le.appContext}},telegram:Ba,yamusic:Da,spotify:Va},g=w(!1);let B;const G=w(!1),Y=w(!1);function $t(k){l.blocks=k}async function jt(){if(!(!W.value||Y.value))try{g.value=!0,l.isPublished?await E():await A()}finally{g.value=!1}}async function Ct(k){var U;try{const X=await S(k);Object.assign(l,X),(U=tt.value)==null||U.fill(X.blocks),rt({type:I.Success,text:V("entry.editor.history.applied")})}catch(X){console.error(X)}}function Kt(){var k;(k=tt.value)==null||k.insertBlock("header",{text:"",style:"h2"},0,!0)}const mt=(de=Bi())==null?void 0:de.title,De=O(()=>l.blocks[0]!==void 0&&l.blocks[0].type==="header"?`🖊 ${l.blocks[0].data.text}`:`🖊 ${o.value>0?V("entry.editor.editing"):V("entry.editor.newPost")}`);function Le(k){var U;return((U=k==null?void 0:k.pluginInstance)==null?void 0:U.isInvisible)??!1}function Ve(k){Y.value=k,k&&rt({type:I.Error,text:V("entry.editor.postBlocksLimitExceeded")})}function Oe({type:k}){Et.value=k!=="header"}function Ie(){u.value=!1,r(),B=ot(l,()=>{b()},{deep:!0}),N.value&&ve(()=>{var k;(k=tt.value)==null||k.focus()})}return wi(O(()=>t.value||a.value),async()=>{W.value&&(l.isPublished?(g.value=!0,await E(),g.value=!1):b())}),ot(De,k=>{pt({title:k})},{immediate:!0}),Zt(async()=>{try{await s()}catch(k){k instanceof Error&&(rt({type:I.Error,text:nt(`entry.editor.errors.${k.message}`,"shared.unknownError")}),Mt());return}(y.isAdminFeaturesAvailable||y.isProFeaturesAvailable)&&(et.special_button=Lt),(y.isAdminFeaturesAvailable||y.isTelegramFeaturesAvailable)&&(et.telegram_button=Ti),y.isAdminFeaturesAvailable&&(et.rawhtml=Dt),xt.value=!0}),xi(()=>{typeof B=="function"&&B(),pt({title:mt})}),(k,U)=>(h(),_("div",Fa,[e(u)?(h(),D(e(oe),{key:0})):L("",!0),G.value?(h(),D(Ji,{key:1,"get-history":e(P),"apply-version":Ct,onBack:U[0]||(U[0]=X=>G.value=!1)},null,8,["get-history"])):L("",!0),St(z("div",Ua,[!e(kt)&&e(l).subsite&&e(l).author?(h(),D(me,{key:0,topic:e(l).subsite,"onUpdate:topic":U[1]||(U[1]=X=>e(l).subsite=X),author:e(l).author,"find-topics":e(x),"get-topic":e(p)},null,8,["topic","author","find-topics","get-topic"])):L("",!0),e(l).repost?(h(),D(_i,{key:1,data:e(l).repost,class:"editor__repost-label","open-in-new-tab":""},null,8,["data"])):L("",!0),C(e(xe),{class:"editor__body"},{default:K(()=>[z("div",Ma,[xt.value?(h(),D(e($i),{key:0,ref_key:"paragraph",ref:tt,tools:et,blocks:e(Pe)(e(l).blocks),"initial-empty-blocks":Nt,limit:e(m),"is-invisible-block":Le,onReady:Ie,onLimitExceededChanged:Ve,onFirstBlockChanged:Oe,"onUpdate:blocks":$t},{prepend:K(()=>[Et.value?(h(),_("div",{key:0,class:"editor__add-title",onClick:Kt},R(e(V)("entry.editor.addTitle")),1)):L("",!0)]),_:1},8,["blocks","limit"])):L("",!0)])]),_:1}),C(ji,{options:Ht.value,"post-id":o.value,"is-published":e(l).isPublished,"is-editor-empty":e(N),"is-blocks-limit-exceeded":Y.value,"is-autosaving":e(ct),"is-autosaved":e(zt),"is-saving":g.value,"is-online":e(W),onSubmit:jt},{default:K(()=>[e(kt)&&e(l).subsite&&e(l).author?(h(),D(me,{key:0,topic:e(l).subsite,"onUpdate:topic":U[2]||(U[2]=X=>e(l).subsite=X),author:e(l).author,"find-topics":e(x),"get-topic":e(p)},null,8,["topic","author","find-topics","get-topic"])):L("",!0)]),_:1},8,["options","post-id","is-published","is-editor-empty","is-blocks-limit-exceeded","is-autosaving","is-autosaved","is-saving","is-online"])],512),[[Ei,!e(u)]])]))}});
4export{ja as default};

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.