@notectl/core 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs → AlignmentPlugin-DeD4C4EP.mjs} +2 -2
- package/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs.map → AlignmentPlugin-DeD4C4EP.mjs.map} +1 -1
- package/dist/chunks/{CodeBlockPlugin-DC0-BnNy.mjs → CodeBlockPlugin-3V2K3RBe.mjs} +2 -2
- package/dist/chunks/{CodeBlockPlugin-DC0-BnNy.mjs.map → CodeBlockPlugin-3V2K3RBe.mjs.map} +1 -1
- package/dist/chunks/{ColorGrid-CXRdpP_n.mjs → ColorGrid-DPNiXxpD.mjs} +2 -2
- package/dist/chunks/{ColorGrid-CXRdpP_n.mjs.map → ColorGrid-DPNiXxpD.mjs.map} +1 -1
- package/dist/chunks/{ColorPickerPopup-C_74bqid.mjs → ColorPickerPopup-lcf3jS6G.mjs} +2 -2
- package/dist/chunks/{ColorPickerPopup-C_74bqid.mjs.map → ColorPickerPopup-lcf3jS6G.mjs.map} +1 -1
- package/dist/chunks/FontPlugin-DQMj65Bc.mjs +2 -0
- package/dist/chunks/{FontPlugin-DB1_bgam.mjs.map → FontPlugin-DQMj65Bc.mjs.map} +1 -1
- package/dist/chunks/{FontSizePlugin-DFvp7Ki9.mjs → FontSizePlugin-9StCjEfN.mjs} +2 -2
- package/dist/chunks/{FontSizePlugin-DFvp7Ki9.mjs.map → FontSizePlugin-9StCjEfN.mjs.map} +1 -1
- package/dist/chunks/{FormulaPlugin-BLEcyazj.mjs → FormulaPlugin-CV5VUxkb.mjs} +2 -2
- package/dist/chunks/{FormulaPlugin-BLEcyazj.mjs.map → FormulaPlugin-CV5VUxkb.mjs.map} +1 -1
- package/dist/chunks/{HeadingPlugin-D9yvG2Aw.mjs → HeadingPlugin-BuGoM9Rz.mjs} +2 -2
- package/dist/chunks/{HeadingPlugin-D9yvG2Aw.mjs.map → HeadingPlugin-BuGoM9Rz.mjs.map} +1 -1
- package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs → HighlightPlugin-C6pHifVz.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs.map → HighlightPlugin-C6pHifVz.mjs.map} +1 -1
- package/dist/chunks/{ImagePlugin-Cp_RINtc.mjs → ImagePlugin-KpkuE2LH.mjs} +2 -2
- package/dist/chunks/{ImagePlugin-Cp_RINtc.mjs.map → ImagePlugin-KpkuE2LH.mjs.map} +1 -1
- package/dist/chunks/{InlineStyleMarkSpec-4R6DC7ij.mjs → InlineStyleMarkSpec-C6LJT7kp.mjs} +2 -2
- package/dist/chunks/{InlineStyleMarkSpec-4R6DC7ij.mjs.map → InlineStyleMarkSpec-C6LJT7kp.mjs.map} +1 -1
- package/dist/chunks/{ListPlugin-CVId2dE0.mjs → ListPlugin-2yl6KiTK.mjs} +2 -2
- package/dist/chunks/{ListPlugin-CVId2dE0.mjs.map → ListPlugin-2yl6KiTK.mjs.map} +1 -1
- package/dist/chunks/{PopupManager-CyOfZUab.mjs → PopupManager-DUtaK3WX.mjs} +2 -2
- package/dist/chunks/{PopupManager-CyOfZUab.mjs.map → PopupManager-DUtaK3WX.mjs.map} +1 -1
- package/dist/chunks/{PopupPositioning-DtUrY9bh.mjs → PopupPositioning-BB97-__N.mjs} +2 -2
- package/dist/chunks/{PopupPositioning-DtUrY9bh.mjs.map → PopupPositioning-BB97-__N.mjs.map} +1 -1
- package/dist/chunks/PrintPlugin-DyIZDY3Q.mjs +2 -0
- package/dist/chunks/PrintPlugin-DyIZDY3Q.mjs.map +1 -0
- package/dist/chunks/{PrintTypes-WdtgSj74.mjs → PrintTypes-CxU69qu3.mjs} +3 -2
- package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-BFKu52mS.mjs +2 -0
- package/dist/chunks/StyleRuntime-BFKu52mS.mjs.map +1 -0
- package/dist/chunks/{TablePlugin-D93RR5xH.mjs → TablePlugin-BTH9VRZq.mjs} +2 -2
- package/dist/chunks/{TablePlugin-D93RR5xH.mjs.map → TablePlugin-BTH9VRZq.mjs.map} +1 -1
- package/dist/chunks/{TextColorPlugin-C1qpzEOa.mjs → TextColorPlugin-CEfZQ6Md.mjs} +2 -2
- package/dist/chunks/{TextColorPlugin-C1qpzEOa.mjs.map → TextColorPlugin-CEfZQ6Md.mjs.map} +1 -1
- package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs → ToolbarPlugin-DVGrFf8v.mjs} +2 -2
- package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs.map → ToolbarPlugin-DVGrFf8v.mjs.map} +1 -1
- package/dist/chunks/{VideoPlugin-D9rQZol6.mjs → VideoPlugin-B3uf1Dwp.mjs} +2 -2
- package/dist/chunks/{VideoPlugin-D9rQZol6.mjs.map → VideoPlugin-B3uf1Dwp.mjs.map} +1 -1
- package/dist/chunks/{full-Cah3qjCT.mjs → full-BBl7mvwH.mjs} +2 -2
- package/dist/chunks/{full-Cah3qjCT.mjs.map → full-BBl7mvwH.mjs.map} +1 -1
- package/dist/chunks/minimal-CtnR4dqp.mjs +2 -0
- package/dist/chunks/{minimal-DqATlnAL.mjs.map → minimal-CtnR4dqp.mjs.map} +1 -1
- package/dist/chunks/src-C89Cw7ni.mjs +2 -0
- package/dist/chunks/{src-YY6n2SmV.mjs.map → src-C89Cw7ni.mjs.map} +1 -1
- package/dist/editor/NotectlEditor.d.ts +22 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/full.mjs +1 -1
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print/PrintHostStyles.d.ts +50 -0
- package/dist/plugins/print/PrintHostStyles.d.ts.map +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/dist/plugins/print/PrintServiceImpl.d.ts +72 -3
- package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -1
- package/dist/plugins/print/PrintStyleCollector.d.ts +150 -21
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print/StaticHostMarker.d.ts +18 -0
- package/dist/plugins/print/StaticHostMarker.d.ts.map +1 -0
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/style/StyleRuntime.d.ts +7 -0
- package/dist/style/StyleRuntime.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/FontPlugin-DB1_bgam.mjs +0 -2
- package/dist/chunks/PrintPlugin-C6gOJT6d.mjs +0 -2
- package/dist/chunks/PrintPlugin-C6gOJT6d.mjs.map +0 -1
- package/dist/chunks/PrintTypes-WdtgSj74.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-BAutwDZT.mjs +0 -2
- package/dist/chunks/StyleRuntime-BAutwDZT.mjs.map +0 -1
- package/dist/chunks/minimal-DqATlnAL.mjs +0 -2
- package/dist/chunks/src-YY6n2SmV.mjs +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as t,d as e,h as n,i as o}from"./Document-r7vLOAGA.mjs";import{c as i,l as r,o as a,r as s,t as l,u as d}from"./Selection-HYoVFpAx.mjs";import{a as c}from"./TypeBrands-Ch9856Gb.mjs";import{n as u}from"./DomUtils-Bf7JLFlx.mjs";import{n as p,r as h}from"./HTMLUtils-C6B4UT00.mjs";import{s as m}from"./BlockInsertion-6rR9tIGP.mjs";import{t as v}from"./NodeSelectionCommands-Dj4VxLdD.mjs";import{t as f}from"./Platform-ByobkiCc.mjs";import{r as b,s as g}from"./StyleRuntime-BAutwDZT.mjs";import{c as y,o as x}from"./PluginHelpers-KDuTlmXm.mjs";import{t as _}from"./ShortcutFormatting-TwiufqeV.mjs";import{i as w}from"./PopupPositioning-DtUrY9bh.mjs";import A from"dompurify";var k=/^[A-Za-z0-9_-]{11}$/,C=/^\d+$/,P=/^[A-Za-z0-9]+$/,z=/^[A-Za-z0-9]+$/;function E(t,e){const n=t.indexOf(e);if(-1!==n)return t[n+1]}function L(t,e,n){const o=e.searchParams.get("h")??n;return o&&P.test(o)?{videoId:t,hash:o}:{videoId:t}}var S=[{id:"youtube",label:"YouTube",hostnames:["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtu.be","youtube-nocookie.com","www.youtube-nocookie.com"],embedHostnames:["www.youtube-nocookie.com","youtube-nocookie.com","www.youtube.com","youtube.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("youtu.be"===e){const t=n[0];return t&&k.test(t)?{videoId:t}:null}const o=t.searchParams.get("v");if(o&&k.test(o))return{videoId:o};for(const i of["embed","shorts","live","v"]){const t=E(n,i);if(t&&k.test(t))return{videoId:t}}return null},buildEmbedUrl(t,e){const n=e.privacy?"www.youtube-nocookie.com":"www.youtube.com",o=V({rel:"0",...e.autoplay?{autoplay:"1"}:{}});return`https://${n}/embed/${t.videoId}${o}`},buildWatchUrl:t=>`https://www.youtube.com/watch?v=${t.videoId}`,thumbnailUrl:t=>`https://i.ytimg.com/vi/${t.videoId}/hqdefault.jpg`},{id:"vimeo",label:"Vimeo",hostnames:["vimeo.com","www.vimeo.com","player.vimeo.com"],embedHostnames:["player.vimeo.com"],parse(t){const e=t.pathname.split("/").filter(Boolean),n=E(e,"video");if(n&&C.test(n))return L(n,t,void 0);const o=e.find(t=>C.test(t));return o?L(o,t,e[e.indexOf(o)+1]):null},buildEmbedUrl(t,e){const n=V({...t.hash?{h:t.hash}:{},...e.privacy?{dnt:"1"}:{},...e.autoplay?{autoplay:"1"}:{}});return`https://player.vimeo.com/video/${t.videoId}${n}`},buildWatchUrl(t){const e=`https://vimeo.com/${t.videoId}`;return t.hash?`${e}/${t.hash}`:e}},{id:"dailymotion",label:"Dailymotion",hostnames:["dailymotion.com","www.dailymotion.com","geo.dailymotion.com","dai.ly"],embedHostnames:["www.dailymotion.com","geo.dailymotion.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("dai.ly"===e){const t=n[0];return t&&z.test(t)?{videoId:t}:null}const o=E(n,"video");return o&&z.test(o)?{videoId:o}:null},buildEmbedUrl(t,e){const n=V(e.autoplay?{autoplay:"1"}:{});return`https://www.dailymotion.com/embed/video/${t.videoId}${n}`},buildWatchUrl:t=>`https://www.dailymotion.com/video/${t.videoId}`,thumbnailUrl:t=>`https://www.dailymotion.com/thumbnail/video/${t.videoId}`}];function I(t,e=S){const n=B(t);if(!n)return null;if("https:"!==n.protocol&&"http:"!==n.protocol)return null;const o=n.hostname.toLowerCase();for(const i of e){if(!i.hostnames.includes(o))continue;const t=i.parse(n);if(t)return{provider:i.id,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}return null}function R(t,e=S){return e.find(e=>e.id===t)}function $(t,e){const n=R(t.provider,e);return n?n.buildWatchUrl(t):null}function N(t,e){return R(t.provider,e)?.thumbnailUrl?.(t)}function H(t,e=S){return R(t,e)?.label??t}function B(t){try{return new URL(t.trim())}catch{return null}}function V(t){const e=Object.entries(t);return 0===e.length?"":`?${e.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&")}`}var M={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},W={providers:S,facade:!0,useProviderThumbnail:!1,privacy:!0,allowedAspectRatios:["16/9","4/3","1/1","9/16"],defaultAspectRatio:"16/9",defaultWidthPercent:100,minWidthPercent:25,widthStep:10,widthStepLarge:25,resizable:!0},j="video",D=/^\d+(?:\.\d+)?\s*\/\s*\d+(?:\.\d+)?$/;function T(t,e){if(!t||!D.test(t.trim()))return e.defaultAspectRatio;const[n,o]=t.split("/");return`${n?.trim()} / ${o?.trim()}`}function O(t,e){return Number.isFinite(t)?Math.max(e.minWidthPercent,Math.min(100,Math.round(t))):e.defaultWidthPercent}var U=/^[A-Za-z0-9_-]+$/;function F(t){return t.length>0&&t.length<=64&&U.test(t)}function K(t,e){return{provider:t?.provider??"",videoId:t?.videoId??"",...t?.hash?{hash:t.hash}:{},aspectRatio:T(t?.aspectRatio,e),widthPercent:O(t?.widthPercent??e.defaultWidthPercent,e),align:t?.align??"center",title:t?.title??"",...t?.caption?{caption:t.caption}:{},privacy:t?.privacy??e.privacy}}function q(t,e){const n=I(t.url,e.providers);return n?{provider:n.provider,videoId:n.videoId,...n.hash?{hash:n.hash}:{},aspectRatio:T(t.aspectRatio,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.title,...t.caption?{caption:t.caption}:{},privacy:e.privacy}:null}function X(t){return{provider:t.provider,videoId:t.videoId,aspectRatio:t.aspectRatio,widthPercent:t.widthPercent,align:t.align,title:t.title,privacy:t.privacy,...t.hash?{hash:t.hash}:{},...t.caption?{caption:t.caption}:{}}}function Z(t){const e=t.selection;if(!r(e))return null;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return null;const o=t.getNodePath(e.nodeId);return o?{block:n,path:o}:null}function G(t,e){const n=t.getState(),o=Z(n);return!!o&&(t.dispatch(n.transaction("command").setNodeAttr(o.path,e).build()),!0)}function Y(t){const e=t.getState(),n=Z(e);if(!n)return!1;const o=v(e,s(n.block.id,n.path));return!!o&&(t.dispatch(o),!0)}var J=0;function Q(t){return`${t}-${J+=1}`}function tt(t,e){const n=Q("notectl-video-field"),o=document.createElement("div");o.className="notectl-video-popup__field";const i=document.createElement("label");i.className="notectl-video-popup__label",i.setAttribute("for",n),i.textContent=e.label,o.appendChild(i);const r=document.createElement("input");r.id=n,r.type=e.type,r.value=e.value,r.placeholder=e.placeholder,r.className="notectl-video-popup__input",r.setAttribute("aria-label",e.ariaLabel),e.required&&r.setAttribute("aria-required","true");const a=[];if(e.hint){const t=`${n}-hint`,i=document.createElement("p");i.id=t,i.className="notectl-video-popup__hint",i.textContent=e.hint,o.appendChild(i),a.push(t)}return e.describedBy&&a.push(e.describedBy),a.length>0&&r.setAttribute("aria-describedby",a.join(" ")),o.insertBefore(r,o.children[1]??null),t.appendChild(o),r}var et=class{context;config;locale;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.config=e,this.locale=n}get isOpen(){return null!==this.panel}openInsert(){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,onSubmit:n=>{const a=q(n,this.config);a&&function(n,a){const l=n.getState(),d=l.selection;if(i(d))return!1;const u=X(a),p=r(d)?d.nodeId:d.anchor.blockId,h=function(t,e){if("table_cell"===t.getBlock(e)?.type)return e;const n=t.getNodePath(e);if(n)for(const o of n)if("table_cell"===t.getBlock(o)?.type)return o}(l,p);h?function(n,i,r,a){const l=n.getNodePath(r),d=n.getBlock(r);if(!l||!d)return!1;const u=o(c(j),[],void 0,a),p=n.transaction("command"),h=e(d);for(let e=h.length-1;e>=0;e--){const n=d.children.findIndex(n=>t(n)&&n.id===h[e]?.id);-1!==n&&p.removeNode(l,n)}p.insertNode(l,0,u),p.setSelection(s(u.id,[...l,u.id])),i.dispatch(p.build())}(l,n,h,u):function(t,e,n,i){const r=o(c(j),[],void 0,i),a=t.transaction("command");!!m(t,a,n,r)&&(a.setSelection(s(r.id,[])),e.dispatch(a.build()))}(l,n,p,u)}(this.context,a)}})}openInsertReplacingRange(e,i){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,initial:{url:i},onSubmit:i=>{const r=q(i,this.config);r&&function(e,i,r){const a=e.getState(),l=a.getBlock(i.blockId);if(!l)return!1;const d=function(e,n){const o=e.getNodePath(n);if(!o||0===o.length)return null;if(1===o.length){const t=e.doc.children.findIndex(t=>t.id===n);return-1===t?null:{parentPath:[],index:t}}const i=o[o.length-2],r=i?e.getBlock(i):void 0;if(!r)return null;const a=r.children.findIndex(e=>t(e)&&e.id===n);return-1===a?null:{parentPath:o.slice(0,-1),index:a}}(a,i.blockId);if(!d)return!1;const u=0===Math.max(0,n(l).length-(i.end-i.start))&&"paragraph"===l.type,p=o(c(j),[],void 0,X(r)),h=0===d.parentPath.length?[]:[...d.parentPath,p.id],m=a.transaction("command");u?(m.removeNode(d.parentPath,d.index),m.insertNode(d.parentPath,d.index,p),0===d.parentPath.length&&d.index>=a.doc.children.length-1&&m.insertNode([],d.index+1,o(c("paragraph")))):(m.deleteTextAt(i.blockId,i.start,i.end),m.insertNode(d.parentPath,d.index+1,p)),m.setSelection(s(p.id,h)),e.dispatch(m.build())}(this.context,e,r)}})}openEditForSelected(){if(this.context.isReadOnly())return;const t=this.context.getState(),e=t.selection;if(!r(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=K(n.attrs,this.config),i={url:$({provider:o.provider,videoId:o.videoId,...o.hash?{hash:o.hash}:{}},this.config.providers)??"",title:o.title,caption:o.caption??"",aspectRatio:o.aspectRatio};this.open({rect:this.videoRect(e.nodeId),mode:"edit",label:this.locale.editDialogLabel,initial:i,onSubmit:t=>{!function(t,e,n){const o=Z(t.getState());if(!o)return!1;const i=I(e.url,n.providers);if(!i)return!1;const r=function(t,e){const n={};for(const[o,i]of Object.entries(t??{}))e.includes(o)||(n[o]=i);return n}(o.block.attrs,["hash","caption"]);r.provider=i.provider,r.videoId=i.videoId,r.title=e.title,r.aspectRatio=T(e.aspectRatio,n),i.hash&&(r.hash=i.hash),e.caption.trim()&&(r.caption=e.caption.trim()),G(t,r)}(this.context,t,this.config)}})}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-video-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","false"),e.setAttribute("aria-label",t.label),this.panel=e,function(t,e){const{config:n,locale:o,initial:i,mode:r}=e;t.classList.add("notectl-video-popup");const a=Q("notectl-video-error"),s=document.createElement("p");s.id=a,s.className="notectl-video-popup__error",s.setAttribute("role","alert");const l=tt(t,{label:o.urlLabel,ariaLabel:o.urlAria,placeholder:o.urlPlaceholder,value:i?.url??"",type:"url",required:!0,describedBy:a}),d=tt(t,{label:o.titleLabel,ariaLabel:o.titleAria,placeholder:o.titlePlaceholder,value:i?.title??"",type:"text",required:!0,hint:o.titleHint}),c=tt(t,{label:o.captionLabel,ariaLabel:o.captionAria,placeholder:o.captionPlaceholder,value:i?.caption??"",type:"text"}),u=function(t,e,n,o){const i=Q("notectl-video-field"),r=document.createElement("div");r.className="notectl-video-popup__field";const a=document.createElement("label");a.className="notectl-video-popup__label",a.setAttribute("for",i),a.textContent=n.aspectRatioLabel,r.appendChild(a);const s=document.createElement("select");s.id=i,s.className="notectl-video-popup__select",s.setAttribute("aria-label",n.aspectRatioAria);const l=e.allowedAspectRatios.includes(o)?e.allowedAspectRatios:[o,...e.allowedAspectRatios];for(const d of l){const t=document.createElement("option");t.value=d,t.textContent=d,d===o&&(t.selected=!0),s.appendChild(t)}return r.appendChild(s),t.appendChild(r),s}(t,n,o,i?.aspectRatio??n.defaultAspectRatio);t.appendChild(s);const p=document.createElement("div");p.className="notectl-video-popup__actions";const h=document.createElement("button");h.type="button",h.className="notectl-video-popup__cancel",h.textContent=o.cancelButton;const m=document.createElement("button");m.type="button",m.className="notectl-video-popup__submit",m.textContent="edit"===r?o.updateButton:o.insertButton,m.setAttribute("aria-label","edit"===r?o.updateAria:o.insertAria),p.append(h,m),t.appendChild(p);const v=(t,e)=>{s.textContent=t,e.focus()},f=()=>{const t=l.value.trim();if(!I(t,n.providers))return void v(o.invalidUrl,l);const i=d.value.trim();i?(s.textContent="",e.onSubmit({url:t,title:i,caption:c.value.trim(),aspectRatio:u.value}),e.onClose()):v(o.titleRequired,d)};h.addEventListener("mousedown",t=>t.preventDefault()),h.addEventListener("click",t=>{t.preventDefault(),e.onClose()}),m.addEventListener("mousedown",t=>t.preventDefault()),m.addEventListener("click",t=>{t.preventDefault(),f()});for(const b of[l,d,c])b.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),f())});requestAnimationFrame(()=>l.focus())}(e,{mode:t.mode,initial:t.initial,config:this.config,locale:this.locale,onSubmit:t.onSubmit,onClose:()=>this.close(!0)}),e.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close(!0))}),this.context.getPluginContainer("top").appendChild(e),w(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||320,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),s=window.innerHeight-t.offsetHeight-8,l=Math.min(n+8,Math.max(8,s));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(l)}px`}(e,t.rect),this.installOutsideHandler()}videoRect(t){const e=this.context.getContainer().querySelector(`[data-block-id="${t}"]`);return e?e.getBoundingClientRect():null}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function nt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}var ot={insertVideo:"Insert Video",insertVideoTooltip:"Insert Video",urlLabel:"Video URL",urlPlaceholder:"https://www.youtube.com/watch?v=...",urlAria:"Video URL",titleLabel:"Title",titlePlaceholder:"Describe the video",titleAria:"Video title",titleHint:"Describes the video for screen readers. Required.",captionLabel:"Caption",captionPlaceholder:"Optional visible caption",captionAria:"Video caption",aspectRatioLabel:"Aspect ratio",aspectRatioAria:"Video aspect ratio",insertButton:"Insert",insertAria:"Insert video",updateButton:"Update",updateAria:"Update video",cancelButton:"Cancel",insertDialogLabel:"Insert video",editDialogLabel:"Edit video",invalidUrl:"Enter a YouTube, Vimeo, or Dailymotion video URL.",titleRequired:"Enter a title so screen readers can describe the video.",play:t=>t?`Play video: ${t}`:"Play video",loading:"Loading video...",providerBadge:t=>`${t} video`,closePlayer:"Close video player",videoAria:(t,e)=>e?`${t} video: ${e}`:`${t} video`,videoSelected:"Video selected.",videoSelectedWithTitle:t=>`Video selected: ${t}.`,resizeHint:(t,e)=>`${t} / ${e} to resize.`,keyboardResizeHint:(t,e)=>`${t} / ${e} to resize`,videoResized:t=>`Video resized to ${t} percent width.`,resetToDefaultSize:"Video reset to full width.",enteredPlayer:t=>t?`Playing ${t}. Press Escape to return to the document.`:"Playing video. Press Escape to return to the document.",exitedPlayer:"Returned to the document.",videoOptions:"Video options",editVideo:"Edit video",alignStart:"Align left",alignCenter:"Align center",alignEnd:"Align right",deleteVideo:"Delete video",embedPrompt:"Embed this video?",embedConfirm:"Embed",embedDismiss:"Keep as link",embedOfferAnnounce:t=>`${t} link pasted. Press Embed to turn it into a video, or continue editing to keep it as a link.`,embeddedAnnounce:"Video embedded."},it=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--O0A9OTR.mjs"),"./locales/de.ts":()=>import("./de-BxQIt_1Y.mjs"),"./locales/es.ts":()=>import("./es-BQweZX6P.mjs"),"./locales/fr.ts":()=>import("./fr-C3EKRThN.mjs"),"./locales/hi.ts":()=>import("./hi-L6pJxZam.mjs"),"./locales/pt.ts":()=>import("./pt-Bb908r0n.mjs"),"./locales/ru.ts":()=>import("./ru-DkW9XZFy.mjs"),"./locales/zh.ts":()=>import("./zh-ikm3rSTR.mjs")});async function rt(t){return y(it,t,ot)}var at={start:"notectl-video--start",center:"notectl-video--center",end:"notectl-video--end"};function st(t,e){for(const o of Object.values(at))t.classList.remove(o);const n=at[e]??at.center;t.classList.add(n)}function lt(t,e,n){g(t,"aspect-ratio",e),g(t,"width",`${n}%`)}var dt=/^[A-Za-z0-9]+$/;function ct(t){return{provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}function ut(t,e){const n=Number.parseFloat(t.getAttribute("width")??""),o=Number.parseFloat(t.getAttribute("height")??"");return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0?T(`${n}/${o}`,e):e.defaultAspectRatio}function pt(t,e,n){const o=function(t,e,n){const o=R(t.provider,e);return o?o.buildEmbedUrl(t,n):null}({provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}},e.providers,{privacy:t.privacy,autoplay:!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches})??"",i=document.createElement("iframe");return i.className="notectl-video__iframe",i.setAttribute("src",o),i.setAttribute("title",t.title||n.providerBadge(H(t.provider,e.providers))),i.setAttribute("allow","autoplay; fullscreen; picture-in-picture; encrypted-media"),i.setAttribute("allowfullscreen","true"),i.setAttribute("referrerpolicy","no-referrer"),i.setAttribute("loading","lazy"),i.setAttribute("frameborder","0"),i}var ht=class{frame;getAttrs;config;locale;announce;facadeButton=null;player=null;iframe=null;escapeHandler=null;renderedKey="";constructor(t){this.frame=t.frame,this.getAttrs=t.getAttrs,this.config=t.config,this.locale=t.locale,this.announce=t.announce,this.renderFacade()}get isActive(){return null!==this.player}facadeKey(t){return[t.provider,t.videoId,t.hash??"",t.privacy,t.title,this.config.useProviderThumbnail].join("|")}renderFacade(){this.facadeButton?.remove();const t=this.getAttrs();this.renderedKey=this.facadeKey(t);const e=document.createElement("button");e.type="button",e.className="notectl-video__facade",e.setAttribute("aria-label",this.locale.play(t.title));const n=document.createElement("span");if(n.className="notectl-video__poster",n.setAttribute("aria-hidden","true"),this.config.useProviderThumbnail){const e=N({provider:t.provider,videoId:t.videoId},this.config.providers);e&&g(n,"background-image",`url("${e}")`)}const o=document.createElement("span");o.className="notectl-video__play-icon",o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 68 48" width="48" height="34" aria-hidden="true" focusable="false"><path d="M66.5 7.7c-.8-2.9-2.5-5.4-5.4-6.2C55.8.1 34 0 34 0S12.2.1 6.9 1.5C4 2.3 2.3 4.8 1.5 7.7.1 13 0 24 0 24s.1 11 1.5 16.3c.8 2.9 2.5 5.4 5.4 6.2C12.2 47.9 34 48 34 48s21.8-.1 27.1-1.5c2.9-.8 4.6-3.3 5.4-6.2C67.9 35 68 24 68 24s-.1-11-1.5-16.3z" fill="currentColor"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>';const i=document.createElement("span");i.className="notectl-video__badge",i.setAttribute("aria-hidden","true"),i.textContent=this.locale.providerBadge(H(t.provider,this.config.providers)),e.append(n,o,i),e.addEventListener("mousedown",t=>t.stopPropagation()),e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.activate()}),this.facadeButton=e,this.frame.insertBefore(e,this.frame.firstChild)}update(){const t=this.getAttrs(),e=this.facadeKey(t);if(e!==this.renderedKey){if(this.renderedKey=e,this.isActive&&this.iframe){const e=pt(t,this.config,this.locale);return this.iframe.replaceWith(e),void(this.iframe=e)}this.renderFacade()}}activate(){if(this.isActive||!this.facadeButton)return;const t=this.getAttrs(),e=document.createElement("div");e.className="notectl-video__player";const n=document.createElement("button");n.type="button",n.className="notectl-video__exit",n.setAttribute("aria-label",this.locale.closePlayer),n.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M19 6.4 17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z" fill="currentColor"/></svg>',n.addEventListener("mousedown",t=>t.stopPropagation()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deactivate(!0)});const o=pt(t,this.config,this.locale);e.append(n,o),this.facadeButton.remove(),this.facadeButton=null,this.frame.insertBefore(e,this.frame.firstChild),this.player=e,this.iframe=o,this.escapeHandler=t=>{"Escape"===t.key&&(t.stopPropagation(),this.deactivate(!0))},this.frame.addEventListener("keydown",this.escapeHandler),o.focus(),this.announce(this.locale.enteredPlayer(t.title))}deactivate(t){this.player&&(this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player.remove(),this.player=null,this.iframe=null,this.renderFacade(),t&&this.facadeButton?.focus(),this.announce(this.locale.exitedPlayer))}destroy(){this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player?.remove(),this.player=null,this.iframe=null,this.facadeButton?.remove(),this.facadeButton=null}},mt=["w","e"],vt={w:-1,e:1},ft=null;function bt(){ft?.remove(),ft=null}function gt(t,e,n,o,i,r){let a=0,s=0,l=0,d=0,c=vt[e];const u=t=>{const e=(t.clientX-a)*c;var n,r;n=s+(l>0?e/l*100:0),r=i.minPercent,d=Math.max(r,Math.min(100,n)),i.applyLiveWidth(d),o.textContent=i.formatPercent(Math.round(d))},p=t=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p),n.classList.remove("notectl-video__resize-overlay--active"),o.classList.remove("notectl-video__size-indicator--visible"),bt(),i.commit(Math.round(d)),t.target?.releasePointerCapture?.(t.pointerId)};r(()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p)}),t.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation(),a=t.clientX,s=i.getWidthPercent(),d=s,l=i.getReferenceWidth(),c=i.isRtl()?-vt[e]:vt[e],n.classList.add("notectl-video__resize-overlay--active"),o.textContent=i.formatPercent(Math.round(s)),o.classList.add("notectl-video__size-indicator--visible"),function(t){bt(),ft=document.createElement("style");const e=b(t);e&&ft.setAttribute("nonce",e),ft.textContent="*{cursor:ew-resize!important;user-select:none!important}",document.head.appendChild(ft)}(n),t.target.setPointerCapture(t.pointerId),document.addEventListener("pointermove",u),document.addEventListener("pointerup",p)})}function yt(t,e,n){const o=document.createElement("button");return o.type="button",o.className="notectl-video__tool",o.setAttribute("aria-label",t),o.title=t,o.innerHTML=e,o.addEventListener("mousedown",t=>t.preventDefault()),o.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),n()}),o}function xt(t){const{config:e,locale:n,resolvedKeymap:o,announce:i,actions:r}=t;return(t,a,s)=>{const l=document.createElement("figure");l.className="notectl-video",l.setAttribute("data-block-id",t.id),l.setAttribute("data-void","true"),l.setAttribute("data-selectable","true");const d=document.createElement("div");d.className="notectl-video__frame",l.appendChild(d);let c=t.id,u=K(t.attrs,e),p=null,h=null,m=null;const v=new ht({frame:d,getAttrs:()=>u,config:e,locale:n,announce:i});function b(t){var o;u=K(t.attrs,e),lt(d,u.aspectRatio,u.widthPercent),st(l,u.align),l.setAttribute("aria-label",n.videoAria(H(u.provider,e.providers),u.title)),(o=u.caption)?(p||(p=document.createElement("figcaption"),p.className="notectl-video__caption",l.appendChild(p)),p.textContent!==o&&(p.textContent=o)):p&&(p.remove(),p=null),v.update(),m?.update(u.align)}function y(){h&&(h.destroy(),h.element.remove(),h=null)}return b(t),{dom:l,contentDOM:null,update:t=>"video"===t.type&&(c=t.id,l.setAttribute("data-block-id",t.id),b(t),!0),selectNode(){l.classList.add("notectl-video--selected"),e.resizable&&!h&&(h=function(t,e){const n=document.createElement("div");n.className="notectl-video__resize-overlay",n.setAttribute("data-notectl-no-print","");const o=document.createElement("div");o.className="notectl-video__size-indicator",n.appendChild(o);let i=null;for(const r of mt){const e=document.createElement("div");e.className=`notectl-video__resize-handle notectl-video__resize-handle--${r}`,e.setAttribute("aria-hidden","true"),gt(e,r,n,o,t,t=>{i=t}),n.appendChild(e)}if(e){const t=document.createElement("div");t.className="notectl-video__keyboard-hint",t.setAttribute("aria-hidden","true"),t.textContent=e,n.appendChild(t)}return{element:n,destroy(){i?.(),bt()}}}({minPercent:e.minWidthPercent,getWidthPercent:()=>u.widthPercent,getReferenceWidth:()=>l.clientWidth||d.clientWidth,isRtl:()=>"rtl"===f(l),applyLiveWidth:t=>g(d,"width",`${t}%`),commit:t=>function(t){const e=a(),n=e.getBlock(c);if(!n)return;const o=e.getNodePath(c);if(!o)return;const i={...n.attrs??{},widthPercent:t};s(e.transaction("command").setNodeAttr(o,i).build())}(t),formatPercent:t=>`${t}%`},function(t,e){const n=t.shrinkWidth??null,o=t.growWidth??null;return n&&o?e.keyboardResizeHint(_(n),_(o)):""}(o,n)),d.appendChild(h.element)),m||(m=function(t){const{locale:e,actions:n}=t,o=document.createElement("div");o.className="notectl-video__toolbar",o.setAttribute("role","toolbar"),o.setAttribute("aria-label",e.videoOptions),o.setAttribute("data-notectl-no-print",""),o.addEventListener("mousedown",t=>t.stopPropagation());const i=yt(e.editVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="currentColor"/></svg>',()=>n.edit()),r={start:yt(e.alignStart,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm0 7h12v2H3v-2zm0 7h18v2H3v-2zm0-3.5h12v-2H3v2z" fill="currentColor"/></svg>',()=>n.align("start")),center:yt(e.alignCenter,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm3 7h12v2H6v-2zm-3 7h18v2H3v-2zm3-3.5h12v-2H6v2z" fill="currentColor"/></svg>',()=>n.align("center")),end:yt(e.alignEnd,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm6 7h12v2H9v-2zm-6 7h18v2H3v-2zm6-3.5h12v-2H9v2z" fill="currentColor"/></svg>',()=>n.align("end"))},a=yt(e.deleteVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" fill="currentColor"/></svg>',()=>n.remove()),s=()=>{const t=document.createElement("span");return t.className="notectl-video__tool-separator",t.setAttribute("aria-hidden","true"),t};o.append(i,s(),r.start,r.center,r.end,s(),a);const l=t=>{for(const e of["start","center","end"]){const n=e===t;r[e].classList.toggle("notectl-video__tool--active",n),r[e].setAttribute("aria-pressed",n?"true":"false")}};return l(t.initialAlign),{element:o,update:l,destroy(){o.remove()}}}({locale:n,actions:r,initialAlign:u.align}),l.appendChild(m.element))},deselectNode(){l.classList.remove("notectl-video--selected"),y(),m?.destroy(),m=null},destroy(){y(),m?.destroy(),m=null,v.destroy()}}}}function _t(t){return(e,n,o)=>{const i=function(t,e,n){const o=t.trim();if(o&&!/\s/.test(o)){const t=I(o,n);if(t)return{url:o,match:t}}const i=function(t){if(!t)return null;const e=function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t),n=e.querySelector("iframe");if(!n)return null;const o=e.cloneNode(!0);for(const i of Array.from(o.querySelectorAll("iframe")))i.remove();return""!==(o.textContent??"").trim()?null:n.getAttribute("src")}(e);if(i){const t=I(i,n);if(t)return{url:$(t,n)??i,match:t}}return null}(e,n,t.providers);if(!i)return null;const r=o.selection;if(!d(r)||!a(r))return null;const s=r.anchor.blockId,c=r.anchor.offset,u=c+i.url.length,p=o.transaction("paste").insertText(s,c,i.url,[]).setSelection(l(s,u)).build();return t.onOffer({blockId:s,start:c,end:u},i.match),p}}var wt=0,At=/* @__PURE__ */new Set,kt=null;var Ct=class{id="video";name="Video";priority=47;config;resolvedKeymap;context=null;locale=ot;overlay=null;embedPrompt=null;constructor(t){this.config={...W,...t},this.resolvedKeymap={...M,...t?.keymap}}async init(t){this.context=t,this.locale=await x(t,this.config.locale,ot,rt),t.registerStyleSheet('\n.notectl-video {\n\tmargin: 12px 0;\n\tposition: relative;\n\tuser-select: none;\n}\n\n.notectl-video--center { text-align: center; }\n.notectl-video--start { text-align: start; }\n.notectl-video--end { text-align: end; }\n\n.notectl-video__frame {\n\tdisplay: inline-block;\n\tposition: relative;\n\twidth: 100%;\n\tmax-width: 100%;\n\tvertical-align: top;\n\toverflow: hidden;\n\tborder-radius: 8px;\n\tbackground: #000;\n\ttext-align: start;\n}\n\n/* Facade (click-to-load) */\n.notectl-video__facade {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 0;\n\tborder: 0;\n\tcursor: pointer;\n\tbackground: #14181c;\n\tcolor: #fff;\n}\n\n.notectl-video__facade:focus-visible {\n\toutline: 3px solid var(--notectl-primary);\n\toutline-offset: -3px;\n}\n\n.notectl-video__poster {\n\tposition: absolute;\n\tinset: 0;\n\tbackground-size: cover;\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n}\n\n.notectl-video__poster::after {\n\tcontent: "";\n\tposition: absolute;\n\tinset: 0;\n\tbackground: rgba(0, 0, 0, 0.25);\n}\n\n.notectl-video__play-icon {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: inline-flex;\n\tfilter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));\n\ttransition: transform 0.12s ease;\n}\n\n.notectl-video__facade:hover .notectl-video__play-icon {\n\ttransform: scale(1.08);\n}\n\n.notectl-video__badge {\n\tposition: absolute;\n\tz-index: 1;\n\tbottom: 8px;\n\tinset-inline-start: 8px;\n\tpadding: 2px 6px;\n\tborder-radius: 4px;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n\tfont-size: 12px;\n\tfont-weight: 600;\n}\n\n/* Player (activated iframe + exit control) */\n.notectl-video__player {\n\tposition: absolute;\n\tinset: 0;\n}\n\n.notectl-video__iframe {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n}\n\n.notectl-video__exit {\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 6px;\n\tinset-inline-end: 6px;\n\twidth: 28px;\n\theight: 28px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tborder: 0;\n\tborder-radius: 50%;\n\tcursor: pointer;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n}\n\n.notectl-video__exit:focus-visible {\n\toutline: 2px solid #fff;\n\toutline-offset: 2px;\n}\n\n/* Static fallback link (no-JS / export rehydration) */\n.notectl-video__fallback-link {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 8px;\n\tcolor: #fff;\n\ttext-decoration: underline;\n\ttext-align: center;\n}\n\n/* Caption */\n.notectl-video__caption {\n\tmargin-top: 6px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n\ttext-align: center;\n}\n\n/* Selection */\n.notectl-video--selected .notectl-video__frame {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Resize overlay + side handles */\n.notectl-video__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-video__resize-handle {\n\tposition: absolute;\n\ttop: 50%;\n\ttransform: translateY(-50%);\n\twidth: 8px;\n\theight: 44px;\n\tmax-height: 60%;\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-raised);\n\tpointer-events: all;\n\tcursor: ew-resize;\n\tz-index: 2;\n}\n\n.notectl-video__resize-handle--w { inset-inline-start: -5px; }\n.notectl-video__resize-handle--e { inset-inline-end: -5px; }\n\n.notectl-video__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-video__size-indicator--visible { opacity: 1; }\n\n.notectl-video__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-video--selected .notectl-video__keyboard-hint { display: block; }\n.notectl-video__resize-overlay--active ~ .notectl-video__keyboard-hint,\n.notectl-video__resize-overlay--active .notectl-video__keyboard-hint { display: none; }\n\n/* On-selection toolbar */\n.notectl-video__toolbar {\n\tposition: absolute;\n\ttop: -44px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n\tpadding: 2px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-overlay);\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-video__tool {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-video__tool:hover { background: var(--notectl-hover-bg); }\n\n.notectl-video__tool--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary);\n}\n\n.notectl-video__tool:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video__tool svg { width: 16px; height: 16px; }\n\n.notectl-video__tool-separator {\n\twidth: 1px;\n\theight: 18px;\n\tmargin: 0 2px;\n\tbackground: var(--notectl-border);\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.notectl-video__play-icon,\n\t.notectl-video__size-indicator {\n\t\ttransition: none;\n\t}\n}\n\n@media (forced-colors: active) {\n\t.notectl-video__frame { outline: 1px solid CanvasText; }\n\t.notectl-video__facade { border: 1px solid ButtonText; }\n\t.notectl-video__play-icon { forced-color-adjust: none; }\n\t.notectl-video__resize-handle { background: ButtonFace; border-color: ButtonText; }\n\t.notectl-video--selected .notectl-video__frame { outline: 2px solid Highlight; }\n}\n'),t.registerStyleSheet("\n.notectl-video-overlay {\n\tposition: fixed;\n\tz-index: 1000;\n\tbox-sizing: border-box;\n\tmin-width: 300px;\n\tmax-width: 92vw;\n\tpadding: 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 6px 24px var(--notectl-shadow);\n}\n\n.notectl-video-popup {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.notectl-video-popup__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.notectl-video-popup__label {\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__input,\n.notectl-video-popup__select {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__input:focus-visible,\n.notectl-video-popup__select:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video-popup__hint {\n\tmargin: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__error:not(:empty) {\n\tmargin: 0;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n\tfont-size: 12px;\n}\n\n.notectl-video-popup__actions {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tgap: 8px;\n\tmargin-top: 2px;\n}\n\n.notectl-video-popup__cancel,\n.notectl-video-popup__submit {\n\tpadding: 7px 14px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__submit {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-popup__cancel:focus-visible,\n.notectl-video-popup__submit:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Ask-first paste affordance */\n.notectl-video-embed-prompt {\n\tposition: fixed;\n\tz-index: 1000;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 6px 8px 6px 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px var(--notectl-shadow);\n\tfont-size: 13px;\n}\n\n.notectl-video-embed-prompt__text {\n\tmargin-inline-end: 4px;\n}\n\n.notectl-video-embed-prompt__embed,\n.notectl-video-embed-prompt__dismiss {\n\tpadding: 4px 10px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-embed-prompt__embed {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-embed-prompt__embed:focus-visible,\n.notectl-video-embed-prompt__dismiss:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n@media (forced-colors: active) {\n\t.notectl-video-overlay,\n\t.notectl-video-embed-prompt {\n\t\tborder: 1px solid CanvasText;\n\t}\n\t.notectl-video-popup__submit,\n\t.notectl-video-embed-prompt__embed {\n\t\tborder: 1px solid ButtonText;\n\t}\n}\n"),function(t){for(const e of t)At.add(e);wt+=1,kt||(kt=t=>{if("iframe"!==t.nodeName.toLowerCase())return;const e=t;e.hasAttribute("srcdoc")?e.parentNode?.removeChild(e):function(t,e){const n=B(t);return!!n&&"https:"===n.protocol&&e.has(n.hostname.toLowerCase())}(e.getAttribute("src")??"",At)||e.parentNode?.removeChild(e)},A.addHook("uponSanitizeElement",kt))}(function(t=S){const e=/* @__PURE__ */new Set;for(const n of t)for(const t of n.embedHostnames)e.add(t.toLowerCase());return e}(this.config.providers)),t.registerNodeSpec(function(t,e){const n=t.providers;return{type:"video",group:"block",isVoid:!0,selectable:!0,attrs:{provider:{default:""},videoId:{default:""},hash:{default:""},aspectRatio:{default:t.defaultAspectRatio},widthPercent:{default:t.defaultWidthPercent},align:{default:"center"},title:{default:""},caption:{default:""},privacy:{default:t.privacy}},toDOM(o){const i=K(o.attrs,t),r=u("figure",o.id);r.className="notectl-video",r.setAttribute("data-void","true"),r.setAttribute("data-selectable","true"),r.setAttribute("data-video-provider",i.provider),r.setAttribute("data-video-id",i.videoId),i.hash&&r.setAttribute("data-video-hash",i.hash),st(r,i.align),r.setAttribute("aria-label",e.videoAria(H(i.provider,n),i.title));const a=document.createElement("div");a.className="notectl-video__frame",lt(a,i.aspectRatio,i.widthPercent);const s=$(ct(i),n);if(s){const t=document.createElement("a");t.className="notectl-video__fallback-link",t.href=s,t.rel="noopener noreferrer",t.textContent=i.title||s,a.appendChild(t)}if(r.appendChild(a),i.caption){const t=document.createElement("figcaption");t.className="notectl-video__caption",t.textContent=i.caption,r.appendChild(t)}return r},toHTML(e){const o=K(e.attrs,t),i=ct(o),r=$(i,n),a=[`data-video-provider="${p(o.provider)}"`,`data-video-id="${p(o.videoId)}"`,`data-video-ratio="${p(o.aspectRatio)}"`,`data-video-width="${o.widthPercent}"`,`data-video-privacy="${o.privacy?"true":"false"}"`];o.hash&&a.push(`data-video-hash="${p(o.hash)}"`),o.title&&a.push(`data-video-title="${p(o.title)}"`);const s=t.useProviderThumbnail?N(i,n):void 0,l=s?`<img src="${p(s)}" alt="">`:h(o.title||r||""),d=r?`<a href="${p(r)}" rel="noopener noreferrer">${l}</a>`:l,c=o.caption?`<figcaption>${h(o.caption)}</figcaption>`:"";return`<figure ${a.join(" ")}>${d}${c}</figure>`},parseHTML:[{tag:"figure",priority:60,getAttrs:e=>function(t,e){const n=t.getAttribute("data-video-provider"),o=t.getAttribute("data-video-id");if(!n||!o)return!1;if(!F(o))return!1;if(!R(n,e.providers))return!1;const i=t.getAttribute("data-video-title")??t.querySelector("a")?.textContent?.trim()??t.getAttribute("aria-label")??"",r=t.querySelector("figcaption")?.textContent?.trim()??"",a=t.getAttribute("data-video-width"),s={provider:n,videoId:o,aspectRatio:T(t.getAttribute("data-video-ratio")??void 0,e),widthPercent:O(a?Number.parseFloat(a):e.defaultWidthPercent,e),align:"center",title:i,privacy:"false"!==t.getAttribute("data-video-privacy")},l=t.getAttribute("data-video-hash");return l&&dt.test(l)&&(s.hash=l),r&&(s.caption=r),s}(e,t)},{tag:"iframe",priority:60,getAttrs:e=>function(t,e){const n=I(t.getAttribute("src")??"",e.providers);if(!n||!F(n.videoId))return!1;const o={provider:n.provider,videoId:n.videoId,aspectRatio:ut(t,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.getAttribute("title")??"",privacy:e.privacy};return n.hash&&(o.hash=n.hash),o}(e,t)}],sanitize:{tags:["figure","figcaption","a","img","iframe"],attrs:["href","rel","src","alt","title","allow","allowfullscreen","referrerpolicy","loading","width","height","frameborder","class","style"]}}}(this.config,this.locale)),this.overlay=new et(t,this.config,this.locale),this.registerNodeView(t),function(t){t.registerCommand("removeVideo",()=>Y(t))}(t),this.registerInsertCommand(t),this.registerResizeCommands(t),this.registerResizeKeymaps(t),this.registerPasteInterceptor(t),this.registerToolbarItem(t)}destroy(){(wt=Math.max(0,wt-1))>0||!kt||(A.removeHook("uponSanitizeElement"),kt=null,At.clear()),this.embedPrompt?.close(),this.embedPrompt=null,this.overlay?.close(!1),this.overlay=null,this.context=null}onStateChange(t,e,n){this.context&&!this.isVideoSelected(t)&&this.isVideoSelected(e)&&this.announceVideoSelection(e)}registerNodeView(t){t.registerNodeView(j,xt({config:this.config,locale:this.locale,resolvedKeymap:this.resolvedKeymap,announce:e=>t.announce(e),actions:{edit:()=>this.overlay?.openEditForSelected(),align:e=>function(t,e){const n=Z(t.getState());return!!n&&G(t,{...n.block.attrs??{},align:e})}(t,e),remove:()=>Y(t)}}))}registerInsertCommand(t){t.registerCommand("insertVideo",()=>(this.isVideoSelected(t.getState())?this.overlay?.openEditForSelected():this.overlay?.openInsert(),!0))}registerResizeCommands(t){const e=this.config.widthStep,n=this.config.widthStepLarge,o=e=>{const n=function(t,e,n){const o=Z(t.getState());if(!o)return!1;const i=o.block.attrs?.widthPercent??n.defaultWidthPercent,r=O(i+e,n);return r!==i&&G(t,{...o.block.attrs??{},widthPercent:r})}(t,e,this.config);return n&&this.announceCurrentSize(t),n};t.registerCommand("resizeVideoGrow",()=>o(e)),t.registerCommand("resizeVideoShrink",()=>o(-e)),t.registerCommand("resizeVideoGrowLarge",()=>o(n)),t.registerCommand("resizeVideoShrinkLarge",()=>o(-n)),t.registerCommand("resetVideoSize",()=>{const e=function(t,e){const n=Z(t.getState());return!!n&&G(t,{...n.block.attrs??{},widthPercent:e.defaultWidthPercent})}(t,this.config);return e&&t.announce(this.locale.resetToDefaultSize),e})}registerResizeKeymaps(t){const e={growWidth:"resizeVideoGrow",shrinkWidth:"resizeVideoShrink",growWidthLarge:"resizeVideoGrowLarge",shrinkWidthLarge:"resizeVideoShrinkLarge",resetSize:"resetVideoSize"},n={};for(const[o,i]of Object.entries(e)){const e=this.resolvedKeymap[o]??null;e&&(n[e]=()=>t.executeCommand(i))}Object.keys(n).length>0&&t.registerKeymap(n)}registerPasteInterceptor(t){t.registerPasteInterceptor(_t({providers:this.config.providers,onOffer:(t,e)=>this.offerEmbed(t,e)}),{name:"video",priority:40})}offerEmbed(t,e){if(!this.context)return;const o=this.context,i=H(e.provider,this.config.providers);this.embedPrompt?.close(),requestAnimationFrame(()=>{o.announce(this.locale.embedOfferAnnounce(i));const e=function(t,e){const o=t.getBlock(e.blockId);if(!o)return"";const i=n(o);return i.slice(e.start,Math.min(e.end,i.length))}(o.getState(),t);this.embedPrompt=function(t){const{locale:e}=t,n=document.createElement("div");n.className="notectl-video-embed-prompt",n.setAttribute("role","dialog"),n.setAttribute("aria-label",e.embedPrompt);const o=document.createElement("span");o.className="notectl-video-embed-prompt__text",o.textContent=e.embedPrompt;const i=document.createElement("button");i.type="button",i.className="notectl-video-embed-prompt__embed",i.textContent=e.embedConfirm;const r=document.createElement("button");r.type="button",r.className="notectl-video-embed-prompt__dismiss",r.textContent=e.embedDismiss,n.append(o,i,r);let a=null,s=!1;const l=()=>{s||(s=!0,a&&(document.removeEventListener("mousedown",a,!0),a=null),n.remove())},d=t=>{l(),t()};return i.addEventListener("mousedown",t=>t.preventDefault()),i.addEventListener("click",e=>{e.preventDefault(),d(t.onEmbed)}),r.addEventListener("mousedown",t=>t.preventDefault()),r.addEventListener("click",e=>{e.preventDefault(),d(t.onDismiss)}),n.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),d(t.onDismiss))}),t.container.appendChild(n),w(n),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||240,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),s=window.innerHeight-t.offsetHeight-8,l=Math.min(n+8,Math.max(8,s));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(l)}px`}(n,t.rect),a=e=>{e.composedPath().includes(n)||d(t.onDismiss)},requestAnimationFrame(()=>{a&&document.addEventListener("mousedown",a,!0),i.focus()}),{close:l}}({container:o.getPluginContainer("top"),rect:Pt(),locale:this.locale,onEmbed:()=>{this.embedPrompt=null,this.overlay?.openInsertReplacingRange(t,e)},onDismiss:()=>{this.embedPrompt=null,o.getContainer().focus()}})})}registerToolbarItem(t){t.registerToolbarItem({id:"video",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm6 4.5v7l6-3.5-6-3.5z" fill="currentColor"/></svg>',label:this.locale.insertVideo,tooltip:this.locale.insertVideoTooltip,command:"insertVideo"})}isVideoSelected(t){const e=t.selection;return!!r(e)&&t.getBlock(e.nodeId)?.type===j}announceVideoSelection(t){if(!this.context)return;const e=t.selection;if(!r(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=n.attrs?.title??"",i=[o?this.locale.videoSelectedWithTitle(o):this.locale.videoSelected],a=this.resolvedKeymap.shrinkWidth??null,s=this.resolvedKeymap.growWidth??null;a&&s&&i.push(this.locale.resizeHint(_(a),_(s))),this.context.announce(i.join(" "))}announceCurrentSize(t){const e=function(t,e){const n=Z(t);return n?n.block.attrs?.widthPercent??e.defaultWidthPercent:null}(t.getState(),this.config);null!==e&&t.announce(this.locale.videoResized(e))}};function Pt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}export{M as a,W as i,ot as n,S as o,rt as r,I as s,Ct as t};
|
|
2
|
-
//# sourceMappingURL=VideoPlugin-
|
|
1
|
+
import{S as t,d as e,h as n,i as o}from"./Document-r7vLOAGA.mjs";import{c as i,l as r,o as a,r as l,t as s,u as d}from"./Selection-HYoVFpAx.mjs";import{a as c}from"./TypeBrands-Ch9856Gb.mjs";import{n as u}from"./DomUtils-Bf7JLFlx.mjs";import{n as p,r as h}from"./HTMLUtils-C6B4UT00.mjs";import{s as m}from"./BlockInsertion-6rR9tIGP.mjs";import{t as v}from"./NodeSelectionCommands-Dj4VxLdD.mjs";import{t as f}from"./Platform-ByobkiCc.mjs";import{c as b,r as g}from"./StyleRuntime-BFKu52mS.mjs";import{c as y,o as x}from"./PluginHelpers-KDuTlmXm.mjs";import{t as _}from"./ShortcutFormatting-TwiufqeV.mjs";import{i as w}from"./PopupPositioning-BB97-__N.mjs";import A from"dompurify";var k=/^[A-Za-z0-9_-]{11}$/,C=/^\d+$/,P=/^[A-Za-z0-9]+$/,z=/^[A-Za-z0-9]+$/;function E(t,e){const n=t.indexOf(e);if(-1!==n)return t[n+1]}function L(t,e,n){const o=e.searchParams.get("h")??n;return o&&P.test(o)?{videoId:t,hash:o}:{videoId:t}}var S=[{id:"youtube",label:"YouTube",hostnames:["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtu.be","youtube-nocookie.com","www.youtube-nocookie.com"],embedHostnames:["www.youtube-nocookie.com","youtube-nocookie.com","www.youtube.com","youtube.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("youtu.be"===e){const t=n[0];return t&&k.test(t)?{videoId:t}:null}const o=t.searchParams.get("v");if(o&&k.test(o))return{videoId:o};for(const i of["embed","shorts","live","v"]){const t=E(n,i);if(t&&k.test(t))return{videoId:t}}return null},buildEmbedUrl(t,e){const n=e.privacy?"www.youtube-nocookie.com":"www.youtube.com",o=V({rel:"0",...e.autoplay?{autoplay:"1"}:{}});return`https://${n}/embed/${t.videoId}${o}`},buildWatchUrl:t=>`https://www.youtube.com/watch?v=${t.videoId}`,thumbnailUrl:t=>`https://i.ytimg.com/vi/${t.videoId}/hqdefault.jpg`},{id:"vimeo",label:"Vimeo",hostnames:["vimeo.com","www.vimeo.com","player.vimeo.com"],embedHostnames:["player.vimeo.com"],parse(t){const e=t.pathname.split("/").filter(Boolean),n=E(e,"video");if(n&&C.test(n))return L(n,t,void 0);const o=e.find(t=>C.test(t));return o?L(o,t,e[e.indexOf(o)+1]):null},buildEmbedUrl(t,e){const n=V({...t.hash?{h:t.hash}:{},...e.privacy?{dnt:"1"}:{},...e.autoplay?{autoplay:"1"}:{}});return`https://player.vimeo.com/video/${t.videoId}${n}`},buildWatchUrl(t){const e=`https://vimeo.com/${t.videoId}`;return t.hash?`${e}/${t.hash}`:e}},{id:"dailymotion",label:"Dailymotion",hostnames:["dailymotion.com","www.dailymotion.com","geo.dailymotion.com","dai.ly"],embedHostnames:["www.dailymotion.com","geo.dailymotion.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("dai.ly"===e){const t=n[0];return t&&z.test(t)?{videoId:t}:null}const o=E(n,"video");return o&&z.test(o)?{videoId:o}:null},buildEmbedUrl(t,e){const n=V(e.autoplay?{autoplay:"1"}:{});return`https://www.dailymotion.com/embed/video/${t.videoId}${n}`},buildWatchUrl:t=>`https://www.dailymotion.com/video/${t.videoId}`,thumbnailUrl:t=>`https://www.dailymotion.com/thumbnail/video/${t.videoId}`}];function I(t,e=S){const n=B(t);if(!n)return null;if("https:"!==n.protocol&&"http:"!==n.protocol)return null;const o=n.hostname.toLowerCase();for(const i of e){if(!i.hostnames.includes(o))continue;const t=i.parse(n);if(t)return{provider:i.id,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}return null}function R(t,e=S){return e.find(e=>e.id===t)}function $(t,e){const n=R(t.provider,e);return n?n.buildWatchUrl(t):null}function N(t,e){return R(t.provider,e)?.thumbnailUrl?.(t)}function H(t,e=S){return R(t,e)?.label??t}function B(t){try{return new URL(t.trim())}catch{return null}}function V(t){const e=Object.entries(t);return 0===e.length?"":`?${e.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&")}`}var M={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},W={providers:S,facade:!0,useProviderThumbnail:!1,privacy:!0,allowedAspectRatios:["16/9","4/3","1/1","9/16"],defaultAspectRatio:"16/9",defaultWidthPercent:100,minWidthPercent:25,widthStep:10,widthStepLarge:25,resizable:!0},j="video",D=/^\d+(?:\.\d+)?\s*\/\s*\d+(?:\.\d+)?$/;function T(t,e){if(!t||!D.test(t.trim()))return e.defaultAspectRatio;const[n,o]=t.split("/");return`${n?.trim()} / ${o?.trim()}`}function O(t,e){return Number.isFinite(t)?Math.max(e.minWidthPercent,Math.min(100,Math.round(t))):e.defaultWidthPercent}var U=/^[A-Za-z0-9_-]+$/;function F(t){return t.length>0&&t.length<=64&&U.test(t)}function K(t,e){return{provider:t?.provider??"",videoId:t?.videoId??"",...t?.hash?{hash:t.hash}:{},aspectRatio:T(t?.aspectRatio,e),widthPercent:O(t?.widthPercent??e.defaultWidthPercent,e),align:t?.align??"center",title:t?.title??"",...t?.caption?{caption:t.caption}:{},privacy:t?.privacy??e.privacy}}function q(t,e){const n=I(t.url,e.providers);return n?{provider:n.provider,videoId:n.videoId,...n.hash?{hash:n.hash}:{},aspectRatio:T(t.aspectRatio,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.title,...t.caption?{caption:t.caption}:{},privacy:e.privacy}:null}function X(t){return{provider:t.provider,videoId:t.videoId,aspectRatio:t.aspectRatio,widthPercent:t.widthPercent,align:t.align,title:t.title,privacy:t.privacy,...t.hash?{hash:t.hash}:{},...t.caption?{caption:t.caption}:{}}}function Z(t){const e=t.selection;if(!r(e))return null;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return null;const o=t.getNodePath(e.nodeId);return o?{block:n,path:o}:null}function G(t,e){const n=t.getState(),o=Z(n);return!!o&&(t.dispatch(n.transaction("command").setNodeAttr(o.path,e).build()),!0)}function Y(t){const e=t.getState(),n=Z(e);if(!n)return!1;const o=v(e,l(n.block.id,n.path));return!!o&&(t.dispatch(o),!0)}var J=0;function Q(t){return`${t}-${J+=1}`}function tt(t,e){const n=Q("notectl-video-field"),o=document.createElement("div");o.className="notectl-video-popup__field";const i=document.createElement("label");i.className="notectl-video-popup__label",i.setAttribute("for",n),i.textContent=e.label,o.appendChild(i);const r=document.createElement("input");r.id=n,r.type=e.type,r.value=e.value,r.placeholder=e.placeholder,r.className="notectl-video-popup__input",r.setAttribute("aria-label",e.ariaLabel),e.required&&r.setAttribute("aria-required","true");const a=[];if(e.hint){const t=`${n}-hint`,i=document.createElement("p");i.id=t,i.className="notectl-video-popup__hint",i.textContent=e.hint,o.appendChild(i),a.push(t)}return e.describedBy&&a.push(e.describedBy),a.length>0&&r.setAttribute("aria-describedby",a.join(" ")),o.insertBefore(r,o.children[1]??null),t.appendChild(o),r}var et=class{context;config;locale;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.config=e,this.locale=n}get isOpen(){return null!==this.panel}openInsert(){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,onSubmit:n=>{const a=q(n,this.config);a&&function(n,a){const s=n.getState(),d=s.selection;if(i(d))return!1;const u=X(a),p=r(d)?d.nodeId:d.anchor.blockId,h=function(t,e){if("table_cell"===t.getBlock(e)?.type)return e;const n=t.getNodePath(e);if(n)for(const o of n)if("table_cell"===t.getBlock(o)?.type)return o}(s,p);h?function(n,i,r,a){const s=n.getNodePath(r),d=n.getBlock(r);if(!s||!d)return!1;const u=o(c(j),[],void 0,a),p=n.transaction("command"),h=e(d);for(let e=h.length-1;e>=0;e--){const n=d.children.findIndex(n=>t(n)&&n.id===h[e]?.id);-1!==n&&p.removeNode(s,n)}p.insertNode(s,0,u),p.setSelection(l(u.id,[...s,u.id])),i.dispatch(p.build())}(s,n,h,u):function(t,e,n,i){const r=o(c(j),[],void 0,i),a=t.transaction("command");!!m(t,a,n,r)&&(a.setSelection(l(r.id,[])),e.dispatch(a.build()))}(s,n,p,u)}(this.context,a)}})}openInsertReplacingRange(e,i){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,initial:{url:i},onSubmit:i=>{const r=q(i,this.config);r&&function(e,i,r){const a=e.getState(),s=a.getBlock(i.blockId);if(!s)return!1;const d=function(e,n){const o=e.getNodePath(n);if(!o||0===o.length)return null;if(1===o.length){const t=e.doc.children.findIndex(t=>t.id===n);return-1===t?null:{parentPath:[],index:t}}const i=o[o.length-2],r=i?e.getBlock(i):void 0;if(!r)return null;const a=r.children.findIndex(e=>t(e)&&e.id===n);return-1===a?null:{parentPath:o.slice(0,-1),index:a}}(a,i.blockId);if(!d)return!1;const u=0===Math.max(0,n(s).length-(i.end-i.start))&&"paragraph"===s.type,p=o(c(j),[],void 0,X(r)),h=0===d.parentPath.length?[]:[...d.parentPath,p.id],m=a.transaction("command");u?(m.removeNode(d.parentPath,d.index),m.insertNode(d.parentPath,d.index,p),0===d.parentPath.length&&d.index>=a.doc.children.length-1&&m.insertNode([],d.index+1,o(c("paragraph")))):(m.deleteTextAt(i.blockId,i.start,i.end),m.insertNode(d.parentPath,d.index+1,p)),m.setSelection(l(p.id,h)),e.dispatch(m.build())}(this.context,e,r)}})}openEditForSelected(){if(this.context.isReadOnly())return;const t=this.context.getState(),e=t.selection;if(!r(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=K(n.attrs,this.config),i={url:$({provider:o.provider,videoId:o.videoId,...o.hash?{hash:o.hash}:{}},this.config.providers)??"",title:o.title,caption:o.caption??"",aspectRatio:o.aspectRatio};this.open({rect:this.videoRect(e.nodeId),mode:"edit",label:this.locale.editDialogLabel,initial:i,onSubmit:t=>{!function(t,e,n){const o=Z(t.getState());if(!o)return!1;const i=I(e.url,n.providers);if(!i)return!1;const r=function(t,e){const n={};for(const[o,i]of Object.entries(t??{}))e.includes(o)||(n[o]=i);return n}(o.block.attrs,["hash","caption"]);r.provider=i.provider,r.videoId=i.videoId,r.title=e.title,r.aspectRatio=T(e.aspectRatio,n),i.hash&&(r.hash=i.hash),e.caption.trim()&&(r.caption=e.caption.trim()),G(t,r)}(this.context,t,this.config)}})}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-video-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","false"),e.setAttribute("aria-label",t.label),this.panel=e,function(t,e){const{config:n,locale:o,initial:i,mode:r}=e;t.classList.add("notectl-video-popup");const a=Q("notectl-video-error"),l=document.createElement("p");l.id=a,l.className="notectl-video-popup__error",l.setAttribute("role","alert");const s=tt(t,{label:o.urlLabel,ariaLabel:o.urlAria,placeholder:o.urlPlaceholder,value:i?.url??"",type:"url",required:!0,describedBy:a}),d=tt(t,{label:o.titleLabel,ariaLabel:o.titleAria,placeholder:o.titlePlaceholder,value:i?.title??"",type:"text",required:!0,hint:o.titleHint}),c=tt(t,{label:o.captionLabel,ariaLabel:o.captionAria,placeholder:o.captionPlaceholder,value:i?.caption??"",type:"text"}),u=function(t,e,n,o){const i=Q("notectl-video-field"),r=document.createElement("div");r.className="notectl-video-popup__field";const a=document.createElement("label");a.className="notectl-video-popup__label",a.setAttribute("for",i),a.textContent=n.aspectRatioLabel,r.appendChild(a);const l=document.createElement("select");l.id=i,l.className="notectl-video-popup__select",l.setAttribute("aria-label",n.aspectRatioAria);const s=e.allowedAspectRatios.includes(o)?e.allowedAspectRatios:[o,...e.allowedAspectRatios];for(const d of s){const t=document.createElement("option");t.value=d,t.textContent=d,d===o&&(t.selected=!0),l.appendChild(t)}return r.appendChild(l),t.appendChild(r),l}(t,n,o,i?.aspectRatio??n.defaultAspectRatio);t.appendChild(l);const p=document.createElement("div");p.className="notectl-video-popup__actions";const h=document.createElement("button");h.type="button",h.className="notectl-video-popup__cancel",h.textContent=o.cancelButton;const m=document.createElement("button");m.type="button",m.className="notectl-video-popup__submit",m.textContent="edit"===r?o.updateButton:o.insertButton,m.setAttribute("aria-label","edit"===r?o.updateAria:o.insertAria),p.append(h,m),t.appendChild(p);const v=(t,e)=>{l.textContent=t,e.focus()},f=()=>{const t=s.value.trim();if(!I(t,n.providers))return void v(o.invalidUrl,s);const i=d.value.trim();i?(l.textContent="",e.onSubmit({url:t,title:i,caption:c.value.trim(),aspectRatio:u.value}),e.onClose()):v(o.titleRequired,d)};h.addEventListener("mousedown",t=>t.preventDefault()),h.addEventListener("click",t=>{t.preventDefault(),e.onClose()}),m.addEventListener("mousedown",t=>t.preventDefault()),m.addEventListener("click",t=>{t.preventDefault(),f()});for(const b of[s,d,c])b.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),f())});requestAnimationFrame(()=>s.focus())}(e,{mode:t.mode,initial:t.initial,config:this.config,locale:this.locale,onSubmit:t.onSubmit,onClose:()=>this.close(!0)}),e.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close(!0))}),this.context.getPluginContainer("top").appendChild(e),w(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||320,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(e,t.rect),this.installOutsideHandler()}videoRect(t){const e=this.context.getContainer().querySelector(`[data-block-id="${t}"]`);return e?e.getBoundingClientRect():null}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function nt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}var ot={insertVideo:"Insert Video",insertVideoTooltip:"Insert Video",urlLabel:"Video URL",urlPlaceholder:"https://www.youtube.com/watch?v=...",urlAria:"Video URL",titleLabel:"Title",titlePlaceholder:"Describe the video",titleAria:"Video title",titleHint:"Describes the video for screen readers. Required.",captionLabel:"Caption",captionPlaceholder:"Optional visible caption",captionAria:"Video caption",aspectRatioLabel:"Aspect ratio",aspectRatioAria:"Video aspect ratio",insertButton:"Insert",insertAria:"Insert video",updateButton:"Update",updateAria:"Update video",cancelButton:"Cancel",insertDialogLabel:"Insert video",editDialogLabel:"Edit video",invalidUrl:"Enter a YouTube, Vimeo, or Dailymotion video URL.",titleRequired:"Enter a title so screen readers can describe the video.",play:t=>t?`Play video: ${t}`:"Play video",loading:"Loading video...",providerBadge:t=>`${t} video`,closePlayer:"Close video player",videoAria:(t,e)=>e?`${t} video: ${e}`:`${t} video`,videoSelected:"Video selected.",videoSelectedWithTitle:t=>`Video selected: ${t}.`,resizeHint:(t,e)=>`${t} / ${e} to resize.`,keyboardResizeHint:(t,e)=>`${t} / ${e} to resize`,videoResized:t=>`Video resized to ${t} percent width.`,resetToDefaultSize:"Video reset to full width.",enteredPlayer:t=>t?`Playing ${t}. Press Escape to return to the document.`:"Playing video. Press Escape to return to the document.",exitedPlayer:"Returned to the document.",videoOptions:"Video options",editVideo:"Edit video",alignStart:"Align left",alignCenter:"Align center",alignEnd:"Align right",deleteVideo:"Delete video",embedPrompt:"Embed this video?",embedConfirm:"Embed",embedDismiss:"Keep as link",embedOfferAnnounce:t=>`${t} link pasted. Press Embed to turn it into a video, or continue editing to keep it as a link.`,embeddedAnnounce:"Video embedded."},it=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--O0A9OTR.mjs"),"./locales/de.ts":()=>import("./de-BxQIt_1Y.mjs"),"./locales/es.ts":()=>import("./es-BQweZX6P.mjs"),"./locales/fr.ts":()=>import("./fr-C3EKRThN.mjs"),"./locales/hi.ts":()=>import("./hi-L6pJxZam.mjs"),"./locales/pt.ts":()=>import("./pt-Bb908r0n.mjs"),"./locales/ru.ts":()=>import("./ru-DkW9XZFy.mjs"),"./locales/zh.ts":()=>import("./zh-ikm3rSTR.mjs")});async function rt(t){return y(it,t,ot)}var at={start:"notectl-video--start",center:"notectl-video--center",end:"notectl-video--end"};function lt(t,e){for(const o of Object.values(at))t.classList.remove(o);const n=at[e]??at.center;t.classList.add(n)}function st(t,e,n){b(t,"aspect-ratio",e),b(t,"width",`${n}%`)}var dt=/^[A-Za-z0-9]+$/;function ct(t){return{provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}function ut(t,e){const n=Number.parseFloat(t.getAttribute("width")??""),o=Number.parseFloat(t.getAttribute("height")??"");return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0?T(`${n}/${o}`,e):e.defaultAspectRatio}function pt(t,e,n){const o=function(t,e,n){const o=R(t.provider,e);return o?o.buildEmbedUrl(t,n):null}({provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}},e.providers,{privacy:t.privacy,autoplay:!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches})??"",i=document.createElement("iframe");return i.className="notectl-video__iframe",i.setAttribute("src",o),i.setAttribute("title",t.title||n.providerBadge(H(t.provider,e.providers))),i.setAttribute("allow","autoplay; fullscreen; picture-in-picture; encrypted-media"),i.setAttribute("allowfullscreen","true"),i.setAttribute("referrerpolicy","no-referrer"),i.setAttribute("loading","lazy"),i.setAttribute("frameborder","0"),i}var ht=class{frame;getAttrs;config;locale;announce;facadeButton=null;player=null;iframe=null;escapeHandler=null;renderedKey="";constructor(t){this.frame=t.frame,this.getAttrs=t.getAttrs,this.config=t.config,this.locale=t.locale,this.announce=t.announce,this.renderFacade()}get isActive(){return null!==this.player}facadeKey(t){return[t.provider,t.videoId,t.hash??"",t.privacy,t.title,this.config.useProviderThumbnail].join("|")}renderFacade(){this.facadeButton?.remove();const t=this.getAttrs();this.renderedKey=this.facadeKey(t);const e=document.createElement("button");e.type="button",e.className="notectl-video__facade",e.setAttribute("aria-label",this.locale.play(t.title));const n=document.createElement("span");if(n.className="notectl-video__poster",n.setAttribute("aria-hidden","true"),this.config.useProviderThumbnail){const e=N({provider:t.provider,videoId:t.videoId},this.config.providers);e&&b(n,"background-image",`url("${e}")`)}const o=document.createElement("span");o.className="notectl-video__play-icon",o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 68 48" width="48" height="34" aria-hidden="true" focusable="false"><path d="M66.5 7.7c-.8-2.9-2.5-5.4-5.4-6.2C55.8.1 34 0 34 0S12.2.1 6.9 1.5C4 2.3 2.3 4.8 1.5 7.7.1 13 0 24 0 24s.1 11 1.5 16.3c.8 2.9 2.5 5.4 5.4 6.2C12.2 47.9 34 48 34 48s21.8-.1 27.1-1.5c2.9-.8 4.6-3.3 5.4-6.2C67.9 35 68 24 68 24s-.1-11-1.5-16.3z" fill="currentColor"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>';const i=document.createElement("span");i.className="notectl-video__badge",i.setAttribute("aria-hidden","true"),i.textContent=this.locale.providerBadge(H(t.provider,this.config.providers)),e.append(n,o,i),e.addEventListener("mousedown",t=>t.stopPropagation()),e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.activate()}),this.facadeButton=e,this.frame.insertBefore(e,this.frame.firstChild)}update(){const t=this.getAttrs(),e=this.facadeKey(t);if(e!==this.renderedKey){if(this.renderedKey=e,this.isActive&&this.iframe){const e=pt(t,this.config,this.locale);return this.iframe.replaceWith(e),void(this.iframe=e)}this.renderFacade()}}activate(){if(this.isActive||!this.facadeButton)return;const t=this.getAttrs(),e=document.createElement("div");e.className="notectl-video__player";const n=document.createElement("button");n.type="button",n.className="notectl-video__exit",n.setAttribute("aria-label",this.locale.closePlayer),n.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M19 6.4 17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z" fill="currentColor"/></svg>',n.addEventListener("mousedown",t=>t.stopPropagation()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deactivate(!0)});const o=pt(t,this.config,this.locale);e.append(n,o),this.facadeButton.remove(),this.facadeButton=null,this.frame.insertBefore(e,this.frame.firstChild),this.player=e,this.iframe=o,this.escapeHandler=t=>{"Escape"===t.key&&(t.stopPropagation(),this.deactivate(!0))},this.frame.addEventListener("keydown",this.escapeHandler),o.focus(),this.announce(this.locale.enteredPlayer(t.title))}deactivate(t){this.player&&(this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player.remove(),this.player=null,this.iframe=null,this.renderFacade(),t&&this.facadeButton?.focus(),this.announce(this.locale.exitedPlayer))}destroy(){this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player?.remove(),this.player=null,this.iframe=null,this.facadeButton?.remove(),this.facadeButton=null}},mt=["w","e"],vt={w:-1,e:1},ft=null;function bt(){ft?.remove(),ft=null}function gt(t,e,n,o,i,r){let a=0,l=0,s=0,d=0,c=vt[e];const u=t=>{const e=(t.clientX-a)*c;var n,r;n=l+(s>0?e/s*100:0),r=i.minPercent,d=Math.max(r,Math.min(100,n)),i.applyLiveWidth(d),o.textContent=i.formatPercent(Math.round(d))},p=t=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p),n.classList.remove("notectl-video__resize-overlay--active"),o.classList.remove("notectl-video__size-indicator--visible"),bt(),i.commit(Math.round(d)),t.target?.releasePointerCapture?.(t.pointerId)};r(()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p)}),t.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation(),a=t.clientX,l=i.getWidthPercent(),d=l,s=i.getReferenceWidth(),c=i.isRtl()?-vt[e]:vt[e],n.classList.add("notectl-video__resize-overlay--active"),o.textContent=i.formatPercent(Math.round(l)),o.classList.add("notectl-video__size-indicator--visible"),function(t){bt(),ft=document.createElement("style");const e=g(t);e&&ft.setAttribute("nonce",e),ft.textContent="*{cursor:ew-resize!important;user-select:none!important}",document.head.appendChild(ft)}(n),t.target.setPointerCapture(t.pointerId),document.addEventListener("pointermove",u),document.addEventListener("pointerup",p)})}function yt(t,e,n){const o=document.createElement("button");return o.type="button",o.className="notectl-video__tool",o.setAttribute("aria-label",t),o.title=t,o.innerHTML=e,o.addEventListener("mousedown",t=>t.preventDefault()),o.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),n()}),o}function xt(t){const{config:e,locale:n,resolvedKeymap:o,announce:i,actions:r}=t;return(t,a,l)=>{const s=document.createElement("figure");s.className="notectl-video",s.setAttribute("data-block-id",t.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const d=document.createElement("div");d.className="notectl-video__frame",s.appendChild(d);let c=t.id,u=K(t.attrs,e),p=null,h=null,m=null;const v=new ht({frame:d,getAttrs:()=>u,config:e,locale:n,announce:i});function g(t){var o;u=K(t.attrs,e),st(d,u.aspectRatio,u.widthPercent),lt(s,u.align),s.setAttribute("aria-label",n.videoAria(H(u.provider,e.providers),u.title)),(o=u.caption)?(p||(p=document.createElement("figcaption"),p.className="notectl-video__caption",s.appendChild(p)),p.textContent!==o&&(p.textContent=o)):p&&(p.remove(),p=null),v.update(),m?.update(u.align)}function y(){h&&(h.destroy(),h.element.remove(),h=null)}return g(t),{dom:s,contentDOM:null,update:t=>"video"===t.type&&(c=t.id,s.setAttribute("data-block-id",t.id),g(t),!0),selectNode(){s.classList.add("notectl-video--selected"),e.resizable&&!h&&(h=function(t,e){const n=document.createElement("div");n.className="notectl-video__resize-overlay",n.setAttribute("data-notectl-no-print","");const o=document.createElement("div");o.className="notectl-video__size-indicator",n.appendChild(o);let i=null;for(const r of mt){const e=document.createElement("div");e.className=`notectl-video__resize-handle notectl-video__resize-handle--${r}`,e.setAttribute("aria-hidden","true"),gt(e,r,n,o,t,t=>{i=t}),n.appendChild(e)}if(e){const t=document.createElement("div");t.className="notectl-video__keyboard-hint",t.setAttribute("aria-hidden","true"),t.textContent=e,n.appendChild(t)}return{element:n,destroy(){i?.(),bt()}}}({minPercent:e.minWidthPercent,getWidthPercent:()=>u.widthPercent,getReferenceWidth:()=>s.clientWidth||d.clientWidth,isRtl:()=>"rtl"===f(s),applyLiveWidth:t=>b(d,"width",`${t}%`),commit:t=>function(t){const e=a(),n=e.getBlock(c);if(!n)return;const o=e.getNodePath(c);if(!o)return;const i={...n.attrs??{},widthPercent:t};l(e.transaction("command").setNodeAttr(o,i).build())}(t),formatPercent:t=>`${t}%`},function(t,e){const n=t.shrinkWidth??null,o=t.growWidth??null;return n&&o?e.keyboardResizeHint(_(n),_(o)):""}(o,n)),d.appendChild(h.element)),m||(m=function(t){const{locale:e,actions:n}=t,o=document.createElement("div");o.className="notectl-video__toolbar",o.setAttribute("role","toolbar"),o.setAttribute("aria-label",e.videoOptions),o.setAttribute("data-notectl-no-print",""),o.addEventListener("mousedown",t=>t.stopPropagation());const i=yt(e.editVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="currentColor"/></svg>',()=>n.edit()),r={start:yt(e.alignStart,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm0 7h12v2H3v-2zm0 7h18v2H3v-2zm0-3.5h12v-2H3v2z" fill="currentColor"/></svg>',()=>n.align("start")),center:yt(e.alignCenter,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm3 7h12v2H6v-2zm-3 7h18v2H3v-2zm3-3.5h12v-2H6v2z" fill="currentColor"/></svg>',()=>n.align("center")),end:yt(e.alignEnd,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm6 7h12v2H9v-2zm-6 7h18v2H3v-2zm6-3.5h12v-2H9v2z" fill="currentColor"/></svg>',()=>n.align("end"))},a=yt(e.deleteVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" fill="currentColor"/></svg>',()=>n.remove()),l=()=>{const t=document.createElement("span");return t.className="notectl-video__tool-separator",t.setAttribute("aria-hidden","true"),t};o.append(i,l(),r.start,r.center,r.end,l(),a);const s=t=>{for(const e of["start","center","end"]){const n=e===t;r[e].classList.toggle("notectl-video__tool--active",n),r[e].setAttribute("aria-pressed",n?"true":"false")}};return s(t.initialAlign),{element:o,update:s,destroy(){o.remove()}}}({locale:n,actions:r,initialAlign:u.align}),s.appendChild(m.element))},deselectNode(){s.classList.remove("notectl-video--selected"),y(),m?.destroy(),m=null},destroy(){y(),m?.destroy(),m=null,v.destroy()}}}}function _t(t){return(e,n,o)=>{const i=function(t,e,n){const o=t.trim();if(o&&!/\s/.test(o)){const t=I(o,n);if(t)return{url:o,match:t}}const i=function(t){if(!t)return null;const e=function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t),n=e.querySelector("iframe");if(!n)return null;const o=e.cloneNode(!0);for(const i of Array.from(o.querySelectorAll("iframe")))i.remove();return""!==(o.textContent??"").trim()?null:n.getAttribute("src")}(e);if(i){const t=I(i,n);if(t)return{url:$(t,n)??i,match:t}}return null}(e,n,t.providers);if(!i)return null;const r=o.selection;if(!d(r)||!a(r))return null;const l=r.anchor.blockId,c=r.anchor.offset,u=c+i.url.length,p=o.transaction("paste").insertText(l,c,i.url,[]).setSelection(s(l,u)).build();return t.onOffer({blockId:l,start:c,end:u},i.match),p}}var wt=0,At=/* @__PURE__ */new Set,kt=null;var Ct=class{id="video";name="Video";priority=47;config;resolvedKeymap;context=null;locale=ot;overlay=null;embedPrompt=null;constructor(t){this.config={...W,...t},this.resolvedKeymap={...M,...t?.keymap}}async init(t){this.context=t,this.locale=await x(t,this.config.locale,ot,rt),t.registerStyleSheet('\n.notectl-video {\n\tmargin: 12px 0;\n\tposition: relative;\n\tuser-select: none;\n}\n\n.notectl-video--center { text-align: center; }\n.notectl-video--start { text-align: start; }\n.notectl-video--end { text-align: end; }\n\n.notectl-video__frame {\n\tdisplay: inline-block;\n\tposition: relative;\n\twidth: 100%;\n\tmax-width: 100%;\n\tvertical-align: top;\n\toverflow: hidden;\n\tborder-radius: 8px;\n\tbackground: #000;\n\ttext-align: start;\n}\n\n/* Facade (click-to-load) */\n.notectl-video__facade {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 0;\n\tborder: 0;\n\tcursor: pointer;\n\tbackground: #14181c;\n\tcolor: #fff;\n}\n\n.notectl-video__facade:focus-visible {\n\toutline: 3px solid var(--notectl-primary);\n\toutline-offset: -3px;\n}\n\n.notectl-video__poster {\n\tposition: absolute;\n\tinset: 0;\n\tbackground-size: cover;\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n}\n\n.notectl-video__poster::after {\n\tcontent: "";\n\tposition: absolute;\n\tinset: 0;\n\tbackground: rgba(0, 0, 0, 0.25);\n}\n\n.notectl-video__play-icon {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: inline-flex;\n\tfilter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));\n\ttransition: transform 0.12s ease;\n}\n\n.notectl-video__facade:hover .notectl-video__play-icon {\n\ttransform: scale(1.08);\n}\n\n.notectl-video__badge {\n\tposition: absolute;\n\tz-index: 1;\n\tbottom: 8px;\n\tinset-inline-start: 8px;\n\tpadding: 2px 6px;\n\tborder-radius: 4px;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n\tfont-size: 12px;\n\tfont-weight: 600;\n}\n\n/* Player (activated iframe + exit control) */\n.notectl-video__player {\n\tposition: absolute;\n\tinset: 0;\n}\n\n.notectl-video__iframe {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n}\n\n.notectl-video__exit {\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 6px;\n\tinset-inline-end: 6px;\n\twidth: 28px;\n\theight: 28px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tborder: 0;\n\tborder-radius: 50%;\n\tcursor: pointer;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n}\n\n.notectl-video__exit:focus-visible {\n\toutline: 2px solid #fff;\n\toutline-offset: 2px;\n}\n\n/* Static fallback link (no-JS / export rehydration) */\n.notectl-video__fallback-link {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 8px;\n\tcolor: #fff;\n\ttext-decoration: underline;\n\ttext-align: center;\n}\n\n/* Caption */\n.notectl-video__caption {\n\tmargin-top: 6px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n\ttext-align: center;\n}\n\n/* Selection */\n.notectl-video--selected .notectl-video__frame {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Resize overlay + side handles */\n.notectl-video__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-video__resize-handle {\n\tposition: absolute;\n\ttop: 50%;\n\ttransform: translateY(-50%);\n\twidth: 8px;\n\theight: 44px;\n\tmax-height: 60%;\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-raised);\n\tpointer-events: all;\n\tcursor: ew-resize;\n\tz-index: 2;\n}\n\n.notectl-video__resize-handle--w { inset-inline-start: -5px; }\n.notectl-video__resize-handle--e { inset-inline-end: -5px; }\n\n.notectl-video__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-video__size-indicator--visible { opacity: 1; }\n\n.notectl-video__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-video--selected .notectl-video__keyboard-hint { display: block; }\n.notectl-video__resize-overlay--active ~ .notectl-video__keyboard-hint,\n.notectl-video__resize-overlay--active .notectl-video__keyboard-hint { display: none; }\n\n/* On-selection toolbar */\n.notectl-video__toolbar {\n\tposition: absolute;\n\ttop: -44px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n\tpadding: 2px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-overlay);\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-video__tool {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-video__tool:hover { background: var(--notectl-hover-bg); }\n\n.notectl-video__tool--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary);\n}\n\n.notectl-video__tool:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video__tool svg { width: 16px; height: 16px; }\n\n.notectl-video__tool-separator {\n\twidth: 1px;\n\theight: 18px;\n\tmargin: 0 2px;\n\tbackground: var(--notectl-border);\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.notectl-video__play-icon,\n\t.notectl-video__size-indicator {\n\t\ttransition: none;\n\t}\n}\n\n@media (forced-colors: active) {\n\t.notectl-video__frame { outline: 1px solid CanvasText; }\n\t.notectl-video__facade { border: 1px solid ButtonText; }\n\t.notectl-video__play-icon { forced-color-adjust: none; }\n\t.notectl-video__resize-handle { background: ButtonFace; border-color: ButtonText; }\n\t.notectl-video--selected .notectl-video__frame { outline: 2px solid Highlight; }\n}\n'),t.registerStyleSheet("\n.notectl-video-overlay {\n\tposition: fixed;\n\tz-index: 1000;\n\tbox-sizing: border-box;\n\tmin-width: 300px;\n\tmax-width: 92vw;\n\tpadding: 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 6px 24px var(--notectl-shadow);\n}\n\n.notectl-video-popup {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.notectl-video-popup__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.notectl-video-popup__label {\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__input,\n.notectl-video-popup__select {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__input:focus-visible,\n.notectl-video-popup__select:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video-popup__hint {\n\tmargin: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__error:not(:empty) {\n\tmargin: 0;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n\tfont-size: 12px;\n}\n\n.notectl-video-popup__actions {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tgap: 8px;\n\tmargin-top: 2px;\n}\n\n.notectl-video-popup__cancel,\n.notectl-video-popup__submit {\n\tpadding: 7px 14px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__submit {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-popup__cancel:focus-visible,\n.notectl-video-popup__submit:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Ask-first paste affordance */\n.notectl-video-embed-prompt {\n\tposition: fixed;\n\tz-index: 1000;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 6px 8px 6px 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px var(--notectl-shadow);\n\tfont-size: 13px;\n}\n\n.notectl-video-embed-prompt__text {\n\tmargin-inline-end: 4px;\n}\n\n.notectl-video-embed-prompt__embed,\n.notectl-video-embed-prompt__dismiss {\n\tpadding: 4px 10px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-embed-prompt__embed {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-embed-prompt__embed:focus-visible,\n.notectl-video-embed-prompt__dismiss:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n@media (forced-colors: active) {\n\t.notectl-video-overlay,\n\t.notectl-video-embed-prompt {\n\t\tborder: 1px solid CanvasText;\n\t}\n\t.notectl-video-popup__submit,\n\t.notectl-video-embed-prompt__embed {\n\t\tborder: 1px solid ButtonText;\n\t}\n}\n"),function(t){for(const e of t)At.add(e);wt+=1,kt||(kt=t=>{if("iframe"!==t.nodeName.toLowerCase())return;const e=t;e.hasAttribute("srcdoc")?e.parentNode?.removeChild(e):function(t,e){const n=B(t);return!!n&&"https:"===n.protocol&&e.has(n.hostname.toLowerCase())}(e.getAttribute("src")??"",At)||e.parentNode?.removeChild(e)},A.addHook("uponSanitizeElement",kt))}(function(t=S){const e=/* @__PURE__ */new Set;for(const n of t)for(const t of n.embedHostnames)e.add(t.toLowerCase());return e}(this.config.providers)),t.registerNodeSpec(function(t,e){const n=t.providers;return{type:"video",group:"block",isVoid:!0,selectable:!0,attrs:{provider:{default:""},videoId:{default:""},hash:{default:""},aspectRatio:{default:t.defaultAspectRatio},widthPercent:{default:t.defaultWidthPercent},align:{default:"center"},title:{default:""},caption:{default:""},privacy:{default:t.privacy}},toDOM(o){const i=K(o.attrs,t),r=u("figure",o.id);r.className="notectl-video",r.setAttribute("data-void","true"),r.setAttribute("data-selectable","true"),r.setAttribute("data-video-provider",i.provider),r.setAttribute("data-video-id",i.videoId),i.hash&&r.setAttribute("data-video-hash",i.hash),lt(r,i.align),r.setAttribute("aria-label",e.videoAria(H(i.provider,n),i.title));const a=document.createElement("div");a.className="notectl-video__frame",st(a,i.aspectRatio,i.widthPercent);const l=$(ct(i),n);if(l){const t=document.createElement("a");t.className="notectl-video__fallback-link",t.href=l,t.rel="noopener noreferrer",t.textContent=i.title||l,a.appendChild(t)}if(r.appendChild(a),i.caption){const t=document.createElement("figcaption");t.className="notectl-video__caption",t.textContent=i.caption,r.appendChild(t)}return r},toHTML(e){const o=K(e.attrs,t),i=ct(o),r=$(i,n),a=[`data-video-provider="${p(o.provider)}"`,`data-video-id="${p(o.videoId)}"`,`data-video-ratio="${p(o.aspectRatio)}"`,`data-video-width="${o.widthPercent}"`,`data-video-privacy="${o.privacy?"true":"false"}"`];o.hash&&a.push(`data-video-hash="${p(o.hash)}"`),o.title&&a.push(`data-video-title="${p(o.title)}"`);const l=t.useProviderThumbnail?N(i,n):void 0,s=l?`<img src="${p(l)}" alt="">`:h(o.title||r||""),d=r?`<a href="${p(r)}" rel="noopener noreferrer">${s}</a>`:s,c=o.caption?`<figcaption>${h(o.caption)}</figcaption>`:"";return`<figure ${a.join(" ")}>${d}${c}</figure>`},parseHTML:[{tag:"figure",priority:60,getAttrs:e=>function(t,e){const n=t.getAttribute("data-video-provider"),o=t.getAttribute("data-video-id");if(!n||!o)return!1;if(!F(o))return!1;if(!R(n,e.providers))return!1;const i=t.getAttribute("data-video-title")??t.querySelector("a")?.textContent?.trim()??t.getAttribute("aria-label")??"",r=t.querySelector("figcaption")?.textContent?.trim()??"",a=t.getAttribute("data-video-width"),l={provider:n,videoId:o,aspectRatio:T(t.getAttribute("data-video-ratio")??void 0,e),widthPercent:O(a?Number.parseFloat(a):e.defaultWidthPercent,e),align:"center",title:i,privacy:"false"!==t.getAttribute("data-video-privacy")},s=t.getAttribute("data-video-hash");return s&&dt.test(s)&&(l.hash=s),r&&(l.caption=r),l}(e,t)},{tag:"iframe",priority:60,getAttrs:e=>function(t,e){const n=I(t.getAttribute("src")??"",e.providers);if(!n||!F(n.videoId))return!1;const o={provider:n.provider,videoId:n.videoId,aspectRatio:ut(t,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.getAttribute("title")??"",privacy:e.privacy};return n.hash&&(o.hash=n.hash),o}(e,t)}],sanitize:{tags:["figure","figcaption","a","img","iframe"],attrs:["href","rel","src","alt","title","allow","allowfullscreen","referrerpolicy","loading","width","height","frameborder","class","style"]}}}(this.config,this.locale)),this.overlay=new et(t,this.config,this.locale),this.registerNodeView(t),function(t){t.registerCommand("removeVideo",()=>Y(t))}(t),this.registerInsertCommand(t),this.registerResizeCommands(t),this.registerResizeKeymaps(t),this.registerPasteInterceptor(t),this.registerToolbarItem(t)}destroy(){(wt=Math.max(0,wt-1))>0||!kt||(A.removeHook("uponSanitizeElement"),kt=null,At.clear()),this.embedPrompt?.close(),this.embedPrompt=null,this.overlay?.close(!1),this.overlay=null,this.context=null}onStateChange(t,e,n){this.context&&!this.isVideoSelected(t)&&this.isVideoSelected(e)&&this.announceVideoSelection(e)}registerNodeView(t){t.registerNodeView(j,xt({config:this.config,locale:this.locale,resolvedKeymap:this.resolvedKeymap,announce:e=>t.announce(e),actions:{edit:()=>this.overlay?.openEditForSelected(),align:e=>function(t,e){const n=Z(t.getState());return!!n&&G(t,{...n.block.attrs??{},align:e})}(t,e),remove:()=>Y(t)}}))}registerInsertCommand(t){t.registerCommand("insertVideo",()=>(this.isVideoSelected(t.getState())?this.overlay?.openEditForSelected():this.overlay?.openInsert(),!0))}registerResizeCommands(t){const e=this.config.widthStep,n=this.config.widthStepLarge,o=e=>{const n=function(t,e,n){const o=Z(t.getState());if(!o)return!1;const i=o.block.attrs?.widthPercent??n.defaultWidthPercent,r=O(i+e,n);return r!==i&&G(t,{...o.block.attrs??{},widthPercent:r})}(t,e,this.config);return n&&this.announceCurrentSize(t),n};t.registerCommand("resizeVideoGrow",()=>o(e)),t.registerCommand("resizeVideoShrink",()=>o(-e)),t.registerCommand("resizeVideoGrowLarge",()=>o(n)),t.registerCommand("resizeVideoShrinkLarge",()=>o(-n)),t.registerCommand("resetVideoSize",()=>{const e=function(t,e){const n=Z(t.getState());return!!n&&G(t,{...n.block.attrs??{},widthPercent:e.defaultWidthPercent})}(t,this.config);return e&&t.announce(this.locale.resetToDefaultSize),e})}registerResizeKeymaps(t){const e={growWidth:"resizeVideoGrow",shrinkWidth:"resizeVideoShrink",growWidthLarge:"resizeVideoGrowLarge",shrinkWidthLarge:"resizeVideoShrinkLarge",resetSize:"resetVideoSize"},n={};for(const[o,i]of Object.entries(e)){const e=this.resolvedKeymap[o]??null;e&&(n[e]=()=>t.executeCommand(i))}Object.keys(n).length>0&&t.registerKeymap(n)}registerPasteInterceptor(t){t.registerPasteInterceptor(_t({providers:this.config.providers,onOffer:(t,e)=>this.offerEmbed(t,e)}),{name:"video",priority:40})}offerEmbed(t,e){if(!this.context)return;const o=this.context,i=H(e.provider,this.config.providers);this.embedPrompt?.close(),requestAnimationFrame(()=>{o.announce(this.locale.embedOfferAnnounce(i));const e=function(t,e){const o=t.getBlock(e.blockId);if(!o)return"";const i=n(o);return i.slice(e.start,Math.min(e.end,i.length))}(o.getState(),t);this.embedPrompt=function(t){const{locale:e}=t,n=document.createElement("div");n.className="notectl-video-embed-prompt",n.setAttribute("role","dialog"),n.setAttribute("aria-label",e.embedPrompt);const o=document.createElement("span");o.className="notectl-video-embed-prompt__text",o.textContent=e.embedPrompt;const i=document.createElement("button");i.type="button",i.className="notectl-video-embed-prompt__embed",i.textContent=e.embedConfirm;const r=document.createElement("button");r.type="button",r.className="notectl-video-embed-prompt__dismiss",r.textContent=e.embedDismiss,n.append(o,i,r);let a=null,l=!1;const s=()=>{l||(l=!0,a&&(document.removeEventListener("mousedown",a,!0),a=null),n.remove())},d=t=>{s(),t()};return i.addEventListener("mousedown",t=>t.preventDefault()),i.addEventListener("click",e=>{e.preventDefault(),d(t.onEmbed)}),r.addEventListener("mousedown",t=>t.preventDefault()),r.addEventListener("click",e=>{e.preventDefault(),d(t.onDismiss)}),n.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),d(t.onDismiss))}),t.container.appendChild(n),w(n),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||240,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(n,t.rect),a=e=>{e.composedPath().includes(n)||d(t.onDismiss)},requestAnimationFrame(()=>{a&&document.addEventListener("mousedown",a,!0),i.focus()}),{close:s}}({container:o.getPluginContainer("top"),rect:Pt(),locale:this.locale,onEmbed:()=>{this.embedPrompt=null,this.overlay?.openInsertReplacingRange(t,e)},onDismiss:()=>{this.embedPrompt=null,o.getContainer().focus()}})})}registerToolbarItem(t){t.registerToolbarItem({id:"video",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm6 4.5v7l6-3.5-6-3.5z" fill="currentColor"/></svg>',label:this.locale.insertVideo,tooltip:this.locale.insertVideoTooltip,command:"insertVideo"})}isVideoSelected(t){const e=t.selection;return!!r(e)&&t.getBlock(e.nodeId)?.type===j}announceVideoSelection(t){if(!this.context)return;const e=t.selection;if(!r(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=n.attrs?.title??"",i=[o?this.locale.videoSelectedWithTitle(o):this.locale.videoSelected],a=this.resolvedKeymap.shrinkWidth??null,l=this.resolvedKeymap.growWidth??null;a&&l&&i.push(this.locale.resizeHint(_(a),_(l))),this.context.announce(i.join(" "))}announceCurrentSize(t){const e=function(t,e){const n=Z(t);return n?n.block.attrs?.widthPercent??e.defaultWidthPercent:null}(t.getState(),this.config);null!==e&&t.announce(this.locale.videoResized(e))}};function Pt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}export{M as a,W as i,ot as n,S as o,rt as r,I as s,Ct as t};
|
|
2
|
+
//# sourceMappingURL=VideoPlugin-B3uf1Dwp.mjs.map
|