83 lines
2.7 MiB
JavaScript
83 lines
2.7 MiB
JavaScript
|
"use strict";var obsidian_module=require("obsidian");var LZString=function(){function o(o,r){if(!t[o]){t[o]={};for(var n=0;n<o.length;n++)t[o][o.charAt(n)]=n}return t[o][r]}var r=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",t={},i={compressToBase64:function(o){if(null==o)return"";var r=i._compress(o,6,function(o){return n.charAt(o)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(e){return o(n,r.charAt(e))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(o){return null==o?"":""==o?null:i._decompress(o.length,16384,function(r){return o.charCodeAt(r)-32})},compressToUint8Array:function(o){for(var r=i.compress(o),n=new Uint8Array(2*r.length),e=0,t=r.length;t>e;e++){var s=r.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null===o||void 0===o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;t>e;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(o){return null==o?"":i._compress(o,6,function(o){return e.charAt(o)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(n){return o(e,r.charAt(n))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(o,r,n){if(null==o)return"";var e,t,i,s={},p={},u="",c="",a="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<o.length;i+=1)if(u=o.charAt(i),Object.prototype.hasOwnProperty.call(s,u)||(s[u]=f++,p[u]=!0),c=a+u,Object.prototype.hasOwnProperty.call(s,c))a=c;else{if(Object.prototype.hasOwnProperty.call(p,a)){if(a.charCodeAt(0)<256){for(e=0;h>e;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++),s[c]=f++,a=String(u)}if(""!==a){if(Object.prototype.hasOwnProperty.call(p,a)){if(a.charCodeAt(0)<256){for(e=0;h>e;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==r-1){d.push(n(m));break}v++}return d.join("")},decompress:function(o){return null==o?"":""==o?null:i._decompress(o.length,32768,function(r){return o.charCodeAt(r)})},_decompress:function(o,n,e){var t,i,s,p,u,c,a,l,f=[],h=4,d=4,m=3,v="",w=[],A={val:e(0),position:n,index:1};for(i=0;3>i;i+=1)f[i]=i;for(p=0,c=Math.pow(2,2),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(t=p){case 0:for(p=0,c=Math.pow(2,8),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 1:for(p=0,c=Math.pow(2,16),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 2:return""}for(f[3]=l,s=l,w.push(l);;){if(A.index>o)return"";for(p=0,c=Math.pow(2,m),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(l=p){case
|
||
|
const EXCALIDRAW_PACKAGES = "PQKhCgAIUgBAbAlgYwKYDsDOrICVUCGyALlDAE6EkB0ADuQPYAmAriYg+tQLaJcBWmMmUgBhBrQCe5RAHMAFsUgAKZAEpIAMSKoARgwYBrADSQAkumTVIBdE0iJimGwDMXiJAWKpM1YdEgAFXlEZ0wGFnI0SGRmHFDIJDQsVHsWO1RySGJ5HABZM0DElAxsSBcIuwd0bNyRABkzUQBRADkAZWbyj3ianJxGBiUmREoSBnJJSAYXWoTwyOjiSlQ/aGBwZRd09k5lNQBvAHIWMsxllGIjgG4tneIOdFVjAA9DgCIGXX5UEneAXkBxEktFQM0gqBetAmTgAZLD3ukmKh3OhUu8AIRAkFg2bcZgseCoAD8L2UkOh5CcagAXO9tpYHpwAdjQeDkajUPCOXxVgRuExiTy0coANrvCkwzDvAC6r1pqn+yAAPsrsPAXK9VNR8ERiP8DgBfNRqY3KHKhYwM3ZP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BMMoPzAdwmGMGPANFCDyEqG8FxRDRv2jHP37HQGTVOVOU0AmDQAAFVdx9xkMY5+47Q8IMByjUBTl8AfFUAm4GiQ1nwYYw9WiyiKiej5ZejvBGjL9mjB5DgiZ2pExWUaBzJMA5B0BjA1xcJrgOx3whghgcQdtMBdQSBxBuBoQ0QZwtidiRwG5AZgdxjh1IN+jG1J4aUQxqxJltYK9HR3jx4C44wsQXQvlMZe9QV5DsBiAJjUBlBqBYTaRshAEfAbAagaVphZh20cB/In9dAiRnB5UwJ9xphlVyhBsOwQh5oFUNFoUUTIUlBwQMSEUZACAcSfA6FfJwBJwCSIIIcRiOixjITHjzQlxo1nwH4
|
||
|
/*!
|
||
|
* html2canvas 1.4.0 <https://html2canvas.hertzen.com>
|
||
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
||
|
* Released under MIT License
|
||
|
*/html2canvas$1.exports=function(){
|
||
|
/*! *****************************************************************************
|
||
|
Copyright (c) Microsoft Corporation.
|
||
|
|
||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||
|
purpose with or without fee is hereby granted.
|
||
|
|
||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
|
PERFORMANCE OF THIS SOFTWARE.
|
||
|
***************************************************************************** */
|
||
|
var e=function(A,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,A){e.__proto__=A}||function(e,A){for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t])},e(A,t)};function A(A,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=A}e(A,t),A.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var t=function(){return t=Object.assign||function(e){for(var A,t=1,i=arguments.length;t<i;t++)for(var n in A=arguments[t])Object.prototype.hasOwnProperty.call(A,n)&&(e[n]=A[n]);return e},t.apply(this,arguments)};function i(e,A,t,i){return new(t||(t=Promise))((function(n,a){function r(e){try{o(i.next(e))}catch(e){a(e)}}function s(e){try{o(i.throw(e))}catch(e){a(e)}}function o(e){var A;e.done?n(e.value):(A=e.value,A instanceof t?A:new t((function(e){e(A)}))).then(r,s)}o((i=i.apply(e,A||[])).next())}))}function n(e,A){var t,i,n,a,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;r;)try{if(t=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((n=(n=r.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(6===a[0]&&r.label<n[1]){r.label=n[1],n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break}n[2]&&r.ops.pop(),r.trys.pop();continue}a=A.call(e,r)}catch(e){a=[6,e],i=0}finally{t=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function a(e,A,t){if(t||2===arguments.length)for(var i,n=0,a=A.length;n<a;n++)!i&&n in A||(i||(i=Array.prototype.slice.call(A,0,n)),i[n]=A[n]);return e.concat(i||A)}for(var r=function(){function e(e,A,t,i){this.left=e,this.top=A,this.width=t,this.height=i}return e.prototype.add=function(A,t,i,n){return new e(this.left+A,this.top+t,this.width+i,this.height+n)},e.fromClientRect=function(A,t){return new e(t.left+A.windowBounds.left,t.top+A.windowBounds.top,t.width,t.height)},e.fromDOMRectList=function(A,t){var i=Array.from(t).find((function(e){return 0!==e.width}));return i?new e(i.x+A.windowBounds.left,i.y+A.windowBounds.top,i.width,i.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),s=function(e,A){return r.fromClientRect(e,A.getBoundingClientRect())},o=function(e){for(var A=[],t=0,i=e.length;t<i;){var n=e.charCodeAt(t++);if(n>=55296&&n<=56319&&t<i){var a=e.charCodeAt(t++);56320==(64512&a)?A.push(((1023&n)<<10)+(1023&a)+65536):(A.push(n),t--)}else A.push(n)}return A},l=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var t=e.length;if(!t)return"";for(var i=[],n=-1,a="";++n<t;){var r=e[n];r<=65535?i.push(r):(r-=65536,i.push(55296+(r>>10),r%1024+56320)),(n+1===t||i.length>16384)&&(a+=String.fromCharCode.apply(String,i),i.length=0)}return a},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),h=0;h<c.length;h++)d[c.charCodeAt(h)]=h;var u=function(e,A,t){return e.slice?e.slice(A,t):new Uint16Array(Array.prototype.slice.call(e,A,t))},g=function(){function e(e,A,t,i,n,a){this.initialValue=e,this.errorValue=A,this.highStart=t,this.highValueIndex=i,this.index=n,this.data=a}return e.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=((A=this.index[e>>5])<<2)+(31&e),this.data[A];if(e<=65535)return A=((A=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[A];if(e<this.highStart)return A=2080+(e>>11),A=this.index[A],A+=e>>5&63,A=((A=this.index[A])<<2)+(31&e),this.data[A];
|
||
|
//![[link|alias]] [alias](link){num}
|
||
|
EXPR:/(!)?(\[\[([^|\]]+)\|?([^\]]+)?]]|\[([^\]]*)]\(([^)]*)\))(\{(\d+)\})?/g,getRes:e=>e.matchAll(REGEX_LINK.EXPR),isTransclusion:e=>!!e.value[1],getLink:e=>e.value[3]?e.value[3]:e.value[6],isWikiLink:e=>!!e.value[3],getAliasOrLink:e=>REGEX_LINK.isWikiLink(e)?e.value[4]?e.value[4]:e.value[3]:e.value[5]?e.value[5]:e.value[6],getWrapLength:(e,A)=>{const t=parseInt(e.value[8]);return isNaN(t)?A>0?A:null:t}},DRAWING_REG=/\n# Drawing\n[^`]*(```json\n)([\s\S]*?)```\n/gm,DRAWING_REG_FALLBACK=/\n# Drawing\n(```json\n)?(.*)(```)?(%%)?/gm,DRAWING_COMPRESSED_REG=/(\n# Drawing\n[^`]*(?:```compressed\-json\n))([\s\S]*?)(```\n)/gm,DRAWING_COMPRESSED_REG_FALLBACK=/(\n# Drawing\n(?:```compressed\-json\n)?)(.*)((```)?(%%)?)/gm,REG_LINKINDEX_HYPERLINK=/^\w+:\/\//,isCompressedMD=e=>null!==e.match(/```compressed\-json\n/gm),getDecompressedScene=e=>{let A,t=e.matchAll(DRAWING_COMPRESSED_REG);return A=t.next(),A.done&&(t=e.matchAll(DRAWING_COMPRESSED_REG_FALLBACK),A=t.next()),A.value&&A.value.length>1?[decompress(A.value[2]),A]:[null,A]},changeThemeOfExcalidrawMD=e=>{const A=isCompressedMD(e);let t=A?getDecompressedScene(e)[0]:e;return t?(isObsidianThemeDark?1===(t.match(/"theme"\s*:\s*"light"\s*,/g)||[]).length&&(t=t.replace(/"theme"\s*:\s*"light"\s*,/,'"theme": "dark",')):1===(t.match(/"theme"\s*:\s*"dark"\s*,/g)||[]).length&&(t=t.replace(/"theme"\s*:\s*"dark"\s*,/,'"theme": "light",')),A?e.replace(DRAWING_COMPRESSED_REG,`$1${compress(t)}$3`):t):e};function getJSON(e){let A,t;if(isCompressedMD(e)){const[A,t]=getDecompressedScene(e);return A?{scene:A.substring(0,A.lastIndexOf("}")+1),pos:t.value.index}:{scene:e,pos:t.value?t.value.index:0}}if(A=e.matchAll(DRAWING_REG),t=A.next(),t.done&&(A=e.matchAll(DRAWING_REG_FALLBACK),t=A.next()),t.value&&t.value.length>1){const e=t.value[2];return{scene:e.substr(0,e.lastIndexOf("}")+1),pos:t.value.index}}return{scene:e,pos:t.value?t.value.index:0}}function getMarkdownDrawingSection(e,A){return A?`%%\n# Drawing\n\`\`\`compressed-json\n${compress(e)}\n\`\`\`\n%%`:`%%\n# Drawing\n\`\`\`json\n${e}\n\`\`\`\n%%`}const estimateMaxLineLen=(e,A)=>{if(!A||!e)return null;if(e===A)return null;let t=0;const i=e.split("\n");if(1===i.length)return null;for(const e of i){const A=e.trim();A.length>t&&(t=A.length)}return t},wrap=(e,A)=>A?wrapTextAtCharLength(e,A,!1,0):e;class ExcalidrawData{constructor(e){this.plugin=e,this.textElements=null,this.elementLinks=null,this.scene=null,this.deletedElements=[],this.file=null,this.autoexportPreference=AutoexportPreference.inherit,this.textMode=TextMode.raw,this.loaded=!1,this.files=null,this.equations=null,this.compatibilityMode=!1,this.selectedElementIds={},this.disableCompression=!1,this.app=e.app,this.files=new Map,this.equations=new Map}initializeNonInitializedFields(){var e,A;if(!this.scene||!this.scene.elements)return;const t=this.scene.elements;for(const i of t){if(i.boundElements){const e=new Map;i.boundElements.forEach((A=>{e.set(A.id,A.type)}));const A=Array.from(e,(([e,A])=>({id:e,type:A})));A.length!==i.boundElements.length&&(i.boundElements=A)}i.boundElementIds&&(i.boundElements||(i.boundElements=[]),i.boundElements=i.boundElements.concat(i.boundElementIds.map((e=>({type:"arrow",id:e})))),delete i.boundElementIds),"text"!==i.type||i.containerId||(i.containerId=null),null===i.x&&(i.x=0),null===i.y&&(i.y=0),null===(null===(e=i.startBinding)||void 0===e?void 0:e.focus)&&(i.startBinding.focus=0),null===(null===(A=i.endBinding)||void 0===A?void 0:A.focus)&&(i.endBinding.focus=0),null===i.fontSize&&(i.fontSize=20)}try{t.filter((e=>"text"===e.type&&e.containerId&&t.some((A=>A.id===e.containerId&&A.boundElements.length>0&&A.boundElements.some((A=>"text"===A.type&&A.id!==e.id&&A.id.length>8)))))).forEach((e=>{try{const A=t.filter((A=>A.id===e.containerId))[0],i=A.boundElements.filter((e=>!("text"===e.type&&!t.some((A=>A.id===e.id)))));A.boundElements=[{id:e.id,type:"text"}].concat(i)}catch(e){}})),t.filter((e=>e.boundElements&&e.boundElements.length>0)).forEach((e=>{const A=e.boundElements.filter((e=>t.some((A=>A.id===e.id))));A.length!==e.boundElements.length&&(e.boundElem
|
||
|
/**
|
||
|
* chroma.js - JavaScript library for color conversions
|
||
|
*
|
||
|
* Copyright (c) 2011-2019, Gregor Aisch
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* Redistribution and use in source and binary forms, with or without
|
||
|
* modification, are permitted provided that the following conditions are met:
|
||
|
*
|
||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||
|
* list of conditions and the following disclaimer.
|
||
|
*
|
||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||
|
* this list of conditions and the following disclaimer in the documentation
|
||
|
* and/or other materials provided with the distribution.
|
||
|
*
|
||
|
* 3. The name Gregor Aisch may not be used to endorse or promote products
|
||
|
* derived from this software without specific prior written permission.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||
|
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*
|
||
|
* -------------------------------------------------------
|
||
|
*
|
||
|
* chroma.js includes colors from colorbrewer2.org, which are released under
|
||
|
* the following license:
|
||
|
*
|
||
|
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
|
||
|
* and The Pennsylvania State University.
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing,
|
||
|
* software distributed under the License is distributed on an
|
||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||
|
* either express or implied. See the License for the specific
|
||
|
* language governing permissions and limitations under the License.
|
||
|
*
|
||
|
* ------------------------------------------------------
|
||
|
*
|
||
|
* Named colors are taken from X11 Color Names.
|
||
|
* http://www.w3.org/TR/css3-color/#svg-color
|
||
|
*
|
||
|
* @preserve
|
||
|
*/chroma$1.exports=function(){for(var e=function(e,A,t){return void 0===A&&(A=0),void 0===t&&(t=1),e<A?A:e>t?t:e},A=e,t={},i=0,n=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];i<n.length;i+=1){var a=n[i];t["[object "+a+"]"]=a.toLowerCase()}var r=function(e){return t[Object.prototype.toString.call(e)]||"object"},s=r,o=r,l=Math.PI,c={clip_rgb:function(e){e._clipped=!1,e._unclipped=e.slice(0);for(var t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=A(e[t],0,255)):3===t&&(e[t]=A(e[t],0,1));return e},limit:e,type:r,unpack:function(e,A){return void 0===A&&(A=null),e.length>=3?Array.prototype.slice.call(e):"object"==s(e[0])&&A?A.split("").filter((function(A){return void 0!==e[0][A]})).map((function(A){return e[0][A]})):e[0]},last:function(e){if(e.length<2)return null;var A=e.length-1;return"string"==o(e[A])?e[A].toLowerCase():null},PI:l,TWOPI:2*l,PITHIRD:l/3,DEG2RAD:l/180,RAD2DEG:180/l},d={format:{},autodetect:[]},h=c.last,u=c.clip_rgb,g=c.type,p=d,w=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];var t=this;if("object"===g(e[0])&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];var i=h(e),n=!1;if(!i){n=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(e,A){return A.p-e.p})),p.sorted=!0);for(var a=0,r=p.autodetect;a<r.length;a+=1){var s=r[a];if(i=s.test.apply(s,e))break}}if(!p.format[i])throw new Error("unknown format: "+e);var o=p.format[i].apply(null,n?e:e.slice(0,-1));t._rgb=u(o),3===t._rgb.length&&t._rgb.push(1)};w.prototype.toString=function(){return"function"==g(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var m=w,f=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];return new(Function.prototype.bind.apply(f.Color,[null].concat(e)))};f.Color=m,f.version="2.4.2";var B=f,E=c.unpack,b=Math.max,C=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];var t=E(e,"rgb"),i=t[0],n=t[1],a=t[2],r=1-b(i/=255,b(n/=255,a/=255)),s=r<1?1/(1-r):0;return[(1-i-r)*s,(1-n-r)*s,(1-a-r)*s,r]},v=c.unpack,y=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];var t=(e=v(e,"cmyk"))[0],i=e[1],n=e[2],a=e[3],r=e.length>4?e[4]:1;return 1===a?[0,0,0,r]:[t>=1?0:255*(1-t)*(1-a),i>=1?0:255*(1-i)*(1-a),n>=1?0:255*(1-n)*(1-a),r]},F=B,x=m,S=d,T=c.unpack,Q=c.type,I=C;x.prototype.cmyk=function(){return I(this._rgb)},F.cmyk=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];return new(Function.prototype.bind.apply(x,[null].concat(e,["cmyk"])))},S.format.cmyk=y,S.autodetect.push({p:2,test:function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];if(e=T(e,"cmyk"),"array"===Q(e)&&4===e.length)return"cmyk"}});var U=c.unpack,k=c.last,M=function(e){return Math.round(100*e)/100},L=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];var t=U(e,"hsla"),i=k(e)||"lsa";return t[0]=M(t[0]||0),t[1]=M(100*t[1])+"%",t[2]=M(100*t[2])+"%","hsla"===i||t.length>3&&t[3]<1?(t[3]=t.length>3?t[3]:1,i="hsla"):t.length=3,i+"("+t.join(",")+")"},O=c.unpack,N=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];var t=(e=O(e,"rgba"))[0],i=e[1],n=e[2];t/=255,i/=255,n/=255;var a,r,s=Math.min(t,i,n),o=Math.max(t,i,n),l=(o+s)/2;return o===s?(a=0,r=Number.NaN):a=l<.5?(o-s)/(o+s):(o-s)/(2-o-s),t==o?r=(i-n)/(o-s):i==o?r=2+(n-t)/(o-s):n==o&&(r=4+(t-i)/(o-s)),(r*=60)<0&&(r+=360),e.length>3&&void 0!==e[3]?[r,a,l,e[3]]:[r,a,l]},D=c.unpack,H=c.last,R=L,P=N,V=Math.round,K=function(){for(var e=[],A=arguments.length;A--;)e[A]=arguments[A];var t=D(e,"rgba"),i=H(e)||"rgb";return"hsl"==i.substr(0,3)?R(P(t),i):(t[0]=V(t[0]),t[1]=V(t[1]),t[2]=V(t[2]),("rgba"===i||t.length>3&&t[3]<1)&&(t[3]=t.length>3?t[3]:1,i="rgba"),i+"("+t.slice(0,"rgb"===i?3:4).join(",")+")")},G=c.unpack,W=Math.round,z=function(){for(var e,A=[],t=arguments.length;t--;)A[t]=arguments[t];var i,n,a,r=(A=G(A,"hsl"))[0],s=A[1],o=A[2];if(0===s)i=n=a=255*o;else{var l=[0,0,0],c=[0,0,0],d=o<.5?o*(1+s):o+s-o*s,h=2*o-d,u=r/360;l[0]=u+1/3,l[1]=u,l[2]=u-1/3;for(var g=0;g<3;g++)l[g]<0&&(l[g]+=1),l[g]>1&&(l[g]-=1),6*l[g]<1?c[g]=h+6*(d-h)*l[g]:2*l[g]<1?c[g]=d:3*l[g]<2?c[g]=h+(d
|
||
|
//!Temporary hack
|
||
|
if(e.activeExcalidrawView=n,n&&(e.lastActiveExcalidrawFilePath=null===(t=n.file)||void 0===t?void 0:t.path),app.isMobile&&n&&!i){const e=document.querySelector("body>.app-container>.mobile-navbar");e&&e instanceof HTMLDivElement&&(e.style.position="relative")}if(app.isMobile&&!n&&i){const e=document.querySelector("body>.app-container>.mobile-navbar");e&&e instanceof HTMLDivElement&&(e.style.position="")}if(i&&i!==n&&(i.leaf!==A&&i.semaphores.dirty&&!i.semaphores.viewunload&&await i.save(!0),i.file&&e.triggerEmbedUpdates(i.file.path)),n&&(!i||i.leaf!==A)){const e=n.file;n.file&&setTimeout((()=>{var A;n&&n._loaded&&(null===(A=n.file)||void 0===A?void 0:A.path)===(null==e?void 0:e.path)&&(n.activeLoader||n.loadSceneFiles())}),2e3)}if(n&&n._loaded&&n.isLoaded&&n.excalidrawAPI&&e.ea.onCanvasColorChangeHook&&e.ea.onCanvasColorChangeHook(e.ea,n,n.excalidrawAPI.getAppState().viewBackgroundColor),e.popScope&&(e.popScope(),e.popScope=null),n){const A=e.app.keymap.getRootScope(),t=A.register(["Mod"],"Enter",(()=>!0)),i=e.forceSaveCommand&&"s"===e.forceSaveCommand.hotkeys[0].key&&e.forceSaveCommand.hotkeys[0].modifiers.includes("Ctrl")?A.register(["Ctrl"],"s",(()=>e.forceSaveActiveView(!1))):void 0;A.keys.unshift(A.keys.pop()),e.popScope=()=>{A.unregister(t),Boolean(i)&&A.unregister(i)}}}))),e.addFileSaveTriggerEventHandlers();const A=app.metadataCache;A.getCachedFiles().forEach((t=>{var i;const n=null===(i=A.getCache(t))||void 0===i?void 0:i.frontmatter;(n&&void 0!==n[FRONTMATTER_KEY]||t.match(/\.excalidraw$/))&&e.updateFileCache(app.vault.getAbstractFileByPath(t),n)})),this.registerEvent(A.on("changed",((e,A,t)=>this.updateFileCache(e,null==t?void 0:t.frontmatter))))}))}addFileSaveTriggerEventHandlers(){this.registerEvent(this.app.workspace.on("click",(e=>{this.activeExcalidrawView&&this.activeExcalidrawView.semaphores.dirty&&(!e.target||"excalidraw__canvas"!==e.target.className&&!getParentOfClass(e.target,"excalidraw-wrapper"))&&this.activeExcalidrawView.save()}))),this.registerEvent(this.app.workspace.on("file-menu",(()=>{this.activeExcalidrawView&&this.activeExcalidrawView.semaphores.dirty&&this.activeExcalidrawView.save()}))),this.modalContainerObserver=new MutationObserver((async e=>{1===e.length&&"childList"===e[0].type&&1===e[0].addedNodes.length&&this.activeExcalidrawView&&this.activeExcalidrawView.semaphores.dirty&&this.activeExcalidrawView.save()})),this.modalContainerObserver.observe(document.body,{childList:!0});const e=document.querySelector(".workspace-drawer.mod-left"),A=document.querySelector(".workspace-drawer.mod-right");if(e||A){const t=async e=>{"display: none;"===e[0].oldValue&&this.activeExcalidrawView&&this.activeExcalidrawView.semaphores.dirty&&this.activeExcalidrawView.save()},i={attributeOldValue:!0,attributeFilter:["style"]};e&&(this.workspaceDrawerLeftObserver=new MutationObserver(t),this.workspaceDrawerLeftObserver.observe(e,i)),A&&(this.workspaceDrawerRightObserver=new MutationObserver(t),this.workspaceDrawerRightObserver.observe(A,i))}}updateFileCache(e,A,t=!1){A&&void 0!==A[FRONTMATTER_KEY]?this.excalidrawFiles.add(e):t||"excalidraw"!==e.extension?this.excalidrawFiles.delete(e):this.excalidrawFiles.add(e)}onunload(){destroyExcalidrawAutomate(),this.popScope&&(this.popScope(),this.popScope=null),this.observer.disconnect(),this.themeObserver.disconnect(),this.modalContainerObserver.disconnect(),this.workspaceDrawerLeftObserver&&this.workspaceDrawerLeftObserver.disconnect(),this.workspaceDrawerRightObserver&&this.workspaceDrawerRightObserver.disconnect(),this.fileExplorerObserver&&this.fileExplorerObserver.disconnect(),this.app.workspace.getLeavesOfType("excalidraw").forEach((e=>{this.setMarkdownView(e)})),this.mathjaxDiv&&document.body.removeChild(this.mathjaxDiv),Object.values(this.packageMap).forEach((e=>{delete e.excalidrawLib,delete e.reactDOM,delete e.react}))}async embedDrawing(e){const A=this.app.workspace.getActiveViewOfType(obsidian_module.MarkdownView);if(A&&A.file){const t=this.app.metadataCache.fileToLinktext(e,A.file.path,"excalidraw"===this.settings.embedType),i=A.editor;if("excalidraw"
|