modernleft-docs/.obsidian/plugins/editing-toolbar/main.js

12 lines
172 KiB
JavaScript
Raw Normal View History

2025-01-19 08:08:22 +00:00
"use strict";var e=require("obsidian");function t(e,t,o,n){return new(o||(o=Promise))((function(i,a){function l(e){try{s(n.next(e))}catch(e){a(e)}}function r(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(l,r)}s((n=n.apply(e,t||[])).next())}))}function o(e){return t(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}function n(e){let t=Date.now().toString(36);return t+=Math.random().toString(36).substr(3,e),t}function i(e,t,o){let n,i={index:-1,subindex:-1},a=e.settings.menuCommands;return o?a.forEach(((e,o)=>{if("SubmenuCommands"in e&&(n=e.SubmenuCommands.findIndex((e=>e.id==t.id)),n>=0))return i={index:o,subindex:n},i})):(n=a.findIndex((e=>e.id==t.id)),i={index:n,subindex:-1}),i}"function"==typeof SuppressedError&&SuppressedError;const a=["Custom","cMenuToolbar","cMenuToolbarSub","cMenuToolbarAdd","cMenuToolbarDelete","cMenuToolbarReload","codeblock-glyph","underline-glyph","superscript-glyph","subscript-glyph","bot-glyph","header-1","header-2","header-3","header-4","header-5","header-6","header-n","obsidian","accessibility","activity","air-vent","airplay","alarm-check","alarm-clock-off","alarm-clock","alarm-minus","alarm-plus","album","alert-circle","alert-octagon","alert-triangle","align-center-horizontal","align-center-vertical","align-center","align-end-horizontal","align-end-vertical","align-horizontal-distribute-center","align-horizontal-distribute-end","align-horizontal-distribute-start","align-horizontal-justify-center","align-horizontal-justify-end","align-horizontal-justify-start","align-horizontal-space-around","align-horizontal-space-between","align-justify","align-left","align-right","align-start-horizontal","align-start-vertical","align-vertical-distribute-center","align-vertical-distribute-end","align-vertical-distribute-start","align-vertical-justify-center","align-vertical-justify-end","align-vertical-justify-start","align-vertical-space-around","align-vertical-space-between","anchor","angry","annoyed","aperture","apple","archive-restore","archive","armchair","arrow-big-down","arrow-big-left","arrow-big-right","arrow-big-up","arrow-down-circle","arrow-down-left","arrow-down-right","arrow-down","arrow-left-circle","arrow-left-right","arrow-left","arrow-right-circle","arrow-right","arrow-up-circle","arrow-up-left","arrow-up-right","arrow-up","asterisk","at-sign","award","axe","axis-3d","baby","backpack","baggage-claim","banana","banknote","bar-chart-2","bar-chart-3","bar-chart-4","bar-chart-horizontal","bar-chart","baseline","bath","battery-charging","battery-full","battery-low","battery-medium","battery","beaker","bed-double","bed-single","bed","beer","bell-minus","bell-off","bell-plus","bell-ring","bell","bike","binary","bitcoin","bluetooth-connected","bluetooth-off","bluetooth-searching","bluetooth","bold","bomb","bone","book-open","book","bookmark-minus","bookmark-plus","bookmark","bot","box-select","box","boxes","briefcase","brush","bug","building-2","building","bus","cake","calculator","calendar-check-2","calendar-check","calendar-clock","calendar-days","calendar-heart","calendar-minus","calendar-off","calendar-plus","calendar-range","calendar-search","calendar-x2","calendar-x","calendar","camera-off","camera","car","carrot","cast","check-circle-2","check-circle","check-square","check","chef-hat","cherry","chevron-down","chevron-first","chevron-last","chevron-left","chevron-right","chevron-up","chevrons-down-up","chevrons-down","chevrons-left-right","chevrons-left","chevrons-right-left","chevrons-right","chevrons-up-down","chevrons-up","chrome","cigarette-off","cigarette","circle-dot","circle-ellipsis","circle-slashed","circle","citrus","clapperboard","clipboard-check","clipboard-copy","clipboard-edit","clipboard-list","clipboard-signature","clipboard-type","clipboard-x","clipboard","clock-1","clock-10","clock-11","clock-12","clock-2","clock-3","clock-4","clock-5","clock-6","clock-7","clock-8","clock-9","clock","cloud-cog","cloud-drizzle","cloud-fog","cloud-hail","cloud-lightning","clou
/**!
* Sortable 1.15.2
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/(n.cMenuFontColor,n.cMenuBackgroundColor))}()}function $(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function z(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?$(Object(o),!0).forEach((function(t){P(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):$(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function V(e){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},V(e)}function P(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function H(){return H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},H.apply(this,arguments)}function R(e,t){if(null==e)return{};var o,n,i=function(e,t){if(null==e)return{};var o,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)o=a[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}function Z(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var j=Z(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),W=Z(/Edge/i),X=Z(/firefox/i),Y=Z(/safari/i)&&!Z(/chrome/i)&&!Z(/android/i),G=Z(/iP(ad|od|hone)/i),U=Z(/chrome/i)&&Z(/android/i),K={capture:!1,passive:!1};function J(e,t,o){e.addEventListener(t,o,!j&&K)}function Q(e,t,o){e.removeEventListener(t,o,!j&&K)}function ee(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function te(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function oe(e,t,o,n){if(e){o=o||document;do{if(null!=t&&(">"===t[0]?e.parentNode===o&&ee(e,t):ee(e,t))||n&&e===o)return e;if(e===o)break}while(e=te(e))}return null}var ne,ie=/\s+/g;function ae(e,t,o){if(e&&t)if(e.classList)e.classList[o?"add":"remove"](t);else{var n=(" "+e.className+" ").replace(ie," ").replace(" "+t+" "," ");e.className=(n+(o?" "+t:"")).replace(ie," ")}}function le(e,t,o){var n=e&&e.style;if(n){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(o=e.currentStyle),void 0===t?o:o[t];t in n||-1!==t.indexOf("webkit")||(t="-webkit-"+t),n[t]=o+("string"==typeof o?"":"px")}}function re(e,t){var o="";if("string"==typeof e)o=e;else do{var n=le(e,"transform");n&&"none"!==n&&(o=n+" "+o)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(o)}function se(e,t,o){if(e){var n=e.getElementsByTagName(t),i=0,a=n.length;if(o)for(;i<a;i++)o(n[i],i);return n}return[]}function ce(){var e=document.scrollingElement;return e||document.documentElement}function de(e,t,o,n,i){if(e.getBoundingClientRect||e===window){var a,l,r,s,c,d,u;if(e!==window&&e.parentNode&&e!==ce()?(l=(a=e.getBoundingClientRect()).top,r=a.left,s=a.bottom,c=a.right,d=a.height,u=a.width):(l=0,r=0,s=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(t||o)&&e!==window&&(i=i||e.parentNode,!j))do{if(i&&i.getBoundingClientRect&&("none"!==le(i,"transform")||o&&"static"!==le(i,"position"))){var h=i.getBoundingClientRect();l-=h.top+parseInt(le(i,"border-top-width")),r-=h.left+parseInt(le(i,"border-left-width")),s=l+a.height,c=r+a.width;break}}while(i=i.parentNode);if(n&&e!==window){var p=re(i||e),g=p&&p.a,m=p&&p.d;p&&(s=(l/=m)+(
/*! Pickr 1.9.0 MIT | https://github.com/Simonwep/pickr */
var Ht=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var o;self,o=()=>(()=>{var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.d(t,{default:()=>E});var o={};function n(e,t,o,n,i={}){t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(o)||(o=[o]);for(const a of t)for(const t of o)a[e](t,n,{capture:!1,...i});return Array.prototype.slice.call(arguments,1)}e.r(o),e.d(o,{adjustableInputNumbers:()=>d,createElementFromString:()=>l,createFromTemplate:()=>r,eventPath:()=>s,off:()=>a,on:()=>i,resolveElement:()=>c});const i=n.bind(null,"addEventListener"),a=n.bind(null,"removeEventListener");function l(e){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild}function r(e){const t=(e,t)=>{const o=e.getAttribute(t);return e.removeAttribute(t),o},o=(e,n={})=>{const i=t(e,":obj"),a=t(e,":ref"),l=i?n[i]={}:n;a&&(n[a]=e);for(const n of Array.from(e.children)){const e=t(n,":arr"),i=o(n,e?{}:l);e&&(l[e]||(l[e]=[])).push(Object.keys(i).length?i:n)}return n};return o(l(e))}function s(e){let t=e.path||e.composedPath&&e.composedPath();if(t)return t;let o=e.target.parentElement;for(t=[e.target,o];o=o.parentElement;)t.push(o);return t.push(document,window),t}function c(e){return e instanceof Element?e:"string"==typeof e?e.split(/>>/g).reduce(((e,t,o,n)=>(e=e.querySelector(t),o<n.length-1?e.shadowRoot:e)),document):null}function d(e,t=(e=>e)){function o(o){const n=[.001,.01,.1][Number(o.shiftKey||2*o.ctrlKey)]*(o.deltaY<0?1:-1);let i=0,a=e.selectionStart;e.value=e.value.replace(/[\d.]+/g,((e,o)=>o<=a&&o+e.length>=a?(a=o,t(Number(e),n,i)):(i++,e))),e.focus(),e.setSelectionRange(a,a),o.preventDefault(),e.dispatchEvent(new Event("input"))}i(e,"focus",(()=>i(window,"wheel",o,{passive:!1}))),i(e,"blur",(()=>a(window,"wheel",o)))}const{min:u,max:h,floor:p,round:g}=Math;function m(e,t,o){t/=100,o/=100;const n=p(e=e/360*6),i=e-n,a=o*(1-t),l=o*(1-i*t),r=o*(1-(1-i)*t),s=n%6;return[255*[o,l,a,a,r,o][s],255*[r,o,o,l,a,a][s],255*[a,a,r,o,o,l][s]]}function f(e,t,o){const n=(2-(t/=100))*(o/=100)/2;return 0!==n&&(t=1===n?0:n<.5?t*o/(2*n):t*o/(2-2*n)),[e,100*t,100*n]}function b(e,t,o){const n=u(e/=255,t/=255,o/=255),i=h(e,t,o),a=i-n;let l,r;if(0===a)l=r=0;else{r=a/i;const n=((i-e)/6+a/2)/a,s=((i-t)/6+a/2)/a,c=((i-o)/6+a/2)/a;e===i?l=c-s:t===i?l=1/3+n-c:o===i&&(l=2/3+s-n),l<0?l+=1:l>1&&(l-=1)}return[360*l,100*r,100*i]}function v(e,t,o,n){return t/=100,o/=100,[...b(255*(1-u(1,(e/=100)*(1-(n/=100))+n)),255*(1-u(1,t*(1-n)+n)),255*(1-u(1,o*(1-n)+n)))]}function y(e,t,o){t/=100;const n=2*(t*=(o/=100)<.5?o:1-o)/(o+t)*100,i=100*(o+t);return[e,isNaN(n)?0:n,i]}function w(e){return b(...e.match(/.{2}/g).map((e=>parseInt(e,16))))}function C(e=0,t=0,o=0,n=1){const i=(e,t)=>(o=-1)=>t(~o?e.map((e=>Number(e.toFixed(o)))):e),a={h:e,s:t,v:o,a:n,toHSVA(){const e=[a.h,a.s,a.v,a.a];return e.toString=i(e,(e=>`hsva(${e[0]}, ${e[1]}%, ${e[2]}%, ${a.a})`)),e},toHSLA(){const e=[...f(a.h,a.s,a.v),a.a];return e.toString=i(e,(e=>`hsla(${e[0]}, ${e[1]}%, ${e[2]}%, ${a.a})`)),e},toRGBA(){const e=[...m(a.h,a.s,a.v),a.a];return e.toString=i(e,(e=>`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${a.a})`)),e},toCMYK(){const e=function(e,t,o){const n=m(e,t,o),i=n[0]/255,a=n[1]/255,l=n[2]/255,r=u(1-i,1-a,1-l);return[100*(1===r?0:(1-i-r)/(1-r)),100*(1===r?0:(1-a-r)/(1-r)),100*(1===r?0:(1-l-r)/(1-r)),100*r]}(a.h,a.s,a.v);return e.toString=i(e,(e=>`cmyk(${e[0]}%, ${e[1]}%, ${e[2]}%, ${e[3]}%)`)),e},toHEXA(){const e=function(e,t,o){return m(e,t,o).map((e=>g(e).toString(16).padStart(2,"0")))}(a.h,a.s,a.v),t=a.a>=1?"":Number((255*a.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return t&&e.push(t),e.toString=()=>`#${e.join("").toUpperCase()}`,e},clone:()=>C(a.h,a.s,a.v,a.a)};return a}const k=e=>Math.max(Math.min(e,1),
/* nosourcemap */