diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json deleted file mode 100644 index 0637a08..0000000 --- a/.obsidian/community-plugins.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-version-history-diff/data.json b/.obsidian/plugins/obsidian-version-history-diff/data.json new file mode 100644 index 0000000..37e1da7 --- /dev/null +++ b/.obsidian/plugins/obsidian-version-history-diff/data.json @@ -0,0 +1,5 @@ +{ + "diffStyle": "word", + "matchWordsThreshold": 0.25, + "colorBlind": true +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-version-history-diff/main.js b/.obsidian/plugins/obsidian-version-history-diff/main.js new file mode 100644 index 0000000..ee9ab29 --- /dev/null +++ b/.obsidian/plugins/obsidian-version-history-diff/main.js @@ -0,0 +1,452 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +If you want to view the source, visit the plugin’s github repository: +https://github.com/kometenstaub/obsidian-sync-version-history +It is MIT-licensed: + + MIT License + + Copyright (c) 2022 kometenstaub and contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + +Other used code in this built file is licensed as follows: + +This plugin uses diff2html: +https://github.com/rtfpessoa/diff2html + + Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +This plugin and diff2html use jsdiff: +https://github.com/kpdecker/jsdiff + + Software License Agreement (BSD License) + + Copyright (c) 2009-2015, Kevin Decker + + All rights reserved. + + Redistribution and use of this software in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + + * 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. + + * Neither the name of Kevin Decker nor the names of its + contributors may 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 THE COPYRIGHT OWNER 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. + + +diff2html uses hogan.js: +https://github.com/twitter/hogan.js + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +hogan.js uses nopt: +https://github.com/npm/nopt + + The ISC License + + Copyright (c) Isaac Z. Schlueter and Contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + 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. + +nopt uses abbrev: +https://github.com/npm/abbrev-js + + This software is dual-licensed under the ISC and MIT licenses. + You may use this software under EITHER of the following licenses. + + ---------- + + The ISC License + + Copyright (c) Isaac Z. Schlueter and Contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + 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. + + +hogan.js uses mkdirp: +https://github.com/isaacs/node-mkdirp + + Copyright (c) 2011-2022 James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me) + + This project is free software released under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +"use strict";var Mt=Object.create;var Ne=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,Ot=Object.prototype.hasOwnProperty;var Ve=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),Wt=(i,n)=>{for(var t in n)Ne(i,t,{get:n[t],enumerable:!0})},Ze=(i,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Vt(n))!Ot.call(i,r)&&r!==t&&Ne(i,r,{get:()=>n[r],enumerable:!(e=At(n,r))||e.enumerable});return i};var je=(i,n,t)=>(t=i!=null?Mt(Rt(i)):{},Ze(n||!i||!i.__esModule?Ne(t,"default",{value:i,enumerable:!0}):t,i)),Ut=i=>Ze(Ne({},"__esModule",{value:!0}),i);var Lt=Ve(qe=>{(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,s=/\\/g,a=/\u2028/,l=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(p,g){var S=p.length,F=0,W=1,$=2,H=F,q=null,se=null,z="",M=[],ee=!1,A=0,C=0,E="{{",y="}}";function ae(){z.length>0&&(M.push({tag:"_t",text:new String(z)}),z="")}function Se(){for(var _=!0,G=C;G"&&(le.indent=M[U].text.toString()),M.splice(U,1));else G||M.push({tag:` +`});ee=!1,C=M.length}function Me(_,G){var U="="+y,le=_.indexOf(U,G),Ae=f(_.substring(_.indexOf("=",G)+1,le)).split(" ");return E=Ae[0],y=Ae[Ae.length-1],le+U.length-1}for(g&&(g=g.split(" "),E=g[0],y=g[1]),A=0;A0;){if(H=c.shift(),$&&$.tag=="<"&&!(H.tag in L))throw new Error("Illegal content in < super tag.");if(i.tags[H.tag]<=i.tags.$||d(H,S))g.push(H),H.nodes=o(c,H.tag,g,S);else if(H.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+H.n);if(W=g.pop(),H.n!=W.n&&!m(H.n,W.n,S))throw new Error("Nesting error: "+W.n+" vs. "+H.n);return W.end=H.i,F}else H.tag==` +`&&(H.last=c.length==0||c[0].tag==` +`);F.push(H)}if(g.length>0)throw new Error("missing closing tag: "+g.pop().n);return F}function d(c,p){for(var g=0,S=p.length;g":T,"<":function(c,p){var g={partials:{},code:"",subs:{},inPartial:!0};i.walk(c.nodes,g);var S=p.partials[T(c,p)];S.subs=g.subs,S.partials=g.partials},$:function(c,p){var g={subs:{},code:"",partials:p.partials,prefix:c.n};i.walk(c.nodes,g),p.subs[c.n]=g.code,p.inPartial||(p.code+='t.sub("'+w(c.n)+'",c,p,i);')},"\n":function(c,p){p.code+=j('"\\n"'+(c.last?"":" + i"))},_v:function(c,p){p.code+="t.b(t.v(t."+N(c.n)+'("'+w(c.n)+'",c,p,0)));'},_t:function(c,p){p.code+=j('"'+w(c.text)+'"')},"{":D,"&":D};function D(c,p){p.code+="t.b(t.t(t."+N(c.n)+'("'+w(c.n)+'",c,p,0)));'}function j(c){return"t.b("+c+");"}i.walk=function(c,p){for(var g,S=0,F=c.length;S{var yn={};(function(i){i.Template=function(o,d,m,u){o=o||{},this.r=o.code||this.r,this.c=m,this.options=u||{},this.text=d||"",this.partials=o.partials||{},this.subs=o.subs||{},this.buf=""},i.Template.prototype={r:function(o,d,m){return""},v:b,t:f,render:function(d,m,u){return this.ri([d],m||{},u)},ri:function(o,d,m){return this.r(o,d,m)},ep:function(o,d){var m=this.partials[o],u=d[m.name];if(m.instance&&m.base==u)return m.instance;if(typeof u=="string"){if(!this.c)throw new Error("No compiler available.");u=this.c.compile(u,this.options)}if(!u)return null;if(this.partials[o].base=u,m.subs){d.stackText||(d.stackText={});for(key in m.subs)d.stackText[key]||(d.stackText[key]=this.activeSub!==void 0&&d.stackText[this.activeSub]?d.stackText[this.activeSub]:this.text);u=t(u,m.subs,m.partials,this.stackSubs,this.stackPartials,d.stackText)}return this.partials[o].instance=u,u},rp:function(o,d,m,u){var v=this.ep(o,m);return v?v.ri(d,m,u):""},rs:function(o,d,m){var u=o[o.length-1];if(!L(u)){m(o,d,this);return}for(var v=0;v=0;T--)if(x=d[T],v=n(o,x,N),v!==void 0){w=!0;break}return w?(!u&&typeof v=="function"&&(v=this.mv(v,d,m)),v):u?!1:""},ls:function(o,d,m,u,v){var x=this.options.delimiters;return this.options.delimiters=v,this.b(this.ct(f(o.call(d,u)),d,m)),this.options.delimiters=x,!1},ct:function(o,d,m){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(o,this.options).render(d,m)},b:function(o){this.buf+=o},fl:function(){var o=this.buf;return this.buf="",o},ms:function(o,d,m,u,v,x,w){var N,T=d[d.length-1],D=o.call(T);return typeof D=="function"?u?!0:(N=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(D,T,m,N.substring(v,x),w)):D},mv:function(o,d,m){var u=d[d.length-1],v=o.call(u);return typeof v=="function"?this.ct(f(v.call(u)),u,m):v},sub:function(o,d,m,u){var v=this.subs[o];v&&(this.activeSub=o,v(d,m,this,u),this.activeSub=!1)}};function n(o,d,m){var u;return d&&typeof d=="object"&&(d[o]!==void 0?u=d[o]:m&&d.get&&typeof d.get=="function"&&(u=d.get(o))),u}function t(o,d,m,u,v,x){function w(){}w.prototype=o;function N(){}N.prototype=o.subs;var T,D=new w;D.subs=new N,D.subsText={},D.buf="",u=u||{},D.stackSubs=u,D.subsText=x;for(T in d)u[T]||(u[T]=d[T]);for(T in u)D.subs[T]=u[T];v=v||{},D.stackPartials=v;for(T in m)v[T]||(v[T]=m[T]);for(T in v)D.partials[T]=v[T];return D}var e=/&/g,r=//g,a=/\'/g,l=/\"/g,h=/[&<>\"\']/;function f(o){return String(o==null?"":o)}function b(o){return o=f(o),h.test(o)?o.replace(e,"&").replace(r,"<").replace(s,">").replace(a,"'").replace(l,"""):o}var L=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"}})(typeof Je!="undefined"?Je:yn)});var Ye=Ve((Gn,Ct)=>{var Ie=Lt();Ie.Template=xt().Template;Ie.template=Ie.Template;Ct.exports=Ie});var Sn={};Wt(Sn,{default:()=>Fe});module.exports=Ut(Sn);var ue=require("obsidian");var K=require("obsidian"),pe=class extends K.PluginSettingTab{constructor(t,e){super(t,e);this.plugin=e}display(){let{containerEl:t}=this,{settings:e}=this.plugin;t.empty(),t.createEl("h2",{text:"Version History Diff (Sync, File Recovery & Git)"}),new K.Setting(t).setName("Diff style").setDesc("What difference level shall be shown").addDropdown(r=>{r.addOption("word","Word difference level").addOption("char","Character difference level").setValue(e.diffStyle).onChange(async s=>{e.diffStyle=s,await this.plugin.saveSettings()})}),new K.Setting(t).setName("Match words threshold").setDesc("Similarity threshold for word matching, default is 0.25").addText(r=>{r.setPlaceholder("0.25").setValue(e.matchWordsThreshold.toString()).onChange(async s=>{let a=s.trim(),l=Number.parseFloat(a);Number.isNumber(l)&&0<=l&&l<=1?(e.matchWordsThreshold=Number.parseFloat(a),await this.plugin.saveSettings()):new K.Notice("Please enter a float between 0 and 1.")})}),new K.Setting(t).setName("Colour blindness").setDesc("Enable colour-blind mode").addToggle(r=>{r.setValue(this.plugin.settings.colorBlind).onChange(async s=>{this.plugin.settings.colorBlind=s,await this.plugin.saveSettings()})})}};var me=class{constructor(n,t){this.plugin=n,this.app=t,this.instance=t.internalPlugins.plugins.sync.instance}async getVersions(n,t=null){return await this.instance.getHistory(n.path,t)}async getContent(n){let t=await this.app.internalPlugins.plugins.sync.instance.getContentForVersion(n);return new TextDecoder("utf-8").decode(new Uint8Array(t))}};var I;(function(i){i.INSERT="insert",i.DELETE="delete",i.CONTEXT="context"})(I||(I={}));var et={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},tt={LINES:"lines",WORDS:"words",NONE:"none"},nt={WORD:"word",CHAR:"char"};var Bt=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],Pt=RegExp("["+Bt.join("\\")+"]","g");function it(i){return i.replace(Pt,"\\$&")}function Re(i){return i&&i.replace(/\\/g,"/")}function rt(i){var n,t,e,r=0;for(n=0,e=i.length;n1?t[t.length-1]:n}function lt(i,n){return n.reduce(function(t,e){return t||i.startsWith(e)},!1)}var ot=["a/","b/","i/","w/","c/","o/"];function Q(i,n,t){var e=t!==void 0?st(st([],ot,!0),[t],!1):ot,r=n?new RegExp("^".concat(it(n),' "?(.+?)"?$')):new RegExp('^"?(.+?)"?$'),s=r.exec(i)||[],a=s[1],l=a===void 0?"":a,h=e.find(function(b){return l.indexOf(b)===0}),f=h?l.slice(h.length):l;return f.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Gt(i,n){return Q(i,"---",n)}function kt(i,n){return Q(i,"+++",n)}function ft(i,n){n===void 0&&(n={});var t=[],e=null,r=null,s=null,a=null,l=null,h=null,f=null,b="--- ",L="+++ ",o="@@",d=/^old mode (\d{6})/,m=/^new mode (\d{6})/,u=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,x=/^copy from "?(.+)"?/,w=/^copy to "?(.+)"?/,N=/^rename from "?(.+)"?/,T=/^rename to "?(.+)"?/,D=/^similarity index (\d+)%/,j=/^dissimilarity index (\d+)%/,c=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,p=/^Binary files (.*) and (.*) differ/,g=/^GIT binary patch/,S=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,F=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,W=/^new file mode (\d{6})/,$=/^deleted file mode (\d{6}),(\d{6})/,H=i.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function q(){r!==null&&e!==null&&(e.blocks.push(r),r=null)}function se(){e!==null&&(!e.oldName&&h!==null&&(e.oldName=h),!e.newName&&f!==null&&(e.newName=f),e.newName&&(t.push(e),e=null)),h=null,f=null}function z(){q(),se(),e={blocks:[],deletedLines:0,addedLines:0}}function M(C){q();var E;e!==null&&((E=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(C))?(e.isCombined=!1,s=parseInt(E[1],10),l=parseInt(E[2],10)):(E=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(C))?(e.isCombined=!0,s=parseInt(E[1],10),a=parseInt(E[2],10),l=parseInt(E[3],10)):(C.startsWith(o)&&console.error("Failed to parse lines, starting in 0!"),s=0,l=0,e.isCombined=!1)),r={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:l,header:C}}function ee(C){if(!(e===null||r===null||s===null||l===null)){var E={content:C},y=e.isCombined?["+ "," +","++"]:["+"],ae=e.isCombined?["- "," -","--"]:["-"];lt(C,y)?(e.addedLines++,E.type=I.INSERT,E.oldNumber=void 0,E.newNumber=l++):lt(C,ae)?(e.deletedLines++,E.type=I.DELETE,E.oldNumber=s++,E.newNumber=void 0):(E.type=I.CONTEXT,E.oldNumber=s++,E.newNumber=l++),r.lines.push(E)}}function A(C,E){for(var y=E;yn.diffMaxChanges||typeof n.diffMaxLineLength=="number"&&C.length>n.diffMaxLineLength)){e.isTooBig=!0,e.addedLines=0,e.deletedLines=0,e.blocks=[],r=null;var G=typeof n.diffTooBigMessage=="function"?n.diffTooBigMessage(t.length):"Diff too big to be displayed";M(G);return}if(C.startsWith(b)&&Se.startsWith(L)||C.startsWith(L)&&ae.startsWith(b)){if(e&&!e.oldName&&C.startsWith("--- ")&&(y=Gt(C,n.srcPrefix))){e.oldName=y,e.language=at(e.oldName,e.language);return}if(e&&!e.newName&&C.startsWith("+++ ")&&(y=kt(C,n.dstPrefix))){e.newName=y,e.language=at(e.newName,e.language);return}}if(e&&(C.startsWith(o)||e.isGitDiff&&e.oldName&&e.newName&&!r)){M(C);return}if(r&&(C.startsWith("+")||C.startsWith("-")||C.startsWith(" "))){ee(C);return}var U=!A(C,E);if(e===null)throw new Error("Where is my file !!!");(y=d.exec(C))?e.oldMode=y[1]:(y=m.exec(C))?e.newMode=y[1]:(y=u.exec(C))?(e.deletedFileMode=y[1],e.isDeleted=!0):(y=v.exec(C))?(e.newFileMode=y[1],e.isNew=!0):(y=x.exec(C))?(U&&(e.oldName=y[1]),e.isCopy=!0):(y=w.exec(C))?(U&&(e.newName=y[1]),e.isCopy=!0):(y=N.exec(C))?(U&&(e.oldName=y[1]),e.isRename=!0):(y=T.exec(C))?(U&&(e.newName=y[1]),e.isRename=!0):(y=p.exec(C))?(e.isBinary=!0,e.oldName=Q(y[1],void 0,n.srcPrefix),e.newName=Q(y[2],void 0,n.dstPrefix),M("Binary file")):g.test(C)?(e.isBinary=!0,M(C)):(y=D.exec(C))?e.unchangedPercentage=parseInt(y[1],10):(y=j.exec(C))?e.changedPercentage=parseInt(y[1],10):(y=c.exec(C))?(e.checksumBefore=y[1],e.checksumAfter=y[2],y[3]&&(e.mode=y[3])):(y=S.exec(C))?(e.checksumBefore=[y[2],y[3]],e.checksumAfter=y[1]):(y=F.exec(C))?(e.oldMode=[y[2],y[3]],e.newMode=y[1]):(y=W.exec(C))?(e.newFileMode=y[1],e.isNew=!0):(y=$.exec(C))&&(e.deletedFileMode=y[1],e.isDeleted=!0)}}}),q(),se(),t}function J(){}J.prototype={diff:function(n,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=e.callback;typeof e=="function"&&(r=e,e={}),this.options=e;var s=this;function a(u){return r?(setTimeout(function(){r(void 0,u)},0),!0):u}n=this.castInput(n),t=this.castInput(t),n=this.removeEmpty(this.tokenize(n)),t=this.removeEmpty(this.tokenize(t));var l=t.length,h=n.length,f=1,b=l+h;e.maxEditLength&&(b=Math.min(b,e.maxEditLength));var L=[{newPos:-1,components:[]}],o=this.extractCommon(L[0],t,n,0);if(L[0].newPos+1>=l&&o+1>=h)return a([{value:this.join(t),count:t.length}]);function d(){for(var u=-1*f;u<=f;u+=2){var v=void 0,x=L[u-1],w=L[u+1],N=(w?w.newPos:0)-u;x&&(L[u-1]=void 0);var T=x&&x.newPos+1=l&&N+1>=h)return a(_t(s,v.components,t,n,s.useLongestToken));L[u]=v}f++}if(r)(function u(){setTimeout(function(){if(f>b)return r();d()||u()},0)})();else for(;f<=b;){var m=d();if(m)return m}},pushComponent:function(n,t,e){var r=n[n.length-1];r&&r.added===t&&r.removed===e?n[n.length-1]={count:r.count+1,added:t,removed:e}:n.push({count:1,added:t,removed:e})},extractCommon:function(n,t,e,r){for(var s=t.length,a=e.length,l=n.newPos,h=l-r,f=0;l+1d.length?u:d}),f.value=i.join(b)}else f.value=i.join(t.slice(l,l+f.count));l+=f.count,f.added||(h+=f.count)}}var o=n[a-1];return a>1&&typeof o.value=="string"&&(o.added||o.removed)&&i.equals("",o.value)&&(n[a-2].value+=o.value,n.pop()),n}function $t(i){return{newPos:i.newPos,components:i.components.slice(0)}}var Xt=new J;function ht(i,n,t){return Xt.diff(i,n,t)}var dt=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,ct=/\S/,Pe=new J;Pe.equals=function(i,n){return this.options.ignoreCase&&(i=i.toLowerCase(),n=n.toLowerCase()),i===n||this.options.ignoreWhitespace&&!ct.test(i)&&!ct.test(n)};Pe.tokenize=function(i){for(var n=i.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),t=0;ti.length)&&(n=i.length);for(var t=0,e=new Array(n);t0?h(j.lines.slice(-a.context)):[],b-=o.length,L-=o.length)}(D=o).push.apply(D,Oe(T.map(function(H){return(N.added?"+":"-")+H}))),N.added?m+=T.length:d+=T.length}else{if(b)if(T.length<=a.context*2&&w=l.length-2&&T.length<=a.context){var F=/\n$/.test(t),W=/\n$/.test(e),$=T.length==0&&o.length>S.oldLines;!F&&$&&t.length>0&&o.splice(S.oldLines,0,"\\ No newline at end of file"),(!F&&!$||!W)&&o.push("\\ No newline at end of file")}f.push(S),b=0,L=0,o=[]}d+=T.length,m+=T.length}},v=0;v0||l.indexB>0)&&(N=v.concat(N)),(e.length>o||r.length>d)&&(N=N.concat(w)),N}return t}var Ee=function(){return Ee=Object.assign||function(i){for(var n,t=1,e=arguments.length;t]*>((.|\n)*?)<\/ins>)/g,"")}function on(i){return i.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function de(i){switch(i){case I.CONTEXT:return O.CONTEXT;case I.INSERT:return O.INSERTS;case I.DELETE:return O.DELETES}}function fn(i){return i?2:1}function Z(i){return i.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function k(i,n,t){t===void 0&&(t=!0);var e=fn(n);return{prefix:i.substring(0,e),content:t?Z(i.substring(e)):i.substring(e)}}function te(i){var n=Re(i.oldName),t=Re(i.newName);if(n!==t&&!ze(n)&&!ze(t)){for(var e=[],r=[],s=n.split(X),a=t.split(X),l=s.length,h=a.length,f=0,b=l-1,L=h-1;ff&&L>f&&s[b]===a[L];)r.unshift(a[L]),b-=1,L-=1;var o=e.join(X),d=r.join(X),m=s.slice(f,b+1).join(X),u=a.slice(f,L+1).join(X);return o.length&&d.length?o+X+"{"+m+" \u2192 "+u+"}"+X+d:o.length?o+X+"{"+m+" \u2192 "+u+"}":d.length?"{"+m+" \u2192 "+u+"}"+X+d:n+" \u2192 "+t}else return ze(t)?n:t}function ce(i){return"d2h-".concat(rt(te(i)).toString().slice(-6))}function he(i){var n="file-changed";return i.isRename||i.isCopy?n="file-renamed":i.isNew?n="file-added":i.isDeleted?n="file-deleted":i.newName!==i.oldName&&(n="file-renamed"),n}function De(i,n,t,e){e===void 0&&(e={});var r=Ee(Ee({},ge),e),s=r.matching,a=r.maxLineLengthHighlight,l=r.matchWordsThreshold,h=r.diffStyle,f=k(i,t,!1),b=k(n,t,!1);if(f.content.length>a||b.content.length>a)return{oldLine:{prefix:f.prefix,content:Z(f.content)},newLine:{prefix:b.prefix,content:Z(b.content)}};var L=h==="char"?ht(f.content,b.content):ut(f.content,b.content),o=[];if(h==="word"&&s==="words"){var d=L.filter(function(x){return x.removed}),m=L.filter(function(x){return x.added}),u=an(m,d);u.forEach(function(x){if(x[0].length===1&&x[1].length===1){var w=mt(x[0][0],x[1][0]);w-1?' class="d2h-change"':"",D=Z(w.value);return N!==null?"".concat(x,"<").concat(N).concat(T,">").concat(D,""):"".concat(x).concat(D)},"");return{oldLine:{prefix:f.prefix,content:ln(v)},newLine:{prefix:b.prefix,content:on(v)}}}var vt="file-summary",dn="icon";function gt(i,n){var t=i.map(function(e){return n.render(vt,"line",{fileHtmlId:ce(e),oldName:e.oldName,newName:e.newName,fileName:te(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:n.template(dn,he(e))})}).join(` +`);return n.render(vt,"wrapper",{filesNumber:i.length,files:t})}var B=function(){return B=Object.assign||function(i){for(var n,t=1,e=arguments.length;t0)&&(t.push([[],e,r]),e=[],r=[]),a.type===I.CONTEXT?t.push([[a],[],[]]):a.type===I.INSERT&&e.length===0?t.push([[],[],[a]]):a.type===I.INSERT&&e.length>0?r.push(a):a.type===I.DELETE&&e.push(a)}return(e.length||r.length)&&(t.push([[],e,r]),e=[],r=[]),t},i.prototype.applyRematchMatching=function(n,t,e){var r=n.length*t.length,s=Math.max.apply(null,[0].concat(n.concat(t).map(function(l){return l.content.length}))),a=r0)&&(t.push([[],e,r]),e=[],r=[]),a.type===I.CONTEXT?t.push([[a],[],[]]):a.type===I.INSERT&&e.length===0?t.push([[],[],[a]]):a.type===I.INSERT&&e.length>0?r.push(a):a.type===I.DELETE&&e.push(a)}return(e.length||r.length)&&(t.push([[],e,r]),e=[],r=[]),t},i.prototype.applyRematchMatching=function(n,t,e){var r=n.length*t.length,s=Math.max.apply(null,[0].concat(n.concat(t).map(function(l){return l.content.length}))),a=r'),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(e.rp("'),e.b(e.v(e.f("fileName",i,n,0))),e.b(""),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(' '),e.b(e.v(e.f("addedLines",i,n,0))),e.b(""),e.b(` +`+t),e.b(' '),e.b(e.v(e.f("deletedLines",i,n,0))),e.b(""),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b(""),e.fl()},partials:{"'),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b(' Files changed ('),e.b(e.v(e.f("filesNumber",i,n,0))),e.b(")"),e.b(` +`+t),e.b(' hide'),e.b(` +`+t),e.b(' show'),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b('
    '),e.b(` +`+t),e.b(" "),e.b(e.t(e.f("files",i,n,0))),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b(""),e.fl()},partials:{},subs:{}});V["generic-block-header"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b(""),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b('
'),e.s(e.f("blockHeader",i,n,1),i,n,0,156,173,"{{ }}")&&(e.rs(i,n,function(r,s,a){a.b(a.t(a.f("blockHeader",r,s,0)))}),i.pop()),e.s(e.f("blockHeader",i,n,1),i,n,1,0,0,"")||e.b(" "),e.b("
"),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b(""),e.fl()},partials:{},subs:{}});V["generic-empty-diff"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b(""),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b(" File without changes"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b(""),e.fl()},partials:{},subs:{}});V["generic-file-path"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b(''),e.b(` +`+t),e.b(e.rp("'),e.b(e.v(e.f("fileDiffName",i,n,0))),e.b(""),e.b(` +`+t),e.b(e.rp(""),e.b(` +`+t),e.b('"),e.fl()},partials:{""),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(" "),e.b(e.t(e.f("lineNumber",i,n,0))),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.s(e.f("prefix",i,n,1),i,n,0,162,238,"{{ }}")&&(e.rs(i,n,function(r,s,a){a.b(' '),a.b(a.t(a.f("prefix",r,s,0))),a.b(""),a.b(` +`+t)}),i.pop()),e.s(e.f("prefix",i,n,1),i,n,1,0,0,"")||(e.b('  '),e.b(` +`+t)),e.s(e.f("content",i,n,1),i,n,0,371,445,"{{ }}")&&(e.rs(i,n,function(r,s,a){a.b(' '),a.b(a.t(a.f("content",r,s,0))),a.b(""),a.b(` +`+t)}),i.pop()),e.s(e.f("content",i,n,1),i,n,1,0,0,"")||(e.b('
'),e.b(` +`+t)),e.b("
"),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b(""),e.fl()},partials:{},subs:{}});V["generic-wrapper"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('
'),e.b(` +`+t),e.b(" "),e.b(e.t(e.f("content",i,n,0))),e.b(` +`+t),e.b("
"),e.fl()},partials:{},subs:{}});V["icon-file-added"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('"),e.fl()},partials:{},subs:{}});V["icon-file-changed"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('"),e.fl()},partials:{},subs:{}});V["icon-file-deleted"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('"),e.fl()},partials:{},subs:{}});V["icon-file-renamed"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('"),e.fl()},partials:{},subs:{}});V["icon-file"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('"),e.fl()},partials:{},subs:{}});V["line-by-line-file-diff"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('
'),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b(" "),e.b(e.t(e.f("filePath",i,n,0))),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(" "),e.b(e.t(e.f("diffs",i,n,0))),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.fl()},partials:{},subs:{}});V["line-by-line-numbers"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('
'),e.b(e.v(e.f("oldNumber",i,n,0))),e.b("
"),e.b(` +`+t),e.b('
'),e.b(e.v(e.f("newNumber",i,n,0))),e.b("
"),e.fl()},partials:{},subs:{}});V["side-by-side-file-diff"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('
'),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b(" "),e.b(e.t(e.f("filePath",i,n,0))),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(" "),e.b(e.t(e.d("diffs.left",i,n,0))),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b('
'),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(' '),e.b(` +`+t),e.b(" "),e.b(e.t(e.d("diffs.right",i,n,0))),e.b(` +`+t),e.b(" "),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.b(` +`+t),e.b("
"),e.fl()},partials:{},subs:{}});V["tag-file-added"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('ADDED'),e.fl()},partials:{},subs:{}});V["tag-file-changed"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('CHANGED'),e.fl()},partials:{},subs:{}});V["tag-file-deleted"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('DELETED'),e.fl()},partials:{},subs:{}});V["tag-file-renamed"]=new R.Template({code:function(i,n,t){var e=this;return e.b(t=t||""),e.b('RENAMED'),e.fl()},partials:{},subs:{}});var ne=function(){return ne=Object.assign||function(i){for(var n,t=1,e=arguments.length;t{if(this.raw)this.raw=!this.raw,(async()=>(s.empty(),await re.MarkdownRenderer.renderMarkdown(this.syncFile,s,this.file.path,null)))(),r.innerText="Show raw text";else{s.empty();let a=s.createEl("textarea",{text:this.syncFile,attr:{spellcheck:!1},cls:"plain-text-area"});this.raw=!this.raw,r.innerText="Show Reading view"}}),e.addEventListener("click",()=>{(async()=>await this.app.vault.modify(this.file,this.syncFile))(),new re.Notice(`The ${this.file.basename} file has been overwritten with the selected version.`),this.close()}),await re.MarkdownRenderer.renderMarkdown(this.syncFile,s,this.file.path,null)}};var Et=require("obsidian");var Y=class extends Et.Modal{constructor(t,e,r){super(e);this.plugin=t,this.app=e,this.file=r,this.modalEl.addClasses(["mod-sync-history","diff"]),this.leftVList=[],this.rightVList=[],this.rightActive=0,this.leftActive=1,this.rightContent="",this.leftContent="",this.ids={left:0,right:0},this.leftHistory=[null],this.rightHistory=[null],this.htmlConfig={diffStyle:this.plugin.settings.diffStyle,matchWordsThreshold:this.plugin.settings.matchWordsThreshold},this.containerEl.addClass("diff"),this.syncHistoryContentContainer=this.contentEl.createDiv({cls:["sync-history-content-container","diff"]}),this.plugin.settings.colorBlind&&this.syncHistoryContentContainer.addClass("colorblind")}onOpen(){super.onOpen()}getDiff(){let t=pt(this.file.basename,this.file.basename,this.leftContent,this.rightContent);return Tt(t,this.htmlConfig)}makeHistoryLists(t){this.leftHistory=this.createHistory(this.contentEl,!0,t),this.rightHistory=this.createHistory(this.contentEl,!1,t)}createHistory(t,e=!1,r){let s=t.createDiv({cls:"sync-history-list-container"});e&&s.createEl("button",{cls:"mod-cta",text:"Render this version"}).addEventListener("click",()=>{new we(this.plugin,this.app,this.leftContent,this.file,r).open()});let a=s.createDiv({cls:"sync-history-list"});return[s,a]}basicHtml(t,e){this.titleEl.setText(e),this.syncHistoryContentContainer.innerHTML=t,this.contentEl.appendChild(this.leftHistory[0]),this.contentEl.appendChild(this.syncHistoryContentContainer),this.contentEl.appendChild(this.rightHistory[0])}makeMoreGeneralHtml(){this.rightVList[0].html.addClass("is-active"),this.leftVList[1].html.addClass("is-active"),this.rightActive=0,this.leftActive=1}async generateVersionListener(t,e,r,s=!1){let a=e[r],l=Number(t.id),h=e[l];return t.addClass("is-active"),s?this.leftActive=l:this.rightActive=l,a.html.classList.remove("is-active"),h}};function xn(i){return i===0?"0":(i/1e3).toString().slice(0,-1)}var Le=class extends Y{constructor(t,e,r){super(t,e,r);this.versions={},this.leftVList=[],this.rightVList=[]}async onOpen(){super.onOpen(),await this.getInitialVersions();let t=this.getDiff();this.makeHistoryLists(Nt),this.makeButtons(),this.basicHtml(t,"Sync Diff"),this.appendVersions(),this.makeMoreGeneralHtml()}async getInitialVersions(){this.versions=await this.plugin.diff_utils.getVersions(this.file);let[t,e]=[0,0];if(this.versions.items.length>1)t=this.versions.items[0].uid,e=this.versions.items[1].uid;else{this.close(),new Dt.Notice("There are not at least two versions.");return}let r=this.plugin.diff_utils.getContent.bind(this);[this.leftContent,this.rightContent]=[await r(e),await r(t)]}appendVersions(){this.leftVList.push(...this.appendSyncVersions(this.leftHistory[1],this.versions,!0)),this.rightVList.push(...this.appendSyncVersions(this.rightHistory[1],this.versions,!1))}makeButtons(){let t=this.leftHistory[0].createDiv({cls:["sync-history-load-more-button","diff"],text:"Load more"}),e=this.rightHistory[0].createDiv({cls:["sync-history-load-more-button","diff"],text:"Load more"});this.setMoreButtonStyle(t,e);for(let r of[t,e])r.addEventListener("click",async()=>{var a;let s=await this.plugin.diff_utils.getVersions(this.file,(a=this.versions.items.last())==null?void 0:a.uid);this.versions.more=s.more,this.setMoreButtonStyle(t,e),this.leftVList.push(...this.appendSyncVersions(this.leftHistory[1],s,!0)),this.rightVList.push(...this.appendSyncVersions(this.rightHistory[1],s,!1)),this.versions.items.push(...s.items)})}setMoreButtonStyle(t,e){this.versions.more?(t.style.display="block",e.style.display="block"):(t.style.display="none",e.style.display="none")}appendSyncVersions(t,e,r){let s=[];for(let a=0;a<=e.items.length-1;a++){let l=e.items[a],h=new Date(l.ts),f=t.createDiv({cls:"sync-history-list-item",text:h.toDateString()+", "+h.toLocaleTimeString(),attr:{id:r?this.ids.left:this.ids.right}});r?this.ids.left+=1:this.ids.right+=1;let b=f.createDiv({cls:["u-muted"],text:xn(l.size)+" KB ["+l.device+"]"});s.push({html:f,v:l}),f.addEventListener("click",async()=>{if(r){let L=await this.generateVersionListener(f,this.leftVList,this.leftActive,r);await this.getSyncContent(L,r),this.syncHistoryContentContainer.innerHTML=this.getDiff()}else{let L=await this.generateVersionListener(f,this.rightVList,this.rightActive);await this.getSyncContent(L),this.syncHistoryContentContainer.innerHTML=this.getDiff()}})}return s}async getSyncContent(t,e=!1){let r=this.plugin.diff_utils.getContent.bind(this);e?this.leftContent=await r(t.v.uid):this.rightContent=await r(t.v.uid)}};var It=require("obsidian");var xe=class extends Y{constructor(t,e,r){super(t,e,r);this.versions=[],this.leftVList=[],this.rightVList=[]}async onOpen(){super.onOpen(),await this.getInitialVersions();let t=this.getDiff();this.makeHistoryLists(Qe),this.basicHtml(t,"File Recovery Diff"),this.appendVersions(),this.makeMoreGeneralHtml()}async getInitialVersions(){let t=await this.app.internalPlugins.plugins["file-recovery"].instance.db.transaction("backups","readonly").store.index("path").getAll(),e=await this.app.vault.read(this.file);this.versions.push({path:this.file.path,ts:0,data:e});let r=t.length-1;for(let s=r;s>=0;s--){let a=t[s];a.path===this.file.path&&this.versions.push(a)}if(!(this.versions.length>1)){this.close(),new It.Notice("There is not at least on version in the file recovery.");return}[this.leftContent,this.rightContent]=[this.versions[1].data,this.versions[0].data]}appendVersions(){this.leftVList.push(...this.appendRecoveryVersions(this.leftHistory[1],this.versions,!0)),this.rightVList.push(...this.appendRecoveryVersions(this.rightHistory[1],this.versions,!1))}appendRecoveryVersions(t,e,r=!1){let s=[];for(let a=0;a{if(r){let b=await this.generateVersionListener(f,this.leftVList,this.leftActive,r);this.leftContent=l.data,this.syncHistoryContentContainer.innerHTML=this.getDiff()}else{let b=await this.generateVersionListener(f,this.rightVList,this.rightActive);this.rightContent=l.data,this.syncHistoryContentContainer.innerHTML=this.getDiff()}})}return s}};var Ft=require("obsidian");var Ce=class extends Y{constructor(t,e,r){super(t,e,r);this.versions=[],this.leftVList=[],this.rightVList=[]}async onOpen(){if(super.onOpen(),await this.getInitialVersions()===!1)return;let e=this.getDiff();this.makeHistoryLists(Ht),this.basicHtml(e,"Git Diff"),this.appendVersions(),this.makeMoreGeneralHtml()}async getInitialVersions(){let{gitManager:t}=this.app.plugins.plugins["obsidian-git"],e=await t.log(this.file.path);if(e.length===0)return this.close(),new Ft.Notice("There are no commits for this file."),!1;this.versions.push({author_email:"",author_name:"",body:"",date:new Date().toLocaleTimeString(),hash:"",message:"",refs:"",fileName:this.file.name}),this.versions.push(...e);let r=await this.app.vault.read(this.file),s=await t.show(this.versions[1].hash,this.file.path);[this.leftContent,this.rightContent]=[s,r]}appendVersions(){this.leftVList.push(...this.appendGitVersions(this.leftHistory[1],this.versions,!0)),this.rightVList.push(...this.appendGitVersions(this.rightHistory[1],this.versions,!1))}appendGitVersions(t,e,r=!1){let s=[];for(let a=0;a{await navigator.clipboard.writeText(l.hash)}),s.push({html:h,v:l}),h.addEventListener("click",async()=>{if(r){let x=await this.generateVersionListener(h,this.leftVList,this.leftActive,r);this.leftActive===0?this.leftContent=await this.app.vault.read(this.file):this.leftContent=await this.app.plugins.plugins["obsidian-git"].gitManager.show(x.v.hash,x.v.fileName),this.syncHistoryContentContainer.innerHTML=await this.getDiff()}else{let x=await this.generateVersionListener(h,this.rightVList,this.rightActive);this.rightActive===0?this.rightContent=await this.app.vault.read(this.file):this.rightContent=await this.app.plugins.plugins["obsidian-git"].gitManager.show(x.v.hash,x.v.fileName),this.syncHistoryContentContainer.innerHTML=await this.getDiff()}})}return s}};var Cn={diffStyle:"word",matchWordsThreshold:.25,colorBlind:!1},Fe=class extends ue.Plugin{constructor(){super(...arguments);this.diff_utils=new me(this,this.app);this.addCommand=t=>{let e=t.name,r=super.addCommand(t);return r.name="Version history diff: "+e,r}}openGitDiffModal(t){this.app.plugins.plugins["obsidian-git"]?new Ce(this,this.app,t).open():new ue.Notice("Obsidian Git is not enabled")}openRecoveryDiffModal(t){new xe(this,this.app,t).open()}openDiffModal(t){new Le(this,this.app,t).open()}async openSyncHistory(t){let{instance:e}=this.app.internalPlugins.plugins.sync;await e.showVersionHistory(t.path)}giveCallback(t){return e=>{let r=this.app.workspace.getActiveFile();return r?(e||t(r),!0):!1}}returnOpenCommand(){return{id:"open-sync-version-history",name:"Show Sync history for active file",checkCallback:this.giveCallback(this.openSyncHistory.bind(this))}}returnDiffCommand(){return{id:"open-sync-diff-view",name:"Show Sync diff view for active file",checkCallback:this.giveCallback(this.openDiffModal.bind(this))}}returnRecoveryDiffCommand(){return{id:"open-recovery-diff-view",name:"Show File Recovery diff view for active file",checkCallback:this.giveCallback(this.openRecoveryDiffModal.bind(this))}}returnGitDiffCommand(){return{id:"open-git-diff-view",name:"Show Git Diff view for active file",checkCallback:this.giveCallback(this.openGitDiffModal.bind(this))}}async onload(){console.log("loading Version History Diff plugin"),this.addCommand(this.returnOpenCommand()),this.addCommand(this.returnDiffCommand()),this.addCommand(this.returnRecoveryDiffCommand()),ue.Platform.isDesktopApp&&this.addCommand(this.returnGitDiffCommand()),await this.loadSettings(),this.addSettingTab(new pe(this.app,this))}onunload(){console.log("unloading Version History Diff plugin")}async loadSettings(){this.settings=Object.assign({},Cn,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}}; diff --git a/.obsidian/plugins/obsidian-version-history-diff/manifest.json b/.obsidian/plugins/obsidian-version-history-diff/manifest.json new file mode 100644 index 0000000..1126a97 --- /dev/null +++ b/.obsidian/plugins/obsidian-version-history-diff/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "obsidian-version-history-diff", + "name": "Version History Diff", + "version": "2.1.0", + "minAppVersion": "1.1.7", + "description": "Diff the version history of the core Sync and File Recovery plugins and Git. Adds a command to open the core Sync version history as well.", + "author": "kometenstaub", + "authorUrl": "https://github.com/kometenstaub", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/obsidian-version-history-diff/styles.css b/.obsidian/plugins/obsidian-version-history-diff/styles.css new file mode 100644 index 0000000..627b5a1 --- /dev/null +++ b/.obsidian/plugins/obsidian-version-history-diff/styles.css @@ -0,0 +1,27 @@ +/* +MIT-licensed from diff2html, with changes from @kometenstaub for the modals +and adaptation to Obsidian variables and colour changes in addition to the colour-blind +mode from @SlRvb, which fall under the same license (MIT license, @kometenstaub and contributors) + + Original license: + + https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md + + Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +@charset "UTF-8";.theme-dark,.theme-light{--sync-delete-bg:#ff475040;--sync-delete-hl:#96050a75;--sync-insert-bg:#68d36840;--sync-insert-hl:#23c02350;--sync-change-bg:#ffd55840;--sync-selected:#3572b0;--sync-delete:#c33;--sync-insert:#399839;--sync-change:#d0b44c;--sync-move:#3572b0}.is-mobile .modal.mod-sync-history.diff .modal-content>*{height:unset;max-height:100%;position:unset;width:unset}.is-mobile .diff .modal-content{flex-direction:unset}.is-mobile .diff .sync-history-list-container{flex-direction:column}.is-mobile .diff .sync-history-list-container button.mod-cta{margin-left:-.25em}.is-mobile .diff .sync-history-list-item.is-active{background-color:var(--background-primary-alt)}.is-mobile .sync-history-content-container.diff{width:70vw!important}.is-ios.is-mobile .diff .sync-history-content-container.diff .d2h-code-linenumber{position:relative}.is-ios.is-mobile .diff .sync-history-content-container.diff .d2h-code-line{padding-left:.5em}.diff .d2h-d-none{display:none}.diff .d2h-wrapper{border-radius:.25em;overflow:auto;text-align:left}.diff .d2h-file-header.d2h-file-header{background-color:var(--background-secondary);border-bottom:1px solid var(--background-modifier-border);font-family:Source Sans Pro,Helvetica Neue,Helvetica,Arial,sans-serif;height:35px;padding:5px 10px}.diff .d2h-file-header,.diff .d2h-file-stats{display:-webkit-box;display:-ms-flexbox;display:flex}.diff .d2h-file-header{display:none}.diff .d2h-file-stats{font-size:14px;margin-left:auto}.diff .d2h-lines-added{border:1px solid var(--color-green);border-radius:5px 0 0 5px;color:var(--color-green);padding:2px;text-align:right;vertical-align:middle}.diff .d2h-lines-deleted{border:1px solid var(--color-red);border-radius:0 5px 5px 0;color:var(--color-red);margin-left:1px;padding:2px;text-align:left;vertical-align:middle}.diff .d2h-file-name-wrapper{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;font-size:15px;width:100%}.diff .d2h-file-name{color:var(--text-normal);font-size:var(--h5-size);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.diff .d2h-file-wrapper{margin-bottom:1em;max-height:100%}.diff .d2h-file-collapse,.diff .d2h-file-wrapper{border:1px solid var(--background-secondary-alt);border-radius:3px}.diff .d2h-file-collapse{-webkit-box-pack:end;-ms-flex-pack:end;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;display:none;font-size:12px;justify-content:flex-end;padding:4px 8px}.diff .d2h-file-collapse.d2h-selected{background-color:var(--sync-selected)}.diff .d2h-file-collapse-input{margin:0 4px 0 0}.diff .d2h-diff-table{border-collapse:collapse;font-family:Menlo,Consolas,monospace;font-size:13px;width:100%}.diff .d2h-files-diff{width:100%}.diff .d2h-file-diff{border-radius:5px}.diff .d2h-file-side-diff{display:inline-block;margin-bottom:-8px;margin-right:-4px;overflow-x:scroll;overflow-y:hidden;width:50%}.diff .d2h-code-line{padding-left:6em;padding-right:1.5em}.diff .d2h-code-line,.diff .d2h-code-side-line{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:100%}.diff .d2h-code-side-line{padding-left:.5em;padding-right:.5em}.diff .d2h-code-line-ctn{word-wrap:normal;background:none;display:inline-block;padding:0;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;vertical-align:middle;white-space:pre-wrap;width:100%}.diff .d2h-code-line del,.diff .d2h-code-side-line del{background-color:var(--sync-delete-hl);color:var(--text-normal)}.diff .d2h-code-line del,.diff .d2h-code-line ins,.diff .d2h-code-side-line del,.diff .d2h-code-side-line ins{border-radius:.2em;display:inline-block;margin-top:-1px;text-decoration:none;vertical-align:middle}.diff .d2h-code-line ins,.diff .d2h-code-side-line ins{background-color:var(--sync-insert-hl);text-align:left}.diff .d2h-code-line-prefix{word-wrap:normal;background:none;display:inline;padding:0;white-space:pre}.diff .line-num1{float:left}.diff .line-num1,.diff .line-num2{-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;padding-left:0;text-overflow:ellipsis;width:2.5em}.diff .line-num2{float:right}.diff .d2h-code-linenumber{background-color:var(--background-primary);border:solid var(--background-modifier-border);border-width:0 1px;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--text-faint);cursor:pointer;display:inline-block;position:absolute;text-align:right;width:5.5em}.diff .d2h-code-linenumber:after{content:"​"}.diff .d2h-code-side-linenumber{background-color:var(--background-primary);border:solid var(--background-modifier-border);border-width:0 1px;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--text-faint);cursor:pointer;display:table-cell;overflow:hidden;padding:0 .5em;position:relative;text-align:right;text-overflow:ellipsis;width:4em}.diff .d2h-code-side-linenumber:after{content:"​"}.diff .d2h-code-side-emptyplaceholder,.diff .d2h-emptyplaceholder{background-color:var(--background-primary);border-color:var(--background-modifier-border)}.diff .d2h-code-line-prefix,.diff .d2h-code-linenumber,.diff .d2h-code-side-linenumber,.diff .d2h-emptyplaceholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.diff .d2h-code-linenumber,.diff .d2h-code-side-linenumber{direction:rtl}.diff .d2h-del{background-color:var(--sync-delete-bg);border-color:var(--sync-delete-hl)}.diff .d2h-ins{background-color:var(--sync-insert-bg);border-color:var(--sync-insert-hl)}.diff .d2h-info{background-color:var(--background-primary);border-color:var(--background-modifier-border);color:var(--text-faint)}.diff .d2h-del,.diff .d2h-file-diff .d2h-change,.diff .d2h-ins{color:var(--text-normal)}.diff .d2h-file-diff .d2h-del.d2h-change{background-color:var(--sync-change-bg)}.diff .d2h-file-diff .d2h-ins.d2h-change{background-color:var(--sync-insert-bg)}.diff .d2h-file-list-wrapper a{-webkit-user-drag:none;cursor:default;text-decoration:none}.diff .d2h-file-list-wrapper svg{display:none}.diff .d2h-file-list-header{text-align:left}.diff .d2h-file-list-title{display:none}.diff .d2h-file-list-line{display:-webkit-box;display:-ms-flexbox;display:flex;text-align:left}.diff .d2h-file-list>li{border-bottom:1px solid var(--background-modifier-border);margin:0;padding:5px 10px}.diff .d2h-file-list>li:last-child{border-bottom:none}.diff .d2h-file-switch{cursor:pointer;display:none;font-size:10px}.diff .d2h-icon{fill:currentColor;margin-right:10px;vertical-align:middle}.diff .d2h-deleted{color:var(--sync-delete)}.diff .d2h-added{color:var(--sync-insert)}.diff .d2h-changed{color:var(--sync-change)}.diff .d2h-moved{color:var(--sync-move)}.diff .d2h-tag{background-color:var(--background-secondary);display:-webkit-box;display:-ms-flexbox;display:flex;font-size:10px;margin-left:5px;padding:0 2px}.diff .d2h-deleted-tag{border:1px solid var(--sync-delete)}.diff .d2h-added-tag{border:1px solid var(--sync-insert)}.diff .d2h-changed-tag{border:1px solid var(--sync-change)}.diff .d2h-moved-tag{border:1px solid var(--sync-move)}.diff .d2h-diff-tbody{position:relative}.diff .sync-history-content-container{border-radius:.25em;padding:.5rem}.diff .sync-history-list-container{flex-shrink:unset}.diff .sync-history-list-container button.mod-cta{margin-left:.5em;margin-right:.5em;margin-top:.5em}.diff .sync-history-list-container button.mod-cta+.sync-history-list.sync-history-list{margin-top:0}.diff .sync-history-list-container .sync-history-list{margin-top:1.5em}.diff .sync-history-list-container .sync-history-list .sync-history-list-item{border-radius:.25em}.diff .modal-content{display:flex;flex-direction:row;height:80vh}.modal.mod-sync-history.diff{min-width:95vw}.modal.mod-sync-history.diff .sync-history-list-item.is-active:hover{background-color:var(--interactive-accent-hover)}@media only screen and (min-width:1200px){.modal.mod-sync-history.diff{min-width:80vw}}.theme-dark .colorblind .d2h-code-line del{background:repeating-linear-gradient(-45deg,var(--background-primary),var(--sync-delete-hl) 2px,var(--sync-delete-hl) 2px,var(--sync-delete-hl) 19px)}.theme-dark .colorblind .d2h-ins:not(.d2h-code-linenumber){background-image:radial-gradient(var(--sync-insert-hl) 2px,transparent 1px),radial-gradient(var(--sync-insert-hl) 2px,transparent 1px)}.colorblind .d2h-code-line del,.colorblind .d2h-del:not(.d2h-change):not(.d2h-code-linenumber){background:repeating-linear-gradient(-45deg,transparent,var(--sync-delete-bg) 2px,var(--sync-delete-bg) 2px,var(--sync-delete-bg) 19px)}.colorblind .d2h-ins:not(.d2h-code-linenumber){background-image:radial-gradient(var(--background-primary) 2px,transparent 1px),radial-gradient(var(--background-primary) 2px,transparent 1px);background-position:0 0,25px 28px;background-size:40px 40px}.colorblind .d2h-code-line ins,.colorblind .d2h-code-linenumber.d2h-ins{border-color:var(--sync-insert);border-style:solid;border-width:1px 2px}.version-display .modal{max-height:90vh}.version-display .modal textarea.plain-text-area{height:67vh;margin-top:1rem;min-width:100%;position:inherit}@media only screen and (max-width:1000px){.version-display .modal{min-width:90vw}}@media only screen and (min-width:1001px){.version-display .modal{max-width:80vw}}@media only screen and (min-width:1200px){.version-display .modal{max-width:70vw}}@media only screen and (min-width:1400px){.version-display .modal{max-width:65vw}} \ No newline at end of file diff --git a/.obsidian/workspace b/.obsidian/workspace deleted file mode 100644 index 4ec7b8b..0000000 --- a/.obsidian/workspace +++ /dev/null @@ -1,111 +0,0 @@ -{ - "main": { - "id": "c01acc1e0c3642a1", - "type": "split", - "children": [ - { - "id": "458b5417a938cfb3", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "SerializedObject.md", - "mode": "source", - "source": false - } - } - } - ], - "direction": "vertical" - }, - "left": { - "id": "b3f2fe956c600b2b", - "type": "split", - "children": [ - { - "id": "b892947aee3a10a9", - "type": "tabs", - "children": [ - { - "id": "b736346aa28b495c", - "type": "leaf", - "state": { - "type": "file-explorer", - "state": {} - } - }, - { - "id": "bd33cd6e5600118d", - "type": "leaf", - "state": { - "type": "search", - "state": { - "query": "", - "matchingCase": false, - "explainSearch": false, - "collapseAll": false, - "extraContext": false, - "sortOrder": "alphabetical" - } - } - } - ] - } - ], - "direction": "horizontal", - "width": 249 - }, - "right": { - "id": "d809b577c235ae94", - "type": "split", - "children": [ - { - "id": "7cbbb049622f8875", - "type": "tabs", - "children": [ - { - "id": "fc04db1c3d5f37f2", - "type": "leaf", - "state": { - "type": "backlink", - "state": { - "file": "SerializedObject.md", - "collapseAll": false, - "extraContext": false, - "sortOrder": "alphabetical", - "showSearch": false, - "searchQuery": "", - "backlinkCollapsed": false, - "unlinkedCollapsed": true - } - } - }, - { - "id": "d9c52b59dc19017c", - "type": "leaf", - "state": { - "type": "calendar", - "state": {} - } - } - ] - } - ], - "direction": "horizontal", - "width": 300, - "collapsed": true - }, - "active": "b736346aa28b495c", - "lastOpenFiles": [ - "SearchFilter UnityEditor筛选器.md", - "Pasted image 20221021171104.png", - "Mesh Baker.md", - "conflict-files-obsidian-git.md", - "图集处理.md", - "待办事项/TODO.md", - "本地化流程.md", - "待办事项/Work.md", - "待办事项/Learn.md", - "未命名.md" - ] -} \ No newline at end of file diff --git a/GPU/GPU渲染流程.md b/GPU/GPU渲染流程.md new file mode 100644 index 0000000..c976625 --- /dev/null +++ b/GPU/GPU渲染流程.md @@ -0,0 +1,52 @@ + +https://www.cnblogs.com/timlly/p/11471507.html +参考网站 + +# SM 流处理器 + 包括 + 运算核心 + load/store 加载与储存 + 特殊数学运算 sin、cos、log + 寄存器 + L1缓存 + 全局内存缓存 + 纹理读取单元 + 纹理缓存 + PolyMorph Engine:多边形引擎(负责属性装配、顶点拉取、曲面细分、栅格化 ~= 专门处理顶点相关) + 2个Wrap Schedulers:负责wrap调度 1一个warp由32个线程组成,warp调度器的指令通过Dispatch Units送到Core执行。 + 指令缓存 + 内部链接网络(?) + +# GPU渲染管线 + 通过图形api调用drawcall-> + 指令推送到驱动,驱动检查是否合法-> + 驱动把指令缓存到buffer里-> + 下次flush会把指令推送到GPU-> + ----------主机------- + + GPU通过主机接口Host Interface接受命令-> + 通过前端(Front End)处理这些命令(?)-> Front End是哪儿 + 图元分配开始工作(indexbuffer产生三角形形成批次, 分配给GPCs{ ? })-> + SM的多边形引擎(Poly Morph Engine)通过三角形索引获取三角形数据(Vertex Fetch)-> + SM的Wrap调度(SIMT)-> +![[Pasted image 20230413163234.png]] + + 等到wrap完成了vertex-shader的所有指令,三角形会被裁剪然后准备栅格化,GPU会把L1和L2缓存来进行vertex-shader和pixel-shader之间的数据通信 + SM上的Attribute Setup保证了从vertex-shader来的数据经过插值后是pixel-shade是可读的。 + 光栅化引擎开始接受三角形工作(裁剪、背面剔除、Early-Z剔除) + 32个线程分成8个2*2的像素块、如果没有三角形覆盖,线程会被遮掩 + 最后会颜色和深度输出到ROP(渲染输出单元),进行深度测试和framebuffer混合 + +# 深度测试 + +### 深度测试失效情况: + 开启透明测试 + 开启像素摒弃指令 - OpenGL的clip + 关闭深度测试 + 开启Multi-Sampling:多采样 + +### 深度测试会导致深度数据冲突 + +# CPU与GPU异构系统 + 分离 + 耦合 \ No newline at end of file diff --git a/GPU/Pasted image 20230413163234.png b/GPU/Pasted image 20230413163234.png new file mode 100644 index 0000000..5eb61a5 Binary files /dev/null and b/GPU/Pasted image 20230413163234.png differ diff --git a/并行计算/CPU/Brust.md b/并行计算/CPU/Brust.md new file mode 100644 index 0000000..8d4c92b --- /dev/null +++ b/并行计算/CPU/Brust.md @@ -0,0 +1,2 @@ + +todo... \ No newline at end of file diff --git a/并行计算/CPU/SIMD(单指令多数据).md b/并行计算/CPU/SIMD(单指令多数据).md new file mode 100644 index 0000000..2bfb5b2 --- /dev/null +++ b/并行计算/CPU/SIMD(单指令多数据).md @@ -0,0 +1,11 @@ + + +- 一个普通加法指令,一次只能对两个数执行一个加法操作。 +- 一个 SIMD 加法指令,一次可以对两个数组(向量)执行加法操作。 + + 一个寄存器存多个数据同时批量处理 + + +## CSharp中的SIMD + 位于 System.Numerics 下的Vector即可开始进行硬件级别上的处理 + Vector.Count为寄存器能容纳的位数 \ No newline at end of file diff --git a/并行计算/GPU/Compute Shader.md b/并行计算/GPU/Compute Shader.md new file mode 100644 index 0000000..e69de29 diff --git a/并行计算/GPU/SIMT.md b/并行计算/GPU/SIMT.md new file mode 100644 index 0000000..ce5e621 --- /dev/null +++ b/并行计算/GPU/SIMT.md @@ -0,0 +1,8 @@ + + +单指令多线程 +一个指令 会有多条线程运行相同的指令 +英伟达会给出多个修饰符,例如:Bit Mask可以指定哪些线程干活 哪些空转,既可支持分支操作 +每个线程会进入锁步(lock-step) +线程会进入被遮掩(be masked out) +被遮掩的原因,例如:if(false) 或者循环次数不一致 \ No newline at end of file diff --git a/手写渲染器/课程.md b/手写渲染器/课程.md new file mode 100644 index 0000000..416eab1 --- /dev/null +++ b/手写渲染器/课程.md @@ -0,0 +1,2 @@ + +https://github.com/ssloy/tinyrenderer/wiki/Lesson-0:-getting-started \ No newline at end of file