2 lines
366 KiB
JavaScript
2 lines
366 KiB
JavaScript
|
var yA=Object.defineProperty,XA=Object.defineProperties;var LA=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var MA=Object.prototype.hasOwnProperty,kA=Object.prototype.propertyIsEnumerable;var Z=(A,e,t)=>e in A?yA(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t,d=(A,e)=>{for(var t in e||(e={}))MA.call(e,t)&&Z(A,t,e[t]);if(Y)for(var t of Y(e))kA.call(e,t)&&Z(A,t,e[t]);return A},m=(A,e)=>XA(A,LA(e));import{i as P,r as I,j as L,k as mA,l as M,p as l,m as FA,w as E,n as OA,e as s,f as Q,d as D,q as H,s as u,t as VA,v as jA,x as pA,F as SA}from"../app.d1307649.js";var U=(A=>(A.Edit="edit",A.View="view",A))(U||{});const QA=Symbol("Schlechtenburg mode");var F,GA=new Uint8Array(16);function KA(){if(!F&&(F=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!F))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return F(GA)}var HA=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function xA(A){return typeof A=="string"&&HA.test(A)}var a=[];for(var j=0;j<256;++j)a.push((j+256).toString(16).substr(1));function JA(A){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(a[A[e+0]]+a[A[e+1]]+a[A[e+2]]+a[A[e+3]]+"-"+a[A[e+4]]+a[A[e+5]]+"-"+a[A[e+6]]+a[A[e+7]]+"-"+a[A[e+8]]+a[A[e+9]]+"-"+a[A[e+10]]+a[A[e+11]]+a[A[e+12]]+a[A[e+13]]+a[A[e+14]]+a[A[e+15]]).toLowerCase();if(!xA(t))throw TypeError("Stringified UUID is invalid");return t}function WA(A,e,t){A=A||{};var n=A.random||(A.rng||KA)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(var g=0;g<16;++g)e[t+g]=n[g];return e}return JA(n)}const x=WA,hA={prop:"block",event:"update"},ft={blockId:{type:String,default:x}},BA=Symbol("Schlechtenburg active block");function iA(A=null){const e=P(BA,I(null)),t=L(()=>e.value===A),n=(i=A)=>{e.value===i&&(e.value=null)},g=i=>n();mA(()=>{document.removeEventListener("click",g)});const B=(i=A)=>{document.addEventListener("click",g,{once:!0}),e.value=i};return{activeBlockId:e,isActive:t,activate:B,deactivate:n,requestActivation:()=>{e.value||B()}}}const vA=Symbol("Schlechtenburg block library");function CA(){const A=P(QA,I(U.Edit)),e=P(vA,M({}));return{mode:A,customBlocks:e,getBlock:n=>e[n]}}const aA=Symbol("Schlechtenburg block dimensions"),IA=Symbol("Schlechtenburg editor dimensions");function oA(A,e){const t=I(null);l(e,t);const n=()=>{if(!A.value)return;const g=A.value.getBoundingClientRect();t.value={width:g.width,height:g.height,left:A.value.offsetLeft,top:A.value.offsetTop}};return FA(()=>{const g=new ResizeObserver(n),B=new MutationObserver(n);E(A,()=>{!A.value||(g.observe(A.value),B.observe(A.value,{attributes:!0,childList:!1,subtree:!1}))})}),{triggerSizeCalculation:n,dimensions:t}}function sA(){const A=P(IA,I(null)),e=P(aA,I(null));return{editorDimensions:A,blockDimensions:e}}const fA=Symbol("Schlechtenburg block tree"),S=Symbol("Schlechtenburg block tree register"),G=Symbol("Schlechtenburg block tree unregister");function EA(){const A=P(fA,I(null)),e=P(S,B=>{}),t=P(G,B=>{}),n=M({id:"",name:"",icon:"",children:[]});l(S,B=>{n.children.find(r=>r.id===B.id)||(n.children=[...n.children,B])}),l(G,({id:B})=>{n.children=n.children.filter(r=>r.id!==B)});const g=B=>{if(!B.id)throw new Error(`Cannot register a block without an id: ${JSON.stringify(B)}`);n.id=B.id,n.name=B.name,e(n)};return OA(()=>{n.id&&t(n)}),{blockTree:A,register:g}}const w=s({name:"sb-button",inheritAttrs:!1,setup(A,e){return()=>{var t,n;return Q("button",m(d({},e.attrs),{class:(e.attrs.class||"")+" sb-button"}),[(n=(t=e.slots).default)==null?void 0:n.call(t)])}}});const uA=s({name:"sb-context-menu",props:{onClose:{type:Function,default:()=>{}},onOpen:{type:Function,default:()=>{}}},setup(A,e){const t=I(!1),n=()=>{t.value=!0},g=()=>{t.value=!1},B=i=>{i.key==="Escape"&&g()},r=()=>{t.value?g():n()};return E(t,(i,v)=>{i!==v&&(i?setTimeout(()=>{doc
|