95 lines
320 KiB
JavaScript
95 lines
320 KiB
JavaScript
|
|
/*
|
||
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
|
|
if you want to view the source, please visit the github repository of this plugin
|
||
|
|
*/
|
||
|
|
|
||
|
|
var hb=Object.create;var Jl=Object.defineProperty;var Pf=Object.getOwnPropertyDescriptor;var gb=Object.getOwnPropertyNames;var vb=Object.getPrototypeOf,yb=Object.prototype.hasOwnProperty;var Wf=t=>{throw TypeError(t)};var Ye=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},bb=(t,e)=>{for(var n in e)Jl(t,n,{get:e[n],enumerable:!0})},td=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of gb(e))!yb.call(t,l)&&l!==n&&Jl(t,l,{get:()=>e[l],enumerable:!(a=Pf(e,l))||a.enumerable});return t};var Y=(t,e,n)=>(n=t!=null?hb(vb(t)):{},td(e||!t||!t.__esModule?Jl(n,"default",{value:t,enumerable:!0}):n,t)),Sb=t=>td(Jl({},"__esModule",{value:!0}),t),Fe=(t,e,n,a)=>{for(var l=a>1?void 0:a?Pf(e,n):e,i=t.length-1,r;i>=0;i--)(r=t[i])&&(l=(a?r(e,n,l):r(l))||l);return a&&l&&Jl(e,n,l),l};var Su=(t,e,n)=>e.has(t)||Wf("Cannot "+n);var R=(t,e,n)=>(Su(t,e,"read from private field"),n?n.call(t):e.get(t)),ot=(t,e,n)=>e.has(t)?Wf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),X=(t,e,n,a)=>(Su(t,e,"write to private field"),a?a.call(t,n):e.set(t,n),n),C=(t,e,n)=>(Su(t,e,"access private method"),n);var ed=(t,e,n,a)=>({set _(l){X(t,e,l,n)},get _(){return R(t,e,a)}});var Od=Ye(()=>{var Cd;(function(t){(function(e){var n=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:o(),a=l(t);typeof n.Reflect<"u"&&(a=l(n.Reflect,a)),e(a,n),typeof n.Reflect>"u"&&(n.Reflect=t);function l(u,s){return function(m,g){Object.defineProperty(u,m,{configurable:!0,writable:!0,value:g}),s&&s(m,g)}}function i(){try{return Function("return this;")()}catch{}}function r(){try{return(0,eval)("(function() { return this; })()")}catch{}}function o(){return i()||r()}})(function(e,n){var a=Object.prototype.hasOwnProperty,l=typeof Symbol=="function",i=l&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",r=l&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",u={__proto__:[]}instanceof Array,s=!o&&!u,m={create:o?function(){return bu(Object.create(null))}:u?function(){return bu({__proto__:null})}:function(){return bu({})},has:s?function(v,b){return a.call(v,b)}:function(v,b){return b in v},get:s?function(v,b){return a.call(v,b)?v[b]:void 0}:function(v,b){return v[b]}},g=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:cb(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:fb(),_=typeof WeakMap=="function"?WeakMap:db(),E=l?Symbol.for("@reflect-metadata:registry"):void 0,A=ob(),d=ub(A);function c(v,b,T,z){if(j(T)){if(!Vf(v))throw new TypeError;if(!Qf(b))throw new TypeError;return at(v,b)}else{if(!Vf(v))throw new TypeError;if(!xt(b))throw new TypeError;if(!xt(z)&&!j(z)&&!La(z))throw new TypeError;return La(z)&&(z=void 0),T=Ze(T),pr(v,b,T,z)}}e("decorate",c);function f(v,b){function T(z,B){if(!xt(z))throw new TypeError;if(!j(B)&&!ib(B))throw new TypeError;qf(v,b,z,B)}return T}e("metadata",f);function y(v,b,T,z){if(!xt(T))throw new TypeError;return j(z)||(z=Ze(z)),qf(v,b,T,z)}e("defineMetadata",y);function O(v,b,T){if(!xt(b))throw new TypeError;return j(T)||(T=Ze(T)),Hf(v,b,T)}e("hasMetadata",O);function q(v,b,T){if(!xt(b))throw new TypeError;return j(T)||(T=Ze(T)),gu(v,b,T)}e("hasOwnMetadata",q);function D(v,b,T){if(!xt(b))throw new TypeError;return j(T)||(T=Ze(T)),Lf(v,b,T)}e("getMetadata",D);function M(v,b,T){if(!xt(b))throw new TypeError;return j(T)||(T=Ze(T)),Bf(v,b,T)}e("getOwnMetadata",M);function L(v,b){if(!xt(v))throw new TypeError;return j(b)||(b=Ze(b)),Yf(v,b)}e("getMetadataKeys",L);function Q(v,b){if(!xt(v))throw new TypeError;return j(b)||(b=Ze(b)),Gf(v,b)}e("getOwnMetadataKeys",Q);function Pt(v,b,T){if(!xt(b))throw new TypeError;if(j(T)||(T=Ze(T)),!xt(b))throw new TypeError;j(T)||(T=Ze(T));var z=Kl(b,T,!1);return j(z)?!1:z.OrdinaryDeleteMetadata(v,b,T)}e("deleteMetadata",Pt);function at(v,b){for(var T=v.length-1;T>=0;--T){var z=v[T],B=z(b);if(!j(B)&&!La(B)){if(!Qf(B))throw new Typ
|
||
|
|
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
|
|
`+ju+t+up}var Xu=!1;function Vu(t,e){if(!t||Xu)return"";Xu=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(e){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(p){var h=p}Reflect.construct(t,[],g)}else{try{g.call()}catch(p){h=p}t.call(g.prototype)}}else{try{throw Error()}catch(p){h=p}(g=t())&&typeof g.catch=="function"&&g.catch(function(){})}}catch(p){if(p&&h&&typeof p.stack=="string")return[p.stack,h.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var l=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");l&&l.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=a.DetermineComponentFrameRoot(),r=i[0],o=i[1];if(r&&o){var u=r.split(`
|
||
|
|
`),s=o.split(`
|
||
|
|
`);for(l=a=0;a<u.length&&!u[a].includes("DetermineComponentFrameRoot");)a++;for(;l<s.length&&!s[l].includes("DetermineComponentFrameRoot");)l++;if(a===u.length||l===s.length)for(a=u.length-1,l=s.length-1;1<=a&&0<=l&&u[a]!==s[l];)l--;for(;1<=a&&0<=l;a--,l--)if(u[a]!==s[l]){if(a!==1||l!==1)do if(a--,l--,0>l||u[a]!==s[l]){var m=`
|
||
|
|
`+u[a].replace(" at new "," at ");return t.displayName&&m.includes("<anonymous>")&&(m=m.replace("<anonymous>",t.displayName)),m}while(1<=a&&0<=l);break}}}finally{Xu=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?oa(n):""}function S0(t,e){switch(t.tag){case 26:case 27:case 5:return oa(t.type);case 16:return oa("Lazy");case 13:return t.child!==e&&e!==null?oa("Suspense Fallback"):oa("Suspense");case 19:return oa("SuspenseList");case 0:case 15:return Vu(t.type,!1);case 11:return Vu(t.type.render,!1);case 1:return Vu(t.type,!0);case 31:return oa("Activity");default:return""}}function sp(t){try{var e="",n=null;do e+=S0(t,n),n=t,t=t.return;while(t);return e}catch(a){return`
|
||
|
|
Error generating stack: `+a.message+`
|
||
|
|
`+a.stack}}var ws=Object.prototype.hasOwnProperty,yc=Ht.unstable_scheduleCallback,Qu=Ht.unstable_cancelCallback,_0=Ht.unstable_shouldYield,T0=Ht.unstable_requestPaint,ge=Ht.unstable_now,E0=Ht.unstable_getCurrentPriorityLevel,Bm=Ht.unstable_ImmediatePriority,qm=Ht.unstable_UserBlockingPriority,uo=Ht.unstable_NormalPriority,x0=Ht.unstable_LowPriority,Ym=Ht.unstable_IdlePriority,A0=Ht.log,M0=Ht.unstable_setDisableYieldValue,Xi=null,ve=null;function Bn(t){if(typeof A0=="function"&&M0(t),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(Xi,t)}catch{}}var ye=Math.clz32?Math.clz32:C0,z0=Math.log,w0=Math.LN2;function C0(t){return t>>>=0,t===0?32:31-(z0(t)/w0|0)|0}var zr=256,wr=262144,Cr=4194304;function ua(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Uo(t,e,n){var a=t.pendingLanes;if(a===0)return 0;var l=0,i=t.suspendedLanes,r=t.pingedLanes;t=t.warmLanes;var o=a&134217727;return o!==0?(a=o&~i,a!==0?l=ua(a):(r&=o,r!==0?l=ua(r):n||(n=o&~t,n!==0&&(l=ua(n))))):(o=a&~i,o!==0?l=ua(o):r!==0?l=ua(r):n||(n=a&~t,n!==0&&(l=ua(n)))),l===0?0:e!==0&&e!==l&&(e&i)===0&&(i=l&-l,n=e&-e,i>=n||i===32&&(n&4194048)!==0)?e:l}function Vi(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function O0(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gm(){var t=Cr;return Cr<<=1,(Cr&62914560)===0&&(Cr=4194304),t}function Iu(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Qi(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function D0(t,e,n,a,l,i){var r=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var o=t.entanglements,u=t.expirationTimes,s=t.hiddenUpdates;for(n=r&~n;0<n;){var m=31-ye(n),g=1<<m;o[m]=0,u[m]=-1;var h=s[m];if(h!==null)for(s[m]=null,m=0;m<h.length;m++){var p=h[m];p!==null&&(p.lane&=-536870913)}n&=~g}a!==0&&jm(t,a,0),i!==0&&l===0&&t.tag!==0&&(t.suspendedLanes|=i&~(r&~e))}function jm(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var a=31-ye(e);t.entangledLanes|=e,t.entanglements[a]=t.entanglements[a]|1073741824|n&261930}function Xm(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var a=31-ye(n),l=1<<a;l&e|t[a]&e&&(t[a]|=e),n&=~l}}function Vm(t,e){var n=e&-e;return n=(n&42)!==0?1:bc(n),(n&(t.suspendedLanes|e))!==0?0:n}function bc(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Sc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Qm(){var t=it.p;return t!==0?t:(t=window.event,t===void 0?32:mv(t.type))}function cp(t,e){var n=it.p;try{return it.p=t,e()}finally{it.p=n}}var na=Math.random().toString(36).slice(2),Xt="__reactFiber$"+na,ue="__reactProps$"+na,Ml="__reactContainer$"+na,Cs="__reactEvents$"+na,N0="__reactListeners$"+na,R0="__reactHandles$"+na,fp="__reactResources$"+na,Ii="__reactMar
|
||
|
|
`).replace(s1,"")}function nv(t,e){return e=dm(e),dm(t)===e}function ct(t,e,n,a,l,i){switch(n){case"children":typeof a=="string"?e==="body"||e==="textarea"&&a===""||vl(t,a):(typeof a=="number"||typeof a=="bigint")&&e!=="body"&&vl(t,""+a);break;case"className":Or(t,"class",a);break;case"tabIndex":Or(t,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Or(t,n,a);break;case"style":Wm(t,a,i);break;case"data":if(e!=="object"){Or(t,"data",a);break}case"src":case"href":if(a===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(n);break}a=Qr(""+a),t.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(e!=="input"&&ct(t,e,"name",l.name,l,null),ct(t,e,"formEncType",l.formEncType,l,null),ct(t,e,"formMethod",l.formMethod,l,null),ct(t,e,"formTarget",l.formTarget,l,null)):(ct(t,e,"encType",l.encType,l,null),ct(t,e,"method",l.method,l,null),ct(t,e,"target",l.target,l,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(n);break}a=Qr(""+a),t.setAttribute(n,a);break;case"onClick":a!=null&&(t.onclick=hn);break;case"onScroll":a!=null&&J("scroll",t);break;case"onScrollEnd":a!=null&&J("scrollend",t);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(x(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(x(60));t.innerHTML=n}}break;case"multiple":t.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":t.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){t.removeAttribute("xlink:href");break}n=Qr(""+a),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(n,""+a):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":a===!0?t.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(n,a):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?t.setAttribute(n,a):t.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?t.removeAttribute(n):t.setAttribute(n,a);break;case"popover":J("beforetoggle",t),J("toggle",t),Vr(t,"popover",a);break;case"xlinkActuate":on(t,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":on(t,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":on(t,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":on(t,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":on(t,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":on(t,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":on(t,"http://www.w3.org/XML/1998/namespace","xml:base",
|
||
|
|
${u}`:u)}getSettingItems(){let n=this.info.id,a=S.settings.folder_templates;return[{name:a.templatesFolderPath.name(),desc:a.templatesFolderPath.desc(),control:{type:"folder",key:`toolkit.${n}.config.templatesFolderPath`,defaultValue:""}},Mn(a.rules.name(),()=>(0,Iv.createElement)(Xv,{app:this.context._app,initialRules:this.settings.data.rules,getTemplatesBasePath:()=>this.getTemplatesBasePath(),persist:l=>{this.context._settingsStore.updateToolSettingByPath(this.info.id,"data.rules",l)}}))]}};Zt.CREATE_AGE_THRESHOLD_MS=5e3,Zt.INFLIGHT_TTL_MS=1e4,Zt.OPEN_WAIT_INTERVAL_MS=50,Zt.OPEN_WAIT_TIMEOUT_MS=2e3,Zt.OPEN_SETTLE_DELAY_MS=100,Zt=Fe([Je({id:"folder-templates",name:S.settings.folder_templates.name(),icon:"folder-cog",version:"2.0.0",description:S.settings.folder_templates.desc()})],Zt);var ne=require("obsidian"),py=Y(_t());var bf=require("obsidian");function Zv(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/|\/$/g,"")}function P1(t,e){if(t==="")return e;let n=`${t}/`;return e.startsWith(n)?e.slice(n.length):e}function W1(t){let e=[],n=[t];for(;n.length>0;){let l=[...n.shift().children].sort((i,r)=>i.name.localeCompare(r.name));for(let i of l)e.push(P1(t.path,i.path)),n.push(i)}return e}function er(t){return W1({name:t.name,path:t.path,children:t.children.filter(e=>e instanceof bf.TFolder).map(e=>Fv(e))})}function Fv(t){return{name:t.name,path:t.path,children:t.children.filter(e=>e instanceof bf.TFolder).map(e=>Fv(e))}}function Kv(t,e){let n=Zv(e);return t.map(a=>Zv(`${n}/${a}`))}function Jv(t,e){return t.filter(n=>!e(n))}function $v(t){let e=[],n=a=>{for(let l of a.children)e.push(l.path),n(l)};return n(t),e}var Pv="ravenhogwarts-folder-structure",Wv=/[\\:*?"<>|#^[\]]/g;function ty(t){let n=t.map(a=>a.replace(Wv,"").trim()).filter(a=>a.length>0).join(`
|
||
|
|
`);return"```"+Pv+`
|
||
|
|
`+n+"\n```"}function ey(t){if(!t)return null;let n=new RegExp("`{3}"+t_(Pv)+"\\s*\\n([\\s\\S]*?)\\n`{3}","m").exec(t);if(!n)return null;let l=(n[1]??"").split(`
|
||
|
|
`).map(i=>i.trim()).filter(i=>i.length>0).map(i=>i.replace(Wv,"")).filter(i=>i.length>0);return l.length>0?l:null}function t_(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var lr=require("obsidian"),Tf=Y(_t());var e_=1;function n_(){return crypto.randomUUID()}function au(t=n_()){return{id:t,enabled:!0,name:"",sourceFolder:"",snapshot:[]}}var ny={enabled:!1,config:{version:e_},data:{templates:[]}};var ay=require("obsidian"),lu=Y(_t()),ly=Y(nt());function Ft({name:t}){let e=(0,lu.useRef)(null);return(0,lu.useEffect)(()=>{e.current&&(0,ay.setIcon)(e.current,t)},[t]),(0,ly.jsx)("span",{className:"rht-fs-icon",ref:e})}var Le=Y(_t());var rt=Y(nt());function a_(t){let e=[],n=(a,l)=>{for(let i of a.children)e.push({node:i,depth:l}),i.children.length>0&&n(i,l+1)};return n(t,0),e}function ry({snapshot:t,onChange:e}){let[n,a]=(0,Le.useState)(()=>iy(t)),[l,i]=(0,Le.useState)(null),[r,o]=(0,Le.useState)(null),u=(0,Le.useRef)(t),s=S.settings.folder_scaffolder.templateCard;(0,Le.useEffect)(()=>{d_(t,u.current)||(u.current=t,a(iy(t)))},[t]);let m=p=>{p_(p),a(p);let _=$v(sy(p));u.current=_,e(_)},g=()=>{let p=wn(n);p.children.push(oy()),m(p)},h=a_(n);return(0,rt.jsxs)("div",{className:"rht-fs-tree",children:[(0,rt.jsxs)("div",{className:"rht-fs-tree-head",children:[(0,rt.jsxs)("div",{className:"rht-fs-tree-head-text",children:[(0,rt.jsx)("span",{className:"rht-fs-tree-title",children:s.structure.name()}),(0,rt.jsx)("span",{className:"rht-fs-tree-hint",children:s.dragHint()})]}),(0,rt.jsxs)("button",{className:"rht-fs-text-btn mod-cta",type:"button",onClick:g,children:[(0,rt.jsx)(Ft,{name:"plus"}),s.addRootFolder()]})]}),h.length===0?(0,rt.jsx)("div",{className:"rht-fs-tree-empty",children:(0,rt.jsx)("span",{children:s.structure.empty()})}):(0,rt.jsx)("ul",{className:"rht-fs-tree-list",children:h.map(({node:p,depth:_})=>(0,rt.jsx)(l_,{node:p,depth:_,root:n,selected:l===p.id,editing:r===p.id,onSelect:E=>{i(E),o(null)},onStartRename:E=>{i(E),o(E)},onEndRename:()=>o(null),onRename:(E,A)=>{m(o_(n,E,A)),o(null)},onAddChild:E=>m(i_(n,E)),onRemove:E=>{l===E&&i(null),r===E&&o(null),m(r_(n,E))},onIndent:E=>m(u_(n,E)??n),onOutdent:E=>m(s_(n,E)??n),onMoveUp:E=>m(c_(n,E)??n),onMoveDown:E=>m(f_(n,E)??n)},p.id))})]})}function l_({node:t,depth:e,root:n,selected:a,editing:l,onSelect:i,onStartRename:r,onEndRename:o,onRename:u,onAddChild:s,onRemove:m,onIndent:g,onOutdent:h,onMoveUp:p,onMoveDown:_}){let E=S.settings.folder_scaffolder.templateCard,[A,d]=(0,Le.useState)(t.name),c=(0,Le.useRef)(null);(0,Le.useEffect)(()=>{d(t.name)},[t.name]),(0,Le.useEffect)(()=>{if(l){let at=c.current;at&&(at.focus(),at.select())}},[l]);let f=()=>{window.requestAnimationFrame(()=>c.current?.focus())},y={"--row-depth":e},O=()=>{let at=A.trim();at&&at!==t.name?u(t.id,at):(at||d(t.name),o())},q=nr(n,t.id),D=!!q&&q.index>0,M=!!q&&q.parent.id!=="__root__",L=!!q&&q.index>0,Q=!!q&&q.index<q.parent.children.length-1,Pt=at=>{if(at.key==="Enter"){at.preventDefault(),l?O():r(t.id);return}if(at.key==="Escape"){at.preventDefault(),l&&(d(t.name),o());return}if(at.key==="Tab"){at.preventDefault(),at.shiftKey?M&&(h(t.id),f()):D&&(g(t.id),f());return}at.altKey&&(at.key==="ArrowUp"||at.key==="ArrowDown")&&(at.preventDefault(),at.key==="ArrowUp"&&L?(p(t.id),f()):at.key==="ArrowDown"&&Q&&(_(t.id),f()))};return(0,rt.jsx)("li",{className:`rht-fs-tree-row${a?" is-selected":""}${l?" is-editing":""}`,style:y,children:(0,rt.jsxs)("div",{className:`rht-fs-tree-line${e>0?" is-nested":""}`,onMouseDown:at=>{let pr=at.target;pr.closest("button")||pr===c.current||a||i(t.id)},children:[(0,rt.jsx)(Ft,{name:"folder"}),(0,rt.jsx)("input",{ref:c,className:`rht-fs-tree-input${l?" is-editing":""}`,spellCheck:!1,readOnly:!l,value:A,"aria-label":E.renameHint(),onChange:at=>d(at.target.value),onFocus:()=>{l||i(t.id)},onBlur:()=>{l&&O()},onKeyDown:Pt,onDoubleClick:()=>r(t.id)}),(0,rt.jsxs)("span",{className:"rht-fs-tree-move",children:[(0,rt.jsx)("button",{className:"rht-fs-icon-btn clickable-icon",type:"button",onClick:()=>{g(t.id),f()},disabled:!D,"aria-label":E.indent(),title:E.indent(),children:(0,rt.jsx)(Ft,
|
||
|
|
`)){let l=a.trim();!l||l==="__proto__"||l==="constructor"||l==="prototype"||e.has(l)||(e.add(l),n.push(l))}return n}function jy(t,e){if(!Array.isArray(t))return{status:"skipped-invalid"};let n=[];for(let r of t){if(typeof r!="string")return{status:"skipped-invalid"};n.push(r)}if(new Set(n).size!==n.length)return{status:"skipped-invalid"};let a=T_(e).filter(r=>n.includes(r));if(a.length===0)return{status:"unchanged"};let l=new Set(a),i=[...a,...n.filter(r=>!l.has(r))];return E_(n,i)?{status:"unchanged"}:{status:"reordered",nextIds:i}}function T_(t){let e=new Set,n=[];for(let a of t)e.has(a)||(e.add(a),n.push(a));return n}function E_(t,e){return t.length!==e.length?!1:t.every((n,a)=>n===e[a])}var Ie=Y(_t());var Xy=require("obsidian"),fu=Y(_t()),Vy=Y(nt());function du({name:t}){let e=(0,fu.useRef)(null);return(0,fu.useEffect)(()=>{e.current&&(0,Xy.setIcon)(e.current,t)},[t]),(0,Vy.jsx)("span",{className:"rht-po-icon",ref:e})}var Qy=require("obsidian"),pu=class extends Qy.AbstractInputSuggest{constructor(n,a,l,i){super(n,a);this.onSelectId=l;this.options=i}getSuggestions(n){let a=n.toLowerCase(),l=this.options.excludeIds();return this.options.getCandidates().filter(i=>!l.has(i.id)).filter(i=>i.id.toLowerCase().includes(a)||i.name.toLowerCase().includes(a))}renderSuggestion(n,a){a.createSpan({cls:"rht-po-suggest-name"}).setText(n.name),a.createSpan({cls:"rht-po-suggest-id"}).setText(n.id)}selectSuggestion(n){this.setValue(""),this.onSelectId(n.id),this.close()}};var Ct=Y(nt());async function Iy(t){try{let e=await t.vault.adapter.read(`${t.vault.configDir}/community-plugins.json`),n=JSON.parse(e);if(Array.isArray(n))return new Set(n.filter(a=>typeof a=="string"))}catch{}return null}function Zy({app:t,initialIds:e,getInstalledPlugins:n,persist:a}){let[l,i]=(0,Ie.useState)(e),[r,o]=(0,Ie.useState)(""),[u,s]=(0,Ie.useState)(new Set),m=(0,Ie.useRef)(null),g=(0,Ie.useRef)(l);g.current=l;let h=S.settings.plugin_order.priority_plugins,p=f=>{i(f),a(f)};(0,Ie.useEffect)(()=>{let f=m.current;if(!f)return;let y=new pu(t,f,O=>p([...g.current,O]),{getCandidates:n,excludeIds:()=>new Set(g.current)});return()=>y.close()},[t]),(0,Ie.useEffect)(()=>{let f=!1;return Iy(t).then(y=>{!f&&y&&s(y)}),()=>{f=!0}},[t,l]),(0,Ie.useEffect)(()=>{let f=!0,y=t.plugins.on("changed",()=>{Iy(t).then(O=>{f&&O&&s(O)})});return()=>{f=!1,t.plugins.offref(y)}},[t]);let _=n(),E=f=>_.find(y=>y.id===f)?.name,A=f=>u.has(f)?"enabled":_.some(y=>y.id===f)?"disabled":"missing",d=(f,y)=>{let O=f+y;if(O<0||O>=l.length)return;let q=[...l],[D]=q.splice(f,1);q.splice(O,0,D),p(q)},c=f=>{let y=f.trim();if(!y||g.current.includes(y)){o("");return}p([...g.current,y]),o("")};return(0,Ct.jsxs)("div",{className:"rht-po-editor",children:[(0,Ct.jsxs)("div",{className:"rht-po-head",children:[(0,Ct.jsx)("span",{className:"rht-po-title",children:h.name()}),(0,Ct.jsx)("span",{className:"rht-po-count",children:h.count({count:String(l.length)})})]}),(0,Ct.jsx)("input",{ref:m,type:"text",className:"rht-po-add-input",spellCheck:!1,placeholder:h.search_placeholder(),value:r,onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),c(r))}}),l.length===0?(0,Ct.jsx)("div",{className:"rht-po-empty",children:h.empty()}):l.map((f,y)=>(0,Ct.jsxs)("div",{className:"rht-po-row",children:[(0,Ct.jsx)("span",{className:"rht-po-order",children:y+1}),(0,Ct.jsxs)("span",{className:"rht-po-name-wrap",children:[(0,Ct.jsx)("span",{className:"rht-po-name",children:E(f)??f}),(0,Ct.jsx)("span",{className:"rht-po-id",children:f})]}),(0,Ct.jsx)("span",{className:`rht-po-badge rht-po-${A(f)}`,children:A(f)==="enabled"?h.status.enabled():A(f)==="disabled"?h.status.disabled():h.status.missing()}),(0,Ct.jsxs)("div",{className:"rht-po-actions",children:[(0,Ct.jsx)("button",{className:"rht-po-icon-btn clickable-icon",type:"button","aria-label":S.common.moveUp(),disabled:y===0,onClick:()=>d(y,-1),children:(0,Ct.jsx)(du,{name:"chevron-up"})}),(0,Ct.jsx)("button",{className:"rht-po-icon-btn clickable-icon",type:"button","aria-label":S.common.moveDown(),disabled:y===l.length-1,onClick:()=>d(y,1),children:
|
||
|
|
`}};var mu=class extends xe{getDefaultSettings(){return Zl}getSettingItems(){let e=this.info.id;return[{name:S.settings.quick_path.addEditorMenu.name(),desc:S.settings.quick_path.addEditorMenu.desc(),control:{type:"toggle",key:`toolkit.${e}.config.addEditorMenu`,defaultValue:Zl.config.addEditorMenu}},{name:S.settings.quick_path.addFileMenu.name(),desc:S.settings.quick_path.addFileMenu.desc(),control:{type:"toggle",key:`toolkit.${e}.config.addFileMenu`,defaultValue:Zl.config.addFileMenu}},{name:S.settings.quick_path.useAbsolutePath.name(),desc:S.settings.quick_path.useAbsolutePath.desc(),control:{type:"toggle",key:`toolkit.${e}.config.useAbsolutePath`,defaultValue:Zl.config.useAbsolutePath}},{name:S.settings.quick_path.pathSeparator.name(),desc:S.settings.quick_path.pathSeparator.desc(),control:{type:"dropdown",key:`toolkit.${e}.config.pathSeparator`,defaultValue:Zl.config.pathSeparator,options:{"\n":S.settings.quick_path.pathSeparator.newline(),", ":S.settings.quick_path.pathSeparator.comma(),"; ":S.settings.quick_path.pathSeparator.semicolon()," ":S.settings.quick_path.pathSeparator.space()}}}]}onload(){super.onload();let e=this.context._app.vault.adapter;this.basePath=e.basePath.replace(/\\/g,"/"),this.registerCommands(),this.registerEventHandlers()}registerCommands(){this.registerCommand({id:"copy_current_file_path",name:S.command.quick_path.copy_current_file_path(),callback:()=>{let e=this.context._app.workspace.getActiveFile();if(e){let n=this.getPath(e);this.copyToClipboard(n)}}}),this.registerCommand({id:"copy_current_folder_path",name:S.command.quick_path.copy_current_folder_path(),callback:()=>{let e=this.context._app.workspace.getActiveFile(),n=e&&this.getParentPath(e);n?this.copyToClipboard(n):this.context.notice(S.notice.quick_path.root_path_warning())}})}registerEventHandlers(){this.isEnabled()&&(this.settings.config.addFileMenu&&(this.registerEvent(this.context._app.workspace.on("file-menu",(e,n)=>this.handleFileMenu(e,n))),this.registerEvent(this.context._app.workspace.on("files-menu",(e,n)=>this.handleFilesMenu(e,n)))),this.settings.config.addEditorMenu&&this.registerEvent(this.context._app.workspace.on("editor-menu",(e,n,a)=>this.handleEditorMenu(e,n,a))))}handleFileMenu(e,n){n instanceof Fl.TFolder?this.addToolkitMenuItem(e,a=>{a.setTitle(S.menu.quick_path.copy_folder_path()),a.setIcon("copy"),a.onClick(()=>{let l=this.getPath(n);this.copyToClipboard(l)})}):this.addToolkitMenuItem(e,a=>{a.setTitle(S.menu.quick_path.copy_file_path()),a.setIcon("copy"),a.onClick(()=>{let l=this.getPath(n);this.copyToClipboard(l)})})}handleFilesMenu(e,n){this.addToolkitMenuItem(e,a=>{a.setTitle(S.menu.quick_path.copy_files_path()),a.setIcon("copy"),a.onClick(()=>{let l=n.map(i=>this.getPath(i)).join(this.settings.config.pathSeparator);this.copyToClipboard(l)})})}handleEditorMenu(e,n,a){this.addToolkitMenuItem(e,l=>{l.setTitle(S.menu.quick_path.paste_current_file_path()),l.setIcon("file-text"),l.onClick(()=>{let i=this.context._app.workspace.getActiveFile();if(i){let r=this.getPath(i);n.replaceSelection(r)}})}),this.addToolkitMenuItem(e,l=>{l.setTitle(S.menu.quick_path.paste_current_folder_path()),l.setIcon("folder"),l.onClick(()=>{let i=this.context._app.workspace.getActiveFile(),r=i&&this.getParentPath(i);r?n.replaceSelection(r):this.context.notice(S.notice.quick_path.root_path_warning())})})}getPath(e){return this.settings.config.useAbsolutePath?(0,Fl.normalizePath)(`${this.basePath}/${e.path}`):(0,Fl.normalizePath)(e.path)}getParentPath(e){let n=this.getPath(e),a=n.lastIndexOf("/");return a===-1?null:(0,Fl.normalizePath)(n.substring(0,a))}copyToClipboard(e){navigator.clipboard.writeText(e).then(()=>{this.context.notice(S.notice.quick_path.copy_success())}).catch(n=>{throw this.context.notice(S.notice.quick_path.copy_failure()),n})}onunload(){this.unregisterCommands(),super.onunload()}};mu=Fe([Je({id:"quick-path",name:S.settings.quick_path.name(),icon:"link",version:"1.0.0",description:S.settings.quick_path.desc()})],mu);var tb=require("obsidian"),hu=class extends tb.Plugin{constructor(){super(...arguments);this.setting
|
||
|
|
/*! Bundled license information:
|
||
|
|
|
||
|
|
reflect-metadata/Reflect.js:
|
||
|
|
(*! *****************************************************************************
|
||
|
|
Copyright (C) Microsoft. All rights reserved.
|
||
|
|
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
|
||
|
|
|
||
|
|
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||
|
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||
|
|
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||
|
|
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||
|
|
|
||
|
|
See the Apache Version 2.0 License for specific language governing permissions
|
||
|
|
and limitations under the License.
|
||
|
|
***************************************************************************** *)
|
||
|
|
|
||
|
|
scheduler/cjs/scheduler.production.js:
|
||
|
|
(**
|
||
|
|
* @license React
|
||
|
|
* scheduler.production.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*)
|
||
|
|
|
||
|
|
react/cjs/react.production.js:
|
||
|
|
(**
|
||
|
|
* @license React
|
||
|
|
* react.production.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*)
|
||
|
|
|
||
|
|
react-dom/cjs/react-dom.production.js:
|
||
|
|
(**
|
||
|
|
* @license React
|
||
|
|
* react-dom.production.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*)
|
||
|
|
|
||
|
|
react-dom/cjs/react-dom-client.production.js:
|
||
|
|
(**
|
||
|
|
* @license React
|
||
|
|
* react-dom-client.production.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*)
|
||
|
|
|
||
|
|
react/cjs/react-jsx-runtime.production.js:
|
||
|
|
(**
|
||
|
|
* @license React
|
||
|
|
* react-jsx-runtime.production.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*)
|
||
|
|
*/
|
||
|
|
|
||
|
|
/* nosourcemap */
|