2024-10-12 17:50:12 +08:00
|
|
|
"use strict";var obsidian_module=require("obsidian"),state=require("@codemirror/state"),view=require("@codemirror/view");var LZString=function(){var r=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",e={};function t(r,o){if(!e[r]){e[r]={};for(var n=0;n<r.length;n++)e[r][r.charAt(n)]=n}return e[r][o]}var i={compressToBase64:function(r){if(null==r)return"";var n=i._compress(r,6,function(r){return o.charAt(r)});switch(n.length%4){default:case 0:return n;case 1:return n+"===";case 2:return n+"==";case 3:return n+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(n){return t(o,r.charAt(n))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(r){return null==r?"":""==r?null:i._decompress(r.length,16384,function(o){return r.charCodeAt(o)-32})},compressToUint8Array:function(r){for(var o=i.compress(r),n=new Uint8Array(2*o.length),e=0,t=o.length;e<t;e++){var s=o.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null==o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;e<t;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(r){return null==r?"":i._compress(r,6,function(r){return n.charAt(r)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(o){return t(n,r.charAt(o))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(r,o,n){if(null==r)return"";var e,t,i,s={},u={},a="",p="",c="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<r.length;i+=1)if(a=r.charAt(i),Object.prototype.hasOwnProperty.call(s,a)||(s[a]=f++,u[a]=!0),p=c+a,Object.prototype.hasOwnProperty.call(s,p))c=p;else{if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),s[p]=f++,c=String(a)}if(""!==c){if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==o-1){d.push(n(m));break}v++}return d.join("")},decompress:function(r){return null==r?"":""==r?null:i._decompress(r.length,32768,function(o){return r.charCodeAt(o)})},_decompress:function(o,n,e){var t,i,s,u,a,p,c,l=[],f=4,h=4,d=3,m="",v=[],g={val:e(0),position:n,index:1};for(t=0;t<3;t+=1)l[t]=t;for(s=0,a=Math.pow(2,2),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 2:return""}for(l[3]=c,i=c,v.push(c);;){if(g.index>o)return"";for(s=0,a=Math.pow(2,d),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.i
|
2024-10-14 16:48:38 +08:00
|
|
|
let PLUGIN_VERSION="2.5.2";;function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var obsidian_module__namespace=_interopNamespace(obsidian_module),React__namespace=_interopNamespace(React);let random$1=e=>crypto.getRandomValues(new Uint8Array(e)),customRandom=(e,t,n)=>{let r=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*r*t/e.length);return(a=t)=>{let o="";for(;;){let t=n(i),s=i;for(;s--;)if(o+=e[t[s]&r]||"",o.length===a)return o}}},customAlphabet=(e,t=21)=>customRandom(e,t,random$1),nanoid$1=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),""),EXCALIDRAW_PLUGIN=null;const setExcalidrawPlugin=e=>{EXCALIDRAW_PLUGIN=e},THEME={LIGHT:"light",DARK:"dark"},MD_EXCALIDRAW="# Excalidraw Data",MD_TEXTELEMENTS="## Text Elements",MD_ELEMENTLINKS="## Element Links",MD_EMBEDFILES="## Embedded Files",MD_DRAWING="## Drawing",MD_EX_SECTIONS=[MD_EXCALIDRAW,MD_TEXTELEMENTS,MD_ELEMENTLINKS,MD_EMBEDFILES,MD_DRAWING],ERROR_IFRAME_CONVERSION_CANCELED="iframe conversion canceled",LOCALE=obsidian_module.moment.locale(),obsidianToExcalidrawMap={en:"en-US",af:"af-ZA",am:"am-ET",ar:"ar-SA",eu:"eu-ES",be:"be-BY",bg:"bg-BG",bn:"bn-BD",ca:"ca-ES",cs:"cs-CZ",da:"da-DK",de:"de-DE",el:"el-GR",eo:"eo-EO",es:"es-ES",fa:"fa-IR","fi-fi":"fi-FI",fr:"fr-FR",gl:"gl-ES",he:"he-IL",hi:"hi-IN",hu:"hu-HU",id:"id-ID",it:"it-IT",ja:"ja-JP",ko:"ko-KR",lv:"lv-LV",ml:"ml-IN",ms:"ms-MY",nl:"nl-NL",no:"nb-NO",oc:"oc-FR",pl:"pl-PL",pt:"pt-PT","pt-BR":"pt-BR",ro:"ro-RO",ru:"ru-RU",sr:"sr-RS",se:"sv-SE",sk:"sk-SK",sq:"sq-AL",ta:"ta-IN",te:"te-IN",th:"th-TH",tr:"tr-TR",uk:"uk-UA",ur:"ur-PK",vi:"vi-VN",zh:"zh-CN","zh-TW":"zh-TW"},{sceneCoordsToViewportCoords:sceneCoordsToViewportCoords,viewportCoordsToSceneCoords:viewportCoordsToSceneCoords,determineFocusDistance:determineFocusDistance,intersectElementWithLine:intersectElementWithLine,getCommonBoundingBox:getCommonBoundingBox,getMaximumGroups:getMaximumGroups,measureText:measureText,getLineHeight:getLineHeight,wrapText:wrapText,getFontString:getFontString,getBoundTextMaxWidth:getBoundTextMaxWidth,exportToSvg:exportToSvg,exportToBlob:exportToBlob,mutateElement:mutateElement,restore:restore,mermaidToExcalidraw:mermaidToExcalidraw,getFontFamilyString:getFontFamilyString,getContainerElement:getContainerElement,refreshTextDimensions:refreshTextDimensions,getCSSFontDefinition:getCSSFontDefinition}=excalidrawLib,FONTS_STYLE_ID="excalidraw-custom-fonts";function JSON_parse(e){return JSON.parse(e.replaceAll("[","["))}/Mac|iPod|iPhone|iPad/.test(window.navigator.platform);const DEVICE={isDesktop:!document.body.hasClass("is-tablet")&&!document.body.hasClass("is-mobile"),isPhone:document.body.hasClass("is-phone"),isTablet:document.body.hasClass("is-tablet"),isMobile:document.body.hasClass("is-mobile"),isLinux:document.body.hasClass("mod-linux")&&!document.body.hasClass("is-android"),isMacOS:document.body.hasClass("mod-macos")&&!document.body.hasClass("is-ios"),isWindows:document.body.hasClass("mod-windows"),isIOS:document.body.hasClass("is-ios"),isAndroid:document.body.hasClass("is-android")},ROOTELEMENTSIZE=(()=>{const e=document.createElement("div");e.style.fontSize="1rem",e.style.display="none",document.body.appendChild(e);const t=getComputedStyle(e),n=parseFloat(t.fontSize);return document.body.removeChild(e),n})(),nanoid=customAlphabet("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",8),KEYCODE={ESC:27},ROUNDNESS={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},THEME_FILTER="invert(100%) hue-rotate(180deg) saturate(1.25)",GITHUB_RELEASES="https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/",URLFETCHTIMEOUT=3e3,PLUGIN_ID="obsidian-excalidraw-plugin",SCRIPT_INSTALL_CODEBLOCK="excalidraw-script-install",SCRIPT_INSTALL_FOLDER="Downloaded",fileid=customAlp
|